Triple phase sensorless brushless motor control and OSHW project! - Page 1
Forum section: electronics / general

author: smashedProton
author_rank: Frequent Contributor
timestamp: February 13, 2013, 04:47:40 am
content: Hi all, I have started a new project with the intention of making it open source. It is an all in one reciever board for high end remote control planes.The way that rc planes are currently made is by independent off the shelf modules with secret black magic components. These components (speed controllers, recievers, video transmitters, battery circuitry) are all expensive , and made from a handful of independent companies.My goal:- low cost- simple- video transmitter (for first person flying)- 6 channel rc receiver (possibly just use a hobbyking one as a daughter board for simplicity and compatibility)- current monitor- low battery voltage protection- brushless electronic speed control-fiberglass board will double as a wing spar to save on weightPretty cool huh?The reason that I am posting this is that I have reached a hiccup in my design. The brushless speedcontroller is complicated as hell. I have read research papers (http://scholar.lib.vt.edu/theses/available/etd-09152003-171904/unrestricted/T.pdf) and I have taken apart a speed controller of my own. The thing that puzzles me is the implementation of inductive spiking as a feedback mechanism, and speed control.To start discussion off, I have taken a magnified picture of my speed controller. Ignore the left half, as all it is is power regulation, filtering, and input buffer. In the middle of the board, there is an atmega 8 MCU and what I suspect is an ADC. The back has a heatsink that I cannot remove, but I suspect it to have 3 n channel fets and 3 p channel fets. The right sight of the top has 15 resistors 3 transistors, and what looks like an rc tank ciruit. The top three are resistors in pull down configuration. The next 6 below them look like resistor dividers. Presumably they are to attenuate the inductive spikes so that they wouldn't blow the ass out of the transistors. The next 3 resistors look like base drive resistors for the next 3 transistors. My guess is that the transistors are another step of isolation between the adc and the motor. They could also be used in a multiplexer system, i have no idea. The rc time constant could be for sample rate or something. I feel really out of my league hereThank you for reading through my project. Any help is appreciated. Thank you!

author: Stiege
author_rank: Regular Contributor
timestamp: February 13, 2013, 04:53:21 am
content: Looks interesting.Funny that you mention an open source project. I did wonder if anyone on the forum would be interested in sharing a Dropbox folder and starting on something. I had an all-pcb quadcopter idea in mind but am open to suggestions.

author: smashedProton
author_rank: Frequent Contributor
timestamp: February 13, 2013, 05:03:46 am
content: To create a second board for a quadrotor wouldn't be too difficult. Just a re spin of the board with more ESCs and some gyro/accelerometer sensors. no need to re invent the wheel

author: NiHaoMike
author_rank: Super Contributor
timestamp: February 13, 2013, 05:25:39 am
content: Microchip makes 3 phase inverter chips (as in literally connect power and control to one side and a small 3 phase motor to the other, no programming needed) designed to control computer fan motors, but they would only work for small model aircraft. It might be possible to connect NPN/PNP followers to the phases with resistors to let it sense the voltages, but I haven't tried it.My friend Megan Cornner actually built a model airplane that used dsPICs for the motor drives. She started from the Microchip app notes and it didn't take her very long to get a great motor drive. DSP based motor drives have been in use in electric vehicles for a long time and they are constantly pushing into smaller and cheaper applications. (The cooling fans in some high performance PCs are DSP controlled.) My power electronics instructor even mentioned that some toilets in Japan have DSP drives!As for the rest of the stuff, if you use Bluetooth for control, it could allow the use of a common phone or tablet as a controller, or possibly even a Wiimote. Video can definitely be done but it would a lot of cost and really increase the complexity. Probably the cheapest way would be to strip down an old phone that can stream video over WiFi. (Really, designing your own device that has a high speed processor is easier said than done!) And if you're going the route of using a stripped down phone, you can dispense with the Bluetooth or whatever and just wire the flight microcontroller to the UART. (Raspberry Pi plus the upcoming camera attachment works too, but that might be a little bulky for smaller planes.)

author: smashedProton
author_rank: Frequent Contributor
timestamp: February 13, 2013, 05:37:19 am
content: Excellent sugguestions but your idea by using transistors to buffer the output of the microchip part may not work for me. The outputs are also inputs to find the location of the rotor. I may be able to use resistors on each terminal (past the fets) to attenuate the back emf to go back into the microchip part. But I am talking out of my ass and have no idea what we are doing.As for the video, I was thinking of going vhf analog for the connection. I want it to be higher power, and bandwidth isn't that much of an issue. Maybe i could etch circularly polarized antennas straight into the board to make it even lighter.http://www.eeweb.com/blog/circuit_projects/500-mw-vhf-video-transmitterhttp://mathieu.huchard.free.fr/pdf/EuCAP2007.pdf

author: Psi
author_rank: Super Contributor
timestamp: February 13, 2013, 06:17:40 am
content: If you want to understand how the firmware drives the motor, and you can understand ASM, have a look at the simonk ESC sourcecode.He (simonk) wrote his own firmware that works on many different hobbyking/tgy ESCs in order to speed up the ESC responsiveness for use in quadcopters.https://github.com/sim-/tgy

author: free_electron
author_rank: Super Contributor
timestamp: February 13, 2013, 06:25:10 am
content: Whoa. So you want to make a sensorless three phase controller ?Not easy...Here is how the system works:The motor is a star configuration. Only two wires are powered at a timeCode:ABC+-..-+-.+-+..+-+.-The dot indicates the unpowered phase. So you need three top side mosfets and three bottom side mosfets. Each fet is driven by a pwm signal that is modulated using a sine table . So essentially you creat ac currents through the coils. This creates a very smooth operation. Around the time the pwm reaches 50 % duty cycle in the operation you disengage both mosfets and connect both ends of the actuated phases to a voltage level of 1/2 vcc. At that moment you need to measure the delta voltage between 1/2 vcc and the unused phase.So if you are in step 1 and you approach 50% duty cycle of the sinewave you disengage the drive, connect phase a and b to 1/2 vmotor and you put a comparator that looks at the delta between 1/2 vmotor and phase c. If this voltage level changes sign meaning phase c goes from below 1/2 vmotor to above 1/2 vmotor or vice versa, the rotor has just passed the magnetic pole. You can now re-engage the drive logic.The mechanism works by prediciting when the rotor will 'fly-by'. If it flys by too late it means that your field is rotating faster than the rotor can follow. Field breakage will stall the motor. If you fly by too early it means your motor is running faster than your set speed. Change the pwm table so you pump less current in the coils so you slow down. (Current x mechanical load determines speed. Drop current and speed goes down. )So now you can do speed control.There is another problem you will need to tackle : startup.At startup there are two problems. 1) there is not enough back emf to sens the speed and close the control loop described above. So you simply need to make a mechansi. That steps the motor faster and faster until you get a stable feedback signal. Then you can engage the drive.But there is a bigger problem.. Which way do we want to spin ? It is possible for the motor to take off in the wrong direction !The trick is to find out where the rotor sits and start by energising the phases using the next logical step....That mechanism i cannot disclose. There is a few around but they are all either patented or NDA. The ones i know are NDA... So i can't help you there.The above is how a harddisk controller drives it bldc. Those controllers also employ additional trickery but i am not at liberty to disclose.

