View Full Version : Cool DIY Brushless Speed Control
zagisrule!
Dec 22, 2003, 12:45 PM
Hi Everybody,
I know there are alot of people out there that want a BL design that they can build to play around with. I think it is time we fill that desire and get some out there!
I think we should all throw around ideas and get this done. I have the ability to do *some* PIC programming, hardware design, PCB design, schematic capture and drawing, and have a few ideas how we can get this done. I can also build and test designs. I have PIC and AVR programming equipment too. If we pool together our knowlege I have no doubt that we can get this done.
What does everyone think? I am aware that there is a thread in the "Indoor and Micro Flight" forum, but that thread seems to be aimed at producing a specialized control that is for use on some of the home-brew motors they are making. I am also aware of Takao Shimizu's free design and some of the other German designs that are not "free." I think that the design that we do should be free for everyone that wants it, I am tired of seeing designs that you have to pay for.
Good idea?
-Matt
mmormota
Dec 22, 2003, 03:06 PM
I think that the firmware for the controller is rather complicated. It is not only routine, needs a lot of ideas, trial-error efforts and a lot of work.
Developing a good firmware and publishing it for free would be a really great gift to the community.
Takao published a new circuit diagram, it is elegant, simple, practical. As he wrote, the firmware is already working, but the receiver interface part is not ready. If he will be so kind to publish it too, then the job is easy, we need only slight modifications for different power levels, different cutoff voltages etc.
soren
Dec 22, 2003, 04:53 PM
Hi
If you want to build your own controllers - look here:
http://jaichi.virtualave.net/speedybl-e.htm
These are super controllers !!!
I have build - and are flying - more than 25 of these controllers....
Jo, that make the program for these controllers is a wise man......
Good luck
Soren
zagisrule!
Dec 22, 2003, 05:11 PM
Where might I find Takao's new schematic?
I am impressed that Takao is so generous as to share his designs so freely.
Speedy-BL designs are only available for purchase, right? I am confused as to whether or not they are free or not.
-Matt
Ron van Sommeren
Dec 22, 2003, 06:01 PM
Matt, the Speedy BL design is free. You can buy it as a kit. You've probably seen these links, six diy brushless ESC designs, including Takao Shimizu's design:
http://www.rcgroups.com/forums/showthread.php?s=&threadid=140454
Met vriendelijke groet ;) Ron van Sommeren
• diy outrunner brushless e-motor (http://www.yahoogroups.com/group/lrk-torquemax/) discussion.
• Electric fly-in & lrk meet (http://home.hetnet.nl/~ronvans/), June 27th, 2004, Nijmegen, the Netherlands.
mmormota
Dec 22, 2003, 06:34 PM
Matt, the Speedy BL design is free. You can buy it as a kit.
Are you sure it is free? Schematics? Code to burn in? I didn't found them.
mmormota
Dec 22, 2003, 06:45 PM
Where might I find Takao's new schematic?
I am impressed that Takao is so generous as to share his designs so freely.
He published it in the One hour CDRom... #2 topic:
http://www.rcgroups.com/forums/attachment.php?postid=1610722
zagisrule!
Dec 22, 2003, 09:20 PM
Looks great! It will be possible to build that design very small, because it eliminates the quad op-amp that the previous version used.
-Matt
PDK
Dec 22, 2003, 10:53 PM
Hi,
Sounds like a good idea to me. I would love to help. Unfortunatly I am not much help on the technical side. I can swing a soldering iron and make a pcb though.
I will follow this thread closely.
Good luck
Phil
hadihf
Jan 15, 2004, 02:51 AM
Hi,
Any feedback and comments???
regards
mmormota
Jan 15, 2004, 07:38 AM
The pcb nice and small. Please give some details...
hadihf
Jan 15, 2004, 08:46 AM
It is at www.bldc.de but is poor quality...I have redrawn it more clearly. The source is also posted at this site but you need to register first.
Regards
hadihf
Jan 15, 2004, 08:50 AM
Here is PCB top...:)
mmormota
Jan 15, 2004, 09:48 AM
Thank you for the fast reply.
This is a free design?
The code is available too?
How can I register there? (I can't speak German)
How is it working?
whanderson
Jan 15, 2004, 10:17 AM
Free, open, and registration free schematics, source code, and design info (all written in English) is at:
www.microchip.com/1010/suppdoc/appnote/all/an857/index.htm
www.microchip.com/1010/suppdoc/appnote/all/an885/index.htm
www.microchip.com/1010/suppdoc/appnote/all/an893/index.htm
www.microchip.com/1010/suppdoc/appnote/all/an894/index.htm
www.microchip.com/1010/suppdoc/appnote/all/an898/index.htm
mmormota
Jan 15, 2004, 10:24 AM
Originally posted by whanderson
[B]Free, open, and registration free schematics, source code, and design info is at:
www.microchip.com/1010/suppdoc/appnote/all/an857/index.htm
It is at most a good starting point to a new design, but not a working firmware.
hadihf
Jan 15, 2004, 10:34 AM
Hi,
Is there any application for model electric aircraft BLDC at microchip?? I know there is one very good for brushed motors....
Regards
whanderson
Jan 15, 2004, 10:37 AM
Originally posted by mmormota
It is at most a good starting point to a new design, but not a working firmware.
It is working firmware as presented. It does need some adaptation for use with RC systems. Should not be a problem for any PIC wonk. Is it your desire to have others do all the grunt work for you?:)
whanderson
Jan 15, 2004, 10:40 AM
Originally posted by hadihf
Hi,
Is there any application for model electric aircraft BLDC at microchip?? I know there is one very good for brushed motors....
Regards
This will get you started:
www.microchip.com/1010/suppdoc/appnote/all/an857/index.htm
hadihf
Jan 15, 2004, 10:43 AM
Hi,
We are talking about teamwork here..right..:)
Regards
whanderson
Jan 15, 2004, 11:06 AM
Originally posted by hadihf
Hi,
We are talking about teamwork here..right..:)
Regards
I helped get the ball down field. The Microchip app notes get you to 90% of your goal. What more does the team want coach?
danyra
Jan 15, 2004, 01:16 PM
Hello everyone , I'm new here
I wonder if there is an ability to use the original CD-ROM controller ( with the sensors ) to drive the improuved CD-Rom motor.
Is the original CD-ROM controller able to vary speed , if not how much rpm is x50 ?
As i undestand all we need is to:
1. Rewind , remagnet the motor ( and gently return it back to its place ).
2. Replace power elements in the controller.
3. Make some ( simple ?? ) interface between Rx to CD-ROM controller input.
Thanks , Dany
third thread posting this in , am i totaly talking rubbish ?
i know that original controller is weak thats why i purosed to add power elements ( FETs )
zagisrule!
Jan 15, 2004, 06:25 PM
From what I have learned, we really need to sense more than one phase. A triple op-amp setup would be better.
There is just not enough control of the motor with only one sensing position, and it is not reliable enought to reliably run the motor under a varying load such as an airplane propeller.
Know that I am not absolutely sure about anything I just said, but it is what I have heard in the past and it really makes sense to me.
whanderson
Jan 15, 2004, 07:21 PM
Originally posted by zagisrule!
From what I have learned, we really need to sense more than one phase. A triple op-amp setup would be better.
There is just not enough control of the motor with only one sensing position, and it is not reliable enought to reliably run the motor under a varying load such as an airplane propeller.
Know that I am not absolutely sure about anything I just said, but it is what I have heard in the past and it really makes sense to me.
read this: www.microchip.com/1010/suppdoc/appnote/all/an857/index.htm
zagisrule!
Jan 15, 2004, 11:28 PM
Ok, I have seen and read that document, but I think that the method of sensing only one point off the motor is not going to be precise enough to allow the motor to run correctly under the varying load conditions on a model airplane prop. In a dive, prop speeds up, if the controller misses a beat the motor will have to loose 2 more positions in order for the controller to regain proper control. With a input to the MCU for each of three phases, the MCU just waits for phase X to go high, then turns on phase Y. MCU waits for Y to go hihg, then turns on phase Z. Repeats over and over. Not that simple in real life of course, but it is the concept that counts here.
The Microchip controller might loose sync with the motor is my point. There is a good chance I am wrong, I am no EE, but if the RC filter works as well as you all hope, why are there no commercial controls that use that method? ESC companies would rapidly adopt that technique if it worked well enough to sell. It would eliminate at least 20 parts on average and you could make the PCB alot smaller. I can assure you that the companies have seen the AN857 document too, where do you think most of them get their brushed ideas from? Microchip App notes of course.
I think that despite the added complexity, a more accurate method of rotor position sensing should be used. I didn't think that a few months ago when I was trying to sort all this out, but it makes so much more sense to me now that a 3-phase sensing system be employed.
JohnnyS
Jan 16, 2004, 01:45 AM
Hello all,
Check out the reference design. Looks like it is only specified to/capable of 8000 RPM. That is pretty poor with a 20MHz part. Surely someone can do better.
-John
whanderson
Jan 16, 2004, 09:37 AM
Originally posted by zagisrule!
Ok, I have seen and read that document, but I think that the method of sensing only one point off the motor is not going to be precise enough to allow the motor to run correctly under the varying load conditions on a model airplane prop. In a dive, prop speeds up, if the controller misses a beat the motor will have to loose 2 more positions in order for the controller to regain proper control. With a input to the MCU for each of three phases, the MCU just waits for phase X to go high, then turns on phase Y. MCU waits for Y to go hihg, then turns on phase Z. Repeats over and over. Not that simple in real life of course, but it is the concept that counts here.
The Microchip controller might loose sync with the motor is my point. There is a good chance I am wrong, I am no EE, but if the RC filter works as well as you all hope, why are there no commercial controls that use that method? ESC companies would rapidly adopt that technique if it worked well enough to sell. It would eliminate at least 20 parts on average and you could make the PCB alot smaller. I can assure you that the companies have seen the AN857 document too, where do you think most of them get their brushed ideas from? Microchip App notes of course.
I think that despite the added complexity, a more accurate method of rotor position sensing should be used. I didn't think that a few months ago when I was trying to sort all this out, but it makes so much more sense to me now that a 3-phase sensing system be employed.
AN857 says the following:
;************************************************* *********************
; *
; Notes: Sensorless brushless motor control *
; *
; Closed loop 3 phase brushless DC motor control. *
; Two potentiometers control operation. One potentiometer (A0) *
; controls PWM (voltage) and RPM (from table). The other *
; potentiometer (A1) provides a PWM offset to the PWM derived *
; from A0. Phase A motor terminal is connected via voltage *
; divider to A3. This is read while the drive is on during *
; phase 4. The result is the peak applied voltage (Vsupply). *
; A3 is also read while the drive is on at two times during *
; phase 5. The result is the BEMF voltage. The BEMF voltage is *
; read at the quarter (t1) and mid (t2) points of the phase 5 *
; period. BEMF is compared to VSupply/2. If BEMF is above *
; VSupply/2 at t1 and below VSupply/2w at t2 then no speed *
; adjustment is made. If BEMF is high at both t1 and t2 then *
; the speed is reduced. If BEMF is low at t1 and t2 then the *
; speed is increased. *
; *
;************************************************* *********************
BEMF is read 2 different times per rotation. If you want more accuracy, go for it.
whanderson
Jan 16, 2004, 09:39 AM
Originally posted by JohnnyS
Hello all,
Check out the reference design. Looks like it is only specified to/capable of 8000 RPM. That is pretty poor with a 20MHz part. Surely someone can do better.
-John
If 8000 RPM is not high enough, change the CCP module setup.
zagisrule!
Jan 16, 2004, 11:20 AM
Ugh...
Ok, Because I think that the 3-phase sensing is better than Microchips method, I will work on it this way and you can do it your way Whanderson. Since you seem to know everything there is to know about this, perhaps you could build the demo circuit and tell us all how it works for the model motors. Also note that timing is going to probably need changed around because our motors tend to not be the high-wind, low current servo motors that they tested that code on. But you already knew that didn't you? It would be a real help if someone would build this and tell if/how it works. If it does work, I was off base with my comments, if not, we can get to work on a different design. My bottom line is...someone needs to build it. If no one else does it, I will do it. Only then will we know if the single RC filter is sufficient.
I have toyed with the idea of 3 RC filters, one at each phase. Perhaps this would discard the need for a triple op-amp and add simplicity.
I built Takao's old design, and I could not get it to arm. Even with a VERY low input, the controller would just go beep...beep...beep :( Yes, I adjusted my radio ALL the way down, both in all the EPA settings and trim. Anyway, I think that if there was a software fix for this portion of the code, it might run well as it is. Does anyone code AVR's here? I have a programmer and software to do it, I just don't know what and how to change it. The only thing that I am starting to understand is PBP, but that of course, is for PIC's, and this is not a PIC. All we need to do for now is push up the lower arming limit so I can get it to arm. If someone can do that, I will test the control and see if we can get this thing running. How is that for teamwork?
-Matt
Attached is a low-quality pic of the breadboarded Takao Shimizu design.
whanderson
Jan 16, 2004, 01:21 PM
Originally posted by zagisrule!
Ugh...
I built Takao's old design, and I could not get it to arm. Even with a VERY low input, the controller would just go beep...beep...beep :( Yes, I adjusted my radio ALL the way down, both in all the EPA settings and trim. Anyway, I think that if there was a software fix for this portion of the code, it might run well as it is. Does anyone code AVR's here? I have a programmer and software to do it, I just don't know what and how to change it. The only thing that I am starting to understand is PBP, but that of course, is for PIC's, and this is not a PIC. All we need to do for now is push up the lower arming limit so I can get it to arm. If someone can do that, I will test the control and see if we can get this thing running. How is that for teamwork?
I am willing to overlook your comments about me and offer to help with your arming problem. I do Atmel as well as PIC. Supply the source code you are using and I will take a whack at it.
whanderson
Jan 16, 2004, 01:41 PM
Originally posted by zagisrule!
Ugh...
Ok, Because I think that the 3-phase sensing is better than Microchips method, I will work on it this way and you can do it your way Whanderson. Since you seem to know everything there is to know about this, perhaps you could build the demo circuit and tell us all how it works for the model motors. Also note that timing is going to probably need changed around because our motors tend to not be the high-wind, low current servo motors that they tested that code on.
AN857 tested with this motor as well as others. looks like you use some seriously large servos.
zagisrule!
Jan 16, 2004, 07:35 PM
I just was saying that the controller was not aimed at a model motor and their needs timing wise.
Sorry about the things I said, I was a little out of line. You were only trying to help. It was your constant suggestion of the Microchip document and no other ideas that irritated me.
Here is the source code if you want to go over it. It is in .txt format so everyone can look over it.
whanderson
Jan 17, 2004, 12:12 AM
zagisrule!
Thank you. I will be out of town for a couple of days, will get back to you early next week.
JohnnyS
Jan 17, 2004, 12:18 AM
Please post the schematic that goes along with this code.
BTW, the 2313 is not a particularly good device for our brushless controllers. RC BL controllers potentially need 5-6 channels of higher resolution A/D - 3 for position sensing, one for current sense, one for temp, and one for battery voltage. The ATmega series has 6-8 channels of 8 and 10-bit A/D and can clock to 16MHz.
-John
whanderson
Jan 17, 2004, 09:05 AM
Originally posted by JohnnyS
Please post the schematic that goes along with this code.
BTW, the 2313 is not a particularly good device for our brushless controllers. RC BL controllers potentially need 5-6 channels of higher resolution A/D - 3 for position sensing, one for current sense, one for temp, and one for battery voltage. The ATmega series has 6-8 channels of 8 and 10-bit A/D and can clock to 16MHz.
-John
PIC 16Fxxx parts have 6 channels of 10 bit A/D and clock to 20Mhz. They also have a PWM module among other things. If you feel the need for speed 18Fxxx parts clock to 40Mhz similar peripheral capabilities.
mmormota
Jan 17, 2004, 11:32 AM
I am not sure that A/D conversion is really necessary. Probably a comparator do the job. On the other hand, a/d is built in and cheap, so why not...
A draft idea:
- the absolute phase angle seems not really critical, in my controller I can set it from 0 to 30 degree, not too much difference
- it is possible to sample the comparator several times, as the emf is a linear ramp, the result is very similar to A/D conversion
- as drive is pulsed, there are distinct time windows when emf measurement possible (if the fets are open, no measurement possible)
- sample the signal at the window in the middle, and in the window before and after
- smooth the angle representative digitally, add or substitute slightly according to the middle window sample if the side window samples are correct
- or correct it radically if the angle error is so high that one of the side window samples is incorrect
Something like that...
The following is oscillogram of a CDrom motor - Jeti controller drive (the upper trace just marks one full turn of the shaft)
mr_wood
Jan 17, 2004, 12:59 PM
Am i underestimating the complexity of controlling a brushless motor. Surely if I used a CD-ROM motor ( after re-wind) and hooked up the Hall sensors to a PIC and then wrote a prog to check the sensors and work out which FET to send signal to to turn on a coil - this would work ?? Obviously I'd need to use a conventional speed controller to power this circuit.
I am new to pics am I being to simplistic ??
The code would be simple !! I reckon - the code above is very complex,
Cheers
Tim
mmormota
Jan 17, 2004, 01:42 PM
Originally posted by mr_wood
Surely if I used a CD-ROM motor ( after re-wind) and hooked up the Hall sensors to a PIC and then wrote a prog to check the sensors and work out which FET to send signal to to turn on a coil - this would work ?? Obviously I'd need to use a conventional speed controller to power this circuit.
Yes, it will work. Considering the PWM voltage from the conventional controller, you have to take care of the gate-source inverse voltage problem.
The motor together the above mentioned circuit is very similar to a brushed motor, but with "electronic brushes", free of the usual brush problems.
Next step: there is everything in your controller to handle speed too, just write some additional code, read the pulses from the receiver, and feed your fet bridge with sw emulated pwm signal.
Next step: some more coplex code and no need for that sensors any more... :D
mr_wood
Jan 18, 2004, 03:54 AM
should I be checking the sensors in interups or just in the main loop ? What sort of clock speed should I use and what is a good cheap PIC for this sort of task - I'd only need 3 bit input, 3 bit output (perhaps an A/D too :)) and enough clock speed to enable to motor to run - what do you reckon ???
Thanks
Tim
hadihf
Jan 18, 2004, 04:33 AM
Hi,
A very good site for sensor DIY Controller....But in japanese only
http://www.cityfujisawa.ne.jp/~iijima-p/BRA2.htm
Translate using
http://babelfish.altavista.com/
Regards
mmormota
Jan 18, 2004, 05:42 AM
Originally posted by mr_wood
should I be checking the sensors in interups or just in the main loop ? What sort of clock speed should I use and what is a good cheap PIC for this sort of task - I'd only need 3 bit input, 3 bit output (perhaps an A/D too :)) and enough clock speed to enable to motor to run - what do you reckon ???
Probably the best method with a not very fast controller:
- assembly, not even dream about C
- handle the receiver with IT and a timer, keep the IT routine as simple and fast as possible
- handle the phase detectors and the driver outputs in the main loop
- the job is not easy (hard for the first uC project)
You need 6 outputs, the series Fets need break-before-make drive to avoid high current spikes.
This is a complex development, I can't estimate the clock speed without a lot of calculations. If you decided to use a uC family, use the fastest member, and lower the clock later, if it seems possible. A 20MHz Pic seems to be fast enough, but it is just a feeling... (a Pic unfortunately needs 4 clocks for 1 instruction cycle)
Microchit offers sample code for sensored controllers too. While I am a bit skeptic about the sensorless code, I am sure the sensored is perfect. (and you can try the sensorless code on the same hw...)
JohnnyS
Jan 18, 2004, 07:27 AM
whandnerson,
ATmega - 16Mhz, 16mips.
PIC - 40Mhz, less than 10 mips. (Two word instructions can take 2 instruction cycles or 8 clocks.)
Do you work for Microchip?
-John
whanderson
Jan 18, 2004, 08:53 AM
Originally posted by JohnnyS
whandnerson,
ATmega - 16Mhz, 16mips.
PIC - 40Mhz, less than 10 mips. (Two word instructions can take 2 instruction cycles or 8 clocks.)
Do you work for Microchip?
-John
No, I don't work for Microchip. The PICs have 32 instructions and AVRs have 90+. Code segments in PICs are much smaller than Atmel. The effective throughput for both devices is equivalent.
hbsloper
Jan 18, 2004, 10:13 AM
Bob,
You want a processor designed to run brushless motors look at the Intel 196, very powerful, probably too large for aircraft, definitely expensive. I am enjoying my PIC so far I can download code and get it to do simple things like brushed controller. The ICD 2 is very useful as is the simple and cheap flash kit which allows programming of the x12 devices. The PIC seems to have a very efficient assembly, the 14 bit opcode allows for direct, indirect and immediate addressing, also like how the I/O and memory is linearly addressed, no extra instructions required.
After I master the DC brushed stuff I will try my hand at the brushless controller, just finished a nice CD rom motor I'd like to control, my CC controller does not do a good job with it.
Steve
mr_wood
Jan 18, 2004, 12:59 PM
i am confused why i need 6 outputs - can someone explain this to me ?
Thanks
Tim
mmormota
Jan 18, 2004, 09:28 PM
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.)
danyra
Jan 19, 2004, 01:40 AM
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
mr_wood
Jan 19, 2004, 04:33 AM
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.
PDK
Jan 19, 2004, 06:07 AM
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:D
Best regards
Phil
mmormota
Jan 19, 2004, 06:15 AM
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.
danyra
Jan 19, 2004, 07:37 AM
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
Jan 19, 2004, 03:29 PM
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
mmormota
Jan 19, 2004, 04:16 PM
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...
danyra
Jan 19, 2004, 04:55 PM
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
mmormota
Jan 19, 2004, 06:31 PM
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...
:D
mmormota
Jan 19, 2004, 06:48 PM
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...
Mr DIY
Jan 21, 2004, 01:42 AM
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
Jan 21, 2004, 01:43 AM
Bottom side
Mr DIY
Jan 21, 2004, 01:44 AM
Test layout
whanderson
Jan 21, 2004, 12:25 PM
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.
hadihf
Jan 21, 2004, 11:50 PM
Hi,
Mr. Takao has version 1.3 of his code posted..
http://www.rcgroups.com/forums/attachment.php?s=&postid=1530527
Regards
DanC
Jan 23, 2004, 12:15 PM
Do a search for the ST72141 part it is a 3phase motor controller with the bemf module built into the device.
They even sell a developement kit with code and a motor
http://www.st.com/stonline/products/promlit/pdf/flst72141-0101.pdf
JohnnyS
Jan 24, 2004, 09:55 PM
DanC,
Did you also find a supplier for this part? I couldn't locate it in any of the standard US suppliers - guess I will have to look a little harder. Couldn't even find it at Arrow who lists STMicro on their linecards.
This device is quite interesting since it is an 8-bit microcontroller with 8 channels of 8-bit A/D, 14 configurable I/O and such.
The negatives are that ST products are typically double the cost of AVRs or PICs. The development system has a MSRP $695. (I could buy 12-13 10-12Amp brushless controllers for that price!) It is also ROM, OTP or EPROM based - would be tough to tweak the code.
-John
zagisrule!
Jan 24, 2004, 11:11 PM
whanderson;
I have tried checking everything, BEMF is fine, connections are fine. Still can't ge tto arm. I will try the changes you suggest and try again.
Thanks!
Mr. DIY;
Thank you for your schematics a while back and that setup looks really nice. I am happy that you are getting things working.
I think we are getting somewhere with this project, there are some really sharp people posting here!
zagisrule!
Jan 24, 2004, 11:13 PM
P.S. Mr. DIY, where do you get your PCB's made? Very nice.
whanderson
Jan 25, 2004, 08:40 AM
Originally posted by zagisrule!
whanderson;
I have tried checking everything, BEMF is fine, connections are fine. Still can't ge tto arm. I will try the changes you suggest and try again.
Thanks!
Mr. DIY;
Thank you for your schematics a while back and that setup looks really nice. I am happy that you are getting things working.
I think we are getting somewhere with this project, there are some really sharp people posting here!
Matt,
A couple of questions. When you start up your controller does the motor beep? Does the motor move at all? What motor are you using? Have you tried Takao's latest software version mentioned earlier in this thread?
BTW - I get my boards from www.expresspcb.com. Their layout and schematic software is free. Their miniboard is $60 for 3 ea. 2 1/2 x 3 3/4 2 sided plated through holes, 3 day turn around. This picture is an example of their work. PCBexpress does similar work, but are a little more expensive.
KreAture
Jan 25, 2004, 09:29 AM
Hi. I've been looking at all the chips selected for theese designs and most of em are not good at all. The 141 chip from ST needs a center-tap to work right.
There is however a great chip from Toshiba called TB6537F. Datasheet avaiable here:
http://www.semicon.toshiba.co.jp/td/en/Linear_ICs/Motor_Driver_ICs/en_20030908_TB6537F_datasheet.pdf
Basically, this is a fully-fledged brushless controller. It has most of what it needs buildt in.
Features:
- PWM input (wants about 16 khz) for speed controlling
- buildt in startup logic
- stops when no pwm is received (PWM = 0% duty)
- small and light (24 pin SSOP only 0.32 grams!!!)
- over-current protection
- no center-tap needed
- programmable lead angle: 0, 7.5, 15 and 30°
Needs:
- 2 external opamps, 1 for OC detection and 1 for commutation wave amplification.
- 1 3-phase driver array or 6 FET's + 3 drivers for the P-FETs.
- crystal/oscillator (1-10MHz)
and a PWM signal!
I am working on getting my hands on one of theese chips. They should integrate very well with any small microchip both AVRs and PICs.
With a 10 MHz resonator max speed should be about as good as the MGM controllers.
zagisrule!
Jan 25, 2004, 11:06 AM
Hi Everyone,
I have gotten PCB's done from ExpressPCb in the past, but I was curious where that nice solder-masked PCB Mr. DIY had came from. Just curious.
Kreature;
I have tried very hard to get the same chip, then use a PIC to drive it and act as the rx interface. I called maybe 6 distibutors across the US and they said that the DIP package (for prototyping) was unavailable and samples for the chips in SSOP form will take months to arrive and nobody has any stock to just buy the chip. I don't think that we could get a hold of many unless we "ordered" a large quantity like a manufacturer. Have you managed to get some sent to you and are waiting on the mail or have you yet to try? If you are getting some samples, request a few and I would be glad to pay postage for you to send one out here. Seems like a promising chip, if we can get it.
Whanderson;
The motor beeps continuously, a Mega 16/15/3 is the only commercially made motor that I have and I have been using to test.
I will test again with software changes and report the results.
KreAture
Jan 25, 2004, 11:20 AM
I have been in contact with multiple suppliers, but have yet to hear from some of them. Those I have heard from are positive to the idea of getting me some samples and say they are working on it.
I am doing this through the university. This helps a lot as the companys know that it may lead to mass-production.
zagisrule!
Jan 25, 2004, 11:51 AM
That is great Kreature! I am betting that these chips have alot of potential.
KreAture
Jan 25, 2004, 12:22 PM
My first implementation will be a tiny ESC capable of max 4-5 amps. (With a small 1A BEC)
It will be to try and use cdrom motors. (They are after all an abundance.)
whanderson
Jan 25, 2004, 01:56 PM
Originally posted by zagisrule!
Hi Everyone,
I have gotten PCB's done from ExpressPCb in the past, but I was curious where that nice solder-masked PCB Mr. DIY had came from. Just curious.
ExpressPCB will do solder mask and other features if you want to spend the money. They have a number of production services including 4 layer boards.
KreAture
Jan 25, 2004, 02:47 PM
But aren't that a insanely expensive way to do it ?
I'd have to pay over $20 pr board if I use a real boardhouse for my simple stuff...
whanderson
Jan 25, 2004, 03:15 PM
Originally posted by KreAture
But aren't that a insanely expensive way to do it ?
I'd have to pay over $20 pr board if I use a real boardhouse for my simple stuff...
Sounds pretty reasonable to me for boards for SMT parts, double sided, plated through holes, and solder plated.
KreAture
Jan 25, 2004, 03:37 PM
That was bare boards. No components.
Besides, I etch my own for $1 a board.
whanderson
Jan 25, 2004, 03:51 PM
Originally posted by KreAture
That was bare boards. No components.
Besides, I etch my own for $1 a board.
Do you do SMT parts, 2 layers, plated through holes, and solder plate? I f so you will get my next order.
KreAture
Jan 25, 2004, 04:01 PM
As I said. you can't "do" smt parts. There are PADS and they are wires... I do 2 layer, but have huge "issues" with vias.
JohnnyS
Jan 26, 2004, 01:57 AM
Poke around a bit in the threads (try a search for etch or etching). I ran across one that gave the proceedure and the proper material to print on for the laser printer toner transfer method. Some people have had great success with this method, even on SM devices.
As for vias, as long as you can perfect your alignment method, use the smallest drill you can find and z-wire the pads. Of course, unless you are extremely good, you probably can't get vias beneath SMDs.
The absolute best way to work on SMDs is to use a long focal range stereoscope of around 7-10X and a higher quality temperature programmable soldering iron with interchangeable tips. (Spent a few years with my eyes glued to a scope building satellite boards.) I suppose you could substitute a higher quality video camera and monitor for the scope.
-John
Mr DIY
Jan 26, 2004, 02:47 AM
Mr zagirules
You were asking who made the pcbs ...
My main job at work is the creation of PCBs. From simple single sided boards to big multilayer ones. I use PCB manufactures all over the world including those locally in my country. The pics here are boards created locally. My latest version comes in from the East (Tiawan) and is really nice.
----------------------
The TB6537
An interesting device. It was only a matter of time before ‘all in one chips’ became more useable. My only gripe about them is that they are not as flexible as to what I would want. And it still requires the overheard of a PWM generating circuit … be it a CPU or a 555 ic, FET drivers and all the associated power supply circuitry. It would appear to me that not much is being gained by the use of this chip .. other that not having to write code for it .. which is were all the flexibility lies.
Side note: The development of these controllers are not cheap. If you are doing it to make one or two for yourself, don’t bother. Rather just purchase them.
To make a decent controller to flog to your club member or buddies, then SMD is the way to go. If you have no experience in small SMD devices and thinking creating your own PCBs, better stop now. Do not pass Go .. do not collect 200. Save yourself the trouble. I have been in this business for the last 25 years, have made plenty of my own PCBs, but gave up on them for fine-pitched SMD devices. You need to be able to create 0,3mm through hole vias ect. If you can do this, I take back what I have just said. I do not want to sound negative, but this is the way things are.
Good luck
KreAture
Jan 26, 2004, 06:52 AM
LOL. Man do you read wrong. I have tonns of SMD experience, I only make SMD boards and I use UV-transfer with Photoresist to transfer artwork to boards. I can do traces half a millimeter easily and with good repeatability.
I just say that doing Vias is very hard work and does not mirror the quality I want compared to the rest of the board. The fact that they are almost impossible to get good enough to place under a SMD is the reason why I try to avoid them.
Mr DIY: About the TB6537...
Do you realize the computing power needed in a PIC or AVR to sensor and commutate a regular 2-magnet brushless motor to run at 25,000 rpm ? You need to detect the half-way point on the driving voltages and change the output controll data 150,000 times pr minute or 2,500 times pr second. And you need to do this accurately without much jitter. (Jitter will make the automatic or adjustable lead-in angle adjustment useless.)
The TB6537 is not a processor based solution, it is a hardware based solution. It contains a digitally designed state machine that will do the job of both starting up the motor and then continue to commutate it. Since the design is not based on a CPU it will give much more reliable response-times and be a lot faster. This improves accuracy and makes for a very effichient, low development-time controller.
CD-ROM motors with the regular 3 sets of coils and 12 magnets make for a gearing of 4:1 thus needing a commutation rate 4 times higher to achieve same rpm. This is 10,000 commutations pr second, wich translates to 100us pr commutation. In this 100us time you need to read the current used, decide if it's too high, maby do PWM generation, detect if the time has come to commutate to next stage, find out what is the next stage and update the commutation-word on the outputs.
If we imagine we can boil it down we would still need:
2 : Read current, and decide if current is too high
3 : Check sensoring port, if time, gety new data, update outputs
2 : Go to top again and start over
In addition, the check would actually need to be performed a lot more often or else we would have a commutation accuracy of 15° and that is useless. We would not have any idea if we were doing anything between a 0 to a 15 degree lead in.
Luckally, the TB6537 doesn't work that way. Result is a very accurate lead-in where the point for next commutation is checked at the rate of the clock input. That is 10,000,000 times pr second or 600,000,000 times pr minute. At 25,000 rpm on a 12 magnet cdrom motor this would translate to a commutation accuracy of 0.015° or a check 1000 times pr commutation. The AVR running at same speed would have to use more than one instruction and thus (if 7-instructions are used) have a accuracy of 0.105° wich would be quite acceptable. It would simply take a lot of time to write good code.
Mr DIY
Jan 26, 2004, 08:18 AM
Hi kreAture.
Not sure about what you are saying about reading wrong, Is it me or somebody else?
Do you realize the computing power needed in a PIC or AVR to sensor and commutate a regular 2-magnet brushless motor to run at 25,000 rpm ? You need to detect the half-way point on the driving voltages and change the output controll data 150,000 times pr minute or 2,500 times pr second. And you need to do this accurately without much jitter. (Jitter will make the automatic or adjustable lead-in angle adjustment useless.)
I am not sure if you noted the pictures on page 4 of this thread, but I have built my own controller already and have observed what you have mentioned. The speed issues you pointed out were initially a problem, but quickly solved with the use of a high-speed logic device. It reduced the micro overhead to basically looking for when to commutate, what timing is being used and other background checking. All this inside 50us without problem. In fact the only timing problem I have is that of the on board Atmel Mega 8 ADC. It is slow, but we can make plans to get around that. Overall I am more than happy with the performance and the figures you mentioned above are actually well inside my unit’s capability. The 10 000 figure mentioned was the bare minimum I was designing for.
The Toshiba device mentioned is an interesting device and I would love to hear from somebody who builds something using it. For me, the 16KHz PWM frequency limit is too low. I have been using 24KHz + for my Mega 3 turn motor. But for CD-rom motors the 16K limit should not be a problem.
Other details mention in the Toshiba PDF is rather vague. It refers to positive detection being in synchronization with the PWM and then warns about the use of high-speed motors. (See page 7). My immediate impression is, this device may not be able to meet your specs described above. But then, I may well be wrong, but I suspect I am not. If somebody cares to decsribe more details of how this chip works, I am all ears ... or is that eyes ;)
One more thing for now. My biggest headache in writing code, turned out to be the starting sequence. It’s the one area I must still modify to allow for the use of heavier props (mass wise). It is quite easy to design for a single type of load, but it’s a little more troublesome to cater for almost any load. If this device can do that without problem, I would be impressed.
So who is going to give it a go? :)
KreAture
Jan 26, 2004, 08:53 AM
Hehe, true. The starting sequence is a headache.
I asked Toshiba about the chip, that's why I know it uses almost unclocked logic for most of the work.
The PWM frequency seems to be reccommended however. I agree they only state a single frequency and find it odd.
A tip: If you drop the ADC completely and instead use a external or internal Opamp to detect the zero-crossing you can avoid the pesky ADC delays. Timing is easily done by using a prediction and adjusting the prediction before the next commutation if it doesn't match the later detected zero-crossing.
This is the method I will be using when making my first controller without the Toshiba chip.
As for flexibility and the use of a programmable logics chip. It appears this results in same situation as using the Toshiba chip. Only, instead of the formentioned flexibility, you sacrifice weight and board size. I hope I can get my controller woking well with cdrom motors without using the Toshiba chip or any other external logic chip, but I know the chances are probably slim. Or it will take a lot of work.
Mr DIY
Jan 26, 2004, 09:05 AM
Yep .. I am indeed using op amps for my feedback as already explained in the description that went with pics a few pages back.
As for flexibility and the use of a programmable logics chip. It appears this results in same situation as using the Toshiba chip. .
Yes .. true, but far more flexable and adaptable.
Only, instead of the formentioned flexibility, you sacrifice weight and board size.
Weight ... hmm maybe 1 or 2 grams.
Board size ... my new board uses a 44 pin device as opposed to the 100 pin device used on proto number 2. My new board is 26mm x 46mm and contain quite a lot more on it than proto 2. Its crammed.
I hope I can get my controller woking well with cdrom motors without using the Toshiba chip or any other external logic chip, but I know the chances are probably slim. Or it will take a lot of work.
Its taken me a year of my spare time!!
KreAture
Jan 26, 2004, 10:26 AM
Taken that long time ?
Hmm, I bet I have mnore free time than you :)
Anyway. It's more fun than the proverbial barrel of monkeys, so who cares it takes time ???
DanC
Jan 26, 2004, 03:29 PM
Sorry for the delay.
When I first saw this devices data sheet it had a aveox motor in the background
Originally posted by KreAture
The 141 chip from ST needs a center-tap to work right.
not from the data sheets I have been reading
In the UK I have beeen told this device is about £4 I have yet to try and buy one
http://www.st.com/stonline/bin/sftab.exedb=apptree&type=&table=a_214_109
THe problem with this chip is the amount of Bemf it can detect so you have to step the motor in open loop quite fast before you can detect the zero crossing point.
KreAture
Jan 26, 2004, 04:34 PM
I can get samples of the 141 chip. I have already been offered them from a local distributor.
I'll give em a hoot and let em know I want some.
KreAture
Jan 26, 2004, 04:38 PM
I just re-checked and now I've reconsidered. I don't want to test the 141 as it's a programmable chip. In fact, it's really a specially tailored DSP processor if one were to classify it. I'm sure it would be quite cool to use it, but for me it means hassle of maby needing a programmer for it and having to read up on the command-set it supports.
I'll see if I can find some other controller from Motorola or TI instead as I have contacts with them too.
Mr DIY
Jan 27, 2004, 12:55 AM
Kreature
Anyway. It's more fun than the proverbial barrel of monkeys, so who cares it takes time ??? .
Yes ... its for the enjoyment and CHALLENGE we get out of it. A lot of people can't understand that. Its such a nice feeling to be flying your own motor and controller. :)
JohnnyS
Jan 27, 2004, 01:51 AM
DanC,
I did a fast check for low cost or free tools for the ST devices, but was unable to locate any specifically for the 141. There is a programmer or two that might work. I didn't find any development system, but I would hope they would have a downloadable one somewhere.
KreAture,
Motorola uses the MC68HC(7)05MC4. Look for the AN1627 application note. I believe the MC means 'motor control'. For some reason I passed this over, but I can't remember why - I think that particular microcontroller is a little rare. Also, if you are interested in writing 'C' instead of assembly (unlikely you will get the necessary speed) you can download a free version of CodeWarrior Lite for microcontrollers.
I looked at a lot of TI stuff - they have some BLDC motor control devices but most I found were sensored and the rest are DSP based. Lot of companies willing to license BLDC source IP at $1-10K. Check out the TMS320LF2401A. Snychronous 5 channel, 10 bit, 500ns A/D; 2 - 8 state sequencers; 3.3V; 40MIPS and all in a 7x7mm 32 pin QFP. That one just might be useful...
-John
Mr DIY
Jan 27, 2004, 02:10 AM
JohnnyS ... yes those TI devices are nice and are very much DSP based. I found the app notes for these devices very useful for gaining knowledge. Having played with an Analog Devices DSP dev. Board, I found writing code for DSP chips a little more difficult. A steeper learning curve. I suspect however, the wish here, in this thread, is to create a controller that does not require software… and to be honest, I find it a tall order to get such a controller working well. For low current applications, it will probably work, but a software-less controller for various motors may prove a little more difficult. But time could change all that.
KreAture
Jan 27, 2004, 05:20 AM
MR DIY:
Yes. The more I run the numbers I am sure I can get a cheap and simple controller working with a simpler solution.
If effichiency isn't the main goal, just a controller for use with the cd-rom motors, then I think I can lower my demands a lot.
For good thrust for a slowflyer / indoor 8000 rpm is a lot. If we select 10000 rpm as our max, and focus on a 12-magnet cdrom motor we would have 10000/60*4*6 = 4000 commutations pr second. This is not that much. I like the PIC controllers because of their simple nature and commandset, but they do run at 1/4 the applied clock. Even at 4 MHz/4 = 1MIPS we wtill have 250 instructions pr commutation.
By using external amps and logic to make the 0-crossing a simple pin-change event and always use 0-deg (or close to) for lead-angle, it should be quite easy making a controller using only 2 main IC's: A PIC, and a 3-phase H-bridge driver. I think Motorola has made a lot of the latter chip. This would simplify the design and especially shrink the circuitboard a lot.
I want to first design a controller that will let me utilize all those cd-rom motors I have. If I get 88% or 60% effichiency, I still get better eff than a brushed setup, and the main thing is removing the wear that we find in brushed motors.
I will try and put together a software fast to test some ideas I have as to simplifying the 0-crossing logic. If it pans out I'll see if I can set some sort of record in DIY ESC-design LOL... Wish me luck. I think I'll need it.
mmormota
Jan 27, 2004, 06:18 AM
KreAture,
Have you seen Takao's new design? It is fairly simple, just a controller and a discrete H bridge. The controller is an AVR, it is faster then a PIC on a given clock speed.
If you like PICs, and need more speed, there are faster PIC members, or there is the code compatible 50 MIPS Ubicomm clone. I think the more the speed the easyer the job, and the price is not too much. Probably better to start with a fast controller, and finally lower the clock if possible.
I think that more or less easy to write a code to just run a motor, but hard to start different motors reliably, and keep good efficiency with different motors. Worth to take a look to the oscillograms of commercial controllers in startup and at different throttle and load conditions. The more similar the new code the safer the success... :-)
KreAture
Jan 27, 2004, 06:39 AM
mmormota:
The reason I want to use a PIC is because I have many years of experience with them and they are the only ones I can get cheap. (and free as samples!) And, about speed... You really want it to go as slow as possible to avoid unnecessary current-drain. Also, noise is an issue. A 50 MHz will be very prone to noise. A 8 MHz PIC will also use less current than a 2 MHz AVR.
The main reason to use a PIC is that I have it right here. No need to get a new chip or programmer...
I do have a MGM controller and a MiniAC 1215/16. I also have a 100 MHz 4-channel scope. This should make it fairly easy to find out how to do the 0-crossing. (I know it was a great help on my 35 MHz FM receiver.)
Mr DIY
Jan 27, 2004, 08:08 AM
KreAture ..
The current drain of a PIC running at say 50MHz is still nothing to what the motor would be consuming. So that’s almost a non issue. I am not sure why current consumption is an issue at all. If you would care to elaborate on that, maybe we could understand your problem.
At work we have reps come in all the time keeping us up to date on Microchip, Atmel, Motorola ect. From what I can remember, PICs are good for high speed. Avr in my opinion are simply nicer, though not nearly as fast. Since moving away from PICs, I have no need to go to back to them.
Noise issues. The Atmel Mega8 device has noise reducing features that could be used. Personally I have had no need for them thus far at all, but then PCB layout should take care of most noise issues and I am only running the Mega 8 at 8MHz and at 3.3Vdc. At work I am very much involved with EMC issues and have learned how to layout correctly to minimize noise as well.
Micro Choice. Compilers for the AVR range is free … even the ‘C’ compiler. If you can write C- Builder or Delphi, you could even write you own programmer, and will be the cheapest method to get going. An ISP programmer from Atmel though, is dirt cheap (less than $30 when I purchased one) and well worth the money. But hey …the choice of micro is yours. If you want to stick by Microchip, go for it. The best policy is to stick with what you know best when tackling a project like this. Just make sure that the micro has the capabilities required. PS: Which one do you wish to use?
Mmormoto said :
I think that more or less easy to write a code to just run a motor, but hard to start different motors reliably, and keep good efficiency with different motors.
Agreed 100%. That’s were all the real software intelligence lies.
ParkJeff
Jan 27, 2004, 08:22 AM
Just out of curiosity are you guys thinking of doing the commutation by polling or using interrupt driven routines? It seems to me that using interrupts together with comparator based zero crossing detection might be an efficient way of doing it. The mcu would of course need to have the required number of interrupts.
Your thoughts?
Jeff
KreAture
Jan 27, 2004, 08:32 AM
Mr DIY
It's mostly the fact that I know the PICs by hart that make me want to use them. I agree that the AVRs are lovely. I have done some AVR projects too, using the free suite and even used most of the advanced features of the AVRs such as interrupts with masking and AD. But for this project, I feel pure assembler will give me the opportunity to finetune the code better, also I will have full control of number of cycles used for every part of the control.
I already have many PIC programmers, all of wich work well and all are homebuilt. I do have 1 AVR programmer too, also homebuilt. (It's actually a lpt connector and 2 resistors LOL.)
I'll start off with the PIC and see how far that gets me.
Oh, btw... I have found the FET's I will be using :)
They are perfectly complementary N/P pair and 6 of them won't cost me more than $12. They can (with a heatsink) handle a whopping 20 amps, but for my use and 2-3 LiPo cell voltage they will handle 5 amps gracefully. They are also made for fast switching applications so they are quick.
MTD20P03HDL trans P-MOS = http://www.elfa.se/pdf/71/07131311.pdf
MTD20N03HDL trans N-MOS = http://www.elfa.se/pdf/71/07131303.pdf
(Ignore the Swedish on page 1 of the datasheets, rest is in English.)
Both are available from my local supplier Elfa (www.elfa.se) and the DPAK packages should be good for my use.
I haven't selected the exact PIC I will be using yet, but I will be using one with a internal oscillator to avoid oscillator components that are quite fragile.
For opamps I will have to look around a bit as I want some special qualitys (seperate input and output voltage swing/supply for directly interfacing the motor +/- voltages to the PIC TTL levels.) This is also to save on extra components. (The board will be 2-sided and I will try to keep all power logic on one side and control on the other. This should minimize number of vias required.
This really seems doable...
Ron van Sommeren
Jan 27, 2004, 08:39 AM
Originally posted by KreAture
... CD-ROM motors with the regular 3 sets of coils and 12 magnets make for a gearing of 4:1 thus needing a commutation rate 4 times higher to achieve same rpm. Field/shaft speed ratio is 6:1, commutation rate is six times higher.
Met vriendelijke groet ;) Ron van Sommeren
• diy brushless e-motor (http://www.yahoogroups.com/group/lrk-torquemax/) homebuilders discussion.
• Electric fly-in & lrk meet (http://home.hetnet.nl/~ronvans/), June 27th, 2004, Nijmegen, the Netherlands.
KreAture
Jan 27, 2004, 08:40 AM
Yes, interrupt on rising edge or falling edge is what I had in mind... Most of the PICs time would be spent decoding PPM and generating PWM at high frequency. (like 30kHz for better 0-crossing detection)
KreAture
Jan 27, 2004, 08:51 AM
Oh, and I have been pondering about using on-board comparators that are fed a composite signal of the 3 phases made to fit 0-5v with a voltage divider then letting the circuit use it's internal reference to select the 0-crossing point. This would allow it to adjust it's timing based on a ADC reading of the voltage on a current-shunt. Minimizing voltage over the shunt for same pwm range should be a good way of making it rather effichient. Also, it can store values it reaches for the different pwm-ranges for faster adaptation when speed is changed. (I'e it would be a bit ineffichient when u set it at 50% throttle, untill it can have a look at the numbers and learn. Then it would go straight to that lead-angle next time it was set at 50%. Untill power is turned off, and chip is reset that is...)
KreAture
Jan 27, 2004, 09:04 AM
Thanks Ron van Sommeren
How was the formula for gearing again ?
A 3-stator, 2 magnet motor is 1:1
A 3-stator, 6 magnet motor is 3:1 ???
A 9-stator, 2 magnet motor is ?
A 9-stator, 6 magnet motor is ?
A 9-stator, 12 magnet motor is 6:1 (as you say?)
vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.