Program help

I was searching on the forum on how to control a ESC motor controller and i found this:

“There’s many ways to control an ESC from the Atom Pro / Bot Board II. The code can be simple to complex, but the bottom line is this. Create a positive going pulse that is from 750uS to 2250uS long that repeats every 20mS. On a Hitec servo 750uS will be almost full CCW, 1500uS would be around centered, and 2250uS would be pretty much full CW. The servo can move a full 180° so if the 1500uS is 0° then 750uS would be around -90° and 2250uS would be around 90°. For a speed controller it’s usually more like 1000uS to 2000uS with 1500uS being stopped. The clock wise or counter clock wise direction would be selected by which way the motor is connected, and there are many ESC’s that can control simple DC PM motors.”

I was wondering how that would look in atom pro code, i tried various ways without success.

Also i was wondering how to control a continuous rotation servo with the basic atom and bot board, i tried using pulsout commands but it only let the servo go one way.

Help is very much appreciated.

The text you found seems to relate to servo motors, not ESCs.
First connect the servo to the board; red wire to 5V, black wire to GND (0V) and signal wire to a digital pin.
To control a servo motor (raw), you set the signal pin HIGH (5V) for a specific number of microseconds, then low, and repeat.
This is not actual code :wink:

servo pin set to HIGH
wait 1500 microseconds
pin 5 set to LOW
wait 30 milliseconds
repeat

There is a lot of code for controlling servos via a Bot Board as part of the AL5 assembly guide.
1500 microseconds is 0 degrees, 500us is -90degrees and 2500 is +90.

Do you want to control an ESC for a brushless DC motor (for a helicopter or airplane) or more along the lines of a DC motor controller for DC gear motors?

Thanks for the reply, I needed to control a DC gear motor with the ESC.

This is the ESC:

That looks to be the BB-12-45 from Banebots (a RobotShop supplier).
You control it the same way you would a servo motor.
If you can position a servo motor, you can control the ESC, with 1500us being neutral.
banebots.com/mm5/support/manual/BB-1245.pdf

One thing to consider - you may need to remove the red wire connected to the +V line from the cable since it may be providing power rather than drawing it. We suggest removing it first.See step 2 here:
lynxmotion.com/images/html/build99f.htm
You would leave it disconnected (and wrapped with heat shrink or electrical tape so it does not make contact with the board.

Ok I will try that and post my results for future reference.

Thank you

Ok, so I hooked everything up correctly and used a pulsout command to the pin nesscary and the motor will not react. Is there any thing i should do or any recommendations?

Take an image of your setup so we can clearly see the connections, and also post the code you used.

Ok the images should be attached

I got the motors working with the code they just are extremely jittery
The code is in one of the images.


The programming…


When you write pulsout 10, 4000, wouldn’t that have the actuator move to a position it cannot go to? The minimum pulse is 500 and the maximum pulse is 2500. Also, you may want to change the delay to 30ms and ensure you continue to send the command more than onces.

It does move at 4000 continuously (with the exception of the jitters), i will try the different pulses and pauses

Thank you

Please note: I believe on the BAP that the pulsout duration is in .5us so the value 4000 would give you a pulse width of 2000us.

Don’t know enough of the code from the snip-it, Like how is Dpad_Right set? but as Coleman mentioned you will need to repeat the Pulsout command to get a continuous stream of pulses.

Alternatively you could use the HSERVO command to set the pulse widths and it will continue to output the same pulses, until you tell it to do something differently.

Kurt