Author Topic: FPGA Servo Control  (Read 4282 times)

0 Members and 1 Guest are viewing this topic.

Offline aerowennTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
FPGA Servo Control
« on: November 29, 2010, 12:40:04 AM »
Hello,

I am an electrical and computer engineering student (junior), and I'm working on a side project just as a hobby.

First off, let me apologize if this topic has been specifically covered, as I have searched through the forum topics for an answer to my question with no luck.

I have experience in verilog, and more specifically, the digilent Spartan-3 xc3s1000 fpga device. I am working out the plans to build a walker robot, most likely a hex, but that isn't important. I will be using servos for leg control. I have used servos back in my hobby days with aircraft, but, I also used a servo controller and radio. More recently I have discovered how servos actually work, with the 50Hz signal and 1 - 2ms pulse. I guess I should say I have a few questions here.

It's no problem for me to write code to produce the 50Hz signal, and any amount of resolution I need for the duty cycle, but, I have read on a couple of guide documents that the reason the servo control period is so large compared to the pulse width is because it's meant to control multiple servos and positions, up to 9 to be specific. Is this true, or, can I simply output a 50Hz signal to one servo with a pulse width of about 1.5ms and expect to land somewhere near neutral (depending on the servo of course). Those documents I read may have been talking about the signal to a servo controller, so ignore this part if that's the case.

The signal from an FPGA like the spartan, is 5V high and 0V low, just like anyone would expect, however, it isn't safe to power a motor directly. I'm sure most of you know this. But, from my understanding, the signal wire of a servo is free of feedback? I'm assuming this means the servo has a transistor circuit and protection built in, is this true? To make this question a little more direct and simple, is it safe to connect the signal wire directly to the output from one of my expansion ports on the spartan board?

Resolution- I'm assuming one could get any amount of resolution as far as degree position they want, but I don't know this for sure. Down the road I may want a powerful microcontroller and sensor array calling the shots as to where and when a leg moves, to do this, it would need to control both the speed at which the servo turns, and the position at which it stops, to a fair degree of accuracy. Does anyone have experience on how accurate a servo can be set to a certain degree, and, do most of them come with spec sheets that give a break down on the pulse width modulation required to control it?

My last one is just a verification of something I read in another post. They said that the ground of the servo must be tied to the 0V side of the power supply, and the ground of the parallel port on a computer (they were controlling it via parallel port), I'm assuming this would be true for the FPGA as well. Would I need to ground to both 0V and GND on my parallel expansion port?

Thank you for taking the time to read my post, I am new here, and I'm sorry if I've echoed some topics discussed numerous times. I am anxious to become part of the community, looks like some very exciting things are being discussed here. Thanks again!
« Last Edit: November 29, 2010, 09:05:09 AM by aerowenn »

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,944
  • Helpful? 99
Re: FPGA Servo Control
« Reply #1 on: November 29, 2010, 09:06:09 AM »
Remember that in a radio control system the information for all of the servos are sent on a single radio carrier. Therefore the data (pulse) for servo is time-multiplexed onto the radio carrier. The receiver after demodulating the pulse train from the RF carrier de-multiplexes each servo's pulse to a different connector. On these connectors there is one pulse every ~20msec and that is all the servo cares about.

A hobby servo has three wires. One is the ground or common voltage reference (black). Another is the power to the servo (red). The third is a TTL level to the servo's logic circuits (yellow or another color). All the current to power the servo's motor is supplied through the red and black wires. The black must be also connected to what ever circuit is supplying the logic level pulses (you should know this if you're an CE student and electronic hobbyist).

Try getting out your old RC system and look at the output signals from the receiver to the servos on an O'scope. This should be educational.

A servo (google this for details on how a servo works) has a complete motor drive circuit and a feed back system. The pulse train is only a signaling method.

Resolution is theoretically infinite as the circuits inside the servo are commonly analog. However to isn't the only criteria to how accurate the servo's position can be controlled. Repeatability, jitter and holding under load are other factors, the higher quality, more expensive, servos are better.
« Last Edit: November 29, 2010, 10:18:00 AM by waltr »

Offline aerowennTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Re: FPGA Servo Control
« Reply #2 on: November 29, 2010, 12:15:48 PM »
Awesome, very good information and I appreciate it. The ground shared between device and controller makes perfect sense the way you worded it, not sure why I didn't pick that up before. As far as resolution, I worked my code a little more last night and found that I can get down to the degree (in theory with the code anyhow), that should be overkill in resolution actually for my purposes. Can't wait to report any progress that I have. Thanks again!

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: FPGA Servo Control
« Reply #3 on: November 29, 2010, 12:35:07 PM »
Hi,

Just FYI, the 1ms to 2ms standard are rarely kept to, so if you discover that your servos don't go to one or both extremes, you should change the min. and/or max. pulse times (some are as low as 500µs and some go to 2.5ms).
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline aerowennTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Re: FPGA Servo Control
« Reply #4 on: November 29, 2010, 03:23:16 PM »
Hi,

Just FYI, the 1ms to 2ms standard are rarely kept to, so if you discover that your servos don't go to one or both extremes, you should change the min. and/or max. pulse times (some are as low as 500µs and some go to 2.5ms).


Thanks, regarding this, where can one find servo datasheets? I can't seem to get anything from the manufacturer, I'm using a Futaba S3010 for code testing, I've googled for data with no luck.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: FPGA Servo Control
« Reply #5 on: November 29, 2010, 07:55:30 PM »
Hi,

[...] where can one find servo datasheets? I can't seem to get anything from the manufacturer, I'm using a Futaba S3010 for code testing, I've googled for data with no luck.
Datasheets on servos are few and far apart. Usually you get the bare minimum like voltage, torque, speed, weight and dimensions - sometimmes a little more, sometimes a little less.

http://www.servodatabase.com/ may be of some help and for your servo, http://www.servodatabase.com/servo/futaba/s3010 have a little info (not on the timing though).
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline aerowennTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
Re: FPGA Servo Control
« Reply #6 on: December 01, 2010, 07:04:40 PM »
Hi,

[...] where can one find servo datasheets? I can't seem to get anything from the manufacturer, I'm using a Futaba S3010 for code testing, I've googled for data with no luck.
Datasheets on servos are few and far apart. Usually you get the bare minimum like voltage, torque, speed, weight and dimensions - sometimmes a little more, sometimes a little less.

http://www.servodatabase.com/ may be of some help and for your servo, http://www.servodatabase.com/servo/futaba/s3010 have a little info (not on the timing though).



Since this post I have the servo working successfully, to report some good news. I had to experiment with different pulse widths until I reach maximum value (audible clicking where the servo was trying to turn further) then backed it off a bit, I now have it working a full 180 degrees!

The data sheet database should be very helpful, it would be nice to have an idea where to start on these before fine tuning. When I order the new servos that will be used, they'll likely be pricey, I would hate to destroy one trying to find the right values (may not get the audible feedback on a good one). Thanks!

 


Get Your Ad Here

data_list