Play the Chrome Dinosaur game by physically jumping while wearing a hat.
Clip your ESP32 and MPU6050 to the brim of a cap, open chrome://dino in your browser, pair over Bluetooth, and jump β the accelerometer detects the motion and sends a spacebar keypress wirelessly to your PC in real time, making the dinosaur jump on screen.
No button. No keyboard. No controller. Just a hat, a jump, and a dinosaur avoiding cacti.
Built with an ESP32 / ESP32-C3 and an MPU6050 accelerometer, designed to be mounted on a hat for hands-free wearable play.
- The MPU6050 is mounted on the hat brim and measures acceleration on the Z axis 10 times per second
- When you jump, your body (and hat) briefly exerts more than 1.5g of upward force
- The ESP32 detects this spike and sends an 8-byte HID keyboard report over BLE
- Windows receives it identically to a real keyboard pressing spacebar
- The Chrome Dino jumps on screen in sync with you
- The cooldown timer prevents one jump from firing multiple times
If you are buying parts specifically for this project, get a regular ESP32 (not C3). It is significantly easier to set up, uses a simpler library, and has better community support. The ESP32-C3 version is documented below for those who already have one.
| Part | Notes |
|---|---|
| ESP32 Dev Board | Any standard ESP32 with 30 or 38 pins |
| MPU6050 | GY-521 breakout board recommended |
| Jumper wires | 4 wires needed |
| USB cable | Must be data cable, not charge-only |
| PC with Bluetooth | Built-in or USB Bluetooth adapter |
| Cap / Hat | Baseball cap works best β firm brim to mount components on |
| Small velcro strips or zip ties | To secure ESP32 and MPU6050 to the hat brim |
| 3.7V 18500 LiPo battery + holder | For wireless use β holder has red and black wires ready to connect |
| TP4056 charging module (6-pin) | Must be the 6-pin version with OUT+ and OUT- (has DW01 protection chip) |
| Rocker switch | SPDT 3-pin, for turning the device on and off |
π‘ Mounting tip: Attach the MPU6050 flat against the top of the hat brim pointing upward so the Z axis faces the sky. This gives the cleanest jump detection. Secure the ESP32 to the side of the brim or tuck it into the hat band.
| MPU6050 Pin | ESP32 Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| SDA | GPIO 21 |
| SCL | GPIO 22 |
| AD0 | GND |
| INT | Not connected |
β οΈ Always use 3.3V not 5V. The ESP32 is not 5V tolerant and 5V will damage the MPU6050.
| From | To |
|---|---|
| 18500 Holder RED wire | Switch outer pin |
| Switch middle pin | TP4056 B+ |
| 18500 Holder BLACK wire | TP4056 B- |
| TP4056 OUT+ | ESP32 VIN |
| TP4056 OUT- | ESP32 GND |
β οΈ Always connect to VIN or 5V pin on the ESP32, never the 3.3V pin directly β that bypasses the regulator and can damage the board.
18500 (+) 18500 (-)
β β
Switch TP4056 B-
β β
TP4056 B+ TP4056 OUT-
β β
TP4056 OUT+ ESP32 GND βββββββββββββββββββ
β β
ESP32 VIN MPU6050 GND
β
3.3V regulator
β
MPU6050 VCC
π‘ Switch wiring: The rocker switch has 3 pins and 2 holes per pin. Use the horizontal hole on each pin β thread your wire through and solder it. The vertical holes are for PCB mounting only. Use the outer pin and middle pin only, leave the third pin empty.
π‘ Charging: Plug USB into the TP4056 to charge the battery. Red LED = charging, Blue/Green LED = fully charged. You can charge with the switch in either position.
β οΈ Always connect to VIN or 5V pin on the ESP32, never the 3.3V pin directly β that bypasses the regulator and can damage the board.
Download and install Arduino IDE from https://www.arduino.cc/en/software
- Open Arduino IDE
- Go to File β Preferences
- In Additional Boards Manager URLs paste:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Click OK
- Go to Tools β Board β Boards Manager
- Search esp32
- Find esp32 by Espressif Systems
- Select version 2.0.17 from the dropdown
- Click Install and wait
β οΈ Version matters. Use 2.0.17 specifically. Version 3.x breaks the BLE Keyboard library.
Go to Sketch β Include Library β Manage Libraries and install these one by one:
| Library | Author | Search term |
|---|---|---|
| ESP32 BLE Keyboard | T-vK | ESP32 BLE Keyboard |
| MPU6050 | Electronic Cats | MPU6050 |
For ESP32 BLE Keyboard β if it does not appear in Library Manager, install manually:
- Go to https://github.com/T-vK/ESP32-BLE-Keyboard
- Click Code β Download ZIP
- In Arduino IDE: Sketch β Include Library β Add .ZIP Library
π‘
Wire.his a built-in Arduino library and comes pre-installed β you do not need to download it.
Go to Tools and set:
| Setting | Value |
|---|---|
| Board | ESP32 Dev Module |
| Port | Your COM port (appears when ESP32 is plugged in) |
| Upload Speed | 115200 |
- Download
Jump_controller_esp32.inofrom this repo - Open it in Arduino IDE
- Click Upload
- Open Serial Monitor at 115200 baud
- You should see:
MPU6050 ready.
BLE advertising started.
Waiting for BLE...
- Windows Settings β Bluetooth & devices β Add device
- Click Bluetooth
- Select Jump Controller
- Serial Monitor should print
Connected!
Open chrome://dino in Chrome and jump β the dinosaur should jump with you. Adjust jumpThreshold in the code if it is too sensitive or not sensitive enough:
float jumpThreshold = 1.5; // increase to require bigger jump
// decrease if jumps aren't registeringUse this section only if you already have an ESP32-C3. If you are buying parts, use the ESP32 version above β it is much simpler.
Everything is the same as the ESP32 version. The only wiring difference is that SDA moves from GPIO 21 to GPIO 8 and SCL moves from GPIO 22 to GPIO 9. All other connections β VCC, GND, AD0, and the entire battery circuit β remain identical to the ESP32 diagram above.
| MPU6050 Pin | ESP32-C3 Pin |
|---|---|
| VCC | 3.3V |
| GND | GND |
| SDA | GPIO 8 β only change from ESP32 |
| SCL | GPIO 9 β only change from ESP32 |
| AD0 | GND |
| INT | Not connected |
The battery circuit (TP4056, switch, 18500 holder) is wired exactly the same as the ESP32 version above.
Download and install Arduino IDE from https://www.arduino.cc/en/software
- Open Arduino IDE
- Go to File β Preferences
- In Additional Boards Manager URLs paste:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Click OK
- Go to Tools β Board β Boards Manager
- Search esp32
- Find esp32 by Espressif Systems
- Install the latest version (3.x is fine for C3)
Go to Sketch β Include Library β Manage Libraries and install:
| Library | Author | Search term |
|---|---|---|
| NimBLE-Arduino | h2zero | NimBLE-Arduino |
| MPU6050 | Electronic Cats | MPU6050 |
The ESP32-C3 uses NimBLE instead of the standard BLE Keyboard library. Do not install ESP32 BLE Keyboard for this version.
π‘
Wire.his a built-in Arduino library and comes pre-installed β you do not need to download it.
Go to Tools and set:
| Setting | Value |
|---|---|
| Board | ESP32C3 Dev Module |
| Port | Your COM port |
| USB CDC On Boot | Enabled β critical, Serial will not work without this |
| Upload Speed | 115200 |
β οΈ USB CDC On Boot must be Enabled. This is the most commonly missed step on ESP32-C3.
- Download
Jump_controller_esp32_c3.inofrom this repo - Open it in Arduino IDE
- Click Upload
- If upload fails, hold the BOOT button on the board while clicking Upload, release when you see
Connecting... - Open Serial Monitor at 115200 baud
- Press the RST button on the board
- You should see:
MPU6050 ready.
BLE advertising started!
Waiting for connection...
- If you have paired before, go to Settings β Bluetooth β Jump Controller β Remove device first
- Windows Settings β Bluetooth & devices β Add device
- Click Bluetooth
- Select Jump Controller
- Windows will complete a secure pairing β Serial Monitor should print:
BLE Connected!
Encrypted connection established!
Open chrome://dino in Chrome and jump. Adjust sensitivity in the code:
float jumpThreshold = 1.5; // increase to require bigger jump
// decrease if jumps aren't registering| Problem | Solution |
|---|---|
| Serial Monitor shows nothing | Enable USB CDC On Boot (C3) or check baud is 115200 |
| Jump Controller not appearing in Bluetooth | Check Serial Monitor is printing, restart ESP32 |
| Connects then immediately disconnects | Remove device from Windows and re-pair from scratch |
| MPU6050 not found | Check wiring, ensure VCC is 3.3V not 5V, power cycle board |
| Upload fails | Hold BOOT button while uploading, close Serial Monitor first |
| Jumps not registering | Lower jumpThreshold value (try 1.2) |
| Too many false triggers | Raise jumpThreshold value (try 2.0) |
| Disconnects after a few minutes | Device Manager β HID Keyboard Device β Power Management β uncheck allow PC to turn off |
| No power from battery | Check switch wiring, confirm TP4056 has 6 pins with OUT+ and OUT- |
Both versions share these settings at the top of the sketch:
float jumpThreshold = 1.5; // g-force required to trigger (1.0 = gravity)
unsigned long jumpCooldown = 500; // ms between jumps (prevents double triggers)When a keyboard sends a keypress to a computer it sends a fixed 8-byte block called a HID report. Every keyboard in the world uses this same format defined by the USB HID specification. Your ESP32 sends this exact format over BLE.
Byte 0 β Byte 1 β Byte 2 β Byte 3 β Byte 4 β Byte 5 β Byte 6 β Byte 7
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Modifier β Reserved β Key 1 β Key 2 β Key 3 β Key 4 β Key 5 β Key 6
- Byte 0 β modifier keys (Ctrl, Shift, Alt etc.) as individual bits.
0x00for plain spacebar - Byte 1 β always
0x00, reserved by the HID spec and never used - Bytes 2β7 β up to 6 simultaneous keycodes.
0x2Cis the spacebar keycode
Pressing spacebar sends:
{ 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00 }
Releasing sends:
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
Both reports are required β without the release report Windows thinks the key is held forever.
Before any keypresses are sent the device tells Windows what format to expect. This is the report descriptor β a schema that defines the 8-byte structure. Windows uses it to install the device as a standard keyboard with no custom drivers needed.
| Key | HID Keycode |
|---|---|
| Space | 0x2C |
| Enter | 0x28 |
| Arrow Up | 0x52 |
| Arrow Down | 0x51 |
| Arrow Left | 0x50 |
| Arrow Right | 0x4F |
| W | 0x1A |
| A | 0x04 |
| S | 0x16 |
| D | 0x07 |
| Escape | 0x29 |
Swap 0x2C in the press array for any of these to send a different key instead of spacebar.
JumpController/
βββ images/
β βββ demo.gif β gameplay demo
β βββ wiring_esp32.png β circuit diagram
β βββ breadboard.jpg β completed breadboard photo
βββ Jump_controller_esp32.ino β use this for regular ESP32
βββ Jump_controller_esp32_c3.ino β use this for ESP32-C3
βββ README.md
π Which file should I use?
- Regular ESP32 β
Jump_controller_esp32.ino- ESP32-C3 β
Jump_controller_esp32_c3.inoDo not mix them up β the libraries and pin numbers are different between the two versions.
Do whatever you want with this. Put it on a hat. Jump around.


