how to build my own brushless motor driver? - Page 1
Forum section: electronics / projects

author: FrankBuss
author_rank: Unknown
timestamp: October 01, 2016, 08:21:52 pm
content: If I want to build my own brushless motor driver, for replacing the usual quadcopter ESCs (I'm planning to build my all-in one board, with FC, PDB and ESCs on one board), where can I find more information about it? Would a FPGA be useful to control multiple motors with high precision? And how can I implement a short circuit protection for the high currents used for the motors (like 30 A, and so far two ESCs from different manufactures on different of my copters released the magic smoke after some heavy crashes) ?Maybe I can use just an oversized FET, like the PSMN0R9, which has 1 milliohm Rdson and allows 100 A continuous current (and a ridiculous 1563 A peak current)? The internal battery resistance, connector and cable resistance is probably not low enough to deliver more than 100 A, so would be short circuit safe.

author: NiHaoMike
author_rank: Super Contributor
timestamp: October 01, 2016, 08:45:52 pm
content: FPGA is overkill for that application. (It can make sense for bigger stuff like EVs and HVAC or very high precision like CNC.) A dsPIC or C2000 would be a better fit. Some C2000 can support 2 motors.

author: FrankBuss
author_rank: Unknown
timestamp: October 01, 2016, 09:03:48 pm
content: I've read something about sinusoidal driving:http://www.atmel.com/Images/doc8030.pdfThis requires very precise timing, if I want to minimize jitter and might be difficult for one microcontroller, if I want to control 4 motors. But it is easy even for a small and cheap FPGA. But maybe jitter doesn't matter much for this application. Would be still nice to have a perfect controller.

author: zapta
author_rank: Super Contributor
timestamp: October 01, 2016, 09:23:24 pm
content: Have you tried to reverse engineer an off the shelf ESC?It can provide you useful information.Edit: searching for 'open source esc' provides some useful hits.

author: AutomationGuy
author_rank: Contributor
timestamp: October 01, 2016, 09:24:55 pm
content: I have build a BLDC controller using an ATMega32 for each motor one. Works fine and easy to adapt software requirements to many problems. The software can get quite complex (failure behaviour, communication, regulation) depending on your requirements. The Atmel AppNotes are helpfull for that.

author: max_torque
author_rank: Super Contributor
timestamp: October 01, 2016, 09:39:16 pm
content: I would suggest reading, and understanding, this guys blog:http://scolton.blogspot.co.uk/p/motor-controllers.htmlIt's got a huge amount of very well explained info on motor controllers!

author: FrankBuss
author_rank: Unknown
timestamp: October 01, 2016, 10:20:18 pm
content: Quote from: max_torque on October 01, 2016, 09:39:16 pmThat's cool, I totally have to implement this for my quadcopter

author: FrankBuss
author_rank: Unknown
timestamp: October 01, 2016, 10:41:29 pm
content: Quote from: AutomationGuy on October 01, 2016, 09:24:55 pmWhich one do you recommend? I have sensorless motors and I found this one:http://www.atmel.com/Images/Atmel-8305-AVR928-Scalar-Sensorless-Methods-to-Drive-BLDC-Motors_Application-Note.pdfLooks very useful.You are right, with a microcontroller it might be easier to implement this. Maybe the FPGA can help with some realtime tasks, because you never have enough timers in a microcontroller, and sometimes setting up the registers in a way that they work how you need it, if it is possible at all, needs more time than just writing some VHDL code which does exactly what you want.

author: awallin
author_rank: Frequent Contributor
timestamp: October 02, 2016, 07:07:38 am
content: fwiw years ago I tried with dsPIC33F and an IRAMS integrated power stagehttp://www.anderswallin.net/2006/06/first-steps-with-brushless-servodrive-microchip-dspic-irf-irams/I got as far as getting the motor rotating and some other basics, mostly following microchip application notes - but then life intervened..I would suggest to start simple and get something going quickly. Use a low DC-rail and motor at first (not 100V or 200V for industrial CNC-machines!) because you will burn things at some point and the smoke is less with 12V. Maybe use one of the integrated H-bridge ICs so you don't have to design that initially and worry about gate-drivers etc.Start with one of the microcontrollers that have peripherals you need (3-phase PWM, capture for hall-sensors, quadrature counter for encoder) and go from there. If you don't already have a lot of FPGA experience it is really jumping in to the deep end of the pool to start there...

author: tatus1969
author_rank: Super Contributor
timestamp: October 02, 2016, 10:59:15 am
content: I did a couple of designs based on Field Oriented Control. Have a look herehttps://www.eevblog.com/forum/chat/regulating-speedtorque-of-induction-motor-methods/FOC brings benefits like direct torque/amperage control, better motor efficiency, better dynamic behavior (acceleration, speed). The cost is higher complexity/cost, more CPU power, lower inverter efficiency (you need continuous PWM all three legs -> switching losses).I used a ready built library from ST, works very well and is free of charge. Drawback is that you need to sign an NDA in order to receive the source code.http://www.st.com/en/embedded-software/stsw-stm32100.html

author: FrankBuss
author_rank: Unknown
timestamp: October 02, 2016, 11:36:58 am
content: Quote from: tatus1969 on October 02, 2016, 10:59:15 amThe licence would be too restrictive for my project, I want to release it as open source hardware.But I found a really nice looking project:http://vedder.se/2015/01/vesc-open-source-esc/I think I'll use this as a base for my design, but adding current sensing to the individual motor wires is a very good idea.

author: tatus1969
author_rank: Super Contributor
timestamp: October 02, 2016, 12:02:36 pm
content: Quote from: FrankBuss on October 02, 2016, 11:36:58 amUnderstandable.A colleague of mine is using the VESC to drive a longboard, and he told me that the transistors occasionally die in FOC mode. That design is using a DRV8302 to control the MOSFETs, and I personally have a bad track record with those, and also the IRF family (IRF2184 and similar) having trouble with ringing on the motor phases. Under specific timing conditions and when ringing causes the phase voltage go below VSS-5V, the IRF2184 will enable both the low and high side transistors simultaneously. Imagine what happened in our lab when that happened to our 25kW inverter with 5 Farad (not micro, not milli) capacitance on the DC bus. The ISOTOP transistor spit out a huge green/blue flame...

author: FrankBuss
author_rank: Unknown
timestamp: October 02, 2016, 12:34:25 pm
content: Quote from: tatus1969 on October 02, 2016, 12:02:36 pmWow, this sounds terrible, a driver should never do this. But 5V below GND sounds like a really bad ringing. Would a series resistor to the power FET gates reduce the ringing?

author: CraigHB
author_rank: Regular Contributor
timestamp: October 02, 2016, 03:02:34 pm
content: A quadcopter ESC needs to perform well with a small footprint. It's possible to use something like a TI DRV8305 which provides a lot of features, however a design like that increases footprint quite a bit and provides advanced features not really required for a lightweight and simple BLDC motor controller. Typically production ESCs for models use a fully µcontroller based solution where FETs are driven by discrete gate drivers. Most commonly Silabs and Atmel MCUs are used.I've designed and built a couple ESCs myself for model helicopters. Rather than re-invent the wheel I've designed them around the open source BLHeli suite (https://github.com/bitdump/BLHeli). Coding is definitely the most involved part of designing and building your own ESC. Using an open source software package allows me to design application specific ESCs without doing all that code development. Coding the controller yourself is great as a learning exercise, but I build these controllers for practical reasons and don't want to spend that much time on it.There are no posted reference designs for BLHeli. What I've done is kind of reverse engineer design requirements by looking at production ESCs and by looking at pin-outs specified in code. You wont' really find anything that says, "use this design with this firmware." However design is pretty standard across production ESCs used for powered models. There's some variation between them, but once you've done one you can do any other.QuoteYou can reduce di/dt rates and thereby ringing by using a series gate resistor, but that can be a problem for ESCs used in models. They often handle relatively large currents and slower transitions increase FET heating. Generally it's better to use a snubber resulting in some loss of efficiency instead. FETs can already run at the limit of thermal tolerance in the best of cases. Lengthening transition times is something to avoid since it results in additional heating.

author: nano
author_rank: Contributor
timestamp: October 02, 2016, 03:55:20 pm
content: I’m playing with BLDC controllers aswell just for fun. I yet have to find a reliealbe commutation strategy.For an easy start I reverse engineered theKISS24AESC and reprogrammed the firmware.I can share more details if somebody is interested in that.For a nice ESC software implementation in C look atSapog.

author: CraigHB
author_rank: Regular Contributor
timestamp: October 02, 2016, 04:23:21 pm
content: Going back to the OP if that's okay.Quote from: FrankBuss on October 01, 2016, 08:21:52 pmWish it was that simple. You have to pay attention to total gate charge since that determines gate current requirements and speed at which the FET transitions. Lower is better. That particular transistor has a fairly large 51nC typical @4.5V. You'd have to use a driver rated for around 6A. It would be better to use something with a lower gate charge requiring only a 2 or 3A driver. There's a down side. The lower the gate charge the higher the "on" resistance. It's a trade-off you have to make in design like most trade-offs in component selection.QuoteNot so fast. The IR (internal resistance) of the batteries used in powered models is the lowest of any battery you can buy over the counter. It's not unusual to see it as low as a couple mOhms per cell. That being the case short circuits can pull hundreds of Amps resulting in a meltdown somewhere in the circuit. Shorts tend to go after the hottest part of the circuit which is usually the ESC, but sometimes the battery can go up instead. LiPo fires are definitely something you don't want to happen.

author: tatus1969
author_rank: Super Contributor
timestamp: October 02, 2016, 05:13:30 pm
content: Quote from: CraigHB on October 02, 2016, 03:02:34 pmthat is a 200V 200A inverter using screw mount ISOTOP transistors. Parasitic inductance and diode reverse recovery are at different levels with these. Snubbers would have been too large and heavy, gate drive and di/dt werecoptimized for a good compromise between efficiency and EMI/ringing. 5V is not much, the problem was the ancient level shifting technology of these H bridge drivers. Not even known by IRF those days. They added some footnotes and appnotes thereafter.

author: FrankBuss
author_rank: Unknown
timestamp: October 02, 2016, 08:19:14 pm
content: Quote from: CraigHB on October 02, 2016, 03:02:34 pmRight, using a BLHeli based design would be even easier, no software development needed at the beginning, and the hardware is cheaper. Once the hardware works, I can still experiment with it. I guess if I identify all chips and connections of a commercial ESC, it would cause no legal problems to implement my own (compatible) version of it, if the layout is different, just the same parts?I really like my DYS XM20A. It uses these parts:- 6 x AON7418 FET- IMP3201 FET driver- F396 Silabs microcontrollerMaybe I'll just start with this design for my ESC, just adding some current measurement shunts and high-side measurement chips for playing with it later, enhancing it with a current limiter etc.

author: tatus1969
author_rank: Super Contributor
timestamp: October 03, 2016, 09:06:52 am
content: if this is for a quadcopter, then you may consider going for FOC. What you get is the ability of torque control. A normal ESC can only provide voltage to the motor, current follows somehow. FOC gives you better control, and it can even implement 2-quadrant operation and decelerate the rotor, feeding back energy to the battery. That would allow you controlling your quadcopter more dynamically And it does greatly help present the accelerometer based control loops that you will likely have. You quadcopter will stay in the air like nailed down.If you want to be prepared for that, all you need to do is add high bandwidth current measurement of at least two motor phases.

author: kt315
author_rank: Regular Contributor
timestamp: October 06, 2016, 12:34:23 am
content: I've seen a rather long thread on this at rcgroups.com. I believe it is this one:http://www.rcgroups.com/forums/showthread.php?t=140454It is a long thread and some of the info is a bit dated. There are a few very knowledgable guys though. I believe quax was active on this forum at some point as well.Update: the monster thread ishttp://www.rcgroups.com/forums/showthread.php?t=200567

author: gamalot
author_rank: Super Contributor
timestamp: October 06, 2016, 02:19:07 am
content: I think STMF3xx MCUs are cheap and easy to usehttp://www.st.com/content/ccc/resource/sales_and_marketing/promotional_material/brochure/fa/7d/6f/b6/8e/c5/4e/b1/brstm32f3.pdf/files/brstm32f3.pdf/jcr:content/translations/en.brstm32f3.pdf

author: Doctorandus_P
author_rank: Super Contributor
timestamp: October 24, 2016, 12:20:16 am
content: Check "SimonK".it's avr asm source for a popular bldc controller based on an AVR and some mosfets.Ti also has some excellent application notes for BLDC motors

author: CraigHB
author_rank: Regular Contributor
timestamp: October 24, 2016, 08:27:03 am
content: I like the Silicon Labs MCUs better than the Atmel ones. They're faster and more optimized for the application. Though I think SimonK only runs on Atmel. BLHeli is another open source ESC platform and it supports SiLabs as well as Atmel MCUs. TI makes some powerful MCUs that would work well, but they tend to be power hungry and they're not inexpensive.I've designed and built a couple SiLabs based ESCs that run BLHeli firmware. I'm not particularly motivated to do the coding myself. It's pretty involved and I'm more interested in building something that simply works. I've never coded an ESC so it would be a big learning project. I fly model helicopters and that's what I build them for. I'm working on a 12S design right now. It's actually worth the effort in terms of cost since high voltage ESCs are pretty expensive. Though I'm rolling my own mainly to use the highest quality components you usually don't get with off the shelf ESCs. Plus I think I can design for better efficiency and reliability.

author: FrankBuss
author_rank: Unknown
timestamp: October 24, 2016, 09:37:32 am
content: Quote from: CraigHB on October 24, 2016, 08:27:03 amThis sounds interesting, can you share a schematic? I'm more interested in the software, so my plan was to reverse engineer just my DYS XM20A to have a known working device to start with (only adding some current measurement resistors for more advanced control later, and integrating 4 of it on one board, together with a FPGA for later), but I can't get the IMP3201 MOSFET driver chip which is used on this ESC. Alibaba had some listings, but when I asked, they were not in stock or they didn't respond (I guess they don't care much for 100 pieces). Then there was a listing at jotrin.com and I bought some, but then they said it is not available and wanted to refund. These suppliers should really improve their inventory softwareWould be cool to have a working schematic of a SiLabs based ESC with BLHeli, with all quality parts and in stock from Digikey.

