PDA

View Full Version : [Question(s)] HB-25 Missing Commands



ROBOTMAN
05-08-2011, 12:03 AM
I'm having issues with my HB-25 from Pololu.

http://www.robotshop.com/content/PDF/hb-25-motor-controller-documentation-v1.2-29144.pdf

It seems to be dropping commands on a regular basis. According to the documentation the amount of time between commands should be 5.8 milliseconds. I am using a 1 second delay between commands. If I widen to gap to 10 seconds the problem resolves itself however I need to run a PID loop at max speed so this is unpractical. On google most issues seemed to be caused by either a under amped power supply or backwash from large motors. These do not seem to apply to my problem because I have a "china made" 12v 30a ac to dc converter and small 6a motors.

Sometimes the motor controllers will also refuse to work at all. The resolution to this has been to restart the arduino ide I am using to program my ardweeny, open a new sketch, and write totally new code. This is illogical and it doesn't seem like it should fix anything but it dose.

I have used these motor controllers before on a different bot where they worked slightly more reliably however they still seemed to have issues with the occasional commands.

For reference here is my code with 10 second delays and a link to my motors.

http://www.pololu.com/catalog/product/1447/specs



void setup()
{
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
}

void loop()
{

delay(10000);

digitalWrite(9, HIGH);
delayMicroseconds(2000);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
delayMicroseconds(2000);
digitalWrite(10, LOW);

delay(10000);

digitalWrite(9, HIGH);
delayMicroseconds(1500);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
delayMicroseconds(1500);
digitalWrite(10, LOW);

delay(10000);

digitalWrite(9, HIGH);
delayMicroseconds(1000);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
delayMicroseconds(1000);
digitalWrite(10, LOW);

delay(10000);

digitalWrite(9, HIGH);
delayMicroseconds(1500);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
delayMicroseconds(1500);
digitalWrite(10, LOW);

delay(10000);
}

Xevel
05-08-2011, 12:35 AM
Hi,

This may have no link whatsoever with your actual problem, but the strange behaviour reminds me of a problem I had once when the voltage for a HIGH state on the serial link would not be hight enough.
The device needed at least 2.5v to detect a HIGH, and due to some excessive load on the line (an LED with the wrong resistor), the controller could not produce more than 1.8v for the HIGH state. The HIGH state was randomly detected or not.

If you have access to an oscilloscope, you might want to check what your pulses look like.

jhertzberg
05-08-2011, 02:41 AM
Hi,
How are you suppling power to your system components?

ROBOTMAN
05-08-2011, 01:21 PM
I will check my high states voltage as soon as I get a chance. As for how I power my systems, I use a custom board with voltage regulators to drop the power to 5v.

ROBOTMAN
05-08-2011, 04:12 PM
I ran some tests by just holing the pin HIGH and testing with a volt meter and got 5.20v. I do not have a oscilloscope so I could not test it while running the actual code. This is an incredibly strange problem... I am supposed to hold the line low between commands right? Some devices require the pin to be returned to a high impedance state, but that dose not make much sense for this motor controller.

ROBOTMAN
05-08-2011, 07:06 PM
I resolved the issue by doing a bit more random debugging. Obviously the time between pulses in the real world isn't exactly 2000 microseconds in reality it is a bit more in some cases. My motor controller was just doing its job and disregarding pulses grater than 2200 microseconds or 2.2 milliseconds. I knew that it would do that from the beginning and should have thought to debug that aspect but made a noob mistake and didn't. The only reason I discounted that theory was that I assumed the error would only be +/- 20 microseconds not +/- 200 microseconds.