Shop OBEX P1 Docs P2 Docs Learn Events
HB-25 always max output except 1500 microsec — Parallax Forums

HB-25 always max output except 1500 microsec

FosamaxFosamax Posts: 4
edited 2014-11-30 10:59 in General Discussion
Hello,

i try to get a HB-25 motor controller connected with an arduino.

If i write 1500 microseconds the output of the motor controller is 0V like it should be. Writing 1000 microseconds should give -12V and 2000 microseconds should give an output of 12V.

The problem is that the output is -12/12 V even if i write 1525 microseconds.

Does anybody kbow wha the problem could be?

Thank you


#include <Servo.h>
Servo myservo; // create servo object to control a servo

void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}

void loop() {
myservo.writeMicroseconds(1525); // sets the servo position according to the scaled value
delay(2000); // waits for the servo to get there
myservo.writeMicroseconds(1500);
delay(2000);
}

Comments

  • FosamaxFosamax Posts: 4
    edited 2014-11-28 06:18
    Tried another Hb-25 now. same problem. So it htink there is somethink wrong with the connection or the code. Connected it is like in the manual. Jumper is in place.

    Does anybody have a idea why i only get -12 or 0 or 12 V?

    Thanks
  • kwinnkwinn Posts: 8,697
    edited 2014-11-28 07:02
    Do you have a scope to look at the pulse being sent to the HB-25?
  • ercoerco Posts: 20,256
    edited 2014-11-28 07:23
    Two quick tests for you, depending on what hardware you have available.

    1) Hook up a known good servo tester ($2 on Ebay) to your HB25s to test them. Doubtful that you have two bad units.

    2) Hook up a standard servo or better, a continuous rotation servo to your Arduino output and test your code for smooth operation.
  • FosamaxFosamax Posts: 4
    edited 2014-11-28 07:51
    Thank you for the answers,

    I hooked up a standard servo, an this works. I dont think that both of the HB25s are damaged because the worked fine in other projects.

    Connection:

    White cable to the arduino digital 9 pin
    Black cable is connected with ground. Datasheet says servo ground. What does it mean? Grund of the system? My DC motor has no ground.
    The red cabel is not connected,

    + and - are connected the right way and the dc motor too.

    Any more ideas?

    Could one of you please write where to connect the three wires red/white/black.

    Thank you
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-11-28 08:15
    Do you have a jumper on the pins next to "J"?

    The signal from the Arduino connects to the pin next to the "W" (white). There also needs to be a ground connection between the Arduino and the "B" pin (black). I don't think the "R" (red) pin is connected to anything internally.

    What sort of motor are you using? Do you have a link to it?

    If you post your code between code tags, we could take a look at it (I'll even try it on my Arduino and HB-25).

    To post code start with [noparse]
    followed by the code you which to include. At the end of the block of code use the closing tag
    
    [/noparse].

    This way code written:
    [noparse]
    void main(void)
    {
      //This should be indented
      while 1
      {
        //This should be indented even more.
      }
    }
    
    [/noparse]

    Will show up as:
    void main(void)
    {
      //This should be indented
      while 1
      {
        //This should be indented even more.
      }
    }
    
  • FosamaxFosamax Posts: 4
    edited 2014-11-28 08:51
    Hey,

    yes the jumper is in place. Single mode. "W" is connected with Pin 9 of the arduino. "B" is connected with the ground of the arduino. "R" is not conected.

    For 1525 microseconds the output of the hb25 is 12V and for 1500 it is 0.
    #include <Servo.h> 
    Servo myservo; // create servo object to control a servo 
    
    void setup() { 
    myservo.attach(9); // attaches the servo on pin 9 to the servo object
    } 
    
    void loop() { 
    myservo.writeMicroseconds(1525); // sets the servo position according to the scaled value 
    delay(2000); // waits for the servo to get there 
    myservo.writeMicroseconds(1500);
    delay(2000); 
    }
    
  • PublisonPublison Posts: 12,366
    edited 2014-11-28 08:58
    Is that with the motor connected?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-11-28 09:34
    Publison wrote: »
    Is that with the motor connected?

    I was wondering the same thing.

    DMM aren't always good at measuring voltages produced by PWM.

    Have you tried running the motor at a low speed setting and a high speed setting?

    I'll get my Arduino out of the basement and test the code.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-11-28 10:48
    erco wrote: »
    1) Hook up a known good servo tester ($2 on Ebay) to your HB25s to test them. Doubtful that you have two bad units.

    I just tried this with one of my HB-25 controllers and found the output from the HB-25 varied between three extremes. The output was 0V when the servo tester knob was centered and either -12V or +12V on all other positions of the servo tester.

    Apparently the HB-25 doesn't make a good voltage regulator. Add a motor and it does fine.
  • PublisonPublison Posts: 12,366
    edited 2014-11-28 11:37
    Good to know Duaue,

    I do not own a HB-25. or an Arduino.
  • bsnutbsnut Posts: 521
    edited 2014-11-29 10:33
    Publison wrote: »
    Good to know Duaue,

    I do not own a HB-25. or an Arduino.
    Same here.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2014-11-30 10:43
    Fosamax wrote: »
    Does anybody have a idea why i only get -12 or 0 or 12 V?

    Wrong test. You can't look at voltage alone from a meter. You need to look at duty cycle, and a basic volt meter isn't going to get you here.

    The HB25 converts standard pulse duration servo signals to duty cycle PWM. You can verify its operation in either of two ways:

    1. With a motor attached, as others have noted.
    2. With an oscilloscope, where you can visually see the duration of the PWM signal produced at the output of the HB25.

    Your meter is likely registering the 12V or -12V when it gets a duty cycle pulse exceeding some percentage. Most motors won't even turn unless duty cycle is at least 50%, and that is apparently enough to fool your meter into thinking it's getting steady DC at that voltage.

    To put this another way, it only *looks* like the HB25 (or any electronic speed controller) is varying the voltage to the motor. It doesn't work this way in real life. The motor is simply getting the full voltage for a longer or shorter period of time.
  • PublisonPublison Posts: 12,366
    edited 2014-11-30 10:52
    We still need to get readings from the OP with the motor connected. He seems to be MIA.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-11-30 10:59
    Using an oscilloscope will probably not show anything without a load. The reason is that on the "off" part of the cycle, the HB25's output is just an open circuit, not pulled to ground. Adding some resitance across the output pins should be enough to remedy this. In fact, you may even get a meaningful reading with a voltmeter under these conditions if the frequency is high enough and the meter gives an average reading.

    -Phil
Sign In or Register to comment.