author: nuno
author_rank: Frequent Contributor
timestamp: October 24, 2016, 02:17:22 pm
content: https://endless-sphere.com/forums/viewtopic.php?f=30&t=36602https://endless-sphere.com/forums/viewtopic.php?f=30&t=57877

author: CraigHB
author_rank: Regular Contributor
timestamp: October 24, 2016, 04:06:55 pm
content: Quote from: FrankBuss on October 24, 2016, 09:37:32 amIt's a nice feature to build your ESCs onto one board, units like that are not commonly available. Building your own can be a benefit since if you design to run a certain voltage range you can use more ideal parts compared to something like a 2 to 6S ESC. I'll attach a schematic for a dual 2S ESC I did used in a micro heli running a brushless tail. It's strictly for 2S due to parts voltage ratings. I'll also post the 12S design I'm working on for a different take.QuoteSometimes it's hard to get Chinese parts. They stock stuff over there our domestic suppliers do not. In that case you need to find a suitable substitute which is usually not too hard in terms of gate drivers.There's a few ways to go on ESC design. Sometimes you can just drive the low side MOSFETs right off the MCU output pin if you keep PWM frequency low, gate charge low, and can power the MCU off higher voltage. Otherwise there's some nice high and low side MOSFET drivers you can use like the TI UCC27211D. I'm using that one for my 12S design.In some cases you might want to add low pass filters on the BEMF sensing network. I've not found I need to do that with the lower voltage, lower power ESCs, but it's a good idea when designing something for higher power. Just adding a small value MLCC cap on each low side phase of the network can do the job.You may need to adjust MOSFET transition times either with a driver that supports it or with a gate resistor inline. You can get a lot of ringing with higher power ESCs. On my 12S design I'm going full speed on transition times with the addition of snubbers, one across each switch. Heat is always a battle with high power ESCs and minimizing transition times can help reduce heating, but it comes at a cost of a little efficiency since the snubbers are dumping energy.

