View previous topic :: View next topic |
Author |
Message |
karimpain
Joined: 15 Feb 2012 Posts: 39 Location: italia
|
How to control an ESC! |
Posted: Sat Apr 21, 2012 5:36 am |
|
|
Hello everyone!
i bought a 18A ESC for controlling the speed of 900kv brushless motor using pic16f877a. do i programm my pic to send pwm data to the esc as if i send the pwm to the base of a npn transistor or like i command a servo dc motor??!!!!!
if u have good tutorial about that please... help me!
Thax 4 reading. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Apr 21, 2012 11:39 am |
|
|
for remote control hobby use ??
post a link to the data sheet for the controller and then lets see about it. |
|
|
karimpain
Joined: 15 Feb 2012 Posts: 39 Location: italia
|
|
Posted: Sat Apr 21, 2012 12:28 pm |
|
|
Something like that. I want to control 4 brushless dc motor for my quadcopter.
The RC Circuit is made by me and i used tws/rws 434, so i can't connect the receiver plug of the esc. So after the pic receive the signal from my rc circuit will send command to esc (that is my problem).
I read that I have to work on the esc like if i want control a servo motor. Send high positive pulse frome 1 to 2 ms in a period of 20 ms. Is that right??
And this is the link:
http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=656
Aand my motor is (maybe can help more):
http://www.hobbyking.com/hobbyking/store/uh_viewItem.asp?idProduct=14737
Hope I was specific and thanks a lot. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Apr 21, 2012 12:43 pm |
|
|
No way to comment about control with timed pulses
as i could not find any user data sheet at all in either link.
sorry |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9245 Location: Greensville,Ontario
|
|
Posted: Sat Apr 21, 2012 4:02 pm |
|
|
That ESC is a 'typical' RC style unit, so regular RC signals apply.
1ms is off....2ms is full on.
There's an RC servo example in the examples folder that CCS supplies and TONS of code on the Web concerning using ESC, RC servos, etc. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat Apr 21, 2012 4:39 pm |
|
|
Quote: |
1ms is off....2ms is full on. |
i have had some small experience using a hobby BLDC // ESC type controller on a test rig.
in the case of the one I used --
middle 1500 usecs was idle/coast with
+usecs causing speed UP
and below 1500 us was dynamic braking effect with 1000 being hard stall
another unit from Koford was pure analog voltage control from 0-5v dc
so........
i think what you get with hobby pulse time controls depends totally on the actual MFG and the unit itself - with GREAT variability between brands and models
so i still won't venture a guess without hard data to decide on
|
|
|
karimpain
Joined: 15 Feb 2012 Posts: 39 Location: italia
|
|
Posted: Mon Apr 23, 2012 5:22 pm |
|
|
so on pulses between 1us to 2us in a period of 20us is how controlling the speed of a brushless motor using esc?!?? |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Mon Apr 23, 2012 5:59 pm |
|
|
Hi,
No, it's milliseconds not microseconds. In the R/C world, 1.0 milliseconds corresponds to fully Off, and 2.0 milliseconds corresponds to full on. The period of the pulse train is 20 milliseconds.
You could test it with something like this:
Code: |
while(1){
output_high(Servo_Out);
delay_us(1500);
output_low(Servo_Out);
delay_us(18500);
}
|
Note that I am using delay_us because delay_ms accepts only an integer value. Also note that 1500 microseconds = 1.5 milliseconds.
This code should make your motor run at 1/2 speed. You may need to "arm" the ESC using a specific pulse train input, so read the ESC docs.
John |
|
|
karimpain
Joined: 15 Feb 2012 Posts: 39 Location: italia
|
|
Posted: Tue Apr 24, 2012 1:36 am |
|
|
Thax John, yeah i mean ms .
Just last question about arming the ESC, I need a transmitter or I can do it by specific pulses, and do I must do it ?!?! or since I'm not gonna use the transmitter, I don't need to "arm"?!!?
Thax to all. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19546
|
|
Posted: Tue Apr 24, 2012 2:39 am |
|
|
Step one:
The ESC, knows _nothing_ about radio. All it receives is a digital pulse train to say 'go to this power level'.
There are actually _two_ standard pulse trains in use. The 'standard' one (99% of kit), uses 1mSec for one end of the travel, and 2mSec for the other. The train should repeat _no less often_ than typically 30mSec (most kit generates 20mSec, and this is now the 'standard'). Separately there is a 'high speed' train, which allows faster updating of the position, but this is rare - however check your ESC, is compatible with standard RC.
What the ESC does with the train, in part depends how smart it is. On some for example, there is an 'autorange' feature, where the motor _will not start_ until it has seen a >1.5mSec pulse for several cycles, and then the train has returned to less than about 1.1mSec. It records the length of the longest pulse it sees before this, and uses this as it's 'maximum' setting. On these, when running off a RC, you have to switch everything 'on', then move the throttle to full, and back to the bottom of the range. Leave the stick there for a moment, and the ESC activates. If your ESC has such a feature, then you will have to generate the required train to activate the devices.
The place to start is with _data_ for your specific ESC. Most of the better ones, have really good tech support, and in some cases a lot of the behaviour is programmable, with you able to specify the pulse lengths to use, how fast the motor accelerates, etc. etc..
Best Wishes |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Tue Apr 24, 2012 7:26 am |
|
|
Hi,
I know that this runs contrary to the current trend on the forum, but you should get in the habit of always reading all the documentation that is available on a given subject, rather than instinctively posting your questions here on the forum. No one is in a better position to solve your problems than you are. We are here to help, but ultimately the solution is up to you!
It looks like the ESC (BTW, that is Electronic Speed Control for those that are not familiar) will arm itself if powered up with the incoming control signal at the shortest duration of 1.0mS. After remaining at this duration for a few seconds, the ESC will "arm" and be ready for normal use. This is a safety feature so that the propeller that is typically attached to the motor doesn't unexpectedly start spinning. This can be dangerous; a fellow flyer at my local model club received 90 stitches from an electric motor/propeller, so please be careful!
So, you'll need to write some code that hold the pulse output at 1.0mS for a few seconds at the start of your code, before you go off to try to actually control the ESC. Note: the ESC will generate a characteristic series of "beeps" once it has successfully been armed!
John |
|
|
|