Robotic Arm with Arduino driver controlled by Leap Motion

This project was created to learn about the basics of how to control a simple robot arm.  The arm itself is a AL5A kit driven by an Arduino compatible board.  A Leap Motion is used as one of the inputs.  The sliders directly control each servo and also visualize in real-time the output of the Inverse Kinematic function.  The 2D slider also can be used to send the desired arm position directly to the IK function.

Processing (processing.org) is used for the GUI.  I created the code step by step with a lot of googling along the way.  First I created a simple mechanism to control each servo using a slider.  Then I spent a long while trying to figure out Inverse Kinematics.  I settled on a very simple function that does the job in this case.  It auto-calculates the shoulder, elbow and wrist angles.

The Leap Motion controller was very easy to integrate thanks to the Processing library (mentioned in the code). 

The Processing app sends servo data to the Arduino compatible board in a very simple format: <servo_number,servo_angle>.  For example sending the command "0,90" make servo 0 (the base) turn to the center position.

One trick that I am proud of is using the built-in easing functions of the sliders.  Without any additional programming the slider objects smooth out any jerkiness.  The result is pretty cool.

Although I haven't tried the software on anything besides a MAC, it should run on Windows and Linux.

The code for the Arduino board and Processing can be downloaded here:
https://github.com/bborncr/AL5A_CONTROL
https://github.com/bborncr/AL5A_Driver 


This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/robotic-arm-with-arduino-driver-controlled-by-leap-motion

Just…

It is just amazing. I like it. 

Things to Do

Thanks for the comments.  

I have been using the code to control a DAGU arm (with wrist rotate) and also a DIY version made from 3 standard servos (base, shoulder, elbow), one micro servo (wrist) and foam core.  The results have been very jerky even with the easing.  Perhaps if I changed from servo.write(angle) to servo.writeMicroseconds(microseconds) the improvement in resolution will give better results…

Connecting

Hi, you used Jhonny Five to connect arduino with the leap motion, or just proccesing by serial??

Connections

The Leap Motion sensor is connected to a MAC.  The Processing library mentioned in the Youtube description parses the x,y,z position and angle of my hand.  The MAC is connected via USB to an arduino-compatible board which receives commands from the Processing app and sends the signals to the servos.

say something

cool …

Trying to reproduce - doubt!

Hi! It’s veeeery nice the project, and I’m trying to reproduce with my leap motion and robotic arm.

But I never had experience with Processing or with Inverse Kinematics before. So, I entered in the link for CONTROL code, but there are many .pde and data files.

Wich of them I need to use in the Processing programming 
environment, for the sketch? I need to use all those files? I’m really lost in this phase of the project…

 

Thank you very much!! 


The DRIVER code is what is

The DRIVER code is what is installed in the Arduino.  The CONTROL code is the processing sketch.  Use the “Download as zip” button to bring all the files down into one folder.

Regards,

Great Project

Just wanted to drop a note to say thanks for the great project.  I adapted the procesing code to include a FK and IK solver useing DH parameters for my homemade arm.  Instead of servo writes i am using a Pololu Mini-Maestro and am not experiencing any jerkiness of arm.  Nice smooth motion. The board uses microseconds by the way.  I convert angle to ms and send that to the controller.

 Still working out some of the bugs - no i am not using a leap motion right now but very interesting to use it this way.  Looking at hooking up a pixy at some point in time as well.  Again, thanks the project saved alot of time.

Mike

Looks great! Do I need to

Looks great! Do I need to run all processing files at once for the data to be sent to the arduino? if not which ones do i run? Is there anything else i should be using besides arduino IDE and processing IDE? Just a bit confused how to data is being sent to the arduino because I can get processing to show a hand and its movements on the leap but the robot arm just flickers every second. Thanks for any help!!