PDA

View Full Version : Help! Please Help On ESC interface with Basic Stamp Microcontroller


MAX_MN
Nov 02, 2008, 12:13 AM
I got the ESC, and a Stamp microcontroller, So the servo type connector on the ESC (orange, red and brown wires) how do I connect those to the micro controller. and what kind of signal I need to send it in order to run the brushless motor?

Please help, we are doing project

Thank you

JohnMuchow
Nov 02, 2008, 01:06 AM
Is this part of that school assignment?

The pinouts can be found with a simple search or by checking the pinouts for the connector on the ESC. That's the easy part. You'll need to do some research on the specific type of PWM signal that the ESC needs to convert to 0% to 100% throttle. The Parallax web site has a ton of info on this application as do many other web sites. A lot will include code so that you won't have to learn much before starting your testing.

Whether that's good or not, only time will tell. :)
Good luck!

John

MAX_MN
Nov 02, 2008, 01:30 AM
Is this part of that school assignment?

The pinouts can be found with a simple search or by checking the pinouts for the connector on the ESC. That's the easy part. You'll need to do some research on the specific type of PWM signal that the ESC needs to convert to 0% to 100% throttle. The Parallax web site has a ton of info on this application as do many other web sites. A lot will include code so that you won't have to learn much before starting your testing.

Whether that's good or not, only time will tell. :)
Good luck!

John


+
John, It is not an assignment, but we chose to do it. It was easy to control brushed motors using H-bridge, but now we are stuck with the brushless and
it become a major task by itself.

The ESC I have is
http://www.amainhobbies.com/product_info.php/products_id/28010

The motor is from the same company E-flight (480),
http://www.e-fliterc.com/Products/Default.aspx?ProdID=EFLM1505

I connected it to the Basic stamp homework board. it is also connected to 3s 2200mAH Li-Po as well. The servo type connectors that come out from the ESC are connected to the board, where Red - to Vdd , Brown - Vss and Orange-P15. And it looks like the whole board is getting power through this pins (it is unlike servos where they get the power from the board).

However, I saw this discussion on Parallax, forum about ESC control and some one put an example code.
And when I put the code, the motor beeps and beeps in some kind of repeating mode, but there is no movement at all. So I have changed the pause time from 100 to 200 and so on but still the beep comes on but no movement. So if you have any idea what I should do with it. the code they have is as follows:


counter VAR Byte

DO
'Forwards
FOR counter = 1 TO 100
PULSOUT 15, 850
PAUSE 100
NEXT

'Backwards
FOR counter = 1 TO 100
PULSOUT 15, 650
PAUSE 200
NEXT

'Left

'Right

LOOP

Thank you

MAX

JohnMuchow
Nov 02, 2008, 03:34 AM
OK, there's a LOT you're going to have to get up to speed on here. :)

I'm going to assume that your ESC and motor are still good but I urge you to test that using a servo-tester or other device...just to make sure. It's REALLY easy to burn one or both of them up with these kinds of experiments if you're not sure of what kind of signal the ESC needs.

A couple of problems I see immediately....
- You have a unidirectional ESC but I believe you are using code that is assuming that you have a fwd/rev ESC.
- The code is outputting a pulse in Pin 15 but you have no way of knowing what the pulse width is unless you check the documentation for the PULSOUT instructions and know the oscillator/crystal frequency for your Basic Stamp Homework board. The documentation for the PULSOUT command will tell you how to calculate the actual pulse width for different osc/crystal frequencies. What pulse width were you trying to create with the code?

This second point above critical. An ESC needs a very specific range of pulse widths to tell it what the throttle setting is. In addition, the pulse width that is selected (for the desired throttle setting) must be repeated about 50 times a second for the ESC to work. You need to find out what out what range of pulse widths the ESC will accept. There are "standard" pulse widths you can use (easy to Google) but it's best to check the docs for the ESC, just to make sure as some use an extended range of pulse widths. That ESC has a programmable throttle input range so the values must be in the docs somewhere.

And because the pulse must be repeated 50 times a second, you need to find out how long the PAUSE commands actually lasts. You'll need to calculate out how much of a pause to add after each pulse to get the pulse to occur about 20 times a second.

So, to get the ESC to move the motor the way you want it to, you'll need to find out the above info and then we can put together a little bit of code to get the motors spinning. :)

John

