‹ back to projects
Smart Lights Controller
This is an ESP32-based IoT controller to turn a TP-Link Kasa HS100 smartplug off and on based on motion and sound. All code for this project is available on my GitHub. I made a video about the device, availabe below and on Youtube.
Software
All the files in the src
directory of the GitHub repository were uploaded to the root directory of an ESP32 flashed with micropython firmware. The main components are:
- the
LightsController
class, which orchestrates all operations of the device - the
WiFi
class, which connects the device to a WiFi network - the
ClapMic
class, which listens to input from the microphone - the (motion)
Detector
class, which listens to input from the motion sensor - the
Kasa
class, which handles communication with the smart plug - the (web)
Server
class, which hosts the user interface web page on the local network
Below is a screenshot of the user interface, available on the device's local wifi network.

Hardware
The housing for the device was 3d printed from the files in the CAD
directory at the University of Maryland's Sandbox maker space.
The following components were used:
- ESP32: HiLetgo ESP32 OLED WiFi Kit (with the original display removed)
- Microphone: DEVMO Microphone Sensor
- Motion detector: HiLetgo HC-SR501 PIR Infrared Sensor
- Display: UCTRONICS 0.96 Inch OLED Module 12864