Introduction: Smart Touch-free Switch
The need for social distancing and safe health practices such as using sanitizers after using public environments such as taps, switches etc is very much essential to reduce the spread of coronavirus. So there is an immediate need in the innovation involving the touch-free triggers to facilitate actions such as activating taps, switches etc.
In this project, I would like to discuss my idea about a prototype to activate the switch using a proximity sensor. Things to be considered while designing something that helps during this tough situation is mainly having very less existing infrastructural changes. So the solution should be a retrofit and can possibly be fitted on a switchboard to activate the switch based on hand gesture or presence based on the sensitivity.
The major features include,
- 200hrs of battery life,
- Security camera which takes a photo of a person entering the room
- Deep sleep to save battery.
- Sending email alerts
1. Proximity sensor [I'm using the KEMET SS-430 ] can be any proximity sensor
2. ESPCam32 for the photo capture and mailing purpose
3. Li-ion battery 1000mAh
4. USB - Li-ion charger TP4056
5. Boost circuit 3.7V to 5V
6. Resistors 10k and 1k
7. BC547 Transistor
8. SG90 Servo motor
9. Arduino pro mini
Step 1: Let's Get Started
In our project, the sensor is nothing but a small proximity sensor by KEMET, SS-430
The data from the sensor will have a 2 200ms clock pulses as shown in the figure.
In the above figure, the 2 200ms pulses are the ones which show human presence other clock pulses are formed due to false triggering. This false triggering occurring since I was experimenting with the bare sensor without lenses or any other cover. False triggering drastically reduced after I used the plastic enclosure to secure the sensor.
Step 2: Let's Test on the Breadboard
For the test, I just used a microcontroller(Arduino Uno) and the sensor and an LED. After hours of reading sensor values on serial monitor and calibrating it, I came with a small code to correctly detect the presence of a human being in front of it.
Step 3: Connecting a Servo to ESP32Cam to Servo
With the limited number of pins available on ESP32 Camera, I had to use timer 2 and GPIO2 for driving servo and GPIO13 for wake functionality using the Kemet SS-430 proximity sensor.
Reason for using ESP32 Camera is to take a picture and go to sleep mode when the person enters the room or unauthorised place. The image will be saved in the
SD card. To act immediately on the intruder, the ESP32 will send an email to the preconfigured email ID. This needs ESP32 Mail client Library to be installed. Go to manage Libraries in Arduino IDE and search for the ESP32 Mail client and download. You will need a working email ID whose credentials you need to put in the code and later you will have to enable Less Secure Apps. It's better to create a new Gmail ID for this project.
Step 4: Testing Proof of Concept
For a simpler exploded view of the project I thought of assembling the things on acrylic sheet in a modular fashion.
There the plastic box for the sensor is helping in reducing the false triggers. Since the ESP camera goes into sleep after taking photos I cannot perform digital signal conditioning operations on the ESP32 camera. Hence I added another microcontroller to reduce the false trigger and signal conditioning and also for driving servo motor.
You can either use esp32 or another microcontroller both works.
Step 5: Final Schematics
The signal from the pyroelectric sensor is fed to the transistor in an open-collector configuration, once the signal comes transistor gets activated as a switch and hence it connects GPIO 13 to the ground and wakes up the ESP32 camera
In code repositories, Pyrolight code along with camera_pins.h is for ESP32 camera rest 2 codes are for testing with Arduino pro mini.
Please find detailed schematics and Kicad PCB in GitHub repository.
Actually I had ordered PCB from china for this project, but I didn't receive it in time because of the coronavirus outbreak. So I had to use a boost converter and TP4056 module.
Step 6: Intruder Alert
When there was an intruder in the vicinity of the sensor, it woke up from the sleep took a picture and sent a mail with an attachment.
Here's how the mail looks like. All this can be done only because of a proximity sensor. Since the whole device is battery powered it allows us to carry anywhere. and make our own smart and safe environment.
You can 3D print an enclosure to fit the electronics as required.
Here's one good design: Link
Step 7: Working Video :
I made a proper PCB shield for esp32 cam board with USB to UART and connectors for servo and the pyro sensor. You can find the Gerber files on my Github repo linked below.
Step 8: Future Enhancements
1. Designing a 3D-printed case for the project to make it look like a product
2. Improving battery performance
3. Analog signal conditioning circuit instead of a secondary microcontroller.
Participated in the
Make it Move Contest 2020