Arduino Gesture Controlled Led Brightness

About the project

In this tutorial we will learn how to control the LED brightness using the gesture sensor and arduino. Watch the video!

Project info

Difficulty: Easy

Platforms: ArduinoSparkFunVisuino

Estimated time: 1 hour

License: GNU General Public License, version 3 or later (GPL3+)

Items used in this project

Hardware components

Breadboard (generic) Breadboard (generic) x 1
Jumper wires (generic) Jumper wires (generic) x 1
Resistor 1k ohm Resistor 1k ohm x 1
LED (generic) LED (generic) x 1
Arduino UNO Arduino UNO x 1
SparkFun Ambient Light Sensor Breakout - APDS-9301 SparkFun Ambient Light Sensor Breakout - APDS-9301 x 1

Software apps and online services

Visuino Visuino
Arduino IDE Arduino IDE

Story

Step 1: What You Will Need

1 / 7

  • Gesture Color Proximity APDS9960 I2C sensor
  • Arduino UNO (Or any other Arduino)
  • LED
  • 1K ohm resistor
  • Jumper wires
  • Breadboard
  • Visuino program: Download Visuino

Step 2: Brought by PCBWay

Thank you PCBWay for supporting this tutorial and helping users learn more about electronics.

What I like about the PCBWay is that you can get 10 boards for approximately $5 which is really cost effective for professional made boards, not to mention how much time you save!

Go check them out here. They also offer a lot of other stuff in case you might need it like assembly,3D printing,CNC machining and a lot more.

Step 3: The Circuit

  • Connect Sensor Pin [GND] to Arduino board pin [GND]
  • Connect Sensor Pin [Vin] to Arduino board pin [3.3V]
  • Connect Sensor Pin [SDA] to Arduino board pin [SDA]
  • Connect Sensor Pin [SCL] to Arduino board pin [SCL]
  • Connect Arduino board pin [GND] to LED negative pin [-]
  • Connect Arduino board digital pin [5] to 1k ohm resistor
  • Connect 1k ohm resistor second pin to LED positive pin [+]

Step 4: Start Visuino, and Select the Arduino UNO Board Type

1 / 2

The Visuino: https://www.visuino.eu also needs to be installed. Download Free version or register for a Free Trial.

Start Visuino as shown in the first picture Click on the "Tools" button on the Arduino component (Picture 1) in Visuino When the dialog appears, select "Arduino UNO" as shown on Picture 2

Step 5: In Visuino Add & Set Components

1 / 8

  • Add "APDS9960" component
  • Add "Clock Multi Source" component
  • Add "Up/Down Counter" component
  • Add "Analog Value" component
  • Add "Integer To Analog" component
  • Add "Analog Multi-Source Merger" component

Select "UpDownCounter1" and in the properties window:

  • set "Max" > "Value" to 10
  • set "Max" > "Roll Over" to False
  • set "Min" > "Value" to 0
  • set "Min" > "Roll Over" to False

Select "IntegerToAnalog1" and in the properties window set "Scale" to 0.1

Step 6: In Visuino Connect Components

1 / 2

  • Connect "GestureColorProximity1" Control pin I2C to Arduino I2C pin [In]
  • Connect "GestureColorProximity1" pin [Up] to "ClockMultiSource1" pin [In]
  • Connect "ClockMultiSource1" pin [0] to "AnalogValue1" > "Set Value1" pin [In]
  • Connect "ClockMultiSource1" pin [1] to "UpDownCounter1" [Reset]
  • Connect "GestureColorProximity1" pin [Down] to "AnalogValue1" > "Set Value2" pin [In]
  • Connect "GestureColorProximity1" pin [Left] to "UpDownCounter1" pin [Down]
  • Connect "GestureColorProximity1" pin [Right] to "UpDownCounter1" pin [Up]
  • Connect "UpDownCounter1" pin [Out] to "IntegerToAnalog1" pin [In]
  • Connect "AnalogValue1" pin [Out] to "AnalogMultiMerger1" pin [0]
  • Connect "IntegerToAnalog1" pin [Out] to "AnalogMultiMerger1" pin [1]
  • Connect "AnalogMultiMerger1" pin [Out] to Arduino PWM pin [5]

Step 7: Generate, Compile, and Upload the Arduino Code

In Visuino, at the bottom click on the "Build" Tab, make sure the correct port is selected, then click on the "Compile/Build and Upload" button.

Step 8: Play

If you power the Arduino module & move the hand Up or Down above the Sensor the LED will turn On or Off, and if you move the Left or Right the LED will change its brightness.

Congratulations! You have completed your project with Visuino. Also attached is the Visuino project, that I created for this Tutorial, you can download it and open it in Visuino: https://www.visuino.eu

Schematics, diagrams and documents

Visuino File

Code

Visuino File

Credits

Photo of Ron

Ron

Arduino Developer

   

Leave your feedback...