Inspiration
We were inspired by videos online showing people coming up with creative party game ideas. We wanted to combine our love for partying with our passion for engineering, so we turned a breathalyzer into a game.
What it does
Each player joins on their own module and gets a virtual pet to look after. When they blow into the MQ-3 sensor, the reading changes their pet's happiness, hunger, and health. Everyone's stats show up on the master screen, where you can see how the pets are doing and who's still in the game.
The host picks a game mode and timer before starting, and once a player's pet runs out of health, they're out. The only way to keep your pet alive is to maintain a minimum breathalyzer reading based on the selected game mode.
How we built it
Gotcha B.A.C. was built in three sections: the individual modules, the server, and the host screen.
Individual Modules
Each player module was built using a CYD, which has an ESP32 microcontroller and a touchscreen display. We connected an MQ-3 alcohol sensor to measure breath alcohol levels and used a 3.7V battery to power the module.
We programmed the CYD using the TFT_eSPI library to control the display and connected it to Wi-Fi. The modules use HTTP requests to send player data to the server and receive game updates.
The Server
We built the server using Python and Flask. The server runs locally on the same network as the modules and host screen, allowing everything to communicate without needing an external server.
It receives data from each module, keeps track of the players and their stats, and sends game settings and updates back to the devices. We also used Flask to host the webpage and handle communication between the modules and host screen.
The Host Screen
The host screen was built as a webpage using HTML, CSS, and JavaScript, with Flask used to host the page. JavaScript regularly checks the server for updates, allowing the screen to display new information as players connect and their modules send data.
The host can use the webpage to set up and start the game, while also viewing all the players and their stats.
Challenges we ran into
Sprites and Display
One of our first challenges was getting the sprites to display properly on the CYD. The sprites would show up with white bounding boxes, the colours were sometimes inverted, and the images looked pixelated or splotchy. We also had issues with the screen not updating properly. Fixing the sprites and mapping the colours took a lot of trial and error.
Server and ESP32 Performance
Getting the server to communicate properly with all the modules was another challenge. We had to figure out how to send and receive data between the devices while making sure that player information and game updates were displayed correctly on the host screen.
Since the ESP32 has limited processing power, we also ran into issues with processor usage when trying to handle multiple tasks at once. This made it difficult to keep everything running smoothly while updating the display and communicating with the server.
Sensor Setup
While learning how to use the MQ-3 sensors, we found out that they were extremely sensitive to liquids. Too much liquid exposure could damage the sensors and cause them to stop giving accurate readings. This meant we had to be careful with how we tested them.
Sensor Readings
This was by far one of our biggest challenges. The cheap ethanol sensors were very inconsistent and often did not give the readings we expected.
During development, we tested them using rubbing alcohol, which seemed to work well. However, when we moved on to live testing with actual beverages, the sensors barely picked up any readings.
What's next for Gotcha B.A.C.?
- Player Customization: Add more player selection options, including different characters and customizable player names.
- Module Display: Improve the layout of the CYD display by adding more sprites for health stats, redesigning the health bar, and making the overall interface easier to read.
- Host Screen: Add custom fonts, graphics, and animations to the main TV screen to make the game more visually appealing.
- Improved Sensors: Invest in better alcohol sensors to get more accurate and consistent readings during gameplay.
- Custom PCB: Design our own circuit board to combine the components into a smaller, more compact module, making it easier to carry and use.
Built With
- 3dprinting
- arduino
- c++
- css
- esp32
- flask
- hardware
- html
- javascript
- lipobattery
- mq-3
- python
- server
