I am trying to use a BaneBots BB-3-9 speed controller to control some larger motors. I am new to Arduino, and have not been able to get this to work. From what I have read (and please correct me if I am wrong), it is expecting to be talked to like a servo, with pulses. I have been able to get my motors turning a little, but I think it was probably a fluke. I would really appreciate any help at all, and any push in the right direction (maybe some sample code or something?). I can post the code I am using now if that would be helpful. Basically I have been using the servo library, with some results, and I also tried the analogWrite() function, which didn't work at all. I saw this post on these forums, and was wondering if these suggestions would also work for me:
The Arduino should be able to communicate with the controller via any of the supported modes.
Mode 1: analog
Use the analogWrite() command. They say you'll need a resistor/capacitor filter on the output pin. You'll have to use one of the pins labeled with "PWM".
Mode 2: R/C
Use the Servo library. Treat it like a continuous-rotation servo. You'll have to use either pin 9 or pin 10.
Mode 3: simplified serial
Connect the Rx/Tx lines (pins 0 and 1, they're labeled) to the controller as per the spec. Use code like the following:
Code:
Serial.begin(9600);
Serial.print(127); // idle
Serial.print(255); // full forward
Serial.print(0); // full reverse
Note that you'll have to set the baud rate using DIP switches on the motor controller.
Mode 4: Packeted serial
Physical connections will be exactly the same as the serial. You'll just need to send slightly more complex packets over the serial interface.
The quote doesn't appear to relate to the controller you're using, which does appear to emulate a servo.
One thing to watch out for is the loss-of-signal shut-down.
It doesn't say how this resets - it may be important to start supplying servo pulses asap after powering on the ESC.
The lights on the speed controller are actually responding the way I want them to. First only the ready light is on, then DIR1, then DIR2. My problem now is that the voltage that it is putting out is really small: it is always below 1 volt and I am expecting around 12 volts. The other question I have is about the length of the pulses. I know that somewhere near 1.5ms is neutral, but what is the total range of the pulse width that I can use?
Unfortunately, I don't have an oscilloscope (but I really want one). I was just using a multimeter. We did try to connect the motor, but it didn't move. The motor I am using is a little Johnson 3-12v. I tried using the servo library earlier, and it didn't work, but I'll try again. The only thing with that was that servo.write() only lets you give the number of degrees to turn, and I didn't know how to use it for a continuous rotation servo.
An ESC is designed to replace earlier R/C speed controllers that were rheostats, or two or three-stage mechanical switches with large power resistors. These devices were controlled by standard servos; imagine a servo driving the shaft of an external potentiometer (I think early ESCs may even have used this method).
Push the stick forward (180 degrees), and the servo would turn the potentiometer/rheostat/switch to maximum forward.
Put the stick (90 degrees) to neutral, and the servo would move the wiper to the mid-position of the rheostat/pot/switch.
Take the servo out of the picture, and you have an ESC.
Ok, so if I use the servo library, then just setting it to 180 degrees is forward continuous, 90 is stopped, and then below that is reverse? And do you have any idea why my speed controller is putting out such small voltages?
Mode 1: analog
Use the analogWrite() command. They say you'll need a resistor/capacitor filter on the output pin. You'll have to use one of the pins labeled with "PWM".
Why not use PWM? Here is the tutorial I used to get my pololu motors running. It uses PWM:
Yes, my motor controller allows for reverse and I am using an external 12v battery. I will try the servo library again and see if that fixes the low voltage problem.
The lights on the motor controller are responding correctly, but I can't seem to give it an angle that is below 30 degree or above 160 degrees. And, I am still having the low voltage problem. I made sure to try it with the motors and I still got nothing. I know that my multimeter can't measure PWM or anything, but I checked the voltage that was going to the motor and it was changing when it was supposed to, but only in very small amounts. Any ideas?
I emailed the company to find out what the range of pulse widths it can handle is to make sure it is the controller, not something with the arduino. I also asked them about the low voltage thing, so hopefully they can help.
Although I have never used this kind of speed controller, I have coded for the IFI Victor speed controllers before. If you want to use analogWrite, you just use between 5 and 10 % and make sure it's a 20ms duty cycle on a PWM pin. I also had problems with the SoftwareServo library - wouldn't compile. I wrote this function to write servos:
void DoServo(int pin, int val)
{
val = map(val,500,2500,0,255);
digitalWrite(pin,HIGH);
delayMicroseconds(val);
digitalWrite(pin,LOW);
}
Usually, they don't care how fast you update them as long its between 20ms and 50ms. The Victors I used could handle up to 10ms updates with no problem. Also - the code above will disable interrupts (Because of delayMicroseconds). If you have a problem sending it pulses near the end of the limits, note this: RC radios are usually designed to output between +- 45 degrees, while the servo lib can go from +- 90. If you have a problem past 45, the BaneBots controllers probably can't go past 45.
The company said that the range is 1.0ms to 2.0 ms with 1.5ms for neutral. They said they weren't familiar with the Arduino, and suggested I make sure it is sending the right pulses.
edit: Thanks apalrd, I'll try that and see if it helps.
So we had bought 2 motor controllers and had only been testing with one of them. On the off chance that the one we were using might be faulty, we tried the other one and it worked! So the majority of the problem is solved, it was just a broken part. However, we did encounter a new problem. My multimeter is reading 12v from the motor controller, but when I hook it up to the motor, it only turns a few times and then stops (my multimeter confirmed that it was just a lower voltage coming from the controller). The controller's specs are here: http://banebots.com/pc/ELECTRONICS/BB-0309
I am still looking for the exact specs on the motor, but it is rated for 1.2 amps at 6 volts and we are running it at 12v. The controller is rated for 3 amps continuous and 9 max. When we were testing the motors on it, I noticed that the controller got pretty hot after only a short time. I thought that the controller we got would be able to handle that, but can it?