loading

Last time, I created an Arduino Car, which is controlled via Web. This time, I have used the same car but it’s controlled via Leap Motion.

Step 1: What Is Leap Motion.

You can check what “Leap Motion” is by visiting the official website.

The device uses infrared light in order to measure various information like positioning, angle and hand and finger gestures. The picture above is taken from the visualizer of Leap Motion. The accuracy of the device is 1/100 mm – So I would say it has quite high accuracy.

Leap Motion has taken care of providing various developer libraries for major programming languages. In this project, I have used the JavaScript library to coordinate with Node.js.

Step 2: System Architecture, Components and Software Libraries.

The system architecture of this prototype is drawn above. The last time, I used Web to control the car but this time I have used Leap Motion. The other parts are the same.

Here are the components and software libraries for the project.

  • Arduino Uno x 1
  • XBee Shield (sparkfun) x 1
  • XBee Explorer USB(sparkfun) x 1
  • XBee (Series 1) x 2
  • Motor Driver TA7267BP x 2
  • Capacitor 0.1uF x 2, 33uF x 2
  • Tamiya Double GearBox
  • Tamiya Universal Plate
  • Tamiya Off-road Tire Set.
  • Tamiya Ball caster

  • Battery Box (for motor power)
  • Mobile Battery (for Arduino power)

  • Node.js (for XBee control and Web Server)
  • node-serialport (a library of Node.js to handle serial connection)
  • Socket.IO (for Web Screen Control)
  • Leap Motion JavaScript Library

Step 3: Breadboard Wiring Diagram.

There is no difference in the Wiring diagram.

Step 4: Specification for Controlling the Car Via Leap Motion

You can download the source codes of this project at GitHub.

The Leap Motion library provides hand information of 200-300 times in a second. It’s too much for this project. So I used the information every 5 times.

The device has a 3D coordinate system as shown above (the picture is taken from the official website).
In the current project I designed the following specifications for controlling the Arduino car.

These two rules are top priority.

  • If the device detects no hands it will stop.
  • If the device detects a number of fingers less than two it will stop.

The positioning of the hands determines the car's movement.

  • If the X-axis absolute value is less than 10 cm and the Z-axis absolute value is less than 5 cm, it will stop.
  • A check on the X-axis and Z-axis absolute value comparison is to be performed. Whichever axis has larger value will be used in such a case. The car can move only in one direction (left rotation, right rotation, forward or backward/reverse) at a time.
  • If the Z-axis is of negative value, the car will move Backward/Reverse. If the Z-axis is of positive value, the car will move Forward.
  • If the X-axis is of negative value, the car will move Left. If the X-axis is of positive value, the car will move Right.
  • The value of the Y-axis determines the power of the motor. A higher value will lead to more power.

The actual accuracy of the device relies on the distance between the device and the hand position. For safety purposes, I would program the car to stop when the device finds either no hand or inadequate data.

The direction based on this rules will be transmitted simultaneously to the Arduino car via XBee and to Web via Socket.IO. I can figure out the kind of direction transmitted to the car by checking Web browser.

It took some time to adjust the specification. Understanding the Leap Motion library and tune-up for deciding the specification is the key part of this project.

Step 5: Conclusion

I used Leap Motion to control the car in the current project, stepping up from the former web-based project. When using Leap Motion, you may suffer hand fatigue in a short time. I think the posture of using the device is unnatural for us. That may be the difficulties of using Leap Motion for a long time.

Leap Motion provides libraries and useful documents for major programming languages. So if you are familiar with one of these languages, you will feel easy to use it. The cost of the device is $99.99. So I think it is a reasonable device for prototyping for makers.

<p>how can i install these node.js, Socket.IO, node-serialport and XBee?</p>
<p>You can download these libraries from here. </p><p>node.js -&gt; <a href="https://nodejs.org/" rel="nofollow">https://nodejs.org/</a></p><p>node-serialport -&gt;<a href="https://github.com/voodootikigod/node-serialport" rel="nofollow">https://github.com/voodootikigod/node-serialport</a></p><p>socket io -&gt;<a href="http://socket.io/" rel="nofollow">http://socket.io/</a></p><p>XBee is a hardware so you need to buy it from electoric shop. </p>
<p>can you tell me how to open the js files code? how can i run them so that i will have the uotput on the node.js command prompt window? thank you</p>
<p>hi, thanks for sharing your project, may i request the codes you being used? i will used it as a reference in my project, i hope that you will provide it, thanks, this is my account: olleresjoseph15@gmail.com</p>
<p>You can download the source code of this project from github. </p><p><a href="https://github.com/mikilabo/arduino_leapmoion" rel="nofollow">https://github.com/mikilabo/arduino_leapmoion</a></p>
<p>i cant find the IC Motor Driver TA7267BP when im searching for it there is no like image of it like in here, can i have a replacement or substitute for this?</p>
<p>You can use any kind of &quot;motor driver ic&quot;. You have to adjust some Arduino code to cope with the ic. But I think it is not so difficult task. </p>
Awesome! I've been waiting for someone to do a nice project with a leap motion! I wanted to get one myself, but lots of people were claiming it was very fidgety if you didn't position your hands right. Have you had any problems with accuracy or the device not even recognizing your hand?
<p>I have the same problem that the sensor sometimes doesn't catch my hand's position. So I programmed that these two rules. </p><ul> <br><li>If the device detects no hands it will stop.<li>If the device detects a number of fingers less than two it will stop.</ul><p>The later one is more important that the car need two data (hand position, number of fingers) to move. If the sensor start to send incorrect position data, I hold a fist. Then the car stops. After I put my hand right position (the sensor start to catch my correct position), then I release the fist. </p>
<p>Very interesting. Thanks for sharing this!</p>
<p>Thanks!</p>

About This Instructable

8,883views

37favorites

License:

Bio: Former software engineer. Beginner of Arduino.
More by mikilabo:Google Earth controlled by Accelerometer(MPU-6050) Controlling Arduino car via Leap Motion Controlling Radio Arduino Car via Web Screen 
Add instructable to: