element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Robotics Fun with Pi, Servo Control and Leap Motion
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: shabaz
  • Date Created: 14 Jun 2018 6:17 AM Date Created
  • Views 2205 views
  • Likes 9 likes
  • Comments 4 comments
Related
Recommended
  • leap motion
  • robotics
  • moversshakersch
  • robot
  • servo hat
  • raspberry pi
  • leap
  • hobby servo
  • robotic arm

Robotics Fun with Pi, Servo Control and Leap Motion

shabaz
shabaz
14 Jun 2018

This very short blog post briefly discusses a simple project that allows for toy robot arms to be controlled using gestures. It had a serious purpose; it was intended to show latency.

 

However, it was also a bit of fun. There is immense pleasure in destroying Lego structures with a mere wave of the hand! There isn't a lot of documentation for this project here - this blog post is just to provide some ideas. To be honest it was quite straightforward, and components of it are documented in various places but some coding is required and is an mini exercise for the reader. Any questions, please ask in the comments section!

 

The whole thing is very similar to the robot arm demonstration at Amazon AWS Re:Invent 2015 by their Deep Learning director, Dr. Matt Wood.

 

To build this project, there isn't a lot of soldering. Just a few header pins. Everything was off-the-shelf. The main components were the robot arms (from Amazon), a couple of Raspberry Pi's (one for each arm, although a single Pi could be used in theory), a couple of Adafruit Servo HAT boards, and a Leap Motion sensor and a PC (e.g. a laptop).

 

The photo here shows the robot arms connected to the Pi's, and at the bottom of the photo you can see the Leap Motion sensor.

 

image

 

Check out the 30-second video here:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

 

To install the Leap Motion software development kit (SDK), the instructions are here: Virtual Reality, Leap Motion, and Controlling Things! - Getting Started Guide

Next, decide how you want to control the thing. Use the code at Amazon's github page as a guideline: https://github.com/aws-samples/simplerobotservice

 

Alternatively the code could be developed in any of several languages. In my case, I used JavaScript. I installed Node.JS, and used Socket.IO to communicate from the PC to the Raspberry Pi. I used JavaScript and Node.JS to control the robot arm using the Servo HAT. The code isn't shown here, but it is a fun learning exercise to try to create it if you have a day to experiment - give it a try!

  • Sign in to reply

Top Comments

  • shabaz
    shabaz over 7 years ago in reply to DAB +3
    Hi DAB, Thanks! Good point - I forgot to mention, the left and right arms were going through different paths. The right one was going halfway around the world on an Internet connection, and we would see…
  • DAB
    DAB over 7 years ago +2
    Nice video. Was it jumpy because of the sensor or your hand motion? I am assuming that you can add some filters to the control cycle to make it a more smooth and deliberate action. DAB
  • genebren
    genebren over 7 years ago +1
    Very cool little demo. I am going to have to consider the Leap Motion sensor/software for some of my up and coming robotics projects. Well done! Gene
  • shabaz
    shabaz over 7 years ago in reply to DAB

    Hi DAB,

     

    Thanks! Good point - I forgot to mention, the left and right arms were going through different paths. The right one was going halfway around the world on an Internet connection, and we would see the impact of delays and jitter (and events would stack up on the remote cloud app, so all sense of real-time control would disappear), so that was quite deliberate; that arm would sometimes take a minute to catch up with what had occurred, if hundreds/thousands of events stacked up. The left arm was more responsive, but in the video was running some code that I wasn't entirely responsible for : ) I have some separate code, but didn't get a chance to capture video of it. That code is extremely smooth and responsive - the Leap Motion has perhaps 100 frames per second of capture, and so it was easy to get smooth movements. I'll write up that code sometime hopefully, but I may change it to run on a different robot arm first.

     

    There are a few things that people will experimentally find when working with such servos and robot arms too by the way. For example, the PWM range differs between servos and arms, so some configurability is needed in the code. Also, it can be a challenge to precisely map from cartesian to servo actions - the leap motion device provides cartesian values. However I found close approximations work pretty good. I think it would be a good high-school math challenge to work out the mappings. And last but not least, low-cost servos don't like it when they hit a mechanical limit such as a limb restriction on the arm - since the servo still tries to correct for the error, but the motor is stalled, it gets hot and can smoke : ) One solution is software that is aware of the limits, but also overload-safe servos are also available (at higher cost).

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 7 years ago

    Nice video.

    Was it jumpy because of the sensor or your hand motion?

     

    I am assuming that you can add some filters to the control cycle to make it a more smooth and deliberate action.

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • shabaz
    shabaz over 7 years ago in reply to genebren

    Hi Gene,

     

    Thanks! It has attracted a lot of attention at a show considering it is such a simple demo. If you need help anytime if you experiment with the sensor, just give me a shout.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 7 years ago

    Very cool little demo.  I am going to have to consider the Leap Motion sensor/software for some of my up and coming robotics projects.

    Well done!

    Gene

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube