sensorless BLDC zero cross detection

dirty_d

10 kW
Joined
Jun 16, 2007
Messages
985
Location
Massachusetts
ok, so im going to start designing a sensorless brushless motor controller, but before i even start drawing any schematics im going to make sure i understand every part of its operation, so far this has been the most troublesome part. it seems there are so many different ways to do the zero cross detection, some using the ADC to sample the voltage of the floating phase and a reconstructed neutral point and watch when they cross, either during PWM on or off, or using analog comparators to trigger external interrupts on the MCU like hall sensors would. this controller would mainly be for the big RC motors, they are pretty much all high rpm and high pole count, so each commutation step is extremely short.

the motor im going to test with is that 130Kv HXT motor, im not sure how many poles it has but ill guess at 12 for now, at 33V and a no load speed of 4300rpm, each commutation step at max speed would only be 387 microseconds. the fastest the MCU im using can take an ADC sample is once every 68 microseconds. so during each commutation step, only 5 voltage samples could be taken, that doesn't seem like it would be anywhere near high enough resolution to accurately determine the zero crossing point. so it seems the only solution for finding the zero crossing point would be to use three analog comparators with the inputs being half the voltage between the two powered phases, and the floating phase. when the backemf in the floating phase crosses zero the output of the comparator will change from low to high or vice versa and trigger an interrupt on the MCU.

there needs to be a low-pass filter on all of the inputs to help with the PWM noise, it seems like it would be best solution would be to use a comparator that would be able to take the full voltage that will be seen across the phases, that way you don't have to use voltage dividers and attenuate an already weak signal that you have at low rpm. i think the comparator would only actually have to be rated at half the largest voltage across the phases would be since there is already a divider across each of the phases to get half the voltage to compare against. the inputs directly from each phase wire for when that phase is floating would see the full voltage when that phase was powered though, so it could be clamped with a zener diode i believe and not do any harm to when that is the phase that is floating.

i found a nice schematic in one of the AVR appnotes, it uses LMV824s, they are only rated for 5.5V though, im thinking maybe LM324s could be used instead since they can be used up to 32V, the thing im not sure about is the bandwidth of them, the lmv824 is 5MHz, and the lm324 is 1MHz, i don't know if this is critical to this circuits operation. also it said the delay on the comparator output after the zero crossing is about 125 microseconds from the low pass filters, how do you calculate the delay of a low pass filter?

if anyone could help out or if you know any other better methods of finding the zero crossing point that would be awsome.
 

Attachments

  • file.jpg
    file.jpg
    23.1 KB · Views: 2,896
I think you need to do the zero cross detection analog, then feed the signal to the MCU.

There's a section in here that describes it briefly, along with some code for sensorless control:
View attachment AN857_Brushless control made easy.pdf

There was another AN somewhere around that had more of the hardware. I'll look around.
Search Atmel and Microchip AN's for sensorless control.

I wonder what the RC controllers do? They seem to have it down.
 
yea ive read a whooooole bunch of pdfs, its not the software thats the problem, im just not so sure about the hardware. some of the waveforms they have in there have me kinda stumped too, like when they show the winding voltage with pwm applied, in the off cycle the voltage goes down to 0, why would it drop to 0? wouldn't it just drop to the voltage of the backemf? like on page 14 in that pdf you sent me, i see that waveform in pretty much every pdf ive read so far.
 
fechter, so do you think putting lm324s in place of the 824s and using a 24v supply instead of 5V, then putting 24V zeners on all the inverting inputs, and 5V zeners on all the outputs, you would be able to use up to almost 48V for the motor supply? ill try to come up with a schematic.
 
For higher voltages, you can use a divider ahead of the op amp. This way you can keep the amp at 5v or whatever. Don't clamp the output of an op amp, that will look like a short to it. The divider ratio can be chosen to keep the amp inputs within the allowable range for any motor voltage.

Here's another not-so-good AN on sensorless control. This one uses direct inputs to the A/D without any op amps. http://www.atmel.com/dyn/resources/prod_documents/doc8012.pdf

