Go Down

Topic: HB-25 Motor Controller will not work (Read 621 times) previous topic - next topic

Drew Davis

I bought the HB-25 Motor Controller from Parallax (link below) but I'm unable to get it working. I have attached it just as it explained in the data sheet but  it is not outputting any voltage.  Its not the power supply as the motor controller is getting 12v in. The program is extremely short as I'm just trying to get this working, however, perhaps my program is not properly controlling the motor driver. It's a strange motor driver because it acts like a servo. Any pointers on how to get it working would be awesome.



Code: [Select]

#include <Servo.h>

Servo servo1;


void setup() {

  servo1.attach(3);


}

void loop() {
 
servo1.writeMicroseconds(2); 
delay(500);

}





http://www.parallax.com/sites/default/files/downloads/29144-HB-25-Motor-Controller-V1.2.pdf
http://www.parallax.com/product/29144

zoomkat

Servo test code that might be of interest.

Code: [Select]

// zoomkat 10-22-11 serial servo test
// type servo position 0 to 180 in serial monitor
// or for writeMicroseconds, use a value like 1500
// for IDE 0022 and later
// Powering a servo from the arduino usually *DOES NOT WORK*.

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

void setup() {
  Serial.begin(9600);
  myservo.writeMicroseconds(1500); //set initial servo position if desired
  myservo.attach(7, 500, 2500);  //the pin for the servo control, and range if desired
  Serial.println("servo-test-22-dual-input"); // so I can keep track of what is loaded
}

void loop() {
  while (Serial.available()) {
    char c = Serial.read();  //gets one byte from serial buffer
    readString += c; //makes the string readString
    delay(2);  //slow looping to allow buffer to fill with next character
  }

  if (readString.length() >0) {
    Serial.println(readString);  //so you can see the captured string
    int n = readString.toInt();  //convert readString into a number

    // auto select appropriate value, copied from someone elses code.
    if(n >= 500)
    {
      Serial.print("writing Microseconds: ");
      Serial.println(n);
      myservo.writeMicroseconds(n);
    }
    else
    {   
      Serial.print("writing Angle: ");
      Serial.println(n);
      myservo.write(n);
    }

    readString=""; //empty for next input
  }
}
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Drew Davis

I tried modifying your code, but I still don't get any voltage on the output pins on the motor driver (m1/m2)

Code: [Select]
String readString;
#include <Servo.h>
Servo myservo;  // create servo object to control a servo



void setup() {
  myservo.attach(7, 0, 3);  //the pin for the servo control, and range if desired
}

void loop() {

  myservo.writeMicroseconds(1);
  delay(500);
}


Any ideas?

zoomkat

Quote
Any ideas?


Sure. You appear to have the wrong idea of how servos are controlled. Below you send a pulse with of only 2us, where servo us commands are generally in the range of 500us to 2500us. The code I posted has instructions on the value ranges to use. Also note the range differences between write and writeMicroseconds. 

Code: [Select]
servo1.writeMicroseconds(2);
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

TomGeorge

Hi, the spec quotes:
Quote
Pulse Input: 1.0ms Full Reverse, 1.5ms Neutral (off), 2.0ms Full Forward

this is   1000 microseconds, 1500 microseconds and 2000 microseconds.
Tom.
Everything runs on smoke, let the smoke out, it stops running......VK3DMK

Drew Davis

Quote
this is   1000 microseconds, 1500 microseconds and 2000 microseconds.
Tom.


Thank you. That fixed the problem. I was thinking that ms stood for microseconds. The motor driver operates correctly now.

Go Up