‹ 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
LightsControllerclass, which orchestrates all operations of the device - the
WiFiclass, which connects the device to a WiFi network - the
ClapMicclass, which listens to input from the microphone - the (motion)
Detectorclass, which listens to input from the motion sensor - the
Kasaclass, which handles communication with the smart plug - the (web)
Serverclass, 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