Archive for the servos Category

Botacon!

Posted in robotics, servos on February 22, 2011 by raphaelabrams

A little late, but here’s a video of me talking at Botacon a few months ago.

Advertisements

The Magic of Words

Posted in robotics, servos on June 23, 2010 by raphaelabrams

Sometimes the really hard part of a project is getting the right parts. That’s even harder if you don’t know what the parts are called. Search engines use words, not concepts.  So here’s some words!

Ball Links:

The Clevis:

The turny bit on a servo is a horn:

Autoblink

Posted in arduino, servos, Uncategorized on May 14, 2010 by raphaelabrams

The eyes now blink automatically. They will flit closed semi-randomly with minimum and maximum time spans between blinks. When the puppeteer wants to take over, they can be switched to manual mode.

How about some code!

unsigned long last_time = millis();
unsigned long time = millis();
unsigned long autoblinkdelay=1000;
unsigned int blinkingnow=0;
void loop(){

//do some other things in the loop here//

//now, the blinking stuff:

  time = millis();  //get the current time in milliseconds
  if ((time-autoblinkdelay)>last_time){
    blinkingnow=autoblink_duration;  //fill up the blinking timer, when it reaches zero the eye will open back up
    autoblinkdelay=random(autoblink_mintime,autoblink_maxtime);  //randomly select how long until the next blink
    last_time=time; //holder for comparing times in the next iteration of the loop
  }
  if(blinkingnow){  //is "blinkingnow" empty? if not, keep eye closed
    blinkingnow--;
    eyes_output=eyes_servo_closed;
    soft_servo(EYES_SERVO,eyes_servo_closed);
  }
  else{  //open the eye!
    eyes_output=eyes_servo_open;
    soft_servo(EYES_SERVO,eyes_servo_open);
  }
  delay(4); //delay to let the servo have time to get where it goes
}

Servo Library Seems Unreliable

Posted in arduino, servos on May 1, 2010 by raphaelabrams

I’m not sure why, but it seems like the Arduino servo library has some sort of periodic twitch to it. Every few seconds or so it gives a pulse that’s too long, which makes the servo try to get all the way over to one side for a split second. Not a problem with cheap servos that have a slow response, but the fancy-pants ones that we’re using are giving an annoying flicking movement to everything. So I decided to just use a simple loop instead:

#define MINIMUMPULSE 550    // Minimum servo position
#define MAXIMUMPULSE 2400   // Maximum servo position

void soft_servo(char pin, int angle){
  angle=constrain(angle, MINIMUMPULSE, MAXIMUMPULSE); //keep it within a safe range
  digitalWrite(pin, HIGH); //start the pulse
  delayMicroseconds(angle);       // Length of the pulse sets the motor position
  digitalWrite(pin, LOW);  //end the pulse
}

void loop(void){
  do this;
  do that;
  soft_servo(whichservo,whatangle);
  delay(10); //give things a bit of time to settle. Something between 1ms and 40ms
}

Advantage: no more funny pulses. Interrupts† and timers are free for other uses.

Disadvantage: has to be called every few milliseconds or else the servo goes slack. Maybe there’s a way to program a modern digital servo to hold a position indefinitely with one command pulse? That would be handy!

In practice I haven’t had any trouble running a servo refresh in my main loop. 10mS is an eternity in which to calculate the math and gather sensor data.

†Disable interrupts during the pulse or else it may get elongated and send the servo into unknown territory!

Crude, but Effective

Posted in servos, silicone, software, Uncategorized on April 29, 2010 by raphaelabrams

Those wiggles in there are from that stupid error I made in the software. It’s fixed now!

A Note About Servos

Posted in servos on April 29, 2010 by raphaelabrams

We got some really fancy servos for this project: the Hitec 5990tg. Behold! Titanium gears, 400 oz/in torque, digital amplifier. That’s about 10x more torque than a standard hobby servo in the same case size.

BUT! They make a horrible high pitched squealing noise almost constantly. It made everyone in the room angry. Having one of those right next to your ear all day would be criminal.

Luckily, we had a backup plan: the 7955tg. Not quite as strong at 333 oz/in, but waaaay quieter and still has all that nice metal everywhere. All is well!

Servo control board!

Posted in robotics, servos, Uncategorized on April 27, 2010 by raphaelabrams

Here’s a circuit board I designed for robots and animatronics. It’s an AVR chip with the Arduino firmware flashed onto it. It has eight servo hookups on it, and a handful of analog and digital inputs. It’s tiny and reliable. I’ll be using it as the motherboard for this project. You may know it as the Twitchie.

In this image is the battery compartment, two servos, a potentiometer with a wad of red duct tape on it and the circuit board. Just in case you’re wondering, it’s running at 16MHz, has voltage regulation for the chip, direct power connections between the servos and the battery case (servos like a few more volts than microcontrollers to really get them going) and is clad in a very dashing shiny black solder mask.