ESP32 Motion-Activated 3D Printed Lamp
A motion-activated 3D printed lamp using an ESP32 for control and an infrared or microwave sensor for presence detection.
Beginner Project
— The project uses standard development boards, a simple digital sensor, and a single MOSFET switch, making it an ideal entry-level project with plenty of community library support.
Assumptions:
- The lamp uses a 5V or 12V LED strip for illumination.
- The user prefers a breadboard-friendly development board for prototyping.
- The lamp will be powered by a standard USB wall adapter or a DC barrel jack.
- Presence detection range should be approximately 3-5 meters.
Bill of Materials
Compatibility Notes
- The ESP32-DevKitC operates at 3.3V logic; ensure the MOSFET chosen is 'logic-level' (like FQP30N06L) to ensure it fully turns on with 3.3V.
- If using a 12V LED strip, the 12V supply must be connected to the LED anode, and a common ground must be shared between the 12V supply and the ESP32.
- PIR sensors like HC-SR501 often require 5V VCC but output 3.3V logic, which is compatible with ESP32.
You'll Also Need
- LED Strip (5V or 12V RGB or White)
- 220 Ohm gate resistor for MOSFET
- 10k Ohm pull-down resistor for MOSFET gate
- Breadboard and jumper wires
- 3D printed enclosure
- External power adapter (5V or 12V depending on LEDs)
Estimated BOM Cost: $20-25 (based on live distributor pricing)
Design Considerations
EMI and Sensor Stability
PIR sensors are sensitive to RF noise; placing the ESP32 antenna too close to the PIR sensor can cause false triggers when WiFi is active. Keep at least 5-10cm of separation or use a shielded microwave sensor like the RCWL-0516.
Soft-Start PWM
To create a premium feel, use the ESP32 LEDC peripheral to fade the LEDs on and off over 1-2 seconds rather than an abrupt switch. This also reduces the inrush current spike on your power supply.
Thermal Management
If driving more than 2 meters of high-density LED strip, the MOSFET may become hot. Ensure the 3D printed housing has ventilation holes and consider a small clip-on heatsink for the TO-220 package if current exceeds 3A.
Presence vs. Motion
PIR sensors detect 'change' in heat. If a person sits perfectly still in the room, the lamp will turn off. Implement a 'keep-on' timer in firmware (e.g., 5 minutes) that resets every time motion is detected to avoid annoying the user.
Ambient Light Sensing
Consider adding a low-cost photoresistor (LDR) so the lamp only turns on when the room is actually dark. This saves power and prevents the lamp from triggering unnecessarily during the day.
Want to customize this project or build something different?
Try the Project Advisor


