SMALL - espritmodel.com SMALL - Telemetry SMALL - Radio
Reply
Thread Tools
Old Jan 18, 2004, 09:28 PM
Registered User
mmormota's Avatar
Budapest
Joined Jul 2003
2,579 Posts
Quote:
Originally posted by mr_wood
i am confused why i need 6 outputs - can someone explain this to me ?
The P and N channel Fet is in series connection. If you want to drive the Fets with 3 pins, you have to connect the gates together and drive this point.

To drive the gates from Gnd to Vbatt or back needs some time. During a big part of this time both the P and N Fets are open, and a very high current flows from Vbatt to Gnd. However the Fets probably survive it, better to avoid the high current spikes, the reasons are obvious.

With 6 outputs you drive every Fet separately. So, first turn off the currently open fet, then after a short delay turn on the other. With several cycles delay you can easily compensate the additional delay of the P channel driver too (the P Fets usually need a driver transistor or IC as the battery voltage higher then the uC Vcc.)
mmormota is offline Find More Posts by mmormota
Reply With Quote
Sign up now
to remove ads between posts
Old Jan 19, 2004, 01:40 AM
Registered User
Israel
Joined Dec 2003
59 Posts
Each output has to be in 3 states :
1. high
2. low
3. disconnected / high impedance / sensing
you can see that on drive waveforms that found in BL ESC threads

therefore you have to use 2 output pin for each power output
danyra is offline Find More Posts by danyra
Reply With Quote
Old Jan 19, 2004, 04:33 AM
Registered User
London Heathrow, Great Britain (UK)
Joined Sep 2001
314 Posts
I am even more confused now.

My idea was to have 3 FETS on the outputs going to the 3-phases that are on the coils. So I would have 6 coils and 2 poles so only 1 coil would be on at a time. Why do I need more 6 outputs ? HEEEEELP

Thanks
Tim

Perhaps I should stick to buying a ready made controller I just fancied writing some assmbler again - I have 12yrs coding experience in financial institutions and haven't written assembler since university. Thought it might be fun.
mr_wood is offline Find More Posts by mr_wood
Reply With Quote
Old Jan 19, 2004, 06:07 AM
PDK
Registered User
PDK's Avatar
Gladstone, Queensland, Australia
Joined Nov 2002
507 Posts
Hi,

You cannot drive both the top and bottom drivers (p-channel, n-channel) with the same output. As danyra said there are three states. Look at the 2nd page of An857 application note (talked about earlier) to see what I mean.

If you really think about it if both high and low sides are driven off the same output what would happen when you PWM this output!!! The wrong fet is switched on during the pwm low point.

You would be better driving 2 N-channel fets each phase with 2 outputs.

But then again I am no E-engineer, Just my own jibbering

Best regards
Phil
PDK is offline Find More Posts by PDK
Reply With Quote
Old Jan 19, 2004, 06:15 AM
Registered User
mmormota's Avatar
Budapest
Joined Jul 2003
2,579 Posts
Quote:
Originally posted by mr_wood
I am even more confused now.

My idea was to have 3 FETS on the outputs going to the 3-phases that are on the coils. So I would have 6 coils and 2 poles so only 1 coil would be on at a time. Why do I need more 6 outputs ? HEEEEELP
There are 3 coils (in star or delta), and 3 pins of the motor a,b,c.

The usual driving scheme:
1. step: a=+, b=-, c= open
2. step: a=open, b=+, c=-
3. step: a=-, b=open, c=+

As seen, every pin connected first to the V+, later to V-. So every motor pin needs 2 fets.
mmormota is offline Find More Posts by mmormota
Reply With Quote
Old Jan 19, 2004, 07:37 AM
Registered User
Israel
Joined Dec 2003
59 Posts
Quote:
Originally posted by mr_wood
I am even more confused now.


Perhaps I should stick to buying a ready made controller I just fancied writing some assmbler again - I have 12yrs coding experience in financial institutions and haven't written assembler since university. Thought it might be fun.
well...
its is not a short time project.
i am trying now to start playing with C language on 16f628.
you and i both know that assembler is not much fun and when time is limited , it wont finish at all.
when i'l have to some relevant parts of code i'l post it here.
i hope we can share code between us all.
danyra is offline Find More Posts by danyra
Reply With Quote
Old Jan 19, 2004, 03:29 PM
Registered User
Israel
Joined Dec 2003
59 Posts
Hello , i am trying to design the software structure of BL ESC.
first the software componnents:

Initial
-------
measuring Batt voltage
safety procedure

acceleration & slowing
----------------------------
sensing
cycle time calculation
cycle states , pwm setting
adjusting phase , cycle time , pwm

