This is an old revision of the document!
The project is an interactive embedded game that simulates a defusal scenario using multiple physical mini-games. The device will be built inside a 3D printed case shaped like a small prop “bomb”, but it is only a game/simulator and does not contain any dangerous elements.
The main goal is to create a physical game where the user has to complete several challenges before the countdown timer reaches zero. These challenges use different sensors and input modules, such as an accelerometer, a capacitive touch sensor, a temperature sensor and a keypad. The system gives feedback using an I2C LCD, LEDs and a passive buzzer.
The user first has to complete the mini-games in order to unlock the final defusal code. After all mini-games are completed, the code is shown on the LCD and the user must enter it using the keypad. If the code is entered correctly before the timer expires, the device is defused. If the timer reaches zero or if a critical mistake is made, the LCD displays “BOOM” and the buzzer sounds an alarm.
At the end of a successful defusal, a servomotor opens a small flap on the back of the 3D printed case. Behind the flap there will be a small reward, such as a candy. I chose this idea because I wanted to make a project that is interactive, physical and more interesting than a simple keypad lock or countdown timer.
This project is useful for me because it combines several concepts from the PM laboratories into one system: timers, PWM, ADC, I2C communication, digital inputs and sensor processing. It is also useful as a small interactive game that shows how an embedded system can react to real physical inputs.
The project is based on the ATmega328P Xplained Mini board, which acts as the main controller. The board reads data from the sensors and input modules, controls the outputs, updates the LCD and manages the game state.
The game will be implemented as a finite-state machine. Each mini-game represents one state, and the player can move to the next state only after completing the current challenge. A global countdown timer runs during the entire game. If the timer reaches zero, the game enters the fail state.
When the device is turned on using the ON/OFF switch, the LCD will display:
BOMB ARMED PRESS START
After the game starts, the LCD displays the countdown timer and instructions for each mini-game.
The planned flow of the game is:
1. Start / Armed State
The device waits for the player to start the game. The LCD shows the “BOMB ARMED” message.
2. Rotation Mini-game
The player must rotate the device to approximately 90 degrees and hold it in that position for 5 seconds. This is detected using the MPU6050 accelerometer. If the device leaves the accepted angle range, the 5-second counter resets. If the movement is too aggressive, the game may enter the fail state.
3. Memory Mini-game
The passive buzzer plays a sequence of beeps. The player must repeat the sequence by tapping the capacitive touch sensor the same number of times. For example, if the buzzer beeps three times, the player must touch the sensor three times.
4. Temperature Mini-game
The LCD asks the player to cool the temperature sensor. The player has to blow air toward the sensor until the measured temperature drops by a small threshold. When the temperature drop is detected, the player passes this stage.
5. Final Code Stage
After all mini-games are completed, the LCD reveals the final defusal code. The player must enter this code using the 4×4 keypad. If the code is correct, the device is defused. If the code is wrong, a penalty is applied: the buzzer beeps faster and the countdown decreases faster.
6. Defused State
If the correct code is entered before the timer reaches zero, the LCD displays “DEFUSED”, the green LED turns on, the buzzer stops and the servomotor opens the back flap of the case.
7. Boom State
If the timer reaches zero, or if a critical fail condition happens, the LCD displays “BOOM”, the red LED turns on and the buzzer plays an alarm sound. In this state, the servomotor does not open the flap.
The LCD is used to guide the user through the game by displaying the current instruction, the remaining time and the final result. The buzzer is used both for feedback and for the memory mini-game. The LEDs show the current status of the device, such as armed, warning, error or defused. The servo motor is used only after a successful defusal, when it opens the physical flap.
The hardware part of the project contains the microcontroller board, sensors, input modules, output modules, the power system and the physical 3D printed case.
The circuit will first be tested on a breadboard. After the prototype works correctly, I plan to solder the components on a solderable prototyping board/perfboard and mount everything inside the 3D printed case. The breadboard will only be used during the testing stage.
| Component | Purpose |
|---|---|
| ATmega328P Xplained Mini | Main microcontroller board used to control the project |
| 16×2 LCD with I2C module | Displays the timer, instructions and game state |
| 4×4 Matrix Keypad | Used to enter the final defusal code |
| TTP223 Capacitive Touch Sensor | Used for the memory mini-game |
| DHT11 Temperature Sensor | Used for the cooling mini-game |
| MPU6050 Accelerometer | Used to detect the 90-degree rotation and device movement |
| Passive Buzzer | Generates beep sequences, countdown sounds and alarms using PWM |
| SG90 Servomotor | Opens the back flap after successful defusal |
| LEDs | Visual status indicators |
| ON/OFF Switch | Turns the device on and off |
| Power Bank | Battery-based power source |
| 3D Printed Case | Physical enclosure for the project |
| Servo-driven flap | Mechanical reward mechanism opened after defusal |
The ATmega328P Xplained Mini is the main controller of the project. It reads all inputs, processes the game logic and controls all outputs.
The 16×2 LCD with I2C interface is used to display the current game state, instructions, countdown timer and final messages such as “BOMB ARMED”, “BOOM” and “DEFUSED”. The I2C interface is useful because it reduces the number of pins needed for the display.
The 4×4 keypad is used in the final stage of the game. The code is not known from the beginning. It is shown on the LCD only after the player completes all mini-games. If the user enters the wrong code, the timer starts decreasing faster and the buzzer beeps faster.
The TTP223 capacitive touch sensor is used for the memory mini-game. The buzzer plays a pattern of beeps, and the user must repeat the pattern by tapping the touch sensor.
The DHT11 temperature sensor is used for the cooling mini-game. The player must blow air toward the sensor until the measured temperature drops enough to pass the stage.
The MPU6050 accelerometer is used for the rotation mini-game. The player must rotate the device to approximately 90 degrees and hold it there for 5 seconds. The same sensor can also be used to detect sudden movement.
The passive buzzer is controlled using PWM. It is used for beep patterns, countdown sounds, warning sounds and the fail-state alarm.
The SG90 servomotor controls the physical defusal mechanism. When the game is successfully completed, the servo rotates and opens a flap at the back of the 3D printed case. Behind this flap there will be a small reward, such as a candy.
The LEDs are used as visual indicators. For example, a red LED can indicate that the device is armed or in fail state, while a green LED can indicate successful defusal.
The ON/OFF switch is used to physically power the project on or off.
| ATmega328P Signal | Connected Component | Usage |
|---|---|---|
| VBUS | Power bank / USB supply | Main power input through Micro USB |
| VCC_TARGET | VCC rail | Power for external modules |
| GND | GND rail | Common ground |
| PC4 | LCD SDA + MPU6050 SDA | I2C data |
| PC5 | LCD SCL + MPU6050 SCL | I2C clock |
| PD2 | DHT11 DATA | Temperature sensor input |
| PD3 | Passive Buzzer | PWM sound output |
| PD4 | TTP223 Touch Sensor OUT | Touch input |
| PD5 | RGB LED - Red | LED output |
| PD6 | RGB LED - Green | LED output |
| PD7 | RGB LED - Blue | LED output |
| PB0 | Keypad R1 | Keypad row |
| PB1 | SG90 Servo | PWM servo control |
| PB2 | Keypad R2 | Keypad row |
| PB3 | Keypad R3 | Keypad row |
| PB4 | Keypad R4 | Keypad row |
| PC0 | Keypad C1 | Keypad column |
| PC1 | Keypad C2 | Keypad column |
| PC2 | Keypad C3 | Keypad column |
| PC3 | Keypad C4 | Keypad column |
The LCD and MPU6050 share the I2C bus on PC4 and PC5. The keypad uses eight GPIO pins, including PC0-PC3 as digital inputs. The buzzer and servo use PWM-capable pins, while the RGB LED uses three separate outputs. The project is powered through the Micro USB connector from a USB power bank, and all modules share the same ground.
I want the project to work without being connected to a laptop, so it will be powered from batteries. The easiest and safest option is to use a USB power bank, because it already provides a stable 5V output.
The power bank will power the ATmega328P Xplained Mini through USB. Since the servo motor can require more current than the microcontroller board can safely provide, I may power the servo from a separate 5V line from the same power bank or from an external 5V supply. In this case, all grounds must be connected together.
The ON/OFF switch will be placed between the power source and the circuit, so the entire device can be turned on and off physically.
The enclosure will be 3D printed and shaped like a small game prop. A rectangular opening will be made at the back of the case, and this opening will be covered by a flap controlled by the SG90 servomotor.
During the game, the flap remains closed. After successful defusal, the servomotor opens the flap and reveals the reward inside. This makes the project more physical and interactive, not just a software game displayed on an LCD.