hello I recently purchased turnigy brush-less motor speed controller and I am trying to make it interface though pwm. I have tried many online example and all failed. the closest to where I got it to move was when I used the servo libary ,but it moved sporaticly. I know the motor controller works because I tested it with a RX receiver module. If sombody has gotten this motor controller to work could you share me your source code or at least point me in the right direction.
You were right to use the servo library. This is exactly the interface that your ESC expects.
For troubleshooting purposes, hook up a servo to your Arduino. That way you are limiting the unknown issues. When you can make a servo move as you desire, then put the ESC back in.
Remember that most RC ESCs require an arming procedure, usually a period of zero throttle, a period of full throttle and finally a period of zero throttle.
As vinceherman says they need arming, unless the ESC is armed the motor will never spin. I've used one in an interactive display only last week and it took a while to get the arming procedure to operate correctly and more importantly reliably and repeatable.
The procedure I used was,
1] Power up Arduino and set Zero position on PWM output (Note that zero position is just above zero PWM and must be within the allowed range)
2] Use the Arduino to apply power to the ESC. ( You usually have to have the radio transmitter ON before the model reciver)
3] The ESC will then beep to say its armed (or not) ie the zero position has been accepted and it's ready to operate. This takes a few seconds and if your PWM changes in this period I found that the ESC will not arm.
4] You can then apply a power to the motor and get it spinning by increasing the PWM.
This whole procedure takes about 5 seconds.
I learned the settings for this by using the servo example and a POT and basically twiddled the pot until I got the ESC to fire up. I used a serial.print to then give me an idea of the PWM setting and after I worked out the sequence I hard coded it into my startup code.
Its also worth noting that the minimum running PWM and therefore motor speed was dependent on the zero position you use to arm the ESC. It it therefore important to power the ESC after you have a known PWM output on the Arduino if you need a repeatable / known motor speed in your application.
I can post some code up when I get more time later in the week. I use a different PC for my Arduino projects and dont have time just at the moment to go digging it out.
Power up Arduino and set Zero position on PWM output
Do you really mean PPM output using a servo library, correct?
There is frequently misunderstanding for beginners thinking that PWM (as used in analogWrite() command) can be used to drive servos (or R/C esc) rather then the correct PPM generated output pulses via a servo library command.
i guess we would need a clear documentation on how to drive ESC (maybe a dedicated library) cause for now how to do it is all but clear
i ordered a couple of turnigy ESC for my second project and yet there is no clear way on how to drive them or even if it will work at all and every one who get them to works seem to forget to say how they did
i guess we would need a clear documentation on how to drive ESC (maybe a dedicated library) cause for now how to do it is all but clear
The details of the "arming" procedure (needed to prevent the propellers in the original application from starting inappropriately and chopping your fingers off) are likely vary from vendor to vendor. The "have to have servo signal before powerup" thing sounds key, but ... what a pain.
yup but even once we are past the arming procedure how do we know if the signals we are sending mean 200 RPM or 10 000RPM
the servo lib is for servo exactly so the measurement is in degre not in power not in rpm
If you have to know the actual rpm, you will need to get a tach and measure the rpm. rpm may vary according to the motor and controller used, the voltage being supplied to the motor, and the load being put on the motor.
I may be able to shed a little light on the arming sequence for the Turnigy series ECS's. Prelude- I'm a total noob with my arduino, having just decided to move into UAV's, yet I'm an avid RC pilot.
Most all esc's I've come across need the first signal to be the max setting (full throttle) then after a signaling beep quickly reduce throttle to zero to arm it or the unit may jump into its 'programming mode'. This step only needs to be done when a new combination of parts is assembled, or a change was made somewhere in the line.(i.e. new rx or tx or motor even)
After the first initialization the esc can and should be habitually started at 20% throttle thus requiring only to be set to zero to arm. But booting at 0% is possible, its just ready to go immediately there after. Not a good thing to have a .01 to 2kw motor swinging a set of knifes that only a minor bump of a lever would set in motion.
The $9 programming card is the only way to go imo, plus you can change the arming tones to any number of common tunes ;D
Just for future readers benefit, I wrote a blog post a little while ago with some code that worked for me when I tried to control a brushless motor via an ESC.
Like Mouse I used a potentiometer and the serial port to see which values worked best for the devices I was using.