top of page

03.29.2018: 30 Minutes of Raspberry Pi

Today's soundtrack is Michael Card: Signature Songs.

This morning's project is part two of the burping button project. I now have the necessary wiring to hook up the device to the button.

Hardware: I started by taking off the top of the device to access the GPIO pins, then I attached two M/F wires into GPIO 3 and the GND pin next to it. Finally, I replaced the top cover of the Raspberry Pi case, feeding the two wires through the slots in the top.

Files: I opened the a new terminal window with the command ctrl+alt+T. I made a new folder for the project files. I changed the directory to the burpbutton folder, which made the terminal show the terminal that I was then in. Once I was in the "burpbutton" folder, I used the web to get a file. I then used the Audio Play command to test the sound. Finally, I closed the terminal by clicking the "x" at the top right of its window.

Software: I opened Python by clicking Menu at the top right of the main Raspberry page, hovered over "Programming," and clicked on "Python 3 (IDLE)" to open it. Once the Python shell opened, I clicked "File," then clicked "New File" to create a new Python file, which opened a new untitled window. I clicked "File" in the new untitled window, then chose to "Save As," double-clicked the "burpbutton" folder, called the file name "burp.py", and clicked "Save".

Python: Inside the "burp.py" window (NOT the Python Shell), I imported the necessary modules on three individual lines. Next, I told Python which GPIO pin the wire is connected toand I initialized (started) Pygame and imported the burp sound into the sound mixer. Finally, I used an infinite "while" loop so that the program would wait for the wires to touch before playing the sound, then start over.

I then clicked File and saved the program, then clicked Run, and chose to Run Module. It worked! Now when the wires touched, the burp sound played.

The very last step was to make a physical button out of a gummy candy by inserting the wires close enough together that they would touch when the candy is squeezed. To do so, I inserted a F/F wire onto the end of each of the M/F wired coming from the GPIO ports, then pushed a bent paper clip into each one. I then put the other ends of the paper clips inside of a gummy candy, lining them up so that one was directly above the other, but not touching. Then, when I pushed down on the candy, the paper clips touched, making the Raspberry Pi burp!


bottom of page