A revolutionary way to play the nostalgic game Icy Tower using motion controls! This Arduino-based project creates an immersive gaming experience by detecting your head movements and translating them into game controls.
This project transforms the classic Icy Tower game into a motion-controlled experience using two Arduino units:
- Transmitter Unit: A wearable device (designed as a hat) that monitors player movements
- Receiver Unit: Connected to your computer to send keyboard commands to the game
The system detects head tilting (left/right movement) and jumping motions, wirelessly transmitting these actions to control the Icy Tower character.
- Arduino Board (Arduino Uno, Nano, or compatible)
- MMA8452Q Accelerometer - For motion detection
- RF Transmitter Module (433MHz recommended)
- Power Supply (Battery pack for portability)
- Wires and Breadboard/PCB
- Arduino Leonardo/Micro (required for HID keyboard functionality)
- RF Receiver Module (433MHz, matching transmitter)
- LEDs (3x) - Visual feedback for movements:
- Left LED (Pin 7)
- Right LED (Pin 5)
- Jump LED (Pin 6)
- Safety Button (Pin 12) - Enable/disable control
- Wires and Breadboard/PCB
- Computer running Icy Tower game
- Hat or Head-mounted Setup for transmitter unit
-
VirtualWire Library - For RF communication
Install via Arduino IDE Library Manager: Search "VirtualWire"
-
SparkFun MMA8452Q Library - For accelerometer
Install via Arduino IDE Library Manager: Search "SparkFun MMA8452Q"
-
Wire Library - I2C communication (built-in)
-
Keyboard Library - HID functionality (built-in with Leonardo/Micro)
- Icy Tower game installed on your computer
- Game should be active and focused when using the controller
MMA8452Q Accelerometer:
- VCC โ Arduino 3.3V
- GND โ Arduino GND
- SDA โ Arduino A4 (SDA)
- SCL โ Arduino A5 (SCL)
RF Transmitter:
- VCC โ Arduino 5V
- GND โ Arduino GND
- DATA โ Arduino Pin 12
RF Receiver:
- VCC โ Arduino 5V
- GND โ Arduino GND
- DATA โ Arduino Pin 11
LEDs:
- Left LED โ Pin 7 (with 220ฮฉ resistor)
- Right LED โ Pin 5 (with 220ฮฉ resistor)
- Jump LED โ Pin 6 (with 220ฮฉ resistor)
Safety Button:
- One terminal โ Pin 12
- Other terminal โ GND
- Download Arduino IDE (if not already installed)
- Install Required Libraries (see Software Requirements)
- Upload Code:
- Upload
Transmitter.ino
to the transmitter Arduino - Upload
Receiver.ino
to the receiver Arduino (must be Leonardo/Micro)
- Upload
The motion detection thresholds are configurable in the transmitter code:
// In detectLeftOrRight() function
const double RightDetected = 0.3; // Adjust for right tilt sensitivity
const double LeftDetected = -0.3; // Adjust for left tilt sensitivity
// In detectJump() function
const double JumpDetected = -0.2; // Adjust for jump sensitivity
- Power on both units (transmitter and receiver)
- Connect receiver unit to your computer via USB
- Mount transmitter unit on your head/hat
- Launch Icy Tower on your computer
- Press and hold the safety button on receiver to enable controls
- Tilt your head LEFT โ Character moves left
- Tilt your head RIGHT โ Character moves right
- Jump/nod downward โ Character jumps
- LED indicators on receiver show active movements
- Release safety button to disable controls
- Safety button must be held to activate controls (prevents accidental input)
- Visual LED feedback confirms movement detection
- Serial monitor output for debugging (115200 baud)
- Accelerometer Reading: The MMA8452Q continuously measures acceleration in X, Y, and Z axes
- Movement Analysis:
- Y-axis movement detects left/right head tilting
- Z-axis movement detects jumping (downward acceleration)
- Threshold Comparison: Movements exceeding predefined thresholds trigger actions
- RF Transmission: Movement commands are sent wirelessly to receiver
- Keyboard Simulation: Receiver translates commands to keyboard inputs for the game
The system uses a simple enum-based protocol:
enum MoveToSend{
LEFT, // Tilt left detected
RIGHT, // Tilt right detected
JUMP, // Jump motion detected
NOTHING_JUMP, // Stop jumping
NOTHING_SIDES, // Stop left/right movement
NOTHING // No action
};
- Motion Detection:
detectLeftOrRight()
anddetectJump()
functions - RF Communication:
sendData()
function transmits movement data - Continuous Monitoring: Main loop processes accelerometer data
- RF Reception: Receives movement commands via VirtualWire
- Keyboard Control: Translates commands to arrow key presses
- Visual Feedback: Controls LEDs based on active movements
- Safety Control: Only processes commands when safety button is pressed
No Response from Game:
- Ensure receiver Arduino is Leonardo/Micro (required for HID)
- Check that safety button is being held down
- Verify game window is active and focused
Erratic Movement:
- Adjust motion detection thresholds in code
- Check accelerometer wiring and power supply
- Ensure stable mounting of transmitter unit
RF Communication Problems:
- Verify transmitter and receiver are on same frequency
- Check antenna connections and range
- Ensure both units are powered properly
LEDs Not Working:
- Check LED polarity (long leg = positive)
- Verify resistor values (220ฮฉ recommended)
- Test LED connections
Connect to the receiver's serial monitor (115200 baud) to see real-time movement detection:
LEFT
RIGHT
JUMP
JUMP NOTHING
LEFT RIGHT NOTHING
Contributions are welcome! Here are some ideas for improvements:
- Enhanced motion detection algorithms
- Wireless range improvements
- Additional game compatibility
- 3D printed enclosures
- Battery optimization
- Calibration interface
This project is open source. Feel free to modify and distribute according to your needs.
Inspired by the classic Icy Tower game and the desire to create immersive motion-controlled gaming experiences.
Have fun playing Icy Tower like never before! ๐ฎโจ