Controlling A Brushless Motor

My son races with rc cars and response matters in 80km/h and 10cm to the the car infront... Have no data, but it seems to be good. If you have a motor with enough power, it responds "instantly". Depending on the applicatation and voltage, you may have to provide up to 100 amps and/or 50 volts, more amps in burst. Rc motors delivering 5kw is nowadays just a question of money and weight. 8-) About brushless esc:s, many newer esc offers a brushed mode too. Dont waste money on brushed (dc) motors, buy brushless (ac). More f**k for the buck.

Brushed motors aren't a waste of money, it's all relative to your intended application! In some cases a brushed motor maybe more ideal than a brushless motor due to their simplicity and low price.

Brushed ESC's and motors can be bought for about a 1/4 the price of a half decent brushless setup!

In the same sentence all my electric RC car's are brushless and I love it, the power and speed is intense, sometimes a little too much power, one particular car of mine can do a proven 88kph, it will go faster, how much faster really depends on if I can implement a driveshaft solution that won't twist itself to pieces!

Good example of high powered RC brushless setup: http://www.castlecreations.com/products/mamba_monster.html

I’ve actually been thinking of converting the motor system in the Power Wheels vehicle that I am turning into a UGV (using an Arduino for some of the control functionality) to use brushless motors; my only big concern is whether I will tear up the gearboxes with too much torque (especially since I am converting the wheels over to actual rubber tires; I won’t have the same slippage as you get with the plastic tires/wheels).

I wrote this last November about an experience I had installing a brushless ESC and motor into a museum display that controlled a model helicopter that ran up and down a pair of power wires. Sorry, but I dont have time to re-edit it for this topic thread but think my experience valuable enough to repeat what I said.


I am guessing the Novak ESC is a Model Brushless Motor Speed Controller? If not I've bashed out a whole load of info for nothing ;)

I've not used the Novak controller but guess they are all much the same. Anyway if you know how I got mine to work it might help. I've used a couple of Mystery RC 100A Brushless Motor Speed Controllers for a project I was contracted to do a couple of months ago. I didnt need the full 100A but couldnt resist the £15ish it cost to get them from a Chinese Ebay shop ;)

I had some similar difficulty because the controller didnt respond as expected. ie it didn't give me MIN to MAX power over the 0 to 180 PWM range and a lot of the time it would not work at all. I spent a bout two solid days with a POT to PWM sketch and debugging with the PWM values being read out of the terminal to understand that a ESC is a bit more involved that I thought and eventually get it to reliably work with the Arduino.

I'm not sure if this is your problem but the controller has a whole bunch of paramaters / features that aid the model builder but made my job controlling it from an Arduino lot trickier and less straight forward.

The features that caused me some grief are;

Throttle range self-adjusting

Most probably your problem. The controller interprets the PWM input at power on and sets a ZERO position from this. The problem is if you have a PWM that is out side its expected ZERO range it fails to start and assumes a SAFE condition until you cycle the power. ie it appears dead. This is done every time the ESC powers up so if you don't standardise your ZERO position you will not get consistent response from the ESC as it uses this as a reference to your PWM value and expected motor responce.

Auto motor cutoff with reset

If the controller spots an abnormal condition, which could be anything, it shut the motor down until the power is cycled. ie it dies for no 'apparent' reason. I had problems with 3 meters of wire and enough voltage drop to trigger flat battery condition. :-?

Safe power arming program ensures motor will not run accidentally after turn on

If the PWM demand is not within the expected ZERO band or possibly fluctuating on power up it goes into a SAFE condition until the power is cycled. ie it appears dead.

The other feature that annoyed me was a minimum motor speed. ie the motor was OFF or spinning at some minimum speed which for my project and motor was a little bit to fast. :-[ I bought a motor with a lower speed rating to solve this :)

My solution was to initalise the controller and use it as follows: A] Set PWM signal at your ZERO position ie low but not 0( I chose 30) B] Supply power to Motor controller. (My Arduino switched the power with a relay) C] Wait for Motor controller to initalise and set its ZERO to your ZERO position(It should beep, I waited 2 seconds) D] Motor will now respond to the PWM signal and spin above the minimum running speed (for me that was about 43 PWM but was different for a different motor)

You'll now have to work out what PWM value will max out the motor.

Keep the PWM signal above your ZERO value and below the max power and you should have it working. If the PWM goes out side this range I found it would shut down into SAFE mode again.

