Author Topic: Hitec Servo Programming for Irobot Create  (Read 1508 times)

0 Members and 1 Guest are viewing this topic.

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Hitec Servo Programming for Irobot Create
« on: August 18, 2010, 12:04:17 PM »
Hi all,

I'm working on a project with an approaching deadline so any immediate help would be great!  I'm trying to get a servo operate with the iRobot Create's command module.  I've wired it with ground and power correctly and the signal line into pin B2 (right eport) on a breakout board.  I'm just testing the code piece by piece to make sure everything is working, so all I want right now is the servo to turn....Unfortunately, that's not happening.  Below is the code, which was partially hacked from admin's iRobot Create mod project.  Any suggestions?

void ServoTurn(void)
{
     //60 degree turn--> .17sec/60 degrees
     delayMs(170);
     while(timer_on)
     {
           //DDRB |= 0x02;
                    PORT_ON(PORTB, 2);
                    delayMs(1);
          PORT_OFF(PORTB, 2);//keep off
          delayMs(1);
     }
}

In the main im just calling this function repeatedly in a while loop to see if I can get any motion at all. Please advise.

Thanks,
IA

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,920
  • Helpful? 97
Re: Hitec Servo Programming for Irobot Create
« Reply #1 on: August 18, 2010, 02:58:59 PM »
A standard hobby servo uses a positive pulse between 1 & 2msec to indicate position repeated about every 20msec.

It looks like your code is sending a 1msec high then a 1msec low, if the delay function is properly calibrated. Try upping the delay after the PORT_OFF to 19msec.

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Hitec Servo Programming for Irobot Create
« Reply #2 on: August 23, 2010, 10:45:40 AM »
Hmmm...its still not moving.  You mentioned the pulse specs for a standard hobby servo....could the timing be different for a Hitec 5625MG?  Any other ideas?

The relevant code (slightly modded cuz I had to shift ports) is below:

void ServoInitialize(void)
{
     //Pin B1 as an output (trigger)
     DDRB |= 0x02;
}

void ServoTurn(void)
{
     //60 degree turn--> .17sec/60 degrees
    
     for (i=0; i<=10; i++) //just run 10 cycles
     {
                    PORT_ON(PORTB, 1);
                    delayMs(1);
           PORT_OFF(PORTB, 1);//keep off
           delayMs(19);
     }
}
« Last Edit: August 23, 2010, 10:46:52 AM by RobotFreak »

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,920
  • Helpful? 97
Re: Hitec Servo Programming for Irobot Create
« Reply #3 on: August 23, 2010, 11:04:57 AM »
I'm doing some googling and see that the Hitec 5625MG is a Digital servo. But a doc I found states that it uses a 1-2msec, 1.5msec = neutral,  pulse to set position.
Other information I found says that it can be programmed but I don't know what can be changed. This:
http://www.rcuniverse.com/forum/m_5568787/anchors_5568787/mpage_1/key_/anchor/tm.htm#5568787
seems to indicate some reliability issues.

I couldn't find any info on the Hitec web site of what digital means with this servo or anything about programming it except this:
http://www.hitecrcd.com/products/servos/programmers/hfp-20.html
 ???


Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: Hitec Servo Programming for Irobot Create
« Reply #4 on: August 23, 2010, 12:12:25 PM »
Digital/analog as no affect on the pulse received, it will operate the same as an old analog servo. The digital/analog only refers to the position feedback the servo uses, not something to worry about.

Offline waltr

  • Supreme Robot
  • *****
  • Posts: 1,920
  • Helpful? 97
Re: Hitec Servo Programming for Irobot Create
« Reply #5 on: August 23, 2010, 12:19:26 PM »
Razor,
What about the info that this servo can be 'Programmed'? and the reports of it 'losing' its programmed settings?


Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
Re: Hitec Servo Programming for Irobot Create
« Reply #6 on: August 23, 2010, 12:32:33 PM »
It isn't really programming, more like setting adjustment. Even if the servo is left default, or "lost" settings, it will still operate like a normal servo.

The servo should be operating correctly, that single forum post is one in a million, hitec is a very reliable brand.

Offline RobotFreakTopic starter

  • Jr. Member
  • **
  • Posts: 17
  • Helpful? 0
Re: Hitec Servo Programming for Irobot Create
« Reply #7 on: August 23, 2010, 12:50:22 PM »
Ok, assuming that there is nothing inherently defective about the Servo (because buying another one is kinda of out of my budget right now, only a last resort really), do you guys see anything else wrong with the code?  Any other possible sources of error?  I tried pulses of 1, 1.5, 2 (high) and no movement at all.  Suggestions please!

BTW, I realized I left out the part where I defined what Port_On means, for example.  Maybe this will provide more insight....Any help is greatly appreciated! Thanks!

/define port functions; example: PORT_ON( PORTD, 6);
#define PORT_ON( port_letter, number )         port_letter |= (1<<number)
#define PORT_OFF( port_letter, number )         port_letter &= ~(1<<number)
#define PORT_ALL_ON( port_letter, number )      port_letter |= (number)
#define PORT_ALL_OFF( port_letter, number )      port_letter &= ~(number)
#define FLIP_PORT( port_letter, number )      port_letter ^= (1<<number)
#define PORT_IS_ON( port_letter, number )      ( port_letter & (1<<number) )
#define PORT_IS_OFF( port_letter, number )      !( port_letter & (1<<number) )

~IA

 


Get Your Ad Here