LED DIMMER with Leapmotion Arduino and Processing

 Led Dimmer With Arduino and LeapMotion controller

Hello In this quick tutorial we will learn to control the intensity of LED by using our hand gesture with Leap motion controller and Arduino. And If we close our hand the intensity (light) of an led is going to dim slowly. When we completely closed our hand grip the led will be turned OFF.
And same as when we open our hand over leap motion device the led will be turned ON.When we fully open our hand the led will glow with full intensity.
This the same as using Duty cycle (pulse width modulation) of Arduino for fading Led. But here is the concept of using the hand gesture to control the fading led instead of using duty cycle ( Pulse width modulation).
So If you are getting used with Leapmotion technology then it’s very easy to understand the programming about hand gestures.So If you didn’t get used to it yet so don’t worry about it.

See that link: what-is-leap-motion-controller .

It will help you to understand the basics.

As in PWM, we are using duty cycle from 0% to 100% to control anything for analog but here, in this case, we are not using the commands of PWM for any percent but we make the hands gesture to do the same work of PWM for fading lamp.If the hand is half open its mean 50% PWM goes to the output and this process is same for 25 % or 75% and others.


  1. Leap Motion controller
  2. Arduino Uno
  3. Led
  4. 220-ohm resistor

For Interfacing 3D gesture technology (leap motion controller ) with Arduino, we are using Processing software for leap motion device and Arduino IDE software for Arduino controller. The serial communication of both device we are controlling the fading led by hand gestures.
For understanding the basics of how to communicate the leap motion to Arduino

Read:how-Integrate-leap motion-controller-with-Arduino 

Programming of Processing for Leap motion

First of all, use the command to import the library of leap motion. With this library the leap motion works otherwise it will not works. For download, the library

Read: How to download leap motion library

Import the serial processing for serial communication of Arduino with the leap motion technology. For this command, if there is changing the grip open or closed the communication will move to Arduino and Arduino will change the brightness of led. It’s same like PWM. When we use PWM for fading it can fade between 0 to 255 means 0% to 100% of PWM but in our case, this process will go with hands. The hand closed means 0% and hand fully open means 100% and in the middle, it will depend on you how much your hand opens like 25% or 50% it’s same as done in PWM.

Here we are making a class of leap and giving the port to Arduino for serial communication with leap motion and also set the baud rate 9600. Remember if it isn’t working or giving error change “[0]” to your port number in which your micro controller is connected.



Here setting the background color black. Get the size of hand sphere radius and write it to the port.

Programming of Arduino



Connect the Led with pin # 13 of Arduino. Read from processing port of leap motion controller and get the size of the radius of a palm of the hand. Map the value of the radius of hands palm to the duty cycle of LED and write it by analog command. That’s the program for controlling 3D technology to hardware using the microcontroller.
Hope you Learn a lot from this.
If you have any query please inform us so our team can help you thanks.Stay Connected for more Tutorials and Subscribe to our YouTube Channel for video Tutorials.

Exit mobile version