Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: cparry on November 11, 2011, 01:35:48 PM

Title: Servo Control with Microcontroller?
Post by: cparry on November 11, 2011, 01:35:48 PM
So this isn't exactly a robot question, but I figured this was a good place to ask. I'm a mechanical engineer working on an engineering design project. We are building a football-themed arcade style game where a ball will be launched through a moving field goal post. The plan is to have the goal post driven by a servo with the zero point being straight up and down, and the ability to tilt around 45 degrees to either side. I assume this means that I need a servo limited to 90 degrees of rotation, but please correct me if I'm wrong. Also, some of the other sensors we are using will most likely be run from a Renesas rx62n microcontroller. Would it be possible to run the servo from the controller as well? If so, how might it be done? Also, how could we get it to reverse rotation once it hits each maximum. Any help is appreciated!

-Chris
Title: Re: Servo Control with Microcontroller?
Post by: Soeren on November 11, 2011, 07:59:30 PM
Hi,

I assume this means that I need a servo limited to 90 degrees of rotation, but please correct me if I'm wrong.
You just need a servo that can turn at least 90°. You can limit its travel in software.


Also, some of the other sensors we are using will most likely be run from a Renesas rx62n microcontroller. Would it be possible to run the servo from the controller as well? If so, how might it be done? Also, how could we get it to reverse rotation once it hits each maximum. Any help is appreciated!
Yes, it can be run from a single I/O line.
You control a (hobby-) servo by a pulse each 20ms (quite some tolerance allowed). The pulse duration determines the position of the servo and the (seldomly adhered to) standard is 1ms to 2ms, with 1.5ms being the center value (they can be from 0.3ms to 2.8ms in some types, but the 1.5ms center position is usually adhered to).
To move it, you change the pulse duration in the 20ms loop in whatever increment you need and to limit the travel to +/-45°, you just find the durations that gives the needed end points and then keep the values within that range - that way you can use any servo that satisfies the minimum 90° travel (i.e. most) and can focus on either price, strength or whatever else you may find important.

Perhaps it helps with a drawing...
Here's a page (http://servocity.com/html/hs-311_standard.html) that shows a rather common servo, with a 0.6ms to 2.4ms timing and the associated angular positions.
(http://servocity.com/assets/images/Servo_Angle_Schematic_180_3.8.jpg)