author: FrankBuss
author_rank: Unknown
timestamp: October 24, 2016, 04:57:58 pm
content: Quote from: CraigHB on October 24, 2016, 04:06:55 pmThanks, your 12S circuit looks good. You are using 10V for the driver IC, so I guess it would work for 3S and 4S as well, which I normally use? But why do you use a linear voltage regulator? With 6S (50V) input voltage it might get hot. I think I'll replace this in my circuit with a switch mode supply. I might need more power anyway if I want to power 12 driver ICs for my quadcopter. With which BLHeli firmware variation does it work?

author: FrankBuss
author_rank: Unknown
timestamp: October 24, 2016, 05:41:09 pm
content: Quote from: nuno on October 24, 2016, 02:17:22 pmLooks like he didn't publish the motor controller, and the ACS714 hall effect current sensor is very expensive, but the ACS711 does the same (if you don't need kV isolation) and costs much less. I'll use this for my circuit for an easy way to measure the current of the phases, for later enhancements.

author: CraigHB
author_rank: Regular Contributor
timestamp: October 25, 2016, 11:38:14 am
content: Quote from: FrankBuss on October 24, 2016, 04:57:58 pmYes the gate drivers run on 10V. It certainly would be possible to use switchers in place of the linear regulators. The main reason is for space savings. Two switching regulators would take up more PCB real estate. I need this ESC to be compact and light as possible. The linear regulators do have to dissipate some power at 12S. It's like a 1/3 Watt based on the demand for the components they power. That particular regulator has a thermal pad and the PCB has copper fill for it so should be fine. There's other advantages with linear regulators such as they are more tolerant to input noise and output is cleaner.That design is loosely based on the FVT Littlebee 20A Pro, but that's only for the BLHeli firmware it will run. The hardware is purely my own design. The MCU pin-outs are actually a bit different so I'll have to do a little modification on the code and compile a custom binary. I'll start with the FVT Littlebee source code. Unlike the Littlebee my design is a true Opto ESC, big advantage there in reducing line noise for the receiver and controller. The BEC I'll be using is a nice switcher also my own design.That 12S ESC design will run down to 3S, but for voltages that low I'd use different parts. Most of the parts are pretty expensive because of the higher voltage rating. For example I'm using an array of MLCC caps on each phase. With lower voltage tolerance, caps would be cheaper and higher values could be used. Also I'd scale the BEMF sensing network for lower voltages. Keep in mind that design is still on the board. I do have PCBs, but I haven't started building it. Could work well, could work not so well.