start
------
open loop slow running

brake
-------
tbd

tx pulse measurement
----------------------------


if i am right , with pic medium series , to manage power all we need is to set
the pwm parameters on active cycle phase.
so the only interrupt is for tx pulse measurement which will take tens
to hundreds of microseconds once in a 20 ms.

i will be happy to see comments on this .
Dany
danyra is offline Find More Posts by danyra
Last edited by danyra; Jan 19, 2004 at 03:31 PM.
Reply With Quote
Old Jan 19, 2004, 04:16 PM
Registered User
mmormota's Avatar
Budapest
Joined Jul 2003
2,579 Posts
Quote:
Originally posted by danyra
Hello , i am trying to design the software structure of BL ESC.
first the software componnents:
There are two very different working modes:
- startup
- normal run

In a sensorless controller there is no phase oinformation until the rotor is spinning faster then a treshold (depends on the back emf sensor circuit).
Not too much possibilities, try to turn solwly the magnetic field with minimal amplitude (low current) and check if the rotor follows. If not, slightly higher current etc. It is a complex part, as very different motors are there, what is proper start current for one, smokes the other.

Normal run:
The pwm is not an independent value, not a number in the "PWM register", but a sw controlled on/off/on/off procedure in the main loop.

The sw is a loop with the necessary procedures inside:
- switching on and off the proper pins
- check back emf
- set phase and calculate cycle time again (based on the emf phase), set the count numbers in the delay loops
- delay loops everywhere, the delay is a function of the above count numbers

In such a program C can't help too much, just slows down the procedure. Nothing there what is C like: bit sets, bit clears, increments, decrements, every action manipulates hw register bits, every variable is static and most of them in special registers etc. The code is not readable, only the detailed comments.

The receiver input is the IT routine, but must be as fast and simple as possible, I mean no more then 10-15 cycles...
mmormota is offline Find More Posts by mmormota
Reply With Quote
Old Jan 19, 2004, 04:55 PM
Registered User
Israel
Joined Dec 2003
59 Posts
hi

in pic medium series ( 16f628 and similar ) there is a pwm module
you have to set cycle time and duty cycle , then it rolls by itself

about C you maybe right but i will check the possibility that it can
be done clearly.

do you know how much idle time there is ? on what xtal freq ?
what is a proper pwm freq ?
is it matters when you sence the emf : during on or off ?
thanks , Dany
danyra is offline Find More Posts by danyra
Last edited by danyra; Jan 19, 2004 at 04:59 PM.
Reply With Quote
Old Jan 19, 2004, 06:31 PM
Registered User
mmormota's Avatar
Budapest
Joined Jul 2003
2,579 Posts
Quote:
Originally posted by danyra


in pic medium series ( 16f628 and similar ) there is a pwm module
you have to set cycle time and duty cycle , then it rolls by itself
Yes, I know it (I am ee working int the uC real-time arena...), but unfortunately you can't use it in this application.
You have to synchronise the "pwm" to the rotor position, and have to turn on and off the fets one by one multiple times in every loop cycle.
The draft code is something like this:

label1:
a:
-switch on Pfet1
-switch on Nfet2
-delayloop x
...
-check emf on A/D
-if the result is far from estimation do some unusual correction...
-turn off Pfet1
-turn off Nfet2
-delayloop y
... do it several times from a: to this line, this is your handmade pwm :-)))


turn on that damned fets again
check emf again, but now you detect more or less the proper emf as estimated, so...
do a fast calculation, modify slightly the estimated phase angle, recalculate the cycle time, calculate the x,y etc values for the delay loops, use the appropriate throttle value in this calculation too
turn off your beloved fets
do the pwm delays according to the x,y etc constants

this is the end of the first 1/3 of a full turn and your main loop

* repeat this nice procedure but with other fets and emv input
* and again for the 3/3...

goto label1 :-)

Not really objectum oriented...
mmormota is offline Find More Posts by mmormota
Reply With Quote
Old Jan 19, 2004, 06:48 PM
Registered User
mmormota's Avatar
Budapest
Joined Jul 2003
2,579 Posts
If you really try to write a code:
- read first carefully the Microchip code
- check the oscillograms of a good commrcial controller in different working points: different throttle and load etc.
- the code is simple, the devil in the details, the "pwm" is not really pwm, the efficiency at low throttle depends on how many times and when you turn on and off (at what angle) the current
- so steel as many ideas from the oscillograms as possible
- probably the hard part is the startup procedure, you solved it for your motor and propeller, but it failed on another drive system, voltage etc...
mmormota is offline Find More Posts by mmormota
Reply With Quote
Old Jan 21, 2004, 01:42 AM
Registered User
Mr DIY's Avatar
South Africa
Joined Aug 2003
587 Posts
Ok .. its time to add my 2c here.