Here's a not-so-clear schematic of the divider setup going straight to the processor:
(from http://aquaticus.info/bldc_controller)
Sensorless schematic 1.jpg

Another possibly useful AN: http://ww1.microchip.com/downloads/en/AppNotes/00992A.pdf
 
ok heres the circuit that i came up with, i have a 5k resistor on the op-amp output so its just clamped to 5V but wont draw a lot of current.

the reason i don't want to use a divider before the op-amp is that at low rpm, the low backemf will be even lower so low speed zero cross detection will suck.

i cant go directly to the mcu, because the commutation freq is too high to use ADC.

does this look like it would work?
 

Attachments

  • bemf.jpg
    bemf.jpg
    42.3 KB · Views: 2,689
Hi dirtyd

What micro are you using? I have used a PIC 18F4331 that has a dual sample 200ksps ADC, which actualy takes at least 6-7us minimum to convert one input. I know analog using fast comparators can be faster than a micro's ADC for sure, but there are more parts too. Note that I used this PIC only only with hall sensors, but microchip app note AN970 describes using the same micro for sensorless too (see app note suggestions bellow).

I think for sensorless I would go with a DSP cored micro that has a fast ADC. I have been eyeing these dsPIC4011 samples I have here - 1Msps quad sampling, specialized 3 phase PWM module, lots of math power and code space... yum!

BTW, do you have a link with specs for the motor you are wanting to use? I'm curious about these motors and think a well organized open source BLDC controller project might be interesting to many people. Personnaly, I like the layout simplicity and the adaptability of the direct input solution better, but I would still like to have optional hall inputs for people using motors for non-flying EVs too (meaning applications requiring low RPM control like regular ebike conversion motors). As for the power stage, I was also looking to a modular, expandable approach that would be easy to adapt to small and medium powered BLDC motors. But maybe your looking for something more specific?

Check out from microchip:
AN901 - Using the dsPIC30F for Sensorless BLDC Control (direct input sensorless)
AN894 - Motor Control Sensor Feedback Circuits (talks about op-amps, comparators, etc)
AN970 - Using the PIC18F2431 for Sensorless BLDC Motor Control (Lower end sensorless solution)

From freescale semiconductor:
AN1913 - 3-phase BLDC Motor Control with Sensorless Back-EMF ADC Zero Crossing Detection using 56F80x (advanced looking sensorless, nice looking micro, but I've never used freescale)

Ciao!
Pat
 
A while back on the http://www.parallax.com forums a discussion on sensorless commutation of BLDC motors started. The attached .pdf was one of the things found during that discussion. The sensing method this person proposes is similar to zero-crossing systems that use a virtual neutral voltage, but modifies the PWM going to the motor so that the neutral voltage of the motor is at the controller's ground when detecting zero-crossings. A key point is that three simple I/O pins with series resistors is enough to sense the motor's phase. (ofc performance can still be improved with some front end circuits, also discussed in the paper.)

I've been meaning to play with this myself. But, it's got a half-dozen projects in line ahead of it. :roll:

Marty
 

Attachments

  • sensorless comutation of bldc motorsT.pdf
    769.8 KB · Views: 277
ZapPat, i was going to use one of the mega avrs, they have up to 200kHz ADC clock at full 10 bit resolution, but it takes 13 cycles to convert it, so its about 68 microseconds, or 15ksps. the motor i planed on using was the hxt 130kv one http://www.hobbycity.com/hobbycity/store/uh_viewItem.asp?idProduct=5142. im definitely with you on the simplicity and least amount of parts deal. modular is good.
 
Circuit above looks like it should work. The 5v zeners on the outputs are probably unnecessary since the inputs to the MCU have diodes to clamp the input to the supply voltage and the series resistors shoud take care of the rest.

I think most of the RC sensorless controllers get away without any active front end stuff. They certainly commutate fast enough. It would be good to reverse engineer one....
 
file.php
(this is Dirty_d's second schematic)

In general this circuit looks good based on my limited understanding. Looks like this is a Schematic from a simulation program? Your motor model for testing won't be very good until a PWM section and some noise is added. I'd expect to see some problems due to PWM and noise if C1-6 get too large or are not well matched. I think a better place for C1-6 is floating between the inputs to each op-amp. (i.e. connecting nodes 5 to 8, 7 to 9, and 10 to 6 with no ties to ground) The op-amps by themselves should get rid of any common mode voltage swings from PWM on their inputs. This should increases the circuit's responsiveness. Meanwhile, the capacitors should filter variations in EMF due to noise just as well. Additionally, matching the capacitors should not be as critical now plus the size of capacitors could be boosted now that they don't need to pass high frequencies from PWM. The other place I'd filter is after the output of the op-amps. (I.e. add an RC filter between nodes 14-16 and any microprocessor) I think this is a better location to catch glitches.

Marty
 
dirty_d said:
ZapPat, i was going to use one of the mega avrs, they have up to 200kHz ADC clock at full 10 bit resolution, but it takes 13 cycles to convert it, so its about 68 microseconds, or 15ksps. the motor i planed on using was the hxt 130kv one http://www.hobbycity.com/hobbycity/store/uh_viewItem.asp?idProduct=5142. im definitely with you on the simplicity and least amount of parts deal. modular is good.

Nice looking motor for sure! I wonder how many continous watts this thing can output, and what kind of efficiency curve it has? I see two of these on an electric paraglider... :roll:

68usecs for 13 cycles? That would be about 5usecs per cycle, meaning that your micro's internal clock is only running at 200kHz... are you sure about this, dirtyd?

I like fetcher's idea of reverse-engineering an RC controller, and specially so I could check out the FET/bypass cap setup they use. They fit a lot of power into a small package, and I know from my past experiences that this is quite a big challenge. As the power output designs are pushed further to the limit, much time and energy goes into making things just a little better. They are so small, they must use a KISS type design (for the circuit that is - MCU code weighs nothing though!). This would also imply they use a very electrically simple commutation setup (as fetcher also mentioned).

Does anyone have a high end RC controller for sale cheap? :D Or a busted one maybe even?
 
ZapPat said:
Does anyone have a high end RC controller for sale cheap? :D Or a busted one maybe even?


Out of all the RC controllers I have tried, only shulze and Castle controllers were decent enough to use in an EV. The rest won't handle quick load changes without losing sync. The Castle Air controllers are good, but the ground controllers are a huge step above. The newer ICE series air controllers will have the same hardware as the ground controllers, so the feedback EMF detection will be better than any other in the world IMO.

I talk with the owner frequently, and of course his knowledge is way above my head. It is interesting hearing what he has to say about control, he has patented designs for sensorless feedback detection.
 
ZapPat, the megaAVR can be run up to 20MHz, the maximum speed the ADC unit can run is 200KHz, so you put the 20MHz clock through a prescaler, then for a conversion it takes 13 ADC clock cycles, so 65uS for a single conversion at max speed. there are other avrs that have faster ADC units.
 
i like the modular idea, i think it would be cool to just design the controller to run off of hall signals, that will be pretty easy. if it is to be used with a sensorless motor, then an addon board or something can be plugged into the controller, it will watch the phase wires and generate the same signals as hall sensors. the current limit could be adjusted to whatever the user needs with a pot. a jumper on the board can be put on or taken off to tell the mcu to run in sensored or sensorless mode, for the 30 degree delay after zero cross signals, and the startup routine.
 
dirty_d said:
i like the modular idea, i think it would be cool to just design the controller to run off of hall signals, that will be pretty easy. if it is to be used with a sensorless motor, then an addon board or something can be plugged into the controller, it will watch the phase wires and generate the same signals as hall sensors. the current limit could be adjusted to whatever the user needs with a pot. a jumper on the board can be put on or taken off to tell the mcu to run in sensored or sensorless mode, for the 30 degree delay after zero cross signals, and the startup routine.

This is what I hope to be able to try to work on from a strictly analog approach. Since I only design analog, this will be a pretty unusual way to try, in these days of digital. I have to better understand how BLDC motors operate before I expect to get very far, however. One thing I would want such a controller to do would be to use current feedback control for each motor phase winding. Almost pure current mode is how the brushed motor controller that I made, and presently use, works. I prefer brushed motors and that probably will remain the case once I have worked with this project.
 
Back
Top