author: C
author_rank: Super Contributor
timestamp: October 25, 2016, 12:57:52 pm
content: Something I saw during my web searches. Good or bad no idea.Think of what happens when you have an output from ESC short.With out motor inductance, current can change very fast at switch time. The idea is to add a small inductance to ESC output on board. Just enough to give current sensor on ESC and controller enough time to turn off the fet on that output when it shorts.

author: nuno
author_rank: Frequent Contributor
timestamp: October 25, 2016, 01:20:01 pm
content: Quote from: FrankBuss on October 24, 2016, 05:41:09 pmHe didn't publish the fw, the chip is the motor controller and sold as is, you look at it as any other IC. This is one of the most advanced motor controller ICs you can find today in this range. The second link is an example of a good (low inductive parasitics) power stage.

author: tatus1969
author_rank: Super Contributor
timestamp: October 25, 2016, 02:36:54 pm
content: Quote from: FrankBuss on October 24, 2016, 09:37:32 amThat seems to be a 600V high voltage h bridge driver, that is really not appropriate for a Lipo BLDC. These ones normally have high dead times, during which the body diodes of your MOSFETs have to conduct all the current. And these are the ones that tend to simultaneously turn on both high and low side when subjected to EMI and ringing. Bam, green flame followed by magic smoke!There are a lot of low voltage H bridge drivers around, pay attention to gate drive capability and dead time. Your choice should also have undervoltage lockout for both drivers that matches the MOSFET. When voltage is going down, you want to make sure that the gate driver switches off the MOSFET *before* the voltage becomes critical for the transistor. A good feature is also an integrated pull-down resistor at the driver output, otherwise you need to add it yourself to make sure the gate does never float.

author: tatus1969
author_rank: Super Contributor
timestamp: October 25, 2016, 02:45:38 pm
content: Quote from: C on October 25, 2016, 12:57:52 pmDon't think that will work, the control loop is probably slower than the 1000A+ current surge.Simple answer:a) home project -> suck in some magic smoke, replace melted parts, and promise yourself to pay more attention next timeb) professional project -> rely on the fuse that you included in your design right from the start;-)

author: C
author_rank: Super Contributor
timestamp: October 25, 2016, 03:42:51 pm
content: Quote from: tatus1969 on October 25, 2016, 02:45:38 pmThink you are reading something in to controller here. On a power supply, over current effects output directly not via control loop. Same here. Over current turns off fed directly or via fet driver, it's controller.The control loop then has more time time to decide, continue with two outputs or drop more.

author: LukeW
author_rank: Frequent Contributor
timestamp: October 26, 2016, 12:41:05 am
content: Almost every cheap brushless driver out there, in the low end hobbyist multirotor market, uses an 8-bit ATmega. It may not be the best, most powerful, feature packed solution, but it obviously "just works" at an adequate level to get something flying.

author: tatus1969
author_rank: Super Contributor
timestamp: October 26, 2016, 08:53:38 am
content: Quote from: C on October 25, 2016, 03:42:51 pmI do understand what you mean, the question for me is, is it practicable? Lets add some numbers: Let's take 25V and 25A from a reasonable motor controller, powered from a beefy 6S Lipo. Lets assume all resistance in a short to total = 10mOhm. This would result in a short circuit current of 2500A. I assume that our MOSFETs could handle a 100A max, and our overcurrent detector reacts in 10 microseconds. A quick LTSpice sim tells me that I need 2.4uH of inductance to achieve this. Now I have to choose a 2.2uH / 25A inductor. These are just huge, you need three of them, and that can easily double the size of that ESC. Cheapest part at Farnell = IHLP6767GZER2R2M01, 17.1mm x 17.1mm x 7mm, quite pricy.

author: CraigHB
author_rank: Regular Contributor
timestamp: October 26, 2016, 04:08:50 pm
content: It would be little more than 10 mOhms, but still there's really large currents. As already mentioned I don't think adding inductance is a viable solution due to component size. Still it takes some time for things to heat up. Looking at total energy the circuit actually does not need to react in micro-seconds, probably a couple milli-seconds is fast enough. For example 1kA at 25V for 1mS is only 25J. That's not a large amount of energy.It's actually not that unusual in high performance models for motors to fail with a short circuit. When those motors overheat there's a cascade effect resulting in a meltdown of the windings. Rare earth magnets start losing their magnetism as they overheat resulting in more current. That results in more heat which further increases loss of magnetism and further increases current.The best way to provide protection from short circuits is to sense current. The easiest way to do that is to simply monitor voltage drop across the FETs using the MCU's ADCs. A reaction time of a mS or two should not be hard to achieve in code. Inexpensive ESCs off the shelf typically don't monitor current and will usually burn up if a short occurs in motor windings. Though the higher end ones do monitor current and will protect themselves.

