Automatic Contactless Switch For Smart Home

Ashwini Kumar Sinha

26624
 
Fig 1. Switch with OLED version

With increased technological advancements, switches require updating with current times. To avoid the risk of contracting COVID-19, it has become important to not touch surfaces of buttons and keys that have been frequently used by other people. This calls for a need to innovate the switching technology for replacing a hand-operated switch, with an automatic contactless switch.

So today, we will design a no-touch switch that works entirely on hand gestures. Our smart contactless switch includes a sensor that is capable of detecting hand movements and translates them into commands for controlling lights, fans and various home appliances.

[defineweblang title=”Change Video Language” language=”English,Hindi”]

[getvideolang url= “https://www.youtube.com/embed/8RzOQ5D5DTA” language=”English”][/getvideolang]

[getvideolang url= “https://www.youtube.com/embed/a5IUmP–1a4″ language=”Hindi”][/getvideolang]

[/defineweblang]

Bill of Materials

Let’s start designing the smart switch by shopping for the following components.

Coding

First of all we need to install the required library in the Arduino IDE. Go to Select → Library Manager → Search APDS9960 → Install Adafruit APDS9960 

Installing Library
Fig 2. Installing library

After installing the library, add it into the code and then define the pin number for light and fan control. Next, create a setup function where you can initialise the sensor and set the pinmode output for light and fan control. 

Fig 3.Coding
Fig 4.Setup function

Then create a loop function to update the sensor readings and use your hand gestures as an input to control the pin. Also create a few if conditions for specifying the commands based on the type of hand gestures (up, down, left and right). 

Up: Lights ON 

Down: Lights OFF 

Left: Fans ON

Right: Fans OFF

Fig 5. Loop function

Connection 

Now upload the code to Arduino and connect the components as described in the circuit diagram. Then connect the AC wire with the common pin of relay module to control the lights and fans.

Connection for Automatic Contactless Switch For Smart Home
Fig 6.Connection for Automatic Contactless Switch For Smart Home
Fig 7. Connection inside board

Testing for the Contactless Switch

Now power the device and relay. When you will move your hand in an upward direction, the relay will be moved and lights will switch ON. Similarly, a hand gesture in downward direction will switch OFF the lights. 

Download Source Without OLED Code

Download Source With OLED Code

33 COMMENTS

  1. Good Project. Thanks for sharing. Please share the circuit diagram and the details how you powered Arduino inside switch board. How you got 5V DC to power Arduino inside switch board.

    I could see a display which shows Arrow in the video but it is not in the bill of materials.

    • There are two versions of CODE attached with the article one is simple other with OLED. The article is about a simplified version of a switch without OLED to reduce the overall cost of the project and to reduce the construction time. If anyone wants to expend extra money then he can add OLED and the code is attached with the article. The connection with OLED is the same as both are I2C based devices.

  2. Can i use it with arduino nano, as I checked in google it is showing it won’t work with arduino nano.. I already bought my arduino nano as u posted micro/nano/mini

  3. When i dumped adafruit example for gesture test. It is not showing initialised or not initialised. I’m not knowing where the fault is. I’m sure that arduino is in good condition

    • Try performing gestures on the sensor and see the output on the serial. also, check the baud rate in code and in m=serial monitor

      • Set same baudrate as in program,conncetions as in circuit diagram. In serial monitor I’m getting failed to initialize device

        • Have you connected the sensor correctly, recheck the wiring , SDA go to SDA of Arduino SCL goes to SCL vcc goes to VCC and GND goes to GND. try testing the sensor with example code

  4. Bro give us the circuit diagram and the connection with main board this way it is not possible to the the project … You are not sharing the main things…. As a bigginer to this field I m interested with your idea…. But your resources are stucking me… Kindly share us the connections properly if possible and source code is not downlable and… If possible make a video how you made it…. Demo it’s fine… But make a connection video…. And thank u for your so much support

    • The connection diagram is in code check it. Also, the Code is downloadable. If you face a problem in connection or understanding circuit diagram please elobrate

SHARE YOUR THOUGHTS & COMMENTS

Please enter your comment!
Please enter your name here