Society of Robots - Robot Forum

Software => Software => Topic started by: ratcateme on June 20, 2008, 01:51:51 AM

Title: Programing AtMega168 for servo modifications ($50 robot)
Post by: ratcateme on June 20, 2008, 01:51:51 AM
I have bought the AtMega168 instead of the AtMega8 because i can compile then run the same C source files on it. but will the hex file in the servo tutorial still work?
if it wont work how do i code a new file to do the same thing? i am using a Fuatba s3003 servo if that makes any difference.

Scott.
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: ishka on June 21, 2008, 02:22:10 AM
I don't think so. I suppose you'll have to make your own .hex as the fuse for m168 are different than those of the m8.
I'm working at it this morning, if I manage to get it work i'll post here.
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: Admin on June 22, 2008, 08:15:46 AM
Have your 168 run this code below. Before modifying your servo, run the code and modify '30' until the servo centers. Then modify the servo and turn the pot until the servo doesn't rotate.

Code: [Select]
while(1)
{
wheel_left(30);
delay_ms(20);
}

(hoping that made sense)
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: ratcateme on June 22, 2008, 01:35:01 PM
cool thanks admin i just have to finish my circuit tonight.

Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: Lycus on July 20, 2008, 03:24:36 AM
Should the servo be silent as well as still? Or can it make a slight noise and small, I mean less than half a degree if that, movement? And does it matter in the end?
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: Admin on July 20, 2008, 07:14:23 AM
Servos sometimes make noise and twitch if your signal is between two different angles. I have a digital servo that gets really noisy sometimes . . .

Unfortunately that twitching will waste battery power and potentially warm/heat up the servo.

But for a HS-311, probably not a big deal at all.
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: datt on March 30, 2009, 02:04:51 PM
I know this is an old post, but I have the same question as the OP. Admin, you say "Have your 168 run this code below. Before modifying your servo, run the code and modify '30' until the servo centers. Then modify the servo and turn the pot until the servo doesn't rotate."

Maybe I don't understand how the servo functions because I haven't built the circuit and powered it up yet. So I run the code and adjust the value until the servo centers, but is something still moving at this point? Because then you say modify the servo and turn the pot until it doesn't rotate. Is it still moving after it centers? Any clarification would be appreciated.
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: Razor Concepts on March 30, 2009, 03:07:15 PM
So all the little gears inside are removed and you have access to the pot. Turn the pot until nothing moves (the motor in the servo should not spin).
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: datt on April 03, 2009, 12:47:11 AM
I opened a new thread, the link is

http://www.societyofrobots.com/robotforum/index.php?topic=7565.0 (http://www.societyofrobots.com/robotforum/index.php?topic=7565.0)
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: datt on April 03, 2009, 01:05:47 AM
Also, I tried turning the LED on using LED_on() and that also did not work...
Title: Re: Programing AtMega168 for servo modifications ($50 robot)
Post by: Miles on April 28, 2009, 05:20:52 AM
Also, I tried turning the LED on using LED_on() and that also did not work...

Make sure that in the header file under simplified functions that 'LED_on()' is set up so the port is 'low'.