Introduction: Control RGB LEDs With the Wave of Your Hand.

Introduction

We were invited to help out at our local elementary school's STEM night, and needed a cool demonstration, with little time to prepare.

So, we looked through the tech we had laying around, and came up with the idea of using the LeapMotion hand tracking sensor, to control the color and intensity of RGB lights.

There is no better way to get kids excited about science, technology, engineering, and math, than having a fun and interactive hands on example.

Note: The following lists are parts closest to what we used for our setup.

Bill of materials (BOM)

LeapMotion + RGB LEDs Amazon.com List

  1. Leapmotion - $50 (amazon.com, leapmotion.com)
  2. Arduino Uno or similar - $25 (amazon.com, sparkfun.com)
  3. Darlington Driver ULN2803 - $2 (amazon.com, sparkfun.com)
  4. Arduino Proto Shield or similar - $5 (amazon.com)
  5. RGB LED light strip - $15 (amazon.com, banggood.com)
  6. 12V DC Adapter - $5 (amazon.com, banggood.com)
  7. A computer of some sort that can run the Leapmotion SDK and Python.
    We used a Windows 10 Pipo mini computer.

Software

  1. LeapMotion SDK
  2. Python
  3. Arduino Software

Let's get started!

Step 1: Installing Software

On your computer of choice, install the following:
(Our setup was on a Windows 10 home 32-bit PC)

  1. Python - https://www.python.org/downloads/
    • Download and follow the install instructions
    • Then open command and install pyserial (pip install pyserial)
  2. Arduino Software - https://www.arduino.cc/en/Main/Software
  3. LeapMotion Software- https://developer.leapmotion.com/v2
    1. Extract the zip file
    2. Install the Leap_Motion_Installer_.exe
    3. Copy or move the LeapSDK folder to the C:\ drive
      • This is referenced by the python script.
        (LeapMotion-RGB_LED_ctrl.py)

Without the lights connected download and run "LeapMotion-RGB_LED_ctrl.py"
(Double click to run)

This is to be sure everything is installed correctly.

If everything configured without a hitch, then your script should look like the screenshot above.

If you should have any errors, take a look at the Troubleshooting step for some helpful tips.

Now we just need to add the lights.

Step 2: Building the LED Controller

To control a 12V RGB LED strip with an Arduino, we will need to build a simple circuit.

Lucky for us, this can be accomplished with a single chip, the ULN2803. (datasheet)
We don't need to add any resistors, since our RGB LED strip already has them built in.

We'll need to supply 12V to pins 9 and 10.

  • Pin 9 - GND, 12V negative side
  • Pin 10 - 12V positive side

Also, be sure to tie the ULN2803 chip's and the Arduino's grounds together.

Then pins 1-8 can be used as PWM inputs from an arduino, and pins 11-18 can be used as the common sink for your 12V - 30V device.

OPTION 1: Using a Breadboard

Most RGB LED light strips have a header that can be directly plugged into a breadboard.

Follow the wiring diagram above.

Tools Needed

  • Breadboard
  • Jumper wires

OPTION 2: Building an arduino shield

A protoboard can be used to create a robust, and permanent arduino shield.
This is what we did, except we used a scrap xbee shield we picked up from Sparkfun.
The wiring diagram above shows how this can be done.

Tools Needed

  • Soldering Iron + Solder
  • Wire
  • Wire Strippers

Tips:

You may have noticed that we are only using 3 pins out of the 8 available.
To make more use of the chip, you could drive two RGB LED strips at once.
Or, If you need to drive a device with a little more current, then you can double up pins (run in parallel).

For additional help on using the ULN2803 chip, check out RU4Realz Instructable:
https://www.instructables.com/id/Controlling-High-Power-Circuits-with-Arduino-and-D

Step 3: Putting It All Together

Make sure the LeapMotion sensor and the Arduino are plugged into your computer.

Also make sure the RGB LED light strip is plugged into the control circuit, and that the 12V power is connected.

Finally, we can start the script and have some fun!

Step 4: Troubleshooting

This step is intended to help users solve common problems that they might encounter.

Right now, we aren't sure what to put here, but we are sure it will be needed in the future.

So feel free to reach out to us with any problems that you might have, and we will add to this step as needed.

Comments

author
Pierre AlexandreT made it! (author)2016-07-08

Great. I made it.

Win7 64. I Used a Mega2560, python 2.7, don't forget the pyserial lib (pip install pyserial)

IMG_20160617_192919.jpgIMG_20160708_113520.jpg
author

Great Job! The globe looks really cool!

And nice catch about installing pyserial, I completely forgot to mention that.
I'll be sure to update the instructable.

author
DIY Hacks and How Tos (author)2016-06-05

Cool motion sensor. I wonder if you could use this kind of sensor to make a kind of theremin.

author

Now that would be a cool way to use the LeapMotion. There are quite a few apps that make this a musical tool: https://apps.leapmotion.com/categories/music-enter...

About This Instructable

384views

7favorites

License:

Bio: TangibleTec helps you bring your ideas to life. Draw on our experience in Mechanical, Electrical, and Software Engineering to provide you with the concept, design ... More »
More by TangibleTec:Control RGB LEDs with the wave of your hand.
Add instructable to: