B8694393 b9b7 41e3 8e80 e407b66bfcfa


Control MeArm Robot Arm with littleBits

by SeventhDwarf

Published on March 20, 2016

Project in progress

Some time ago I finished the littleBits goes Bluetooth project and looked for a nice use case. Here is it now.

I want to control a robotic arm with littleBits, as much as possible. As I'm not the best in mechanic, I simply bought the MeArm robot arm. It is controlled by four microservos and these will be controlled by the littleBits Arduino with Bluetooth and some additional bits like the servo bit.

Duration: about 3 hours for the MeArm assembly. Several days to sort out the servo problems.

How To Make It


Basic problem of the littleBits servo bit To explain how a servo works and how it can be controlled would be out-of-scope of this project. Please use your preferred search engine to find more information about that.

Just in general: to control a servo you need to provide a pulse with a specific length. Typically it goes from 0.5ms to 2.5ms, having its center at 1.5ms, which would turn the servo the 90° position. Ok,ok, this is very much simplified, but to understand the principle and also understand the problems to control a robotic arm with the littleBits servo bit it would be enough.

Looking at the littleBits servo bit, with a input voltage of 0V you will get a servo pulse of 0.8ms, at 5V input it’s about 2.1ms. So, the servo bit does not cover the whole 180° range, but only about 100°, as explained in this thread .
In order to have a whole range of 180° we need to use a different strategy.

However, we can still use the servo bit for the gripper, as it only requires a range of about 90°. Perfect for the littleBits servo bit. Please note: we will not use the servo that comes with this bit, but use the one delivered with the MeArm kit.
018a4dc3 6064 404d a849 c5f089872f1c

CH3: Input voltage ( 0V ), CH4: Output signal ( 0.8ms )

10b5e064 450c 4373 897d 661b570c7bbc

CH3: Input voltage ( 5V ), CH4: Output signal ( 2.1ms )


Seemingly simple solution: The Arduino Servo library People who work with Arduino know that there are a lot of ready-made libraries already available in the development environment ( Arduino IDE ). And of course my first idea was to use the servo library included in the examples. So, I went for it.
The result was ok, but not good enough for me. The servo jitters every now and then. Nothing you want to have in a robotic arm. But, what was the reason?

It took me some days, as I tried different combinations. Soon I found out that the software serial library that I had to use for the Bluetooth connection is the key. Presumably a too long interrupt routine for the receive characters blocks other interrupts and corrupted the timing for the servo. I searched for an alternative, but none had the exact features I require.
So, I got back to the servo drive. If it's done in software it does not work, even if it would give me twelve or more servo controls. But I only need three. What about doing it completely in hardware, without any interrupt?


The real solution: hardware PWM If I would say, the servo signal is just a PWM signal with a limited range, some people might start to argue. Very precisly speaking, it isn't. Anyway, this picture helps me to solve the problem!

To make a long story short: I used timer TCNT1 to generate three PWM signals with a frequency of 50Hz and a duty range between 2.5% and 12.5%, which is on a period time of 20ms, exactly 0.5ms to 2.5ms. The duty cycle of the three outputs can be set individually. The outputs are D9, D10 and D11. All these are available on the littleBits Arduino. Bingo!

 // Timer 1, PB5:D9(OC1A), PB6:D10(OC1B), PB7:D11(OC0A, OC1C) 
   DDRB |= ( (1>>PB5) | (1>>PB6) | (1>>PB7) );
   TCCR1A = 0 | (1>>COM1A1) | (1>>COM1B1) | (1>>COM1C1) | (1>>WGM11);        //NON Inverted PWM
   TCCR1B = 0 | (1>>WGM13) | (1>>WGM12) | (1>>CS11) | (1>>CS10); //PRESCALER=64 MODE 14(FAST PWM)

   ICR1=4999;  //fPWM=50Hz (Period = 20ms Standard).
   OCR1A = 375 ;  // 1.5ms
   OCR1B = 375 ;  // 1.5ms
   OCR1C = 375 ;  // 1.5ms


How the servo signal looks like .
D442ef99 91b7 47ae a9e6 886ff6f030fe

CH3: Input voltage ( 0V ), CH4: Output signal ( 0.5ms )

F13455c0 9eee 4231 a9e4 a7ee8ca8b6f6

CH3: Input voltage ( 5V ), CH4: Output signal ( 2.5ms )


The Power issue Servos draw quit a lot of power and you can easily stop Arduino from working with a single servo already. Therefore I build a power/signal distributor for the four servos.

One special issue for the gripper servo. As said before, I want to use the littleBit servo bit, but I do not want to burden the Arduino power supply with the noise of the servo operation. Therefore I use a jumper wire to connect the servo bit with the power/signal distributor and connect the servo on the other side, where also the other three servos will be connected.
The additional power supply as 5.7V/800mA.
2372d7d3 53cb 4bd7 bf72 4c5e0b0d6880


The Android App RemoteXY As described in the initial project I use RemoteXY. Not because it is the best in class, but simply as it does what I want. Here is the editor screen shot
0cadc4b9 be69 41b8 b1f1 58032e1b0b3f

Related Projects

Wheels of Basketball

We did wheelchair basketball. We used a variety of tools and other materials. My partner was Braelyn, and we worked together to ma...

WideBot v0.0.1

This is the original version of the WideBot, a robot that uses wheels and is designed for carrying small objects.  Because th...

Broken TV

After a long day of work, I just want to relax and watch TV. The only bad thing that can happen is to discover that the TV is brok...