The idea was originated from my son complaining about how difficult was to find the desk lamp switch... when he was already in bed.
So we had an excuse to create a new project. A contact less switch that could switch the light on\off even by throwing a little pillow nearby.
The project has four main components:- sensor APDS-9960 as gesture-control sensor;
- a relay used as a switch for the lamp;
- Arduino Nano as a microcontroller to coordinate all the actions;
- desk lamp.
The sensor APDS-9960 is able to capture the direction of a movement (right, left, up, down) happening nearby.
The Arduino microcontroller is programmed to listen to the signal from the APDS-9669 sensor.
When a movement from right to left is identified, the Arduino send a high signal to the relay that switches on the desk lamp.
Instead, when a movement from left to right is identified the Arduino send a low signal to the relay, that switches off the desk lamp
Electronic ImplementationThe electronic implementation is powered by an external USB power supply which provides 5v to the vin pin of microcontroller.
The Arduino is powering the sensor ADPS-9660 with 3v output and the relay with 5v output.
The relay sensor pin is connected to the Arduino 3 digital pin.
The three pins of sensor ADPS-9660: interrupt pin, I2C Serial Data Address and 2C Serial Clock are connected to the Arduino digital pin 2, Arduino analogic 4 and 5 pins, respectively.
Once the system is tested properly, the power cable of the desk lamp is cut and connected to the relay to be used as switch.
Final StepAs a final step, all the components are inserted into a plastic box, and glued to the box with a hot glue gun.
I decided to use a massive amount of glue to prevent any mechanic stress due to the local wildlife (my cat and....my son).
Below an overview of the whole device with the lamp, and the external USB power supply.
Below the inside of the plastic box with all the elements glued to it.
The code is available at the link:
just a couple of notes
1. Before compiling the code you need to install the SparkFun_APDS9960 library.
2. All the time related variables need to be defined as float instead of int, since the size of the int variable in the Arduino C version are not big enough to contain more than a minute of delay time (expressed as milliseconds).
Comments
Please log in or sign up to comment.