Pages: [1]   Go Down
Author Topic: HB-25 Motor Controller will not work  (Read 547 times)
0 Members and 1 Guest are viewing this topic.
Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 559
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9682
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Servo test code that might be of interest.

Code:
// 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
  }
}
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 559
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
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?
Logged

0
Offline Offline
Tesla Member
***
Karma: 145
Posts: 9682
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
servo1.writeMicroseconds(2);
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Victoria, Australia
Online Online
Edison Member
*
Karma: 46
Posts: 1613
Electronics Engineer/Industrial Control
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Everything runs on smoke, let the smoke out, it stops running......VK3DMK

Florida
Offline Offline
God Member
*****
Karma: 2
Posts: 559
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: