Welcome!

Here we go, a new site in the nosomos.org family: Projects.

Cool name, isn't it? ;-)

This site will be dedicated to some hardware hacking projects (for geeks). So, if you are on the mood for some home robotics... Stay tuned, as news will come soon in my first project: A DIY small robotic arm.

Robotic arm first pictures!

Yeah baby! The servos finally arrived, so I worked out the first prototype of the robotic arm, that you can see in the following pictures:

As you can see it features three servos (they are quite small and do work reasonably well) that are joined together with small tubes made of aluminium and carbon fiber (they are, in fact, pieces of broken arrows). I thought about using icecream sticks or something like that, but found those little tubes that do the job and look cool :-)

This prototype has a lot (not really a lot but some) duct tape, but all great prototypes use it. I plan replacing it later, but for now it just works.

In the picture above you can see how the servos are placed: Servos 1 and 2 make the shoulder, with servo 1 pointing backwards and servo 2 pointing to the outside of the "body". They allow the arm to be turned up and out. Meanwhile, servo 3 is the elbow, and do what elbows do.

Servo 1 moves all the weight of the arm, so it should be the first one being replaced as the arm grows and takes heavier loads (or any load at all).

In the top view you get the idea of how it is all arranged. You can see that I have used two tubes for the upper section of the arm, while only one for the lower section, only one tube between servos 1 and 2, that I will eventualy cut shorter:

And yes... It moves!! I even wrote a simple program to send commands through the usb port of the computer, and a not so simple program to make all this using a graphical interface...

More to come, stay tuned!

RA Code: Moving servos with potentiometers

Today we are going to move our three servos (yes, they finally arrived!) using three 10K ohm potentiometers.

Reading the voltage in each potentiometer, using analog inputs, we will change the duty cycle of each servo, changing how much time is the PWM in high level and how much in low level. (If you don't know what I am talking about, have a look here).

First of all, set up this circuit in the prototyping board: (click on the image to see a larger version)

Now, read the code below, understand what will happen when it runs in the Arduino, tune it as you like, and transfer it to the board.

Important note: The values for minPulse, maxPulse and refreshTime will be servo dependant, you should find suitable values for your gear.

byte numServos=3; // Number of servos to use
int minPulse[3] = {400, 400, 400}; // Pulse for minimum servo position (microseconds)
int maxPulse[3] = {2050, 2050, 2050}; // Pulse for maximum servo position (microseconds)
byte refreshTime[3] = {20, 20, 20}; // Time needed in between pulses (milliseconds)
byte servoPin[3] = {9, 10, 11}; // Pins where servos are
int analogValue[3] = {0, 0, 0}; // To store potentiometers values
int pulse[3]={0, 0, 0}; // Pulse to be sent to servos
long lastPulse[3] = {0,0,0}; // Time in milliseconds when the last pulse started
byte analogPin[3] = {0, 1, 2}; // Pins where potentiometers are

void setup() {
  byte i=0;
  for(i=0;i<numServos;i++)
  {
    pinMode(servoPin[i], OUTPUT);  // Set servo pin as an output pin
  }
  Serial.begin(9600);
}

void loop() {
  int i=0;
  for(i=0;i<numServos;i++)
  {
    // Read potentiometers values
    analogValue[i] = analogRead(analogPin[i]);
pulse[i]=map(analogValue[i],0,1023,minPulse[i],maxPulse[i]);
    // And send control signal to servos
    if (millis() - lastPulse[i] >= refreshTime[i]) 
    {
      digitalWrite(servoPin[i], HIGH);   // Turn the motor on
      delayMicroseconds(pulse[i]);       // Length of the pulse sets the motor position
      digitalWrite(servoPin[i], LOW);    // Turn the motor off
      lastPulse[i] = millis();           // save the time of the last pulse
    }
  }
  // Send feedback through serial port
  for(i=0;i<numServos;i++)
  {
    Serial.print(" Servo ");
    Serial.print(i);
    Serial.print(" pulse: ");
    Serial.print(pulse[i]);
  }
  Serial.println("");
}

Now, when this runs in the Arduino, you should have three servos, that move each one as you change the corresponding potentiometer value. We will use this to try out our robotic arm, to see the maximum and minimum values of pulse that make each servo reach the lower and upper limits that we want our arm to reach, that will strongly depend of the mechanical design of the arm.

But we'll go deeper into that later, now just play for a while and start thinking what will you use as "bones", how will you join the servos to make all this look like an arm.

I already have my arm, so I'll post some pictures round here soon :-)

RA Part list: Wires and prototyping board.

While we wait for the servos to arrive from Hong Kong, we can do some soldering work and set up some wires for connecting the servos to the Arduino board, using a prototyping board as a bridge for all the connections:

As you can see in next picture I built a connector with three pins together on a side (where the servo will be attached) and three separated ones on the other side, that will go to the protoboard:

We'll need one of those for each servo. The red wire is for power in (5V DC), the black one is ground and the yellow one is for the control signal. Be careful and check that the servos you are going to use have this wiring, and in other case change as necessary your home-made connector, to avoid plugging 5V into the control wire of the servo.

RA Part list: Servos

The arm, at least the first release, will have three degrees of freedom, so we'll need three servos: Two for the shoulder and one more for the elbow.

I chose to use small, light and cheap servos for the prototype, as it won't move heavy loads. So, I ordered 5 Mystery Micro Servos in e-bay:

I bought them in (and took the picture from) RC-Timer.

They won't probably be very hard, but they are really cheap and will be useful to test my ideas. If things go well, I would probably buy some Futaba servos, with metal gears and able to pick up heavier loads. This mystery micro servo has a stall torque of 1.2 kg*cm and each one weights 9g, that should be more than enough to move the arm parts.

I expect them to arrive in a week or two, so we'll see what can they do...

RA Part list: Arduino

To control the servos that will move the robotic arm, I will use an Arduino board.

This small board features several analog and digital inputs and outputs. And as stated in Arduino's site:

"Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments."

So, this is just what we need for our projects :-)

I bought mine from BricoGeek, and in a couple of days you'll have your new board at home.

While the other components we'll need for the arm arrive, I suggest having a look at the Arduino Getting Started page and learning how to program it. After that, a good read and try (as we'll need that later) would be the tutorials about reading an analog input and setting a PWM in an output pin.

Enjoy :-)

Syndicate content