The electro Viking

The Electro Viking - discontinued due to shitty servos

Work in progress - this project is not complete.

So I am building a sumo robot, and since it is my first robot I am going for the looks and bare functionality for start. So I bouth most of the parts from our local open source hardware provider Robofun.ro, wich I totally recommend to you if you are from Romania : 2 servos, 2 wheels, an Arduino Pro, one proximity sensor and 4 line following sensors. Since I don't really like a scruffy wired look on a robot, I thought the best armor could be provided by a helment and I hhave chosen a Viking plastic helm :P

So I will start testing and making parts individually first and after that put them togheter.

1. The brain

Arduino Pro

The Arduino Pro manufactured by Sparkfun needed some pins mounted, because in the prototyping stage I will plug in and out alot of components so this was the first step.

Then I pluged my FTDI cable and loaded the blinky led example schetch from Arduino IDE to test it out. It worked!

Empowered by this win I move to the next stages.

2. The muscles

S0NF STD Servo

The servos are two S04NF STD made by DGServo. There is almost no data on the internet about them so I deducted from other related to it that they function with about 5V and they can rotate continuous.

I connected the Arduino output VCC that is 5V to the servos and the digital pins 1 and 2 to the signal cable of the servos. So the first code I tried was the sweep example from the Arduino IDE that I altered a little bit so it can move 2 servos instead of one. The servos happily swept back and forth. They were not in synch, but the victory was enough for me.

#include <Servo.h>
Servo leftservo;
Servo righttservo;
int pos = 0;
void setup()
{
 leftservo.attach(0);
 righttservo.attach(1);
}
void loop()
{
 for(pos = 0; pos < 180; pos += 1)
 {
  leftservo.write(pos);
  righttservo.write(pos);
  delay(15);
 }
 for(pos = 180; pos>=1; pos-=1)
 {
  leftservo.write(pos);
  righttservo.write(pos);
  delay(15);
 }
}

Next I tried another piece of code that controls the servos in a totally different way, using the Pulse-width modulation pins from the Arduino:

int servoPinl = 9;
int servoPinr = 10;
void setup()
{
 pinMode(servoPinl,OUTPUT);
 pinMode(servoPinr,OUTPUT);
}
void loop()
{
 int temp;
 for (temp = 0; temp <= 200; temp++)
 {
  digitalWrite(servoPinl,HIGH);
  digitalWrite(servoPinr,HIGH);
  delayMicroseconds(1500); // 1.5ms
  digitalWrite(servoPinl,LOW);
  digitalWrite(servoPinr,LOW);
  delay(20); // 20ms
 }
 for (temp = 0; temp <= 200; temp++)
 {
  digitalWrite(servoPinl,HIGH);
  digitalWrite(servoPinr,HIGH);
  delayMicroseconds(1800); // 1.8ms
  digitalWrite(servoPinl,LOW);
  digitalWrite(servoPinr,LOW);
  delay(20); // 20ms
 }  for (temp = 0; temp <= 200; temp++)
 {
  digitalWrite(servoPinl,HIGH);
  digitalWrite(servoPinr,HIGH);
  delayMicroseconds(1200); // 1.2ms
  digitalWrite(servoPinl,LOW);
  digitalWrite(servoPinr,LOW);
  delay(20); // 20ms
 }
}

Bad news everyone, the servos are totally shit and you cannot make them work identically as much as you try. I had 4 of them, all working with different parameters. Project discontinued until I regain hope in servos.

blog comments powered by Disqus

 

Powered by dark forces using ponies and ropes.