Leap Motion (Ultraleap) – Unity Editor Hands

Testing Leap Motion controller for hand tracking inside the Unity editor. Deploying to HoloLens 2 takes a few minutes each time and a specific process to prevent errors. Less deployments is better, especially if you just want to tweak something small.

Rocco – 2019 Update

Still working on this guy… sorry no video at this time. He was assembled enough to execute some motion presets that I added to the code, but there are some interference issues and possibly one or two servos that don’t work quite right. I took him back apart to work on shielding but got pulled off the project for a while. So close to getting back to the code.



Partially Assembled



Circuit Diagram v8 (WIP)



Alive! Well, the light is on…



Mostly Assembled



Servo Hook-Up Board – Bottom



Servo Hook-Up Board – Top



Servo Hook-Up Board – Side



PC Power Supply with Voltage Regulator (Arduino wants 7-12V, I gave it 9V)

Rocco – Controls and Connection

Controls

The videos below are demonstrations of the potentiometer and a few other commands.  The potentiometer controls the interval value when turned left or right (as does “i##”).  You can also see some examples of the other commands that Rocco accepts as input in the first video.  I am pasting a sequence of motion pre-sets while using the potentiometer to change his movement speed.

“[” or “]”   |   Increase/decrease servo speed – Rocco continues executing a motion every “servo_speed” milliseconds until motion is complete

“s###”   |   Set a three digit servo speed (default is 25ms, maximum 999ms)

Hardware potentiometer   |   Increase/decrease servo_interval – Rocco moves each servo “servo_interval” number of degrees until executed motion is complete

“i##”   |   Set a two digit servo interval (default is 32 which is the maximum value)

“p”   |   Toggle usage of potentiometer for reading the servo interval (potentiometer is used by default)

“j##”   |   Select a servo using a two digit servo number

“,” (the “<” key)   |   Select previous servo

“.” (the “>” key)   |   Select next servo

“k”   |   “Knock” selected servo (move +5 degrees then -5 degrees just to see which servo is selected)

“a###”   |   Set the angle of current servo, requires three digit angle (add leading zeros if necessary)

“g”   |   Get angle of selected servo

“m##” (00-08 currently)   |   Execute pre-coded motion

“+”   |   Selected servo plus 5 degrees

“-”   |   Selected servo minus 5 degrees

“d”   |   Disconnect selected servo (reset required to reconnect)

“r”   |   Reset

Connection

I am using an HC-06 Bluetooth serial module for wireless control.  It accepts 3.6 – 6V and I’m using 5V from the Arduino.

Module:
http://www.amazon.com/dp/B0093XAV4U/ref=pe_385040_127541860_TE_dp_1

The transmit/receive pins should be wired as follows:

Arduino “TX0” -> HC-06 “RXD”
Arduino “RX0” -> HC-06 “TXD”

Other markings on the module:  JY-MCU, BT_BOARD V1.06

The HC-06 is a slave device only and cannot start communication on its own (it cannot be paired with other Bluetooth modules, only “masters” like a computer or smart phone)

I am using the Real-Term application to connect to the module, which can be downloaded here:
http://realterm.sourceforge.net/

Real-Term is also referenced on the page below, which is a good source of information on serial communication in general:
https://learn.sparkfun.com/tutorials/terminal-basics/all

Below is an example of how to connect to the HC-06 module using Real-Term:

Baud: 9600 (this value should match what is coded in the Arduino)
Port: “6 = \BthModem0” (you can find which COM port HC-06 is using in Windows 7 by “Devices and Printers”, “HC-06”, “Hardware”)
Parity: None
Data Bits: 8
Stop Bits: 1
Hardware Flow Control: None
Press “Change” to connect

I am also able to connect to the Bluetooth module using my Nook tablet and the “Bluetooth Terminal” application.  Any Android tablet will work, but iPads and iPhones will not as they don’t support this kind of connection.

Additional links:
http://embeddedprogrammer.blogspot.co.uk/2012/06/ubuntu-hacking-hc-06-bluetooth-module.html
http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
(if the link breaks just search for “a child’s guide to basic two way bluetooth” – that is how the document is titled)

Rocco – Circuit and Arduino

Servo Power Supply

I had a left over power supply with a molex connector on the end that can put out 5V @ 2A or 12V @ 2A.  I am using it at 5V to independently power the servos collectively.  I also re-purposed a female molex to 2-pin adapter to get the power to the breadboard.

I am not sure yet how much current these servos draw.  I only know that 2A is enough because, well, I tried it.  I tried to measure this with my multimeter but could not get a valid reading.  I later discovered most multimeters can’t read servo current.

Below are two possible explanations (they may be the same) and a discussion about idle and stalled current draw:
http://forum.arduino.cc/index.php?topic=109988.0
http://www.rcuniverse.com/forum/rc-radios-transmitters-receivers-servos-gyros-157/2357551-how-much-power-does-servo-use.html

I will find a way to measure before adding more servos or planning a battery system.

Circuit

I ordered a SunFounder breadboard kit with jumper wires and some other components for testing.

SunFounder Kit:
http://www.amazon.com/dp/B00DGNZ9G8/ref=pe_385040_121528360_TE_dp_1

I haven’t made a schematic yet for how I have the board and servos wired up.  I would like to make one in Fritzing but for now, here are some photos:

I’m using the potentiometer from the SunFounder kit to increase/decrease an interval value in the code.  I’m also using a switch from the kit to enable/disable an HC-06 Bluetooth module.

Bluetooth serial module:
http://www.amazon.com/dp/B0093XAV4U/ref=pe_385040_127541860_TE_dp_1

Fritzing circuit design tool:
http://fritzing.org/home/

Lastly, I am using some servo extension cables to give myself some room to work.

Futaba / JR Style Servo Extension Leads:
http://www.amazon.com/dp/B00DU7KLCM/ref=pe_385040_30332200_TE_item

Arduino

I chose an Arduino Mega 2560 R3 for the main board.  I’ve never used an Arduino before so this is exciting.  There are dedicated products for controlling servos and pre-programming motions, but I’m currently putting an emphasis on coding as much of this project as possible.  The Mega has enough pins to control (but not power) all 18 servos.  I’ve read there may be problems with interrupts or “bandwidth” when trying to control all 18, but I’m still going to try.  If it doesn’t work out I’ll look at adding hardware to the project.

I like this board:
https://www.pololu.com/product/207

This one I feel is cheating:
https://www.pololu.com/product/1350

The Arduino can be powered with a wide range of supplies, but I am using a generic 9V DC 650mA supply from Amazon.

Arduino Safety

Knowing nothing specific about Arduino boards or dev boards in general, I looked up what kinds of things can break it (so that I don’t do those things).

10 Ways to Destroy an Arduino:
http://www.ruggedcircuits.com/10-ways-to-destroy-an-arduino/

Rocco – Frame and Parts

Rocco was designed in Tinkercad.  The model can be found here:  https://tinkercad.com/things/i91TkKbNDc9

It should not be printed to a 3D printer currently because the holes don’t line up quite right.  When I started assembling the first leg I had to widen most of the holes and even move some of them.  This is possibly because the servo dimensions aren’t exact.  I will try to fix the model when I build the rest of the legs.

Below is a description of all the materials and components currently used to make the robot.

Drill Bits

Any drill bits meant for plexiglass will work, but these are the bits I’ve used:

R&H 3/16″ Plexiglass Acrylic & Lexan Drill Bit
http://www.eplastics.com/Plastic/Plexiglass_Lexan_Plastic_Drill_Bits/DB-187

1/8″ Drill Bit for Plastic
http://www.amazon.com/dp/B0011Z0I82/ref=pe_175190_21431760_cs_sce_3p_dp_1

5/64″ Carbide Small-Diameter Drill Bit
http://www.mcmaster.com/#2841a95/=w65byx
(M2’s actual outer diameter is 1.9mm = .0748in = use 5/64)

3/32″ Carbide Small-Diameter Drill Bit
http://www.mcmaster.com/#2841a96/=w65bz9
(M2.5’s actual outer diameter is 2.4mm = .0945in = use 3/32)

Plexiglass

You can order acrylic sheets anywhere, but I have a lot left over from prior projects.  I have previously ordered them from U.S. Plastics.  You can cut plexiglass by scoring it repeatedly with a box cutter along a heavy straight edge.

Acrylic Sheet 24″ x 24″ x 1/16″ (.060) Thick
http://www.usplastic.com/catalog/item.aspx?itemid=35662

Plexiglass Cuts

18 @ 20mm x 100mm – mid-leg and outer leg lengths (shared size)
6 @ 10mm x 132mm – longest leg pieces
12 @ 10mm x 42mm – knee servo side mounts
18 @ 10mm x 32mm – knee servo top and bottom mounts
12 @ 35mm x 35mm – hip top and bottom plates
6 @ 12mm x 35mm – hip mid-panel
2 @ ? – hexagonal body top and bottom (no exact dimensions currently)
Other – there may be other plexiglass cuts added later

Wood Block

I needed some spacing material to fill an area in my design and provide support.  I also needed to be able to cut it by hand, so I just got a stick of wood from the hardware store.

6 @ ~27mm x ~22mm x ~11mm (length, width, height)

The wood is then cut to an “L” shape.  I’ve only made one so I’m not sure how much I cut out.  Let’s just call it “some”.

Frame Hardware

I designed the mounting hardware solution around getting as many of the components as I could from one place.

I was able to do this such that I got everything from McMaster-Carr.  Most of the components are shown to the right:

According to the link below, the “spline screw” that fits in the center of the servos I’m using (TowerPro MG90s) is an M2.5 size.  I needed longer screws than the ones that were supplied so that I could put plexiglass between the screw heads and the servos.

http://hobbyking.com/hobbycity/store/product_discussion.asp?idproduct=9392

I also needed some threaded rod that I could cut to specific lengths using a dremmel.  The threaded rod and the the metal hex nuts for it are the heaviest parts of the mounting hardware but it is necessary to keep the hip/shoulder “square” and keep it from flexing.  To keep the weight down, almost all the mounting hardware is nylon.

Metric Pan Head Phillips Machine Screw
Black-Oxide 18-8 Stainless Steel, M2.5 Size, 8mm Length,.45mm Pitch
http://www.mcmaster.com/#95836a255/=w65we0

Type 316 Stainless Steel Fully Threaded Rod
M2 Thread, 0.4mm Pitch, 1 Meter Long
http://www.mcmaster.com/#94185a135/=w65wf3

Type 18-8 Stainless Steel Thin Hex Nut – DIN 439B
M2x0.4 Thread Size, 4mm Wide, 1.2mm High
http://www.mcmaster.com/#90710a020/=w65wf5

Metric Nylon Pan Head Phillips Machine Screw
Black, M2 Size, 16 mm Length, 0.4 mm Pitch
http://www.mcmaster.com/#92492a110/=w65wej

Nylon 6/6 Hex Nut
M2x0.4 Thread Size, 4.2mm Wide, 1.5mm High
http://www.mcmaster.com/#93800a300/=w65wet

Nylon Flat Washer
M2 Screw Size, 2.2mm ID, 5.0mm OD
http://www.mcmaster.com/#95610a510/=w65xbz

Rocco – Servos

At first I thought I was going to get full size servos for this project, but the lowest price I saw for those was around $10 per servo, which would have added $180 to the project before it even got started.  I did not want to make that kind of commitment never having worked with these components before.  I did a lot of research and have tried to summarize it below.

Here is a look at the current outcome of having chosen metal geared MG90s micro servos:

Considerations

Cost/Quality – Servos are another type of purchase where you get what you pay for.  I feel like the choice was sort of “expensive” vs. “disposable”.  There are also robotics grade servos, but those were definitely out of the question.

Gear Type – I wanted the more expensive metal geared servos instead of plastic so that the gears don’t strip/slip under the weight of the robot. I’ve heard these can get hot but I can’t test that yet.

Brands and Models – I’ve heard Hitec and Futaba are the better brands.  Many people have strong negative and positive opinions about brands and models of servos.  This is in part due to the fact that the market contains a lot of knock-off products and a lot of servos with really bad quality control.  Many arrive faulty or fail quickly.  On top of that, I found most of the discussion about servos seems to center around keeping expensive RC planes and helicopters in the air.  As I understand it, there are also a lot of issues with online hobby shops holding people’s money hostage while they obtain their stock from overseas.  Lastly, using servos to carry the weight of a robot is an inherent abuse of their design.

Physical Size – Standard size servos with metal gears cost too much to be “disposable”, and I didn’t want to spend enough to get a quality brand/model at that size.  I chose the micro size instead.  The micro servos are lighter and use less power too.

Voltage and Torque – For testing I was able to power one servo using the Arduino, but it definitely can’t power 18 of them.  I don’t know how many it can power safely, but I think the answer is very few.  The more voltage you supply to a servo (within its specified range), the greater its torque (strength).  Torque is one of the more important factors for walking robots since they need immediate and constantly available support for their weight.  Running servos at their maximum voltage will wear them out quicker though, so I chose to run mine at 5V which is in between their minimum and maximum values.

Accuracy – I’m actually minimally concerned with this, as I want my robot to have a little personality anyway.  I plan to accommodate for any detrimental imprecision with code wherever possible.

Practicality – I wondered was it even practical to use micro servos?  They’re not famous for doing heavy lifting.  It turns out yes!  There aren’t as many examples of these in use, but some of my favorite robots are using them.  Sometimes they are a little shaky in certain positions, but I will try to design and code around that as well.

Examples

Pretty much my favorite robot:
https://www.youtube.com/watch?v=-KDnMeRvkqo

Amazingly fast and very smooth:
https://www.youtube.com/watch?v=HlxTxyLp2qk

I think this one is a kit:
https://www.youtube.com/watch?v=MjTJpvNxVcM

Nylon geared:
https://www.youtube.com/watch?v=yFHzD1PYoY8

Decision

Given the quality issues, I assume I will be replacing servos periodically, so being able to return them and get new ones quickly and cheaply is my main concern.  With hobby shops and eBay ruled out, I ignored a lot of negative comments about the TowerPro MG90s and ordered it anyway because it was the only servo that met the requirements AND could be ordered via Amazon Prime for $5 per servo.

TowerPro MG90s Micro Servo Specs:

Dimensions: 22.8 x 12.2 x 28.5mm

Operating Speed (4.8V no load): 0.1sec / 60 degrees
Operating Speed (6V no load): 0.08sec / 60 degrees

Stall Torque (4.8V): 1.8 kg / cm
(also seen listed as 2.2 kg / cm)

Stall Torque (6V):   2.2 kg / cm
(also seen listed as 2.5 kg / cm)

Temperature Range: -30 to +60 Degree C

Dead Band Width: 5usec
(also seen listed as 2usec)

Operating Voltage: 4.8 – 6.0 Volts

Weight: 13.4g
(also seen listed as 13g)

Links

Types of Servos and How They Work
http://www.societyofrobots.com/actuators_servos.shtml
http://www.rchelicopterfun.com/rc-servos.html

Tips for reducing servo failure:
http://forum.arcbotics.com/viewtopic.php?t=193

 

Rocco – Code and Slow/Fast Movement

Rocco is built on an Arduino, which is a development board and environment that can read data from sensors and run code written in C.  The code for this project is located on GitHub here:
https://github.com/levans88/Rocco

The main focus of the code right now is to read input over a serial connection and execute appropriate functions (mostly movements) based on the characters received. The core function handling movement is “motion”.

There are no inverse or forward kinematics involved yet, only motion presets which are defined in the motionPreset function. Destination angles are set in that function as well and passed to the motion function to be executed.

The motion function uses the servo_interval variable to determine how many degrees each servo should move at a time on the way to completing a motion. It also uses the servo_speed variable to determine how frequently each servo should move.

For an interval of “01” (one degree, the most granular), a speed of “010” (10 milliseconds) works best.  Here is an example of Rocco moving slowly (with an interval close to 01):

For the fastest movements, the maximum interval value of “32” (32 degrees) can be used along with a speed of “001” (1 millisecond).  There is very little observable difference in anything lower than 25 milliseconds for fast motions.

Rocco – A Hexapod Robot

For a few years now I have been seeing hexapod robots show up on sites like Hack-A-Day and in my search results.  Some are custom, built from scratch robots made with wood, or professionally cut aluminum, and others are kits that can be bought and assembled from RC/Hobby shops and robotics web sites.

Here are some custom examples:
http://makezine.com/projects/chopsticks-the-spider-robot/
http://orangenarwhals.blogspot.com/2011/07/strange-and-beautiful-hexapods-spider.html

Here is a kit example from Lynxmotion:
http://www.lynxmotion.com/c-117-phoenix.aspx
https://www.youtube.com/watch?v=ryO03bQk3m4

I was successfully avoiding building my own hexapod until I saw one with a Leap Motion controller.  I haven’t had a lot of interest in touch and gesture technologies lately, but this is the perfect use for a gesture detecting controller like the leap motion:  http://hackaday.com/2013/08/06/leap-motion-controls-hexapod-with-hand-signals/

So, armed with more ideas and questions than anything else, I set out to build my own hexapod robot named Rocco, and I will document the project here.  I am catching up on documentation, and a lot of work has already been done.  I will make separate blog posts for different project components.

You can find the code, current issues, and other project documentation on GitHub here:
https://github.com/levans88/Rocco

I designed the robot in Tinkercad with the idea of cutting out all the pieces from plexiglass by hand.  The model is available here:  https://tinkercad.com/things/i91TkKbNDc9

The initial concept model is also on Tinkercad:  https://tinkercad.com/things/gs7jj3mGE9D