What is it?
The MeArm has been developed by Ben Gray (aka @phenoptix) and is a laser cut, build it yourself, robotic arm controlled by 4 servos. Once built, just add a controller of some description (micro controller/Arduino, Pi, Beaglebone Black, etc) and drive the servos to move the arm around. You can find out more from Indestructibles article. Mine was purchased from 4tronix.
By and large there are no real problems building it, so long as you take it slow and steady. I think it took me between two and three hours one evening to put it all together. The instructions were pretty clear and concise, some parts needed a couple of attempts to put together as there is a small angle on the screw holes meaning that the screws/bolts only go in one way. The screws are stiff as they bind/thread into the plastic so while it takes some effort, too much could result in tears! To that end there are a couple of spare servo collars in the kit, which (thankfully) I didn’t have to use. The only bit I would say was difficult was getting the main arm attached to the “hip” servo. This is one of the last steps and there ends up with a lot of parts getting in the way.
My initial concern is the strength of the “hip” joint as the entire weight of the arm, and anything it’s holding, is supported by a servo and a screw. Some sort of collar round the servo at base of the arm might help. But it would need to support the weight while allowing fluid movement.
I moved all the joints by hand and was happy that it was all working as expected
At this point I wanted to test my construction skills, and not worry too much about the finesse of the control method. My last project was the ToffeeBot, which has a dual servo pan and tilt mechanism on it, so I started with that – why reinvent the wheel!
As a result I ended up with a web control panel built on Flask – i.e. a copy/paste of the pan/tilt code for four servos instead of two 😀
The main snag I hit when trying to operate the MeArm was over tightened joints. While I could move them by hand the servos just wouldn’t budge. To begin with I thought I had a code issue and the servos were not responding. With a bit… OK, a lot of trial and error the joints moved easily and the servos behaved as expected. The lesson here is to only tighten as needed!
I also had to fiddle around with the gripper so I could find the closed position accurately. To do this I needed to set the servo to the maximum (180 deg) position, unscrew and move the gripper closed, re-screw and test. I ended up setting it to around the 165-170 mark so that when the gripper closed it was tight.
With the hardware testing complete and a few lessons learnt I wanted to move away from the web interface and make use of a PS3 controller. There are LOADS of examples of using the PS3 controller as a joystick in PyGame. The nice thing is, so long as it’s connected via USB, it just works™. In the past, I have got the controller working via bluetooth, again there are many guides for this (try the Raspbians guide) and I recommend you use a USB hub as plugging/unplugging on an original B caused it to reboot and a lot of frustration on my part.
It was at this point that the RPIO.GPIO library began to show its limitations. The code to detect the joystick movement and button actions runs in a while loop. this started interfering with the servo timings causing the arm to move around. Servos work by a pulse occurring at a certain frequency which requires very precise timings. The Pi is not very good at doing this when it has other things to think about, this caused the timings to be off, and hence the jitter.
Enter ServoBlaster (via here)- this I had been aware of for some while and had been suggested as a more effective alternative to RPIO. It’s advantage is that it operates at a lower level in the operating system, and runs as a separate process. With ServoBlaster compiled and installed everything went back to working as expected.
The controls are
- Left Stick (up/down) = “Shoulder”
- Right Stick (up/down) = “Elbow”
- Right Stick (left/right) = “Hip”
- Triangle = Gripper close
- X = Gripper open
- Start = Reset to start point
- Select = Exit
which you can hopefully see demonstrated here
The code for all this can be found on my GitHub
I’ve enjoyed playing with this and have a few things I can do with it. One thing I hope to do in the near future is to position the arm by a set of 3D co-ordinates. I’ll have to brush up on angles in a triangle from my GCSE maths for that one!
This project will be with me at the Southend Raspberry Jam on 21st Feb – come along and have a go yourself.