The Sound Board project is a easy, fun and short project. It plays sound(Just as described in the name). You can customize the sounds to be whatever you want it to be. Your imagination is your limits.(To simply it, it's a jukebox but instead of playing music, it can play whatever you want it to play).
1 Raspberry Pi
7 male to male wire
3 push buttons
Any audio file
Step 1: Setup
You will need to use the T-cobbler and place it on the bread board. Make sure that the T-cobbler is going along the lines and not against(This is because it will not fit if you go against the lines). Then connect the ribbon cable onto the Raspberry Pi. The Ribbon cable should be going away from the Raspberry Pi and not over the Raspberry Pi.
Place your buttons anywhere(Placing the buttons close to each other makes it easier to setup the circuit, it also makes it look neater). Your buttons must face sideways and not upwards(If you place the buttons incorrectly, the buttons won't work even if you did the rest of the circuit correctly).
Now for the wiring. Place one of the wires from ground(GND) to the side rails that extend from top to bottom(They are on the side). Use 3 wires(1 for each button) and connect them to the rail(They all must be on the same rail). Use the last 3 remaining wires (1 for each button) and connect them to a GPIO pin. Each button needs to get it's own GPIO pin as if 2 buttons are connected to the same GPIO pin, it won't work.
Now onto the next step, the code
Step 2: Coding
With the code, you can look at my image to see how I have done it.
Here is the full code in text
#(Date here) #(What is it for??) #It's a soundboard(Plays funny sounds)
#Importing Libraries from gpiozero import Button import pygame from time import sleep
#Defining Variables(For the Buttons) tbutton = Button(17) mbutton = Button(27) bbutton = Button(22)
#For the Sound meme1 = pygame.mixer.Sound('samples/IBelieveICanFly.wav') meme2 = pygame.mixer.Sound('samples/MissionimpossibleFluteFail.wav') meme3 = pygame.mixer.Sound('samples/WhyareYouRunning.wav')
tbutton.when_pressed = meme1.play
mbutton.when_pressed = meme2.play
bbutton.when_pressed = meme3.play
The sound files that are in here needs to be changed to whatever your sound file is called.
If you are having issues with this, make sure your raspberry pi is up to date. You can do this by going to the terminal and typing"sudo apt-get update" and "sudo apt-get upgrade" this should fix the issue. If it doesn't You can look here for help. (https://projects.raspberrypi.org/en/projects/gpio-music-box)