author: C
author_rank: Super Contributor
timestamp: October 26, 2016, 04:26:35 pm
content: start with h-bridge no little inductorNo load you have nice big square voltage wave.With motor inductance, a more rounded square voltage wave.Short with no inductor little square voltage wave & extreme current.Add little inductorAll the square waves get rounded a little, more for the higher current.Short is very rounded change and more voltage.You do not have to measure current.Measure rate of voltage change at switch time.A voltage vs time.It is a window of time when you have good information.Putting in some inductance makes short have a slower rate of change.But at same time still faster rate of change then normal motor.The little inductor supplies resistance to fast change. This results in less fast current rise for short, less current for a time, but at same time changes a no voltage to some voltage.10mOhm= 2500A20mOhm= 1250A40mOhm= 625ASo the little inductor is supplying some resistance for a time to limit peak current.Your 10mOhm with just 30mOhm added by inductor drops peak current.But you do not even get to the 10mOhm state on the fet as you started turning it off way before this value. Think turn on fet get to 1Ohm and turn off. The 1Ohm could be higher or lower due to total circuit.So you have a time window that voltage & current are related.Think voltage probe connected to scope with scope trigger connected to signal causing a switch change.The probe is at inductor & fet junction.For fault state, Other end of inductor is tied to ground, Supply voltage or some thing not motor .For not fault state, A low inductance motor.For fault state, You want to find a voltage on scope display that off to fet driver results in fet increasing it's resistance before max current harms fet.For not fault state, you are looking at the time change between fault and not fault for that voltage.Note that soa of fet helps here as you are in nano sec part of soa.Note that the resistance change rate of fet actually gives you some time.This is not total time current protection for fet, think more turn-on protection for fet.At power up you are preventing damage due to a short.At each transition you are checking for new shorts.If a short happens at other time, not this circuits main concern.Need to use the time changing numbers for this not static.You have a voltage trip that works faster with a larger change.Note that large voltage change is normal input for above.You have a inductor that makes a larger change that you want a very small value for.You have a fet that has a resistance change during switch time.You have a time where less is a short & greater is a motor with low inductance.Think for full turn on protection you may need to use two voltage comparators.High side short to ground and low side short to battery for example.Note also that if you can get one, a tapped inductor could make the change larger.If you think of paths, you change frompower rail, fet, current sense resistor, output.power rail, fet, inductor resistance, current sense resistor, output.Inductor resistance has a frequency component.You can not just use on fet resistance to compute short current. A short current is also limited by current sense resistor.So leaving power supply out, three components determine short current and fet switch resistance and inductor resistance have a time component.QuoteIn LTSpice you can do some un-practicable design and use the whole system effects to work down to what can be done.Guess I have seen to many designs that looks simple but actually has a lot of things coming together just right to make simple work.Sorry for ramble

author: nuno
author_rank: Frequent Contributor
timestamp: October 26, 2016, 05:27:55 pm
content: Inductor in series with a motor is a "valid" technique but have seen it being used only once, in a project by some students. It solves the problem of having a "slow" controller, but for a new controller design I think it's just a patch, with its disadvantages.To drive propellers, the controllers I've seen don't have current limiting; a propeller spends little to no time at low speed (only when starting, and that's pretty quick). Then you just switch from phase to phase guided by motor back-EMF, that's what I typically see in R/C controllers.

author: C
author_rank: Super Contributor
timestamp: October 26, 2016, 05:48:08 pm
content: If you look at timeCraigHB's voltage across fet has a time window when valid. Covers a large part of a half cycle of waveform. uses a voltage level as current trip point.My voltage change rate is outside the time window above, and in change part of cycle. Uses voltage rate of change as current trip point.Looking at protection sense In time,no protection(not needed), my protection, gap_in_time, CraigHB's protection & back to no protection(not needed).The time for fet'sdead time, low fet, dead time, high fet and back to start.My protection when tripped, prevents getting to gap_in_time & CraigHB's.CraigHB's when tripped prevents getting to my protection, gap_in_time, CraigHB's protectionThe two methods can work together.Both are actually sensing same spot.My protection could be done with no inductor.The very small inductor is a time stretch effect changes what is practicable.So no inductor to inductor that fits on board.Switching speed changes size of inductor.You adjust CraigHB's with voltage level.You adjust My protection with time.

author: nuno
author_rank: Frequent Contributor
timestamp: October 26, 2016, 06:22:33 pm
content: If you want a tough controller that can escape from a short circuit at the motor, use a FET/IGBT driver that has "desaturation detection", AVAGO for example has some of these.

author: tatus1969
author_rank: Super Contributor
timestamp: October 27, 2016, 07:32:47 am
content: Quote from: CraigHB on October 26, 2016, 04:08:50 pmThe weakest part might be the MOSFET, and that cannot handle a lot of pulse energy. For the application that I sketched this may be in the range of 50 to 500mJ. In my example, a 1mOhm MOSFET will receive 173mJ in 200us. I was working on a 25kW inverter with ISOTOP MOSFETs, and I once had a 50cm plasma flame melting its way all through a six layer high current board because of a driver failure turning on both L and H for a few milliseconds. Surely adding an inductor helps with output shorts, and I agree that this technique is common for industrial inverters (aside from lowering EMI), just want to say that I would not choose this solution in a hobby ESC, just add a fuse instead.Quote from: CraigHB on October 26, 2016, 04:08:50 pmThe higher end ones also typically come with phase current measurement for torque control, FOC, and alike. There you get this feature basically for free, but I tend to rely on hardware only for protection, like fast comparators.

author: tatus1969
author_rank: Super Contributor
timestamp: October 27, 2016, 07:42:34 am
content: Quote from: C on October 26, 2016, 04:26:35 pmNot necessary to explain me how inductors behave, I had understood your idea. And I didn't say that it is invalid, but I think it is not the best solution for a hobby ESC because of the physical size of the inductors.Quote from: C on October 26, 2016, 04:26:35 pmSure, but placing a voltage source + resistor + inductor and running a time simulation is a good short cut if you are lazy like me and don't want to solve the exponential equations by hand. The task to limit current to 100A from 25V/10mOhm results in a 2.4uH requirement for the inductor.

author: tatus1969
author_rank: Super Contributor
timestamp: October 27, 2016, 07:43:43 am
content: Quote from: nuno on October 26, 2016, 06:22:33 pmAFAIK this technique can only be applied to IGBTs, not MOSFETs.

author: C
author_rank: Super Contributor
timestamp: October 27, 2016, 11:19:13 am
content: Quote from: tatus1969 on October 27, 2016, 07:42:34 amNo that is proving you want a large inductor so you can say it is to large.

