My Robotics Adventures.

So, I bought myself this Robotic Arm Kit (similar to this) from China, since I thought it will be a nice thing to play with. Unfortunately, I didn’t notice the ‘Kit’ part in the name, and surely enough, the parts arrived disassembled. Alas – they also arrived without any documentation. After some googling, I found some info resembling those parts, but one conclusion presented itself  very quickly – a Robotic Arm is not a good starting point for a beginner such as myself. Servos, controllers, Arduino / Raspberry-PI / BeagleBone / YouNameIt, I had to start reading it all, and start assembling everything from scratch. I admit, the thought of getting a pre-assembled Arm was tempting, but I resisted the urge. It’s been a while since I last struggled with an unknown territory, so I decided to press on.


The parts started to come together, and after doing some more reading and online learning, I ordered myself an Arduino Uno coupled with a Pololu Maestro Servos Controller (12 channel), and all kinda pins, cables, connectors, etc. It started to look like a real Robotic Arm.


After assembling all the parts, it was time connect and wire everything. Since Arduino is part of the OSS ecosystem, I knew I can find all documentation I wanted. I didn’t assume it will be that tedious to find it. It turns out, each Servos Controller behaves differently, and expects different connections – some will be just happy with 1 VIN (Voltage In), while others require two power sources: one for Servos Controller Processor, and another for the Servos themselves; some will require direct TTL Serial, others the SPI (Serial Peripheral Interface), and so on, and on. Needless to say – a lot of reading, a lot of headache, and a lot of trial & error, but as one of my former bosses used to say – you learn from your mistakes, and so I did. Here is how the final assembled Robotic Arm looks like.





*TIP: You must connect your controller via USB for the 1st time to configure it, since the serial configuration (BAUD, etc) is being done via USB only using the supplied software.


The following two sites helped me the most figuring out how to connect the pins properly: Arduino Uno Pinout description, and the Pololu Micro Maestro 6-Channel Servo Controller tutorial (although it has one mistake on the diagram, and SPI didn’t work for me).


As you can see from the pictures, I connected all 6 servos to channels 0-5 on the controller, and used the blue jumper to connect the pins “VSRV=VIN” to indicate same power source for both Servos Processor and the servos themselves. I connected RX and TX on the controller to PIN-0 and PIN-1 on the Arduino UNO, respectively. I then connected the VIN and GND from the Arduino to the controller.


Next step was connecting a sensor (which was fairly easy thanks to this blog) – I connected a Photocell to a 10k resistor and connected it like the following:



It is now time for me to start working on the code part. Here is the basic code templates I’m using to control the servos and detect the sensor input:


#include <SoftwareSerial.h>

const int DEFAULT_BAUD = 9600;

SoftwareSerial ServoController = SoftwareSerial(SERVO_CONTROLLER_RX_PIN, SERVO_CONTROLLER_TX_PIN);

void setup()

void moveServo(int ServoChannel, int target)
   //656ms PWM pulse represents a servo angle of 0 degrees.
   //2000ms PWM pulse represents a servo angele of 180 degrees.
   //These values could vary based on the servo you use, check your servo's
   //spec documentation and verify what PWM pulses are needed to move it.

   byte serialBytes[4]; //Create the byte array object that will hold the communication packet.

   target = (map(target, 0, 180, 656, 2000) * 4); //Map the target angle to the corresponding PWM pulse.

   serialBytes[0] = 0x84; // Command byte: Set Target.
   serialBytes[1] = ServoChannel; // First byte holds channel number.
   serialBytes[2] = target & 0x7F; // Second byte holds the lower 7 bits of target.
   serialBytes[3] = (target >> 7) & 0x7F; // Third byte holds the bits 7-13 of target.

   ServoController.write(serialBytes, sizeof(serialBytes)); //Write the byte array to the serial port.

void loop()
   moveServo(5, 180);
   moveServo(4, 180);
   moveServo(5, 0);
   moveServo(4, 0);

The Photocell code:

const int PHOTOCELL_PIN = 0;

int lightLevel;
int lightLevelDefault;

void setup() {
 //Setup the starting light level limits
 lightLevelDefault = analogRead(PHOTOCELL_PIN);

void loop(){
 lightLevel = analogRead(PHOTOCELL_PIN);
 if (lightLevelDefault != lightLevel) {
 //slow down the transmission for effective Serial communication.



  1. Hi Ziggy

    That’s quite an interesting post you have there.
    You got me interested into trying to buy something similar with in order to tinker with
    especially for home automation of small tasks

    could you describe which hardware did you buy eventually ? How hard was it to write code for it (find the approp angles, etc)

    1. The hw I used was a generic Arm I found on Amazon, there are better nowdays, some with Arduino+code in package, which makes your life much easier.

      Bottom line – there is no replacement for trial & error. just enjoy it, and you’ll find out yourself how to make it work best for you.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s