author: Kremmen
author_rank: Super Contributor
timestamp: February 13, 2013, 07:26:26 am
content: A few comments here:Firstly, properly controlling a so called brushless DC motor is not trivial. Depending on the level of sophistication desired it will be anything from a design exercise up to a complex challenge. The latter if you wish to do sensorless vector oriented or direct torque control.Secondly it is not necessarily the case that you need sinusoidal phase voltages. Motors classified as "brushless DC" have their magnet circuit geometry designed with trapezoidal excitation voltages in mind. This precisely because a 3 phase bridge will naturally produce that kind of output voltage. Motors that tend to be called "PM synchronous" are then designed for sinusoidal voltages.There is no big secret in finding out the rotor position - the techniques are well established and commonly known so no risk of breaking patents or NDAs there.I could go on but instead hand over to James R Mevey - please see his Master's Thesis, linked herehttp://www.mediafire.com/view/?u74w369m2fs387p(warning: large file ~8MB).In my opinion it is still unsurpassed as an introduction to the way externally commutated synchronous AC motors should be controlled. Read and understand, and you questions will be answered.

author: free_electron
author_rank: Super Contributor
timestamp: February 13, 2013, 07:55:06 am
content: There are indeed well known techniques for finding rotor position. I'm just saying that the ones i know i can't disclose.

author: mazurov
author_rank: Frequent Contributor
timestamp: February 13, 2013, 08:10:19 am
content: Allegro makes a nice BLDC pre-driver with phase advance, the P/N is A4960. I made a controller from datasheet reference and it worked on the first try ->https://www.circuitsathome.com/diy-2/advanced-brushless-dc-motor-controller. Could be overkill for small motors though, the thing really shines driving 100A/phase loads.

