Author Topic: Programing AtMega168 for servo modifications ($50 robot)  (Read 7727 times)

0 Members and 1 Guest are viewing this topic.

Offline ratcatemeTopic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
Programing AtMega168 for servo modifications ($50 robot)
« 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.

Offline ishka

  • Jr. Member
  • **
  • Posts: 38
  • Helpful? 0
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #1 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.
May the Achtuche be with you...

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #2 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)

Offline ratcatemeTopic starter

  • Jr. Member
  • **
  • Posts: 19
  • Helpful? 0
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #3 on: June 22, 2008, 01:35:01 PM »
cool thanks admin i just have to finish my circuit tonight.


Offline Lycus

  • Jr. Member
  • **
  • Posts: 11
  • Helpful? 0
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #4 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?
There are 10 people in the world,
Those that understand Binary,
And those that don't.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,632
  • Helpful? 169
    • Society of Robots
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #5 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.

Offline datt

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #6 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.

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #7 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).

Offline datt

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #8 on: April 03, 2009, 12:47:11 AM »
« Last Edit: April 03, 2009, 01:37:13 PM by datt »

Offline datt

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #9 on: April 03, 2009, 01:05:47 AM »
Also, I tried turning the LED on using LED_on() and that also did not work...

Offline Miles

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 1
Re: Programing AtMega168 for servo modifications ($50 robot)
« Reply #10 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'.

 


Get Your Ad Here

data_list