Building Bop It!

The classic 90's game

My version

## Specs / Materials - **To run the game:** Raspberry Pi Pico W running MicroPython - **To bop it!:** TTP223B1 Touch Sensor - **To shake it!:** MPU6050 6DOF Sensor - **To slide it!:** Slide potentiometer - **To flick it!:** KY023 Joystick - **To instruct:** 16x2 LCD Display and Piezo Buzzer - **To power it:** 2AA Batteries! Total cost: ~$31, not including materials already available at the hub 😅
### Game Play - Player powers on game using battery switch. - Player touches the touch sensor to start the game. - In a loop, the game prompts (via the LCD) to perform one of the four actions (Beep, Shake, Flick, or Slide). - Similar to Bop It!, player attempts to perform the actions as quickly as possible and go for a high score. - Player gets 3 wrong chances before they lose.
### Game Input The sensors follow a number of different protocols: - **I2C:** Inter-Integrated Circuit, which is a two-pin input. The Pico has two sets of I2C pins, one which is used to read the accelerometer data, and the other to communicate with the LCD display. - **Analog:** Both the sliding potentiometer and the joystick return analog data, which takes up the three Pico analog pins. No converter needed! - **PWM (Pulse Width Modulation):** The Pico uses PWM to control the buzzer, varying the duty cycle to produce different tones.
### Reading from a sensor ```python from machine import Pin, ADC JOYSTICK_X_PIN = 27 JOYSTICK_Y_PIN = 26 vrx = ADC(Pin(JOYSTICK_X_PIN)) vry = ADC(Pin(JOYSTICK_Y_PIN)) joystick_x_position = vrx.read_u16() joystick_y_position = vry.read_u16() ```
### Trust the process - Prototype first using a breadboard - Connect to one sensor at a time - Document the schematic - Convert the prototype to a more permanent, wired device - Design and print the housing - Assemble and hope you haven't broken something during all those steps - Debug, debug, debug

Altogether now

## (A Few) Lessons Learned - Soldering is _really_ hard (for me) 😩 - If something's broken, it's _probably_ the wiring 🤦‍♀️ - Gotta handle those debounces 👈 - Audio is kinda complicated 🔊 - Analog inputs fluctuate slightly, so the application logic needs to account for it 🔀

Thanks!