Skip to content

DecodedCo/leap-arduino

Repository files navigation

Leapmotion + Arduino

Getting leapmotion to talk to arduino.

Top level: Leapmotion makes data available via websockets on ws://127.0.0.1:6437. Node.js can parse this. There is also a Node.js library for talking to Arduino called Johnny-five. You need something called StandardFirmata which standardises commands sent between the Arduino and a host computer, which Johnny-five speaks.

Note: the serialport library only works with node 0.12.x

1. Setup

  1. Install nodejs
  2. Run npm install

2. Leapmotion + Node.js

  1. Enable websockets on Leapmotion: Enable websockets on Leapmotion
  2. Run node leap.js
  3. Sit-back and enjoy the raw JSON feed! Example frame in leap.json

3. Arduino + Node.js

  1. Flash the Arduino with StandardFirmata: Install StandardFirmata
  2. Run node arduino.js

4. Arduino + Leapmotion via Node.js

  1. Run node leap-arduino.js (ref @xavier_seignard)
  2. Placing one or more hands above leap will switch built-in LED on pin 13 on, otherwise off.
  3. Run node leap-gestures.js
  4. You should see console output for a Screen Tap, Key Tap, Circle and Swipe.

5. Detecting valid ranges from your Leapmotion

  1. Run node leap-range.js
  2. Move both hands around for a while in all directions
  3. Stop program when you stop seeing changes. The final values are the min and max ranges (in mm) of your current setup.

6. Leapmotion + Servo (via Arduino and Node.js)

  1. Wire up a servo to pin 9.
  2. Run node servo.js.
  3. Tweak ranges in code if need (servo and leap). Here is a demo video: Leap Servo demo

7. Leapmotion + 6 Servos

Tested using 6 degrees of freedom robot arm from: http://www.lynxmotion.com/c-130-al5d.aspx

  1. Open six-servos.js and adjust parameters
  2. Run node six-servos.js

Resources

About

Getting leapmotion to talk to arduino

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published