If you trigger a SAFE condition you have to reinitalise the ESC and reset the ZERO value. ie steps A,B and C above. If you dont then your current PWM value becomes ZERO and you get in a mess.

Oh yes, and dont forget he schoolboy error of not having a common ground with the Arduino AND the motor controller. Without this you might not be giving it PWM at all ;) got me a couple of times ::)

Hope this is more helpful than confusing and remember I wrote this about 3 months ago for a different question . ;)

PS I used an IR link between the Arduino and the ESC!

I've actually been thinking of converting the motor system in the Power Wheels vehicle that I am turning into a UGV (using an Arduino for some of the control functionality) to use brushless motors; my only big concern is whether I will tear up the gearboxes with too much torque (especially since I am converting the wheels over to actual rubber tires; I won't have the same slippage as you get with the plastic tires/wheels).

As long as you keep the max throttle level down you should be fine, the very last thing you want it to do is go from full forward to full backward, that is a sure fire way to destroy plastic drive line components.

The other feature that annoyed me was a minimum motor speed. ie the motor was OFF or spinning at some minimum speed which for my project and motor was a little bit to fast. Embarrassed I bought a motor with a lower speed rating to solve this.

I know you’ve solved this but I thought I’d expand for other peoples interest.

This is related to the KV rating of a brusless motor, KV is the measurement used for describing how fast a brushless motor is, for instance a 6000kv motor will turn at 6000rpm for every volt, if you’re feeding the battery 10 volts it will be spinning at 60,000rpm, assuming no load condition.

For low speed applications you should be aiming for a very low KV motor < 1000, the higher the KV the more trouble you will have controlling it at low speeds.

A quick eBay search showed motors as low as 310 KV, There are some very high speed motors aswell, some go up to and over 10,000 KV, which are an absolute nightmare to control at low speeds, they suffer from the “cogging” effect where they seem to be stopping and starting.

In short choose the motor that will best suit your application.

As long as you keep the max throttle level down you should be fine, the very last thing you want it to do is go from full forward to full backward, that is a sure fire way to destroy plastic drive line components.

Yeah - that would definitely be something to avoid. My biggest concern is the new tires, though - no slip, all grip (they are knobby 13 inch tires from Harbor Freight; meant for garden stuff); but others have used them successfully, so maybe it will be ok.

Something that I want to try is 2-wheel traction control (since there is a different motor on each side of the Powerwheels axle for each wheel); kinda like an electronic differential (that, and I want to see if I can do sharp turns by retarding or reversing the speed on one side of the vehicle rear wheels while steering with the front - kinda a differential steering mechanism with Ackerman steering up front).

Pricing will be another issue - it may be too much money for too little return; this platform is my beta-testing dev platform; ideally in the end I will be using a 4WD quadcycle (or Polaris vehicle if I can afford it or get a sponsor). I might want to spend my money in that direction, but who knows until I get to that point...

:D

Are we offtopic in this thread now?

Mouse; you found it out the hard way! Good work. One more thing you could have done was to calibrate the Esc. Almost every esc has that feature, usally a button to press when arming the Esc. Check the manual for instructions. After calibrating, its zero output when stop, reverse works and full trottle is full trottle. Even then, it could be more, many ESC:s are programmable in some manner.

Cr0sh: I have planned a 1:8 4wd 4-motor street car for some time. My idea is to forget all about diffs and traction control, in normal speaking. I use a standard radio, one Arduino, four motors and four Esc. The signals from the radio, speed and steering, is fed into the onboard Arduino. Every Esc has its own output. When travelling straight forward, all Esc have the same order. When turning, the outer front wheel is master, slowing the others depending on speed and steering. But what if one wheel looses traction? Now, its the time not to think. ;) Because your brain refeers to known facts from diffs. Instead think on the result if one wheel slips, when controlled by an Esc. The speed you ordered from the Arduino is the speed the Esc delivers. There is no spinning if the motor is correctly dimensioned! Every wheel will do just the ordered movement, regardless of traction. As long as at least one wheel has traction and you steer the car as ususal, it will do what you tell it to. Am I right or am I right?

SRyLul:

