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 - $50 (amazon.com, leapmotion.com)
- Arduino Uno or similar - $25 (amazon.com, sparkfun.com)
- Darlington Driver ULN2803 - $2 (amazon.com, sparkfun.com)
- Arduino Proto Shield or similar - $5 (amazon.com)
- RGB LED light strip - $15 (amazon.com, banggood.com)
- 12V DC Adapter - $5 (amazon.com, banggood.com)
- A computer of some sort that can run the Leapmotion SDK and Python.
We used a Windows 10 Pipo mini computer.
- LeapMotion SDK
- Arduino Software
Let's get started!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Installing Software
On your computer of choice, install the following:
(Our setup was on a Windows 10 home 32-bit PC)
- Python - https://www.python.org/downloads/
- Download and follow the install instructions
- Then open command and install pyserial (pip install pyserial)
- Arduino Software - https://www.arduino.cc/en/Main/Software
- Download and follow the install Instructions
- Load your arduino with the PWM_serial sketch (attached bellow)
- LeapMotion Software- https://developer.leapmotion.com/v2
- Extract the zip file
- Install the Leap_Motion_Installer_.exe
- Copy or move the LeapSDK folder to the C:\ drive
- This is referenced by the python script.
- This is referenced by the python script.
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.
- 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.
- Soldering Iron + Solder
- Wire Strippers
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:
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.
Participated in the
Sensors Contest 2016
1 Person Made This Project!
Pierre AlexandreT made it!