Monday, 19 November 2012

Published Chapter II on Inverse Kinematics

Good news everyone,

The second chapter on Inverse Kinematics is now published. In this one I show a simple code using the equations from chapter one to make the tetrapod alive...

I hope you find it interesting and useful.

Tuesday, 6 November 2012

Inverse Kinematics - Chapter I

Good news everyone,

I've published the first chapter regarding the Inverse Kinematics. This will allow us to set the legs to a desired position.

The Inverse Kinematics will provide the angles that the servos need to rotate to achieve the position we want.

I've tried to be simple and clear in my explanations but any questions or improvement will be much appreciate it. I hope this is useful and see you in the next post.

Sunday, 21 October 2012

Pressure sensor

Hello everyone,

I came across to a nice tutorial about how to control a servomotor's position using the value returned from an analog sensor and I've decided to try it but adapting it using the SSC 32 controller as I will use it in my tetrapod.
I'm using a variable resistance pressure sensor as a analog input. The sensor operates by decreasing resistance the harder it is pressed. When applying different pressure levels to the sensor the servo will move accordingly.
The sensor is connected in series with a fixed resistor across a 5v supply (from Arduino) forming a voltage divider. The pressure dependent voltage is then read by the microcontroller and then the value is mapped to move the servo in a range between 0 and 180 degrees.
Let's see the connexions sketch. Note I couldn't find in Fritzing an SSC 32 controller so I've used a PWM shield to show connections:

I've used a 820 ohms reistor instead of 10k because I couldn't find one in my toolbox and the resistor is as I said before to act as a voltage divider. So I play with the one I had and it worked as you can see in the little video.
I've used the Serial Monitor from Arduino IDE to visualise the readings from analog input to be able to map the values.


int potpin = 0;                                                // analog pin used to connect the potentiometer
int val;                                                           // variable to read the value from the analog pin

void setup()
  Serial.begin(115200);                                 //initiate serial communication with SSC 32

void loop()
  val = analogRead(potpin);                         // reads the value of the pressure sensor (value between 323 and 330)
  val = map(val, 323, 330, 100, 500);          // scale it to use it with the servo (value between 0 and 180)
  Serial.print ("#");
  Serial.print (0);
  Serial.print (" P");
  Serial.print (val);                                       // sets the servo position according to the scaled value
  Serial.print (" T");
  Serial.println (800);                
  delay(15);                                                 // waits for small amount of time before making another reading

Maybe I can use this type of sensor to make my tetrapod react in different ways. We will see. 

Wednesday, 17 October 2012

Arduino + SSC 32 + Servo

Hello everyone,

In this post I want to show how to use the SSC32 controller with Arduino for moving few servos and compare it with a direct connexion of servos to Arduino without using a servo controller.

I will start with the later...

We need:
  • Arduino
  • Servos
  • Breadboard
  • Wires
  • Power cable for Arduino
I've made the connections layout below using fritzing

Arduino receives power and data from USB. Arduino is powerful enough to give power to 3 servos so we can connect red and black wire from 5v and ground in Arduino to breadboard. Servos will take power from the breadboard lines set by Arduino. We also need to connect yellow wire to a PWM input pin. I select pins 2, 3 and 4. If we want to connect more servos probably we will need to add an external battery to power them.

#include <Servo.h>
Servo servoMain1;                                // Define our 1st Servo
Servo servoMain2;                                // Define our 2nd Servo
Servo servoMain3;                                // Define our 3rd Servo
void setup()
   servoMain1.attach(2);                        // servo1 on digital pin 2
   servoMain2.attach(3);                        // servo2 on digital pin 3
   servoMain3.attach(4);                        // servo3 on digital pin 4
void loop()
   servoMain1.write(0);                          // Turn Servo1 to 0 degrees
   servoMain2.write(90);                        // Turn Servo2 to center position (90 degrees)
   servoMain3.write(180);                      // Turn Servo3 180 degrees
   delay(1000);                                        // Wait 1 second
   servoMain1.write(180);                      // Turn Servo1 to 180 degrees
   servoMain2.write(135);                      // Turn Servo2 135 degrees
   servoMain3.write(90);                        // Turn Servo3 to center position (90 degrees)
   delay(1000);                                       // Wait 1 second
Using SSC32
  • Arduino
  • Controller SSC32
  • Servos
  • Wires
  • External battery
  • Power cable for Arduino and SSC32
We need to connect the SSC32 controller to Arduino like below:

See also how to connect the 3 wires of each servo and where to connect an external power supply (5v) for the servos. The picture below shows the controller being powered by USB cable to the computer.

Also it is important to set the baud rate the same as in the code ("serial.begin" parameter)

