This project will turn a manual light switch into an automatic one, which will turn on the light upon entry to the room if the room is too dark, as well as having remote control functionality through Bluetooth to remotely turn on and off the light. To accomplish this, I will use the STM32L476 board with a combination of an ultrasonic sensor to detect the door opening, a light sensor to detect the light levels inside the room, a Bluetooth module to remotely connect to a phone, and a servo to press the physical light switch. As time permits, I will add a light dimming functionality to the remote, using another servo and a 3D printed part that will allow the servo to move the slider on the light switch up and down.
1 HC-SR04 Ultrasonic Distance Sensor
1 TSL2591 Light Sensor
1 HC-05 Bluetooth Module
1 20kg Servo Motor
1 HC-SR501 IR Sensor
I2C (Light Sensor)
UART (Bluetooth Module)
https://github.com/scho01/Automatic-and-Remote-Controlled-Light-Switch
The software will utilize an RTC clock to enable the system on a daily basis. when the clock reaches 4 PM, the light switch will begin checking the lux value in the room. When the lux becomes lower than a certain threshold, the IR sensor will begin checking for movement in the room. Upon detection of movement, the light switch will be flipped with the servo. Then software will enable the ultrasonic sensor, and begin checking for large changes in distance. Upon detecting significant a significant change in distance, the IR sensor will check for movement. If movement is found and the light is currently off, or movement is not found and light is currently on, the light switch will be flipped. Otherwise, no action will be taken. The Bluetooth remote will have the ability to switch between the reset state in which it begins waiting for the next time the RTC reads 4PM, or to the on state, in which the ultrasonic sensor is enabled.