author: CraigHB
author_rank: Regular Contributor
timestamp: October 27, 2016, 01:33:05 pm
content: Quote from: tatus1969 on October 27, 2016, 07:32:47 amNever seen a fuse on a hobby ESC and there's a reason. Fuses have some insertion loss which is typically something to avoid. Larger high performance models have motors that can demand over a hundred Amps. The loss from even a couple mOhms can become significant at those currents. Fuses don't actually react that fast either. Look at a data sheet for a fast blow fuse and there's a chart there for reaction time versus fault current. It's usually in the area of ten milliseconds for a fault current ten times that of the rated current. A fault current of that magnitude is about the most that would occur considering battery internal resistance and resistance of the current path. It's possible to react a lot faster in code by sensing current.

author: FrankBuss
author_rank: Unknown
timestamp: October 27, 2016, 01:39:41 pm
content: I'll measure the current of each winding. This would be a good first application for the FPGA, which will monitor the current of all 12 windings (4 motors on my quad) and switch it off, when it is too high. And in addition maybe another current sensor for the supply for all MOSFETs, so that I can detect shorts if a high side and low side FET are enabled both (if I'm fast enough).Is there a cheaper way to do it than buying 12 x ACS711 hall-effect sensors? I've found already a nice ADC, the MAX11126, with 12 channels, 8 bit and 1 Msp, and I'm lucky for a Maxim part, in stock at DigikeyWould the MAX4378 work, for sensing the 3 FETs (from battery supply to FET drain with a shunt), instead of bi-directional measuring the current to the windings? This would solve the problem if a high and low FET are turned on both, too, without an extra sum current sensor.

author: CraigHB
author_rank: Regular Contributor
timestamp: October 27, 2016, 01:57:57 pm
content: If you were to use FET voltage drop to sense current then you would need to monitor each phase of each motor, but I think using a current sensor on every phase of every ESC is redundant. Rather insert a current sensor on the battery side for each ESC. In fact you might only need a single sensor on the supply line for all four ESCs. Any individual motor fault will crash the model since it only has four rotors. It's not going to save the model if the other motors can operate when one drops out. That is the advantage of hexacoper or octocopter over a quadcopter, a motor failure won't necessarily cause the model to crash.