void setup() {
Serial.begin(115200);                              //Start serial communication at 115200 baud rate
void loop() {
  Serial.println("#0 P750 #4 P750 #11 P750 T500");         //Moves 3 servos at same time
  delay(1000);                                                                     //Wait 1 second
  Serial.println("#0 P2200 #4 P1500 #11 P2200 T500");

Using the SSC 32 controller the connexions are simpler and neater. Also is really powerful to be able to move many servos at same time using the multi-servo command (the one used in the code above). Notice in the video that the servo with yellow target starts and finish movement at the same time as the others even though rotates smaller angle, so movement is slower than the other 2.

Sunday, 30 September 2012

Good news everyone

Components selection

A tetrapod robot is a mechanical vehicle that walks on 4 legs.
After some research I've selected the following components to achieve my walking robot. I don't want to say too much information at same time as many of the topics below will be developed in future posts:
Microcontroller (Brain)
ATmega1280 (datasheet) mounted on a Arduino Mega microcontroller board.

Why? Lots of inputs/outputs (to talk to motors, sensors and other devices). Open source and extensible software and hardware (lots of info in the web), cost effective, clear programming environment. The fact to have the microcontroller on a board like the Arduino Mega simplifies the connexions and also allows us to interact with sensors and other devices (like distance sensor, mobile phones & Wii nunchuck). Has 4 serialcommunications.


RC Servos. Not decided model yet until a torque study is done. This study will provide size (torque) needed. I will purchase a couple of standard servos for first tests.

Why? Provide precise control of motor output (in terms of an angle). We will give sequences of angles to the legs in order to create walking motion.

SSC-32 Servo Controller (link)

This servo controller board can communicate with a microcontroller like Arduino via serial communication and control up to 32 servos.

Why? Why not... Joking. My tetrapod has 4 legs with 3 servos in each leg to give nice movements. To control 12 servos using the Arduino Mega is feasible but because each servo has 3 cables to be connected this can become quite messy. The SSC-32 has header pins that facilitates the connexion a lot. I purchased mine here.

On top of that the SSC-32 can control motion on speed, time or a combination. Also has "Group Move" commands that allow any combination of servos to begin and end motion at the same time, even if the servos have to move different distances. This is a very powerful feature for creating complex walking gaits for multi servo walking robots. It has also 4 digital inputs that can be handy.

Physical structure (legs and body)

Legs and body will carry motors, sensors , batteries and electric boards. I will use aluminium or plastic if possible to keep weight down. The physical size (leg length) has to be as small as possible again to keep weight down but also to keep torque as low as possible.

Why? The overall weight and length of parts attached to servos is a key factor when sizing the servos. A heavier and long legged robot requires bigger (more expensive) servos. We will see this when discussing the "Torque Study".


We need to give power to the Arduino, SSC-32 and servos. The 2 boards will be powered with a 9V battery and servos need 4V-7.4V (depending on type).
For servos I will use 7.4V Li-Po battery. Arduino can give power to other devices like sensors and Wii nunchuck.

Why? Because I have a 7.4V Li-Po battery from our RC helicopter. Although, even if I select servos rated to 6V I'm planning to use 7.4V battery as people has been using them with no issues. I invite you to contradict this (and the sooner the better as I don't want to burn any servo). The weight of this battery is also a lot less than 4AA batteries (this give us 6V (1.5Vx4)) and as I said before weight is critical for sizing cheaper servos.


We need to tell (program) the microcontroller what to do and when to do thinks. I will use the Arduino IDE. This is cross-platform application that "controls" your software to make sure the microcontroller will understand. Also will allow us to send the software to microcontroller so our brain knows what to do. The Arduino IDE comes with a C/C++library called "Wiring" (from the project of the same name), which makes many common input/output operations much easier

Why? Quite simple and easy language with lots of info in the net. And it's designed to talk to Arduino.
Recently I've heard that has some limitations but I will see if as I develop the project.

Hello and Welcome

Good news everyone!

I'm going to use this Blogg as a notebook for my robotic projects.

The main project is to create a "tetrapod" robot (spider inspired) but I may develop other small projecst as I go along.

I'm new to robotics so I'm going to learn as I develop the project. Please feel free to comment on my posts and I will appreciate any piece of advice you guys can give me.

Tuesday, 25 September 2012

Privacy policy

Privacy Policy for 

If you require any more information or have any questions about our privacy policy, please feel free to contact us by email at 

At, the privacy of our visitors is of extreme importance to us. This privacy policy document outlines the types of personal information is received and collected by and how it is used. 

Log Files
Like many other Web sites, makes use of log files. The information inside the log files includes internet protocol ( IP ) addresses, type of browser, Internet Service Provider ( ISP ), date/time stamp, referring/exit pages, and number of clicks to analyze trends, administer the site, track user’s movement around the site, and gather demographic information. IP addresses, and other such information are not linked to any information that is personally identifiable. 

Cookies and Web Beacons does use cookies to store information about visitors preferences, record user-specific information on which pages the user access or visit, customize Web page content based on visitors browser type or other information that the visitor sends via their browser. 

DoubleClick DART Cookie 
.:: Google, as a third party vendor, uses cookies to serve ads on
.:: Google's use of the DART cookie enables it to serve ads to users based on their visit to and other sites on the Internet. 
.:: Users may opt out of the use of the DART cookie by visiting the Google ad and content network privacy policy at the following URL - 

Some of our advertising partners may use cookies and web beacons on our site. Our advertising partners include ....
Google Adsense

These third-party ad servers or ad networks use technology to the advertisements and links that appear on send directly to your browsers. They automatically receive your IP address when this occurs. Other technologies ( such as cookies, JavaScript, or Web Beacons ) may also be used by the third-party ad networks to measure the effectiveness of their advertisements and / or to personalize the advertising content that you see. has no access to or control over these cookies that are used by third-party advertisers. 

You should consult the respective privacy policies of these third-party ad servers for more detailed information on their practices as well as for instructions about how to opt-out of certain practices.'s privacy policy does not apply to, and we cannot control the activities of, such other advertisers or web sites. 

If you wish to disable cookies, you may do so through your individual browser options. More detailed information about cookie management with specific web browsers can be found at the browsers' respective websites.