What is being discussed here is all the things I had to learn the hard way. Prior to starting development with my own design, I knew very little about motor control. I can now help by steering you chaps in some sort of direction.

The Microchip app note: Fantastic for gaining knowledge of brushless theory … but that is all. Totally useless for model motors. You cannot do the sampling with an ADC unless you have a very high-speed device … like a suitable DSP device. Anyway, it is a lot simpler to use a very cheap LM324 and a bunch of resistors to provide the feedback… as done on mmormota original circuit. This same type of circuitry is used on the Texas Instrument DSP speed controller app notes.

Choice of micro. As already pointed out, you do not need a super fast micro. However, if you wish to do everything with one micro, it does help to have a faster device. I found that the time taken to carry out interrupt procedures doing the PWM messed me around. Yea it worked, but I was unable to get smooth PWM on the very low power range. My current design can do 1% PWM absolutely smoothly. I solved the problem by taking away as much of the PWM processor overhead by utizing an Altera logic device to handle all the high-speed stuff. That way, the Atmel Mega 8 device running at 8MHz, with its internal clock, can do everything without any speed problems at all. Hell .. I can almost run into the MHz range with this controller. Oh yes .. the logic device allows numerous different PWM frequencies (a must have with any decent design) and also different PWM resolutions (a luxury) The Mega device also has an on board 8 channel ADC which is used for checking voltages (like my switch mode supply that supplies the high side FETs gate drive) bec and other things. So the ADC is a must, but not for feedback sampling.

Some other points. The Altera logic has it code written in VHDL. The Atmel code is in C. (the free compiler from AVR Freaks) Yes, that’s right… writing in assembler is not mandatory. Once you become efficient with ‘C’.. Goodbye to assembly languages forever.

Attached are photos of my second test PCB. I am currently on my final version (hopefully) As you can see, everything is in surface mount using caps and resistors in 0603. The second board is the FET board, which at present does not have the correct FETs .. hence the heatsink. Note the logic device and FET driver Ics on the bottom of PCB. The fan unit to test controller is a Mega 3 turn Mini fan combo .. for which you need high PWM frequency to work … otherwise poof goes your FETS. That 3 turn motor has a very low impedance.
Mr DIY is offline Find More Posts by Mr DIY
Last edited by Mr DIY; Jan 21, 2004 at 02:13 AM.
Reply With Quote
Old Jan 21, 2004, 01:43 AM
Registered User
Mr DIY's Avatar
South Africa
Joined Aug 2003
587 Posts
Bottom side
Mr DIY is offline Find More Posts by Mr DIY
Reply With Quote
Old Jan 21, 2004, 01:44 AM
Registered User
Mr DIY's Avatar
South Africa
Joined Aug 2003
587 Posts
Test layout
Mr DIY is offline Find More Posts by Mr DIY
Reply With Quote
Old Jan 21, 2004, 12:25 PM
Registered User
Baltimore Bwi Rr Stn, Maryland, United States
Joined Oct 2003
520 Posts
Quote:
Originally posted by zagisrule!

Here is the source code if you want to go over it. It is in .txt format so everyone can look over it.
Matt,

I have finally taken a look at Takao's code and have the following comments. The program hangs in a loop to beep the motor when power is first applied. It then waits for the following things to happen: throttle signal detected, battery check (LVC?), and throttle pulse width => 1.1msec. If none of these checks are passed the code hangs in the motor beep segment. I suggest checking your breadboard to make sure all these things are OK. The 1.1msec minimum pulse width is reasonable to me, but if you want to reduce it change line 485 from:
cpi temp,uS1100 ;Shorter than 1100uS?

to:
cpi temp,uS1000 ;Shorter than 1000uS?

This is the minimum pulse width the receiver should output. Let me know how you make out.

Bill A.
whanderson is offline Find More Posts by whanderson
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Brushless speed control problem TomL Sport Planes 8 Jun 08, 2003 02:23 AM
TMM-18-3ph Brushless Speed Control nelsonjo1 Power Systems 5 Apr 04, 2003 01:33 AM
FS: Model Motors 40 amp Brushless Speed Control. Jim McPherson Aircraft - Electric - Airplanes (FS/W) 3 Dec 10, 2002 06:02 PM
Dragon 35 brushless speed control Steve H. Aircraft - Electric - Airplanes (FS/W) 0 Aug 17, 2002 01:29 AM
Hooking up a Jeti Brushless Speed Control to a Jeti Pashor 15/4 motor. HELP!!! Rob R Power Systems 3 Jan 10, 2002 07:37 PM