Driving 256 servos

Status
Not open for further replies.
without a breakout, how many can the teensy itself run off the gpios directly provided it can achieve that pwm rate smoothly? :)
 
without a breakout, how many can the teensy itself run off the gpios directly provided it can achieve that pwm rate smoothly? :)

22 off the through hole GPIOs (not the pads on the bottom) of a 3.6! By breakout i meant the breakout for the pads on the bottom of the teensy for the other GPIOs, with that, i just noticed there are no pwm capable pins on the bottom pads anyway so it's 22.
 
just throwing it out there as an alternative option, you could always use canbus to link up teensies together, youll have the option to control a set of servos or a mass of them depending on how youll handle the IDs, you have 8 byte payload you can handle
 
just throwing it out there as an alternative option, you could always use canbus to link up teensies together, youll have the option to control a set of servos or a mass of them depending on how youll handle the IDs, you have 8 byte payload you can handle

Can i ask why you suggest canbus over another protocol?
 
if you dont want to handle issues with serial out of sync (you need to write a protocol for serial) , i2c is also slow, but the data chunks have hardware crc on canbus so you can rest assured the data you send wont be corrupt in any way :)
You could also run it at 1Mbps speeds over 40meters of UTP
 
As for the numbers I showed, the 0x8585 was from your code, although I did get it wrong:
Wire.write(85);
Wire.write(85);
So the actual value: given is 85*256=85=21845 = 0x5555 I believe only the low 3 bits is use of high byte: so this is 0x555 or 1365...

As for pulse width:
If you go to the libraries example program servo.ino you see:
Code:
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;
  
  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000000;  // convert to us
  pulse /= pulselength;
  Serial.println(pulse);
  pwm.setPWM(n, 0, pulse);
}

Again I was assuming 60hz as per their code...
So if you pass in .0015 as the pulse width which internally multiply by 1000000 = 1500
and you divide this by pulselength= (1000000/60)/4096 = 4.0690104166666666666666666666667
so 1500/4.06... = 368 then you need to convert to bytes...

Now with 50hz instead of 60, I would suspect a value of about 307 (same calculations substitute 50 for 60...)

As for +-5 degrees. A lot of the may depend on what servos you are using? How much slop...

If you are doing 50 hz and the range of valid values is 0-4095, than a change of 1 in the output will change the pulse width by about 5us (4.8...)
But lets assume that your servos have a valid range of output of 500(-90 degrees) 1500(0) 2500(90 degrees), I would suspect that the valid data to
pass as pulse widths is: 102 - 512 So about a difference of 410 so 180 degrees/410=.439 degrees per unit...

But this really depends on your servos. Also not all are linear... So yes you may need to use your own observations to do the valid conversions. Also if you have different brands/model numbers, the conversion may be different for each of them.

Warning it has probably been 5 years since I did much of anything with RC servos!

As an aside note: I've been having issues with these parallax servos's accuracy, and saw the dynamixel AX - 12A, then wondered how i'd command 256 of them from a single teensy, then saw your library (i think) here. I'm only after a servo that has a higher resolution ADC so it can actually move to n angle instead of n +- 10 (sometimes 20) that these crap servos are doing. Is the dynamixel my best choice in your opinion? I'm welcome to other brand suggestions that are known to have high accuracy.

Back to your post, i used an oscilloscope to assert what i was sending matched the datasheet (0.75 to 2.25 ms), and noticed the numbers i should send were 146 to 437, but these numbers move the servoes about 155 degrees. I'm going to give up with these parallax ones, i called the US technical support and they were not very useful.

I have been using identical parallax servos. I'm going to look for high accuracy ones , only issue with the dynamixel one is it's got a lot of stuff i don't need.
 
RC Servos: I have only tried one of the Parallax servos (free one that shipped with some order...) As you mentioned, it did not appear to have a very high level of quality...
Probably along the line of tower pro... Some people had luck with them, but most of the comments were along the line of buy lots of extras as they are not robust/reliable... And their is a lot of slop in their gears... Again this is from remembering stuff from several years ago...

Back then I stayed with Hitec servos. like the 645mg, and maybe some lighter duty ones like 425??? again been a long time. Again these are analog servos, so you have to update them something like 50 times per second or they lose some of the strength... You can also use digital RC servos like hitec 5645.. With these you only need to send one proper pulse and it will hold that same position until you send it another pulse... Note: A lot of these servos do have a limited angle they can move so 155-160 degrees is probably not un-common.

Robotis Servos:
Most of my stuff I have played with over the last several years was with the Dynamixel servos and most of this time was with the AX-12s. Nice servos. If I were starting a new project and I had to build all of the rest of it, I would strongly look at some of their newer ones. like: http://emanual.robotis.com/docs/en/dxl/x/xl430-w250/
At some point hopefully soon will be building a hexapod with 18 of these... I have a couple of legs prototyped...

If I did not need a lot of power and could use the smaller sizes, I might look at: http://emanual.robotis.com/docs/en/dxl/x/xl320/

Now driving 256 of them... Can not do all of them on one Dynamixel chain as ID is one byte with a couple of them reserved (0x255 broadcast, and often one for the servo controller...
But they are all controlled by a half duplex serial. So you can setup to have multiple serial ports doing this...

And yes the bioloid serial is what I have been using. Although I am sort of trying to convert most/lots of my stuff over to the Robotis Dynamxel SDK... However they only currently support their own boards. I have a version that works with Teensy. And I do like using Teensy boards... But for quick and dirty and cheap their http://www.robotis.us/opencm9-04-c-with-onboard-xl-type-connectors/
board is nice to play with. More if interested...

Yes - an oscilloscope or logic analyzer often helps to figure out what things are doing.
 
Status
Not open for further replies.
Back
Top