author: nuno
author_rank: Frequent Contributor
timestamp: October 27, 2016, 02:16:33 pm
content: Quote from: tatus1969 on October 27, 2016, 07:43:43 amIt can. There's some text and actual hw in the Motor Controllers sub-forum at endless-sphere.com.There's also some theory (and a chip from TI; can't remember the reference) that says the most efficient way to switch top2bottom & vice-versa in a half-bridge is to have a little bit of shoot-through.

author: nuno
author_rank: Frequent Contributor
timestamp: October 27, 2016, 02:38:47 pm
content: Quote from: FrankBuss on October 27, 2016, 01:39:41 pmJust to start... before or after the supply rail caps?

author: tatus1969
author_rank: Super Contributor
timestamp: October 28, 2016, 05:41:01 am
content: Quote from: C on October 27, 2016, 11:19:13 ameh? I'm not thinking that way. Why don't you make your own calculations?

author: CM800
author_rank: Frequent Contributor
timestamp: October 28, 2016, 08:40:43 am
content: Quote from: FrankBuss on October 27, 2016, 01:39:41 pmYou certainly don't need to measure each phase, if you measure two of the phases you can calculate the third one easily enough. (Subtract the current of one phase from the current of the other, the difference would be the current on the third phase)I've seen that was done by many servo drives.

author: FrankBuss
author_rank: Unknown
timestamp: October 29, 2016, 10:25:54 am
content: Quote from: CM800 on October 28, 2016, 08:40:43 amRight, so just 8 x ACS711 hall-effect current sensors would be the best solution, and would work out of the box. Designing my own current sense circuit with shunts etc. might be more expensive, need more parts, and would be more complicated.

author: CraigHB
author_rank: Regular Contributor
timestamp: October 29, 2016, 01:29:02 pm
content: You can use current sense resistors if you like, just have to use ones with a relatively low value. The Hall Effect sensors are a bit expensive and the gains are not adjustable. Using a current sense resistor is pretty cheap, just need an op-amp to amplify the signal for the MCU's ADC. Though some MCUs have milliVolt ADCs which can span the whole swing without amplification. Actually a pretty nice feature in an MCU for low voltage sensors.

author: FrankBuss
author_rank: Unknown
timestamp: October 29, 2016, 03:06:59 pm
content: Quote from: CraigHB on October 29, 2016, 01:29:02 pmWhich op-amp and shunt do you suggest (would be good to get it from Digikey) ? I don't know much about analog electronics and couldn't design this myself. It should have the same specs as the hall-effect sensor: 25 A full scale (I guess negative is not necessary if I don't measure the phase, but all low side FETs with a shunt in the source path to GND), and the 100 kHz bandwidth would be nice, too. The hall-effect sensor doesn't look very accurate, +/-4% error and up to +/- 35 mV offset voltage, which would be 0.5 A offset and +/- 1 A error, but this is ok for this application. And the shunt can be very cheap, I can calibrate this, if it doesn't drift.

author: CraigHB
author_rank: Regular Contributor
timestamp: October 30, 2016, 04:43:46 pm
content: Quote from: FrankBuss on October 29, 2016, 03:06:59 pmIf you need to amplify the signal (like I said some MCUs have mV ADCs) a general purpose op-amp with low offset can do the job, they're like a dime dozen from the usual suspects, Digikey, Mouser, etc. The cost depends on the accuracy you're shooting for (drift, offset, noise rejection specs), but even so you can calibrate in code to account for offsets with a general purpose op-amp. You can actually get current sense amplifiers which are op-amps designed for this purpose, but they can get a bit expensive.It's a pretty simple circuit really and you can find tons of reference schematics with some Google foo. LTSpice has a slough of canned op-amps you can select from to simulate the circuit. I use LTSpice a ~lot~ in doing my projects, really great tool. It's well supported and best of all it's free.As far as current sense resistors, there's a whole category for them on vendor sites and they're inexpensive. It's basically just a 1W or 2W resistor that uses a metal core. You find the required value by using the projected upper current limit to keep power dissipation within tolerance. So for example a 2W resistor with 2 mOhms would result in a current limit just over 30A.

author: C
author_rank: Super Contributor
timestamp: October 30, 2016, 05:13:29 pm
content: Keep in mind that when you sense voltage & current can make a big difference.Stable point is often just before next switch time.

author: FrankBuss
author_rank: Unknown
timestamp: October 30, 2016, 07:06:01 pm
content: Quote from: CraigHB on October 30, 2016, 04:43:46 pmLooks like I don't have the right Google fooI found a nice explanation of the different possible circuits inthis article, but no recommendation for a concrete op-amp, they only recommend a shunt monitor like the INA282, which itself is already more expensive than the hall-effect sensor. Then I foundthis article, which is way more accurate than I need, and so is the price of the OPA320, which is also more expensive than the hall-effect sensor. And as the eetimes article explains, I need to measure differential anyway, especially because I plan to use a very low resistance shunt of 1 milliohm, so I can't use this circuit.

author: tatus1969
author_rank: Super Contributor
timestamp: October 30, 2016, 09:41:24 pm
content: Quote from: CraigHB on October 27, 2016, 01:33:05 pmUnless we have some commercial ESC designers around, I can only guess. That would be that they 1) don't need to care about possible safety requirements 2) don't want to add any extra cost 3) can sell another copy if the user blows the controller that didnothave a fuse.Quote from: CraigHB on October 27, 2016, 01:33:05 pmFuse resistance scales with amperage. A 10A mini blade fuse (Littelfuse mini 297) has 7.3mR, the 30A version only 1.8mR. A 100A midi blade fuse goes for 0.45mR. I agree that the situation becomes problematic for high current controllers because of the large component sizes that would be needed for this. The question for me is: do Ihaveto use a fuse? If safety rules force me, yes. It is very difficulty to substitute a fuse by electronic current limitation, you need redundancy, monitoring, etc.Quote from: CraigHB on October 27, 2016, 01:33:05 pmGood point. As I am currently developing a controller for a commercial product which actually has a fuse onboard for mentioned safety rules, I thought I should make an experiment. Would the fuse be quick enough to not only prevent setting everything on fire, but also protect the circuit from an output short?My first test setup is- 6S/4Ah/20C LiIon pack- a PSMN1R4-30YLD transistor (1.11mR at room temp, this one is used in my design)- a lab supply preset at 10V for gate voltage- a scope monitoring the battery terminals close to the transistorMy son was taking a video while I closed the gate supply circuit. The result was quite more spectacular that I expected from this small MOSFET-->https://www.dropbox.com/s/zafmnkip425pks9/Short_wo_fuse.mp4?dl=0Apologizes to my wife for collaterally ruining a Skipbo cardMeasurement results:- the transistor conducted for 6.1ms before melting (which doesn't mean that it wasalivefor the entire time, because a MOSFET typically shorts when damaged).- the current was probably in the order of 1kA during that time (measured voltage across D-S was 1.4V, Rgs estimated as 1.4mR).- energy dumped into the transistor approx 1000A^2 * 1.4mR * 6.1ms = 8.5J.This energy is way above the transistor's rated avalanche energy of 0.65J, so I assume that it died much earlier and just kept holding on.In a second experiment i added a 15A mini blade fuse in series. These are used in my design as well.This video is not quite as spectacular as before... -->https://www.dropbox.com/s/rl3eulupbhkxfe5/short_with_fuse.mp4?dl=0Results:- the fuse tripped in 390us (!)- the current profile was much better for the transistor, because the fuse resistance was rising while it was heating up. (Ignored in the calculations below.)- energy dumped into the transistor: 1000A^2 * 1.4mR * 390us = 0.55J.- transistor in good health thereafter.Just below the limit... But it proves that a fuse is not necessarily a bad solution, even in such an extreme situation. And that I can assume proper output protection as well in my design.The key is to match the I2t characteristics of fuse and protected circuit. You want the fuse to have the smallest I2t so that it will melt first. This condition is met in my test circuit:- I2t of fuse is 270A2s according to its datasheet- I2t of transistor is 0.653J / 1.4mR = 466A2sAnother problem of the inductor solution that came into my mind: it will run into saturation after the current has passed a certain value above the rated inductor current. An inductor operating in saturation basically loses all of its inductivity, allowing the current to instantaneously shoot through the ceiling. I will be happy if anyone can show me that I am wrong, but I stay with my opinion that it is not a viable solution in most cases.

author: tatus1969
author_rank: Super Contributor
timestamp: October 30, 2016, 10:04:01 pm
content: Quote from: FrankBuss on October 27, 2016, 01:39:41 pmWhen you go for phase current measurement, then you should also go for a FOC implementation that makes use of them and the additional cost and complexity they bring. For example, the VESC supports it:http://vedder.se/2015/01/vesc-open-source-esc/. If your goal is just to protect the copter from total failure, I would add a fuse which is way cheaper. If you have an output short, that motor is likely dead anyway.Quote from: FrankBuss on October 27, 2016, 01:39:41 pmWhen chosing suitable H bridge drivers, you can rely on them not to do this. But you might want to measure supply current.Quote from: FrankBuss on October 27, 2016, 01:39:41 pmFor phase current measurement (for torque control, not for overcurrent detection) you typically have these choices:1) two phases with shunt resistors and high-voltage high-CMRR opamps2) two hall sensors like your ACS7113) three shunt resistors from the low side transistor's sources to GND, plus low-voltage high-speed opampsOption 1 and 3 have typically less efficiency compared to option 2.Options 2 and 3 have similar cost.Option 2 is simplest to design.Option 3 is cheapest but most difficulty. Among other challenges, you have to sample the voltages between switching transients, so you have to adjust your A/D timing depending on PWM duty cycle. The STM32 FOC library supports this, and they describe it very detailed in their manual.

