Make it mech
  • Home
  • How & Why
    • Arduino
    • Leapmotion with arduino
    • Sensors/Modules
    • Basic Electronics
    • NodeMcu
    • LabView
    • MATLAB
    • Industrial Automation
  • Projects
    • arduino projects
    • Robotics
    • Brain Wave Decoder
    • EEG
    • Leapmotion with arduino
    • Circuit Diagrams
    • Electrical
    • Mechatronics
    • IEE Projects
  • Ideas
  • Startups
  • Videos
No Result
View All Result
  • Arduino
  • Robotics
  • Circuits
  • LeapMotion
  • EEG
  • IOT
  • LabView
  • NodeMcu
  • Mechatronics
  • Sensors
  • Motivation
  • Soft skills
  • Success
Wednesday, January 13, 2021
Make it mech
No Result
View All Result
Home Leapmotion with arduino

LED DIMMER with Leapmotion Arduino and Processing

499
SHARES
1.4k
VIEWS

 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.

Related posts

Leap Motion gesture controlled Robot | Leap Robotic Arm Processing Arduino

Leap Motion gesture controlled Robot | Leap Robotic Arm Processing Arduino

August 31, 2020
How to control servo motor using Leapmotion and Arduino

How to control servo motor using Leapmotion and Arduino

August 30, 2020

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.


Components


  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 


Step: 01Programming 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.

leap codee 1

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.

 

void draw() {
background(0);
for (Hand hand : leap.getHands()) {
pushMatrix();
float handSize = hand.getSphereRadius();
int handSize2 = int(handSize);
myPort.write(handSize2);
println(handSize2);
popMatrix();
}
}

 

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


Step: 02Programming of Arduino


 

int val;
int led = 13;           // the pin that the LED is attached to
int brightness = 0;    // how bright the LED is
int fadeAmount = 5;    // how many points to fade the LED by
// the setup routine runs once when you press reset:
void setup()  {
Serial.begin(9600);
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop()  {
if (Serial.available() == 'n') { //  Check if there is a new message
val= Serial.read();
val = map(val, 30, 165, 0, 255); // map(value, fromLow, fromHigh, toLow, toHigh)
analogWrite(led, val);
}
}

 

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.

Previous Post

How to Integrate LeapMotion Controller with Arduino

Next Post

How to control servo motor using Leapmotion and Arduino

Immad Fareed

Immad Fareed

Related Posts

Leap Motion gesture controlled Robot | Leap Robotic Arm Processing Arduino
Leapmotion with arduino

Leap Motion gesture controlled Robot | Leap Robotic Arm Processing Arduino

August 31, 2020
How to control servo motor using Leapmotion and Arduino
Leapmotion with arduino

How to control servo motor using Leapmotion and Arduino

August 30, 2020
How to Integrate LeapMotion Controller with Arduino
Leapmotion with arduino

How to Integrate LeapMotion Controller with Arduino

August 30, 2020

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Contents

RECOMMENDED ARTICLES

ideas for at home business

Top10 Amazingly Different Tech Startup Ideas | Business Ideas

2 years ago
What are the best ways to get extra ordinary results in studies?

What are the best ways to get extra ordinary results in studies?

2 years ago
Top-10 The Most Inspirational Books Ever

How to Think Out of the Box – Self Learning Experience

2 years ago
What is Leap Motion Controller and How does Leap Motion Works

What is Leap Motion Controller and How does Leap Motion Works

4 years ago
  • Privacy Policy
  • About Us
  • Contact Us
Subscribe Our YouTube Channel

© 2020 Make it mech

No Result
View All Result
  • Home
  • How & Why
    • Arduino
    • Leapmotion with arduino
    • Sensors/Modules
    • Basic Electronics
    • NodeMcu
    • LabView
    • MATLAB
    • Industrial Automation
  • Projects
    • arduino projects
    • Robotics
    • Brain Wave Decoder
    • EEG
    • Leapmotion with arduino
    • Circuit Diagrams
    • Electrical
    • Mechatronics
    • IEE Projects
  • Ideas
  • Startups
  • Videos

© 2020 Make it mech

Go to mobile version