The goal of this project was to create an interactive device which incorporates sensor data. This project is a video game where the user plays as a penguin and tries to eat as many fish before being eaten by a shark. The penguin is controlled via use of a joystick. A potentiometer controls the frequency of the sharks and the button allows the user to restart after the penguin is eaten. The ESP32 is used for collection of sensor data and serial communication.
To learn more, take a look at my blog post: https://diamond-bovid-ab4.notion.site/Module-2-Interactive-Devices-11af9793688a8090a1f1d78dcfac3082?pvs=4
- ESP32 TTGO T-display
- Joystick
- Button
- Potentiometer
- Breadboard
- M-M Header Pins
- Wires
- Heatshrink
- M3 Heatset Inserts
- M3 Phillips Pan Screws
- 3/4 Inch Felt Furniture Pads
- Hot Glue
- Tape
- Solder
- 1/8 Inch Wood
- 3D Printer Filament
![](https://private-user-images.githubusercontent.com/77693699/381650932-4fff7989-0ed2-4872-b0d3-4f44b46cdd2e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MzM3NjEsIm5iZiI6MTczOTUzMzQ2MSwicGF0aCI6Ii83NzY5MzY5OS8zODE2NTA5MzItNGZmZjc5ODktMGVkMi00ODcyLWIwZDMtNGY0NGI0NmNkZDJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDExNDQyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI4ZmUxNmM1OGUzNzA4NTFmMTg0YjU5NDhhMjc1ZWQ4ODU1Mzc2Y2YwNGRlNzQxOThjMjNjZDU3NjEwNTBjZDEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.u-gtluEAIKSpvN85MdyBmb12IG8iEdcE81E_8aTJKXw)
-
Follow the Fritzing diagram above when wiring the components.
-
Before attaching the joystick, button, and potentiometer to the breadboard, you should solder extension wires and M-M header pins to the components. Add heatshrink over these new connections to strengthen them. This is so that the components can easily be attached to the penguin enclosure. I would also recommend adding tape every about half inch so that the extended wires do not get tangled.
![](https://private-user-images.githubusercontent.com/77693699/381653612-784b5d67-d500-488a-9bd9-5c3ea9a5796d.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MzM3NjEsIm5iZiI6MTczOTUzMzQ2MSwicGF0aCI6Ii83NzY5MzY5OS8zODE2NTM2MTItNzg0YjVkNjctZDUwMC00ODhhLTliZDktNWMzZWE5YTU3OTZkLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDExNDQyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg0NmRhNGJjM2M4MTRmMTE4OTBiYzc4ZDc1ZjAyM2I4NzJkOTFjZWFiYjljMzRkNWEzNWU1ZjlmMWI2MTJiMDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.zDBa_FjTyZvcFuD4rskdpMf65c_2HGIhxiTdjHc5oMY)
-
Download the penguin.ino file from the Arduino-Code folder. Upload this program onto your ESP32.
-
Download the files from the Processing-Game-Code folder. Note you may have to change line 34 in Main_Game.pde so that it reflects the correct port name for your ESP32. Run the game from Main_Game.pde.
-
To create the enclosure, you will use both a laser cutter and 3D printer. Begin by downloading the 3 files from the Enclosure-Files folder.
-
To laser cut the penguin body, use a piece of 1/8 inch wood and the Penguin Laser Cut.svg file.
-
To create the joystick enclosure, 3D print the Joystick-enclosure-bottom.stl and Joystick-enclosure-top.stl files. This should take about 2.5 hours.
-
Install the heatset inserts into the bottom of the joystick enclosure. Screw the joystick into the bottom of the enclosure. Then screw the top of the enclosure to the bottom.
-
Now is time to bring the penguin to life. Place the potentiometer into the square hole and the button into the circular hole. Make sure to have the wires coming out of the back side. I used hot glue to secure the potentiometer in place and tape for the button. Add to the back side of the penguin body felt pads so that the enclosure is level. I used two 3/4 inch felt pads on top of each other to get the desired height. Lastly, hot glue the bottom of the joystick enclosure to the stomach of the penguin.
![](https://private-user-images.githubusercontent.com/77693699/381776231-5b382172-6253-493f-bdd4-d96299fb73a7.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MzM3NjEsIm5iZiI6MTczOTUzMzQ2MSwicGF0aCI6Ii83NzY5MzY5OS8zODE3NzYyMzEtNWIzODIxNzItNjI1My00OTNmLWJkZDQtZDk2Mjk5ZmI3M2E3LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE0VDExNDQyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTYzODk0OWI4YTAzMzc0MWViMzQyY2M2NWUyNGZhOTgwYWZkNThjZTllMjE2NjRkYjFjOTAxNTVkNzRlMzliZDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.57GN6Wwxv60ZAkrQxkPyblxsEcT2cO9vR6RayBlnK0A)