We all have seen different kinds of mood lamps & RGB light, most of them have some buttons or a remote to interact with them, but we thought of making a Gesture Controlled RGB Desk Lights which can change its colour only using a simple swipe gesture as a trigger. This is an interactive art project made using the Arduino uno board & IR array sensor. It’s a fun and easy project which can be taught to students & kids.
Let’s dive to the making portal.
Follow us on Instagram: Random stuff We Make! for more cool projects.
Step 1: Arrange the Material
- Arduino Uno
- IR sensor Array (8 sensors)
- WS2812b Addressable RGB LED
- 5V, 2A power adapter
Step 2: Introduction
Attached here is an image of IR sensor array and the gestures associated with the code. The two simple gestures will be :
- Left Swipe
- Right Swipe
Check out the working of these gestures here :
Step 3: Making the Connections
IR Sensor Connections :
- Connect GND of IR line follower sensor to GND of Arduino.
- Connect VCC of IR line follower sensor to 5v of Arduino.
- Connect Digital Output of sensor A to Digital pin 4 of Arduino.
- Connect Digital Output of sensor B to Digital pin 5 of Arduino.
- Connect Digital Output of sensor C to Digital pin 6 of Arduino.
- Connect Digital Output of sensor D to Digital pin 7 of Arduino.
- Connect Digital Output of sensor E to Digital pin 8 of Arduino.
- Connect Digital Output of sensor F to Digital pin 9 of Arduino.
- Connect Digital Output of sensor G to Digital pin 10 of Arduino.
- Connect Digital Output of sensor H to Digital pin 11 of Arduino.
LED strip Connections :
- Connect GND of LED strip to GND Arduino.
- Connect 5V of LED strip to Vin of Arduino.
- Connect Data In of LED strip to Digital pin 3 of Arduino.
That’s all folks!
Step 4: Let’s Code It
Explanation :
The Code is simple, We are using one library named FAST LED to control the LED and giving it effects. Then 8 variables are declared using alphabets to store the data coming from sensors. The Number of LEDs in pixel strip is defined as 90(you can change this according to your setup) & data pin is defined as pin 3 of Arduino.
The void loop consists of 2 nested if loops which will check which of the sensors are turned on & hence glowing up/changing the colours of LEDs.
One Void Fadeall function is made to provide the Hue(Color) Changing effect.
Download the code from here & enjoy.
Follow us on Instagram: Random stuff We Make! for more cool projects.