author: tatus1969
author_rank: Super Contributor
timestamp: October 30, 2016, 10:13:03 pm
content: Quote from: nuno on October 27, 2016, 02:16:33 pmThat's interesting. Do you have a link or a document? I cannot find anything useful.Quote from: nuno on October 27, 2016, 02:16:33 pmThe idea is to keep the substrate diodes from conducting, which eliminates diode reverse recovery losses and ringing problems. These get worse with high voltage applications. I have not used that technique yet, fearing not being able to control the transistion between it not being effective, and running into shoot-through problems. Do you know if there are some integrated controllers around that can easily be used?

author: tatus1969
author_rank: Super Contributor
timestamp: October 30, 2016, 10:22:05 pm
content: Quote from: FrankBuss on October 30, 2016, 07:06:01 pmThe opamp selection is quite critical. You want- Reasonably high GBW. You'll need significant amplification. For example, gain=50, desired BW=100kHz ---> 5MHz GBW at least.- high CMRR. Both inputs see the full PWM switching at their inputs.- high voltage inputs but low voltage supply. You don't want to supply them from your battery voltage, as this would make interfacing to your ADC more complex.This quickly limits your choice. In my last design, I used parts from Analog Devices, after being unsuccessful with that INAxxx stuff (problems with CMRR). They have a good overview page:http://www.analog.com/en/analog-dialogue/articles/high-side-current-sensing-wide-dynamic-range.html.

author: nuno
author_rank: Frequent Contributor
timestamp: October 31, 2016, 12:44:17 am
content: Quote from: tatus1969 on October 30, 2016, 10:13:03 pmWell, it is spread out. There are at least 2 controllers using "desaturation detection" with forum discussion and hw debugging, Arlo1's and Zombiess, here's some entry points, you should do fw and bkw (the threads are huge, sorry, this is as deep as I'll dig now):https://endless-sphere.com/forums/viewtopic.php?f=30&t=35387&p=870141&hilit=desaturation+detection#p870050https://endless-sphere.com/forums/viewtopic.php?f=30&t=51342&p=849448&hilit=desaturation+detection#p849448https://endless-sphere.com/forums/viewtopic.php?f=30&t=35387&p=834781&hilit=desaturation+detection#p834781Pay attention to user HighHopes' posts. A search for "desaturation detection" on the forum may be useful too.Quote from: tatus1969 on October 30, 2016, 10:13:03 pmExactly, keep the parasitic diodes from conducting, which cause a bunch of "trouble". Here's some info from TI, on their "predictive gate drive", and a DC-DC converter chip that uses it (don't know of any controller):http://www.ti.com/lit/an/slua285/slua285.pdfhttp://www.ti.com/lit/ds/symlink/ucc27223.pdfAs you can see the chip as 10+ years, I don't know why isn't it more common.But for high voltages, isn't that one of the advantages of SiC (no reverse recovery)?

author: FrankBuss
author_rank: Unknown
timestamp: October 31, 2016, 07:23:09 am
content: Quote from: tatus1969 on October 30, 2016, 10:04:01 pmThat's what I thought. I don't know much about analog electronics, but enough to see that option 3 is difficult. It is just for hobby at the moment, so I think I'll use the hall-effect sensors.

author: tatus1969
author_rank: Super Contributor
timestamp: October 31, 2016, 08:09:05 am
content: Quote from: nuno on October 31, 2016, 12:44:17 amThanks for the links, just browsed through them. They are re-using the desat detection of IGBT drivers (these are basically comparators) for overcurrent protection of MOSFETs. Nice idea, I didn't have that thought yet. Combine that with active clamping and you have a pretty compact solution. Still my world is "in order" as this does not mean that MOSFETs have a desaturation characteristic. Instead they use the MOSFET's Rdson as a rough current shunt.Quote from: nuno on October 31, 2016, 12:44:17 amIt's a pity that this controller only goes to 20V. I like that predictive idea, but it somehow also frightens me. What if the control mechanism fails in going the right direction more than once? Can it run in the wrong direction when being confused by ringing? Hmmm...And as I read it, it does not solve the problem of reverse recovery, it just keeps diode conduction time short. Which means no solution to excessive ringing of switch node and supply, reduced but still high EMI, need for snubbers....You are right, lack of reverse recovery charge is one big advantage of SiC (the biggest one in my opinion).

author: CraigHB
author_rank: Regular Contributor
timestamp: October 31, 2016, 06:38:15 pm
content: Quote from: tatus1969 on October 30, 2016, 09:41:24 pmWell powered models are a bit of an exception to how safety is normally handled with consumer products, it's just how they are. It's unusual to see controllers with short circuit protection. The higher end ESCs have over-current protection in software, but that's the exception more than the rule.I don't know why powered models lack the safety mechanisms you normally see in consumer products. It might be more a cultural attitude, but it's probably motivated by cost primarily. Systems that provide protection when current demands are nominally high can be bulky and expensive.The philosophy with these powered models seems to be that safety wholly falls on the user. Models do burn up sometimes and you can find a few YT videos of model aircraft bursting into flames mid-air. It's not that rare for people to run into safety issues handling the high output Li-Ion batteries they use as well. Those have no protection on them either. That's unlike Li-Ion batteries normally used in consumer products which employ a wide range of protection mechanisms.The whole system with these powered models is pretty much a fire waiting to happen. And it does happen at a disconcerting frequency. I fly model helicopters myself. There's always a lot of talk on hobby forums about fire and safety issues. I see lots of reports where a battery has caught on fire while being charged or a model has gone up in flames.

author: tatus1969
author_rank: Super Contributor
timestamp: November 01, 2016, 07:04:30 am
content: Quote from: CraigHB on October 31, 2016, 06:38:15 pmI know what you're talking about. I already had three incidents, one of them almost having set my house on fire.

author: CraigHB
author_rank: Regular Contributor
timestamp: November 01, 2016, 03:04:52 pm
content: I haven't had any battery fires, but it's always in the back of my mind handling these things. If you don't employ a good level of precaution you can end up burning down your house. I saw one video where a guy had a multi-copter go up in flight and almost started a brush fire in a large field when it hit the ground, that would be ugly. Another problem is multi-copters are sold like typical consumer products more so than others. People that buy them are often not aware of the fire hazard.