CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to control an ESC!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
karimpain



Joined: 15 Feb 2012
Posts: 39
Location: italia

View user's profile Send private message AIM Address MSN Messenger ICQ Number

How to control an ESC!
PostPosted: Sat Apr 21, 2012 5:36 am     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Sat Apr 21, 2012 11:39 am     Reply with quote

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

View user's profile Send private message AIM Address MSN Messenger ICQ Number

PostPosted: Sat Apr 21, 2012 12:28 pm     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Sat Apr 21, 2012 12:43 pm     Reply with quote

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: 9226
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Apr 21, 2012 4:02 pm     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Sat Apr 21, 2012 4:39 pm     Reply with quote

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

Very Happy Very Happy Very Happy Very Happy
karimpain



Joined: 15 Feb 2012
Posts: 39
Location: italia

View user's profile Send private message AIM Address MSN Messenger ICQ Number

PostPosted: Mon Apr 23, 2012 5:22 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Apr 23, 2012 5:59 pm     Reply with quote

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

View user's profile Send private message AIM Address MSN Messenger ICQ Number

PostPosted: Tue Apr 24, 2012 1:36 am     Reply with quote

Thax John, yeah i mean ms Smile.
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: 19513

View user's profile Send private message

PostPosted: Tue Apr 24, 2012 2:39 am     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Apr 24, 2012 7:26 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group