Files
README.mdGestureLamp.ino
Use an ESP32 + MPU-6050 IMU to control a lamp by hand gestures:
- Tilt up/down → increase/decrease brightness
- Shake (quick jerk) → toggle on/off
Every brightness change is advertised over BLE so your phone can display real-time status.
- ESP32 Dev Board (e.g. NodeMCU-32S)
- MPU-6050 6-axis IMU breakout
- N-channel MOSFET (IRLZ44N or similar)
- Lamp or 12 V LED strip
- 12 V DC power supply (for lamp)
- 5 V USB supply (for ESP32 & MPU-6050)
- 10 kΩ resistor (MOSFET gate pulldown)
- (optional) 100 Ω resistor in series with MOSFET gate
- Breadboard & jumper wires
MPU-6050 ESP32
┌─────────┐ ┌────────┐
│ VCC ──► 5V │ VIN │
│ GND ──► GND │ GND │
│ SDA ──► 21 │ (I2C) │
│ SCL ──► 22 │ (I2C) │
└─────────┘ └────────┘
Lamp Strip (12 V) ESP32 + MOSFET
┌─────────────┐ ┌─────────┐
│ +12 V ───► +12 V │ │
│ – ───► Drain │ IRLZ44N │
└─────────────┘ │ Gate◄─┬─► GPIO 23
│ Src ─►└─ GND
└─────────┘
• Put a 10 kΩ between Gate and GND.
• (Optional) 100 Ω series on Gate for noise suppression.
- In Arduino IDE add ESP32 board definitions.
- Install libraries via Library Manager:
MPU6050(I2Cdevlib by Jeff Rowberg)BLEDevice.h(built-in with ESP32 support)
- Save this folder as
GestureLamp/containing:README.mdGestureLamp.ino
- Select NodeMCU-32S (or your ESP32) and correct COM port.
- Power the ESP32 via USB and lamp via 12 V supply.
- On boot the ESP starts advertising BLE service “GestureLamp”.
- Pair from a generic BLE app (nRF Connect, LightBlue).
- Subscribe to the Brightness Characteristic.
- Make gestures:
- Tilt device up/down → lamp brightens/dims by 5%.
- Shake device (fast jerk) → toggle lamp ON/OFF.
- Watch lamp change and BLE notifications update your phone in real time.
Say continua to move on to project #9!