Society of Robots - Robot Forum

Software => Software => Topic started by: rox2007 on January 18, 2008, 09:33:18 PM

Title: need help with pwm in atmega168
Post by: rox2007 on January 18, 2008, 09:33:18 PM
please
Title: Re: need help with pwm in atmega168
Post by: hazzer123 on January 19, 2008, 09:13:34 AM
please post more about your problem
Title: Re: need help with pwm in atmega168
Post by: rox2007 on January 19, 2008, 09:22:14 AM
i have two servos that i would like to control with PWM because i cant seem to get it right anyother way.
Title: Re: need help with pwm in atmega168
Post by: Ro-Bot-X on January 19, 2008, 09:37:27 AM
You like to be secretive, don't you? We can't guess your setup, you have to explain more.

If you are using Arduino, there is a library that uses Timer1 to generate PWM servo pulses. http://www.arduino.cc/playground/ComponentLib/Servotimetimer1 (http://www.arduino.cc/playground/ComponentLib/Servotimetimer1)

If you are using $50 robot there is this tutorial: http://mil.ufl.edu/~achamber/servoPWMfaq.html (http://mil.ufl.edu/~achamber/servoPWMfaq.html)
Title: Re: need help with pwm in atmega168
Post by: rgcustodio on January 19, 2008, 10:03:11 AM
i guess rox2007 is referring to his problem posted here:
http://www.societyofrobots.com/robotforum/index.php?topic=2917.0
Title: Re: need help with pwm in atmega168
Post by: rox2007 on January 19, 2008, 10:59:42 AM
yep, would really appreciate any help
Title: Re: need help with pwm in atmega168
Post by: rox2007 on January 19, 2008, 11:03:19 AM

If you are using $50 robot there is this tutorial: http://mil.ufl.edu/~achamber/servoPWMfaq.html (http://mil.ufl.edu/~achamber/servoPWMfaq.html)

how would i modify it for a hacked servo

this tutorial is helpful. it actually leads to this

http://mil.ufl.edu/~achamber/servoPWMwCodeVision.html

but the codevision i have, which is the new one does not look like what was described in that tutorial
Title: Re: need help with pwm in atmega168
Post by: Ro-Bot-X on January 20, 2008, 01:41:29 AM
Quote
how would i modify it for a hacked servo

A modified servo for continuous rotation is controlled exactly the same as a regular servo. If you send a pulse between 1 ms to 1.5 ms, the servo will rotate counterclockwise at a different speed, the 1.5 ms pulse makes the servo stop and a pulse between 1.5 ms and 2 ms will make the servo rotate clockwise at a different speed. It all depends on servo quality. Some servos just rotate at the maximum speed no matter what pulse you give.
Title: Re: need help with pwm in atmega168
Post by: rox2007 on January 20, 2008, 09:46:40 AM
sorry i didnt say this earlier, but it worked...:)
thanks alot for the link. to use it with an atmega 168 you need the file incompato.h, i found it on google.