Society of Robots - Robot Forum

Software => Software => Topic started by: scrvtch on March 14, 2008, 06:27:36 PM

Title: iRobot Create - Servo
Post by: scrvtch on March 14, 2008, 06:27:36 PM
I recently downloaded the source code for the scanning IR on this page: http://www.societyofrobots.com/robot_iRobot_Create_mod.shtml

I'm trying to use it with a standard servo (http://acroname.com/robotics/parts/R276-S03N-SERVO.html) and a maxbotix EZ1 ultrasonic range finder. The white wire of my servo is connected to pin 3 of the top center eport (B1).

When I uploaded the .hex file and tested it out, it immediately backed up (as if it was too close) and began rotating while the servo did nothing. I changed the code a bit, in case it was because of the larger range of the sonar, so that it would only control the servo and it didn't move again.

Does anyone have any test code that I could try to see if it's a problem with my servo or just stupidity on my part? Thanks. And I'm not really sure I understand the math involved with delay_cycles in generating 1.5-2.0 ms high signals every 20ms...

I looked into controlling the PWM signal with a timer (http://mil.ufl.edu/~achamber/servoPWMfaq.html)  but all three timers are already being used in my program, so I would need to find another way. (I think I'll test it again in another program just to see if I can get my servo working...)
Title: Re: iRobot Create - Servo
Post by: Admin on March 15, 2008, 04:39:58 PM
Are you using my Stampy algorithm?

So the servo doesn't move at all? Does it jitter or hold its place or anything?

Check to make sure the servo is being powered. Also, if you have a multimeter or oscope, measure the output of that port. With an oscope you can verify that the PWM is what you think it is.
Title: Re: iRobot Create - Servo
Post by: scrvtch on March 15, 2008, 04:59:17 PM
Yes, I believe it is the same algorithm, downloaded from the link on your Create page that says: "iRobot Create Sharp IR Scanner source code."

The servo did not move at all. (No jittering or anything.) I don't have an oscilloscope but I'll check the voltage to see if the servo is being powered.

With the delay cycles function, I assume that it takes 1.5ms to waste 300 cycles and 2.0ms to waste 1200 cycles? How exactly does your code use up the rest of the 18 - 18.5ms to keep the 20ms interval pulses?

I'm still pretty new with programming/robotics so thank you very much for the help.
Title: Re: iRobot Create - Servo
Post by: Admin on March 16, 2008, 09:05:33 AM
Well, if you are using the exact same code and setup, then you are doing something wrong . . .

Quote
With the delay cycles function, I assume that it takes 1.5ms to waste 300 cycles and 2.0ms to waste 1200 cycles?
Hmmm I didn't check my code for exactly what I did, but yeap thats the basic concept.

Quote
How exactly does your code use up the rest of the 18 - 18.5ms to keep the 20ms interval pulses?
The code does other stuff, running loops and all. I didn't get it to exactly 18ms, nor does it need to be, but what I had was working fine without problems. I wasn't very scientific about it, as you can see :P