author: Psi
author_rank: Super Contributor
timestamp: February 13, 2013, 08:59:21 am
content: Quote from: mazurov on February 13, 2013, 08:10:19 amModern remote control planes can put out a few kW.Most of them are around 20-60A and around 300-700W but up to 3kW is still commoneg, this one is 2kW and its only 50mm x 50mmhttp://www.hobbyking.com/hobbyking/store/__22035__NTM_Prop_Drive_50_50_580KV_2000W.html

author: ignator
author_rank: Regular Contributor
timestamp: February 13, 2013, 01:12:22 pm
content: Forgive my ignorance here, but as this is a one off design, can't a shaft encoder be used to determine rotor position relative to stator poles. Seems this is designed out for expense and reliability. My experience has been with avionics servo motors. We use a 2 phase design, that have independent processor control for safety reasons, and it has shaft position hall effect sensors.ignator

author: poorchava
author_rank: Super Contributor
timestamp: February 13, 2013, 03:51:47 pm
content: Shaft encoder could do if it can handle the frequency. Haven't tried that myself. But for determining the starting position you would need absolute, nonvolatile type. And those aren't cheap

author: jerry507
author_rank: Regular Contributor
timestamp: February 13, 2013, 04:57:45 pm
content: Mevey is complete overkill.http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en546013http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en533912

author: Kremmen
author_rank: Super Contributor
timestamp: February 13, 2013, 06:40:41 pm
content: Maybe so, insofar as this thread seems to be about soldering together a couple of ready made chips, not so much to actually design a control system.

author: smashedProton
author_rank: Frequent Contributor
timestamp: February 13, 2013, 08:14:15 pm
content: It's fine, soldering readymade chips is really all that you can really expect a teenager to do. It might just be better to rip apart readymade modules, and soldering them as a psuedo daughterboard. It will certainly be easier than designing it myself.The method of starting could just simply be done with a 0 threshhold say the bottom 10 percent or so would be a deadzone. when the input exceeds that, there would be two startup phases. A sensing phase where it jitters it and senses the output across secondary sensitive input circuitry, and a power phase where it reaches 10 percent power. At least this is my theory.Well, the project is a lot more difficult than i have expected. Gotta love proprietary tech

author: NiHaoMike
author_rank: Super Contributor
timestamp: February 14, 2013, 06:20:52 am
content: Quote from: free_electron on February 13, 2013, 06:25:10 amWhile there are some places where a motor spinning in the wrong direction for even a moment is bad (you don't want your car to reverse for a moment before driving forward!), it is perfectly fine for an airplane propeller to spin backwards for a moment prior to it taking off. And the fact that propellers and fans pose no load at standstill (ignoring the negligible friction in the bearings) makes them even easier to start up - just send low voltage, low frequency open loop and switch to closed loop when back EMF is detected.

author: poorchava
author_rank: Super Contributor
timestamp: February 14, 2013, 08:04:19 am
content: You may want to take a look at Atmel's application notes AVR172 and AVR498. They give you a simple example of sensorless bldc control

author: ignator
author_rank: Regular Contributor
timestamp: February 14, 2013, 08:09:07 am
content: Quote from: poorchava on February 13, 2013, 03:51:47 pmI've seen shaft encoders that have both the quadrature output, and a zero output, (I think that's what it was called). However is this not just a speed control for a brushless motor? At least I thought that's what the OP was wanting, not an absolute position controlled motor.

author: jerry507
author_rank: Regular Contributor
timestamp: February 14, 2013, 04:34:01 pm
content: Quote from: Kremmen on February 13, 2013, 06:40:41 pmI see what you're saying and while I would highly encourage the OP to read and really understand the paper (and the whole complex system), some people don't want to dive right in first. If the OP gets a prototype going and then decides he wants more than what the chips can do or wants to know more, go ahead. But a lengthy time between initial interest and seeing something work can turn a lot of people off. Appnotes are a better size and complexity than a masters thesis for getting people off and running.

author: Kremmen
author_rank: Super Contributor
timestamp: February 14, 2013, 04:59:20 pm
content: I guess my response was mostly to this:QuoteEspecially the comment about research papers, of which the Mevey thesis is one. But if this is not desired then no prob, whatever floats your/the OP's boat. Just don't expect to gain true understanding from a Lego block approach. But then maybe true understanding was not the point.

author: smashedProton
author_rank: Frequent Contributor
timestamp: February 15, 2013, 03:39:49 am
content: I have been wondering, is it a bad idea to gang multiple motors in parallel on the same controller? Or would it drift, and blow up?

author: poorchava
author_rank: Super Contributor
timestamp: February 15, 2013, 09:30:35 am
content: That would be possible if they were perfectly identical. Since in reality they will never be, then it's not possible.For example one motor may produce the inductive spike i a bit different instant tha the other one does. And there you have a problem.