Flappy Bird on the Raspberry Pi
by 734937 in Circuits > Raspberry Pi
29 Views, 0 Favorites, 0 Comments
Flappy Bird on the Raspberry Pi
This project guides you in creating Flappy Bird using a Raspberry Pi, Touch Sensor, LEDs, 4017 Chip (Decade Counter) and a 555 Timer. The Raspberry Pi uses code to control the bird in the game so you flap whenever you tap the Touch Sensor. It’s a fun and practical way to explore robotics, electronics, and programming. Follow the steps to assemble and test your game with ease.
Supplies
- Raspberry Pi(1) and SD Card(1) Pi SD Card
- HDMI Cord Amazon
- 4017 Chip (Decade Counter)(1) Link
- 555 Timer(1) Amazon
- 0.01uF Capacitor(1) Amazon
- 10uF Capacitor(1) Amazon
- Potentiometer(1) Amazon
- LEDs of any Colour(10) Amazon
- 560 Ohm Resistor(1) Amazon
- 10k Ohm Resistor(1) Amazon
- Breadboard(1) Amazon
- Touch Sensor(1) Amazon
- Female to Female Jumper Wires(3) and Male to Female Jumper Wires(2) Amazon
- Coiled Wire Amazon
- GPIO Extension Board(1) Link
Setting Up the Raspberry Pi
Set up your Raspberry Pi:
Locate the ports for the HDMI, Micro USB and USB ports.
For each port make sure you:
- Connect HDMI so your Raspberry Pi can connect to any Monitor
- Connect the Micro USB cable to the Raspberry Pi so it has power to work
- Connect a Keyboard and Mouse to the Raspberry Pi so you are able to interact with it
- After your Raspberry Pi is connected, connect the pins to your Breadboard with the Raspberry Pi Extension Board
Connect the Touch Sensor
Connect the touch sensor as follows:
1) Connect the VCC pin on your Touch Sensor to the 3.3V pin on the Raspberry Pi
2) Connect the GND pin on your Touch Sensor to a ground pin on the Raspberry Pi
3) Connect the Sig pin on your Touch Sensor to the GPIO 17 pin on the Raspberry Pi
The Lights Component: Initial Steps
In order to have the light functionality, you will need to create the circuit which can be found on this TinkerCad on a Breadboard. First, place your Potentiometer, 4017 Chip (Decade Counter) and 555 Timer as shown in the image above. Then connect power and ground to the chips through the bottom rails as follows; giving the 4017 Chip (Decade Counter) direct power and ground. Then proceed to give the 555 Timer power through a 10K Ohm resistor with direct ground into the Discharge Pin. Make sure to also connect the bottom ground rail to the upper ground rail directly while connecting it to the upper power rail with a 560 Ohm resistor. Finally connect the Reset Pin to the power rail.
The Lights: Connections
To create the connections necessary in order for the LED chaser portion of this project to function, make the following connections:
- Connect the Wiper Pin on the Potentiometer to the Trigger Pin on the 555 Timer and to one of the Terminal Pins to the Discharge Pin
- Connect the other Terminal Pin to the Discharge Pin on the 555 Timer
- Connect the Control Voltage Pin on the 555 Timer to the upper ground rail with the 0.01uF Capacitor
- Connect the 10uF Capacitor to the Trigger Pin and the power rail
- Connect the Trigger and Threshold Pins on the 555 Timer
- Connect the Reset and power pins on the 555 Timer
- Connect the Output Pin on the 555 Timer to the Clock Pin on the 4017 chip
- Connect the ground pin and the Clock Enable Pin on the 4017 chip
- Connect the Clock Enable Pin and the Reset Pin on the 4017 chip
The Lights: Final Steps and Putting It All Together
To finish off the lights, connect the output pins to the LEDs, respectively with Output Pin 1 to the right most LED and so on so forth. After you connect your LEDs, connect your LED chaser circuit to the Raspberry Pi by connecting the power rail to the GPIO 27 pin, and the ground rail to a ground pin from the Raspberry Pi.
Final Steps
After you have assembled the circuit correctly, upload the code attached to your Raspberry Pi in order to make everything function together as intended. Feel free to mess aroudn with the variable valued to customize this game to your liking!