Yep, four-wheel electronic traction control - monitor the current of the motors and/or quad-encoders for slip/stall conditions. Furthermore, if you did it right, you could even get rid of the steering mechanism, and do electronic controlled steering (fully drive-by-wire - Toyota's issues notwithstanding, of course!).

You would probably want a tie-bar or something between the front wheels (and a similar arrangement on the rear wheels, if you want 4 wheel steering); kinda like an Ackerman linkage without the steering gear attached - to make sure both wheels pointed in the proper direction regardless of what happenned to one or the other.

I have thought about the same thing (indeed, I was thinking about maybe trying it with my UGV if I can fit some extra motors on the front wheels); I have also considered it in a "fantasy" idea for a 4-wheel drive electric vehicle (likely using inbound motors with CV joints to the wheels to reduce unsprung weight)...

I would love to see someone do it, no matter what - should be easily doable...

Yes, that kind of steering would be fun! But then I think tires will be a bigger expence than I would afford?
So, you didnt buy my idea? And skip the measuring, just trust your esc:s? It’s used in the industri (electrical axles) and the rc esc:s is pretty good for its size and money.

I just pulled apart an old R/C i had laying around and with the help of this post, I had the R/C car, steering and Motor, controlled by the Arduino! I also looked on line and, some ESC’s go for as low as $25…

Are there any downsides?

I know that if i write the value 90-95 to the ESC it is in the off position, and > is foreword and < is reverse then whats break?

IIRC, to brake with an R/C ESC, you are supposed to switch to "off" (neutral), then quickly toggle between low-speed reverse and neutral/off, until your wheels stop spinning (you monitor the wheels with encoders). I also think some ESCs have an automatic brake mode when in the off position. The documentation for your ESC should cover how to activate the brake function, if one is included.

ok first post, hope im not digging up an old thread. dont want to start a new one.

what I would like to do is control a brushless ESC through a program I have. this program is for controlling a CNC mill and the ESC runs a brushless motor for the spindle. the program is Mach3 and it can output a PWM signal with varing duty cycle for spindle control. i would like to program an arduino, the funny thing is is that programing microprocessors is not my strong spot :-[ i can program CAD/toolpaths though! :P

basically i need it to take a certain PWM freq. and convert it to the standard 1-2ms an ESC needs. preferably with a small ramp up time to the set speed (output freq). (you have a certain spindle speed set in the toolpath code, mach3 reads it, starts the spindle).

any help?? ;D

edit: oh yea, if it matters, the ESC i want to use is the Castle Creations Phoenix ICE HV 40

You can get speed controls at a very low cost for brushless motors at some R/C sites online. Several people in our club buy theirs from www.hobbycity.com You could simply use the arduino to output the ppm signal like an R/C receiver does to a servo and viola, you have a working speed control.

skmetal7, one other way of using the arduino as a modulation converter, is to use its serial cababilitys to send info from Mach3. Maybe somebody already created a driver interface to Arduino?

If you can't get serial data for motor control out of the Mach3, you can decode the PWM using pulseIn.

Assuming that you set the Mach3 for a 10Hz PWM frequency, the following pseudo code fragments should give you an idea of how to proceed

#define inPin  2

#define PWM_PERIOD  100000 // the number of microseconds for one PWM cycle
#define PWM_IDLE_STATE  LOW   // set this to HIGH or LOW depending on how the 
mach3 outputs PWM 

#define ESC_MOTOR_OFF 1000;
#define ESC_MOTOR_FULL 2000;


long  pwmIn = pulseIn( inPin,  PWM_IDLE_STATE );

long escOut = map(pwmIn, 0, PWM_PERIOD, ESC_MOTOR_OFF , ESC_MOTOR_FULL);   

servo.writeMicroseconds(escOut);

This is untested and will need some work (for example of there is a possibility that the PWM pulse is always high or always low)

ok that's a lot to take in :o they recomend a PWM freq. of between 5-10hz

this seems like a pretty ambitious goal for someone who has never programmed an arduino before :-/

but I will not give up! :smiley:

im pretty sure Mach3 outputs PWM HIGH

is inPin 2 where the input from Mach3 connects to? i still have to define my output pin?

so how would the code look if I wanted the arduino to ramp up to specified speed (freq)? would it be a modified version of the fade example?

int ledPin = 9; // LED connected to digital pin 9

void setup() {
// nothing happens in setup
}

void loop() {
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(ledPin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}

Yes, inPin is connected to the Mach3 PWM output.

I sugggest you start with something simple, like adjusting the brightness of the LED by the PWM output level from Mach3.

if you change the map function to give a an output range of 0 to 255 you can use this to light the led:

long  pwmIn = pulseIn( inPin,  PWM_IDLE_STATE );
long escOut = map(pwmIn, 0, PWM_PERIOD, 0, 255); 
analogWrite(ledPin, escOut);

I should be getting my arduino board next week. looks promising though. 8-)

in the mean time, i gots me some learnin to do. ;)