Thanks for your help, it was actually my power source to the servo that was
causing it to react so slow.
I am now trying to cause the servo to actuate between two positions. I have
modified the code for acquiring data from the a2d channels to changes
between 100 and 200 every time the while loop executes. The code works as
expected, except my heart beet has been cut in half and the servo will move
back and forth around 8 times then start twitching in the center of the two
positions. What could cause my clock speed to cut in half?
Dave Hylands wrote:
> Hi Marq,
>> Another question for you, I am trying to modify the program to make the
>> servo move/react faster and after reading over program I don't see where
>> would do this? Also after looking through the simple servo program I see
>> lot of stuff that I would like to read more about like the timer's,
>> WGM and COM modes. Looking over the robostix wiki I didn't seem to come
>> with much, do you have somewhere you suggest I can read?
> All of the stuff about ICR's and WGM and COM is contained in the
> ATMega128 data sheet.
> The Internet resources section on the Robostix page has a link to the
> So, the way the H/W is setup right now, the 40,000 being set into the
> ICR register controls how frequently a pulse is sent to the servo. A
> value of 40,000 corresponds to one pulse every 20 msec. (20,000 usec).
> I've run servos with update rates as low as 13 msec. Some servos will
> go a little faster, but it depends on the servo.
> The OCR register controls the width of the pulse (which is what
> determines the position of the servo).
> The SimpleServo code currently updates the OCR register about once
> every 20 msec.
> The WaitForTimer0Rollover function waits for the Timer 0 to rollover,
> which happens once every 10 msec. The for i = 0 to 1 loop at the end
> of the main function causes the OCR register to be updated once every
> 20 msec. It doesn't make sense to update the OCR register faster than
> the pulse rate going to the servo.
> Making the servo move faster is really a function of the servo and not
> a function of the code. Increasing the voltage to the servo will make
> it move faster. Using a servo with faster specs also makes it move
> faster. Faster servos tend to start to cost quite a bit more than the
> cheap inexpensive ones.
> For example, a standard Hi-Tec HS-311 servo, can move through 60
> degrees in 0.19 sec @ 4.8v or 0.15 sec @ 6.0v. Servo City's price for
> an HS-311 is $8.99.
> The fastest Hi-Tec (HS-925MG) servo can do the same move in 0.11 sec
> @4.8v or 0.08 sec @ 6.0v, but they cost $72.99 per servo).
> Faster than this requires either overvoltaging the servo. I've run
> servos at 9v or 12v. Obviously, you run the risk of burning out your
> servos when you do this, but sometimes the risk is worth it.
> To go even faster (normally only required if you're using a servo as
> part of the drive system) requires using a regular Permanent DC motor
> and an H-Bridge.
> Dave Hylands
> Vancouver, BC, Canada
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> gumstix-users mailing list
View this message in context: http://www.nabble.com/Problems-running-Simple-servo-tf4604210.html#a13221747
Sent from the Gumstix mailing list archive at Nabble.com.