hargard
Nov 02, 2008, 09:18 AM
Hi
Another thing is to arm it first...
Note from the manual.
"This controller is very simple to use, and for safety, will not arm the motor until the throttle stick has been held in the Idle/Off position for more than 1 second."
Manual is here... http://www.helihobby.com/download_files/EFL30AProBrushlessESCInstSheet.pdf
It is simple to do as I have done this with Atmel chips.
This link might help Yes its for servos But the esc's need the same thing to drive them.. http://www.eettaiwan.com/ARTICLES/2002MAR/PDF/2002MAR08_PL_ST_AN70.PDF?SOURCES=DOWNLOAD

Regards Antony(UK)

MAX_MN
Nov 02, 2008, 08:05 PM
Really thank You guys for your help

I am still trying it. still the motor does not move. But based on your suggestions, I have made some changes and I managed to get into the programming mode by putting the following code

the code now is:

DO
PULSOUT 15, 950
PAUSE 100
LOOP

which is 1.9 ms high and
.1ms low

So the above code was to follow the instruction set on the manual

#1 procedure in the manual
"1. With the battery disconnected from the controller, and the transmitter
turned on, first move the throttle stick to full throttle (>1.7ms)
position. Leave it in this position and then connect the battery to the
controller."

One thing I have noticed is that, it says ESC needs 8KHz PWM Frequency Set. But as I understand the basic stamp can not output that kind of frequency or am I missing something?

Thanks

MAX

JohnMuchow
Nov 02, 2008, 08:54 PM
Max,
I believe that the 8KHz refers to the frequency of the ESC's output that drives the motor. The input will still be a standard servo signal.

John

MAX_MN
Nov 02, 2008, 11:16 PM
John
and Hargard,

on the data sheet for the ESC page 2 and #2 at the top where it start saying (" 2. Plug the battery pack into....)

I did that and got the 1 low long tone, then 3 tones for 3 cell count (i think that's for the battery), then I get the 3 rising tones. (the 3 rising tones come only when my pin 15 is getting some kind of signal from the micro controller.

the code for that is
DO
'Forwards

PULSOUT 15, 800
PAUSE 20
LOOP

Right after that on #3 it says move the throttle stick upward....
In my case I am inputting "PULSOUT 15, 820... THEN 830 ... UPTO 850 with the same pause of 20

how ever that doesnot seem to move the motor, at all so what should I do?

hargard
Nov 03, 2008, 03:02 AM
Hi
Can you show all the code that is relevant.
And what basic stamp are you using ?? BS1, BS2, BS2e, BS2sx or BS2p. as the timing is different.
Are you sure that the signal is connected to pin 15 on the stamp ?
Have a look at the servo demo on this page. http://www.me.umn.edu/courses/me2011/robot/technotes/servos/servos.html
There are a lot of samples for Pulseout with the basic stamp out there.

Regards Antony(UK)

pmackenzie
Nov 03, 2008, 03:11 AM
which is 1.9 ms high and
.1ms low


To arm the controller you need first a 1msec high followed by ~ 19 msec of low. This needs to be held for between 1 and 3 seconds for most speed controls.

Once armed the "On" time can be increased to get the motor to run.
Full throttle will usually be at about 1.9 msec high. Motor off at about 1.1 msec high.
Idealy the off period will always be (20 msec - "On" period), but it could likely just be a constant 19 msec.

Hope that helps.

JohnMuchow
Nov 03, 2008, 04:28 AM
MAX,
You've gotten some great recommendations. :)
If none of them work, take step back and make sure that your ESC and motor are functioning properly. You'll need a test rig or a radio to do that. Perhaps get a servo to test your code with too. That way you won't have to worry about initializing and programming an ESC.

Good luck!
John

MAX_MN
Nov 03, 2008, 07:34 AM
Wow, I Really really Thank you guys,

I just did what pmackenzie recommended to arm it first and then, I increased the speed and there you go the motor start rotating with a good speed.
John and Hargard Thank you for all your great help, Thank you pmackenzie your very good tip, :) where have you been hiding so far hahah. (but it was a good learning experience)

For Hargard's question, I am using

BS2

and the only code i Have right now is that

DO
'Forwards
PULSOUT 15, 500
PAUSE 19
LOOP

that is to arm it then ones, and I hear the armed tone, I just increased the 500 to 600 to 700... and the motor was changing speed.

And that makes my day.

Thank you all

MAX

Red Eagle
Dec 19, 2008, 02:21 PM
Cool! How do you set up your basic stamp to receive power through the pins?

I have the Prop-1 controller.