ZombieSS's power stage for Lebowski's controller video pg17

It's official, the controller is spinning the motor. I need to sort out all the parameters so it works correctly, but I have some success getting the motor to start spinning in drive 1. When it tries to switch to drive 2 I run out of current, but I'm only testing with about a 6A supply so I know my FOC measurements aren't correct either, just wanted to make sure I didn't have sparks and smoke first.

Dead time looks like it could be set as low as 450nS which give me a theoretical 44khz operating frequency according to the formula in Lebowskis documentation. I decided to go for 500nS dead time to play it safe. Setup the controller for 15khz PWM and 11khz sampling.

Motor is a 46 pole hub motor, 13.23 KV, 62uH inductance. Any suggestions on settings to improve how it runs, doesn't always want to start off in Drive 1 when I give it throttle, but I noticed I have some nasty 60hz interference on my phase wires, to the tune of 4V P-P! I was able to get it to run and drop the interference down to < 1v by connecting the ground of my +5v isolated supply to the B-, no physical earth ground, everything is floating. Haven't been able to track down the source of the 60hz in the circuit.

Time for bed, what a long night and now I won't get much sleep, but it was worth it since the motor spun.
 
Zombies... 15 kHz pwm should have 29-31 kHz f-sample.

The sample frequency should be just off from 2x the pwm.
 
Arlo1 said:
Zombies... 15 kHz pwm should have 29-31 kHz f-sample.

The sample frequency should be just off from 2x the pwm.

I guess I read the directions wrong, late night. Thanks for pointing that out, it will save me a lot of troubleshooting.

When you tested your dead time for shoot through what kind of times were you getting? Using lebowskis method I came up with 450nS, but I chose 500nS for extra Safety. Not sure how this relates to reality when it is operating. I did test 10, 20 and 40khz, all gave the same 450nS optimal dead time when I graphed the current.

I found 2 silly mistakes on my board last night while double checking before operating. Super simple fixes with a soldering iron, just glad I checked everything before playing around.

I am puzzled by the intense 60hz noise on my phase wires since my entire setup is floating, including the power supplies feeding the on board isolated supplies. Noise is only on the phase wires and is almost eliminated by connecting the brain board ground to the buss ground. I wasn't able to do my coilmeasurements until i sorted that out.

I wonder if its the USB serial adapter from my laptop. I though I tried it plugged in and also in plugged but I'll check again tonight.
 
Ok, noise is being coupled in from laptop USB, probably earth ground.

Now I need to figure out how to get this controller to run the motor in sensor mode. Just can't seem to get this operating. I had it spinning a little last night, but tonight it's not working.

I followed the documentation but it's still not working. My FOC measurements are not close to what the motor is in real life, but I am only driving it with 24V from a 20A supply.
 
zombiess said:
Ok, noise is being coupled in from laptop USB, probably earth ground.

Now I need to figure out how to get this controller to run the motor in sensor mode. Just can't seem to get this operating. I had it spinning a little last night, but tonight it's not working.

I followed the documentation but it's still not working. My FOC measurements are not close to what the motor is in real life, but I am only driving it with 24V from a 20A supply.
I think the FOC mesurements will be off when you have things like your dead time and other adjustments to far off. I don't do the FOC measurement until I get the controller running smooth and good switching happening first then let it do the FOC and its close then... Lebowski has a way to enter the inductance manually. I will try to remember some things and post later.
 
zombiess, thought i would answer your PM here if that's ok with u.

450ns deadtime good? well, that by itself is not enough info. the purpose of the deadtime is to avoid shoot-through and it is working then that is good. mind you, it also has to work over temperature, it also has to work over aging, tolerance etc. but lets say 450ns will cover all that spread and still no shoot-through.. so you are 50% towards the way of saying it is good. the other half is to look at the impact that your positive success has... increasing deadtime = increasing low frequency distortion. that is, your fundamental current sinewave starts be no longer shaped perfect sinusoidal which is not good, but at least no shoot-through. you can measure this distortion with a really good probe & scope with math package .. or .. just stick to the rule of thumb that deadtime <= 5% of switching period. so if you have 450ns deadtime, and assuming that is adequate value, then that implies that your switching frequency has to be <= 1/(450ns/5%) or <= 110kHz. so that statement is true in your case so maybe the 450ns deadtime is probably good. or is it?? only thing left to consider is if 450ns really will cover the tolerance spread or not.

let's double check.. take a look at this a bit further..

let's say that the brain delivers ideal PWM with no deadtime and that all components are perfect ideal over all temperature.. except for TD350 which follows datasheet. taking worse case.. we see that the longest turn OFF delay is 620ns. now, our brain board is issueing ideal PWM.. so it tells upper MOSFET to turn OFF at the same time it tells lower MOSFET to turn ON. so upper mosfet is told to turn OFF but .. due to TD350 propegation delay, this does not happen for 620ns. hmmm... that might be a problem because our lower MOSFET was asked to turn ON immediately (ideal PWM).. sh#t, i hope its not that fast.. else it might be asked to turn ON while the upper MOSFET is still lingering in the ON state.. well.. how fast can our MOSFET turn ON? the delay of TD350 at least is 350ns. so.. you can see, in worse case assessment considering only the propegation delay of TD350, there is a minimum need for at least 620ns - 350ns = 270ns.

in your real brain you have 450ns deadtime which is greater than minimum needed so that's good. you have 450 - 270ns = 180ns of margin left. since the datasheet gives those values over worse case tolerance and brain board is very stable in all conditions, i would say 180ns would be enough margin. but ... but ... the propegation delay of TD350 is not the only delay in the system! so now you must go and look at all the rest of them .. add them all up .. find worse case over temperature range, tolerance, aging etc., and pray that it is total 180ns or less (probably it is not).

so how is it that 450nS seems to be working just fine if my implication is that it is not a good value? well.. it is by chance. eventually, sometime in the next 20 years, your controller will eventually - most likely - experience a worse case condition and have a shoot-through event because i suspect you will find that 450ns is not enough deadtime. i suppose you can laugh this off a bit because if you have ONE shoot-through event in 20 years AND you have a working desat circcuit, what's the harm? ok.. i don't know the good answer to that, but i come from mission critical world where one event is not acceptable. so.. i would not be happy (i am hard to please as you have found by now).

one solution is to increase your deadtime to value chosen to cover entire worse case spread and the good news is that since your max frequency is 110kHz with 450ns.. so you have some room to increase deadtime! lucky you have such a rock solid gate driver (pat yourself on your back here).

so lets say you do some analysis and find that the more suitable deadtime is 900ns and that means your max switching frequency is 55kHz. recall that is assuming 5% phase current distortion is acceptable. in truth that might be too high to your liking .. probably you don't want to lose 5% available torque.. so lets say you are willing to only lose 2% (which is my comfort zone) then you will find the max frequency is 22kHz which is almost exactly what i said this TD350 gate drive IC would be good for when we started this last year. i think i said 21kHz.. hey, i'm not perfect ;)
 
I like that answer. I knew I was going to have to compensate for temp drift, but I never thought about aging. Since I padded the 450nS by an additional 50nS to 500nS for initial testing. I will have to go through and do a total work up of all your mentioned specs to come up with a real dead time spec I can justify. I'll ping on you to spot check me.

Right now I just need to get the darn motor to spin in sensor mode. I'll post up my settings later tonight or tomorrow for those who have made it work to look over and tell me what I have wrong.
 
i don't know lewbowski's controller so probably can't help you too much, but a couple things to check:
- when brain board issues phase A upper mosfet ON, does that signal make it to phase A upper mosfet ON? check the other 5
- when phase A upper mosfet pulse test has current flowing through your sensor in positive direction (inverter to motor) does the signal side of current sensor start to have positive increase (starts at 2.5V and tends towards 5V as pulse current is measured). is phase A current sensor properly mapped to brain board phase A input? what about b & C?
- your current sensor operates with 0A = 2.5V at output. positive peak current (inverter to motor) = +4.5V; and negative peak of valley current = 0.5V. does your brain board expect this type of signal?
 
HighHopes said:
i don't know lewbowski's controller so probably can't help you too much, but a couple things to check:
- when brain board issues phase A upper mosfet ON, does that signal make it to phase A upper mosfet ON? check the other 5
- when phase A upper mosfet pulse test has current flowing through your sensor in positive direction (inverter to motor) does the signal side of current sensor start to have positive increase (starts at 2.5V and tends towards 5V as pulse current is measured). is phase A current sensor properly mapped to brain board phase A input? what about b & C?
- your current sensor operates with 0A = 2.5V at output. positive peak current (inverter to motor) = +4.5V; and negative peak of valley current = 0.5V. does your brain board expect this type of signal?

I have already verified all the basics you just posted here, but that doesn't mean something else as simple as the above has been missed. I am 95% sure it's a software setup problem.

BTW, isolated power everywhere makes scope probing interesting... 120v a/c everywhere lol..with respect to the scopes ground. Figured that one out quick when I used a battery operated scope and saw what I expected, solution was to tie some key isolated stuff to earth since I didn't feel like bringing out the differential late last night. A very valuable lesson learned, the 120v was real, but only with respect to scope earth ground. Guess that verifies that my 9 or so isolated supplies in circuit and being used to simulate batteries are working correctly.
 
Success!

Drive mode 1,2 and 3 are all working. Transition from sensor to sensorless occurs at 3500 erpm in 600mS. Works beautifully on my test motor. No FOC yet, I don't understand it so I haven't played with it yet.

Now for the power stage info. I haven't taken any scope shots, but I have scoped the high/low sides and they look really clean. Transitions are about 285nS from on/off, no overshoot at all and only about 1V of ring. Dead time is at 500nS, switching is 15kHz. This was tested at 24-55V buss with varying load, as much as an accelerating unloaded motor in a 17" moped rim can give me while I try to slow it down with my hand and a rag. Gate drive looks really clean. Kinda funny that my transitions clean up when I'm running the motor, but then again this is pretty low current due to the light load. I have a bunch of varying transitions going on, mainly on the turn off, but I believe this is a function of how the controller works. The average of them looks quite solid.

My motor is 63uH and an unknown resistance as I have not measured it yet. Should be < 100mOhm as it's a high KV hub motor.

It feels so good to hit this mile stone.

Next up, maybe FOC, not quite sure what advantage it offers? Then my favorite, the annoying task of working with metal to make proper heat sinks so I can enclose this beast and try riding a bike with it. I still need to add a CA V3 harness, that's on the short list, it needs to be CA DP compatible.
 
cool, that's a major accomplishment!

FOC means as you know "Field Orientated Control" and there are a lot of variations of this, that is just the generic title. finally though, it means also that the field built up by the rotor is tracked by the controller so that the inverter can form it's phase current IN PHASE exactly with the "field" of the motor. remember my previous post saying that the max torque is generated when the inverter phase current matches the bEMF voltage of the motor in phase (and shape)? so here we are saying it again.. track the "field" and match it to inverter phase current. the field is a magnetic field in a BLDC motor and by lenz law (or is it lorentz? i get them mixed up) the field produces a voltage on the stator when the magnetic field cuts the conductor. as the field passes the stator windings the bEMF voltage is created. so now you see the link beteween "field" and bEMF .. then the phase current matches the bEMF.

the funny part about using the term FOC when talking BLDC motor is that it is not really needed. we already know where exactly the field IS because the field is produced by magnets which are fixed. so, you get a choice... pretend you do not know where the magnets are and use FOC to find them .. or somewhat easier... install a resolver on the shaft of the motor and physically align the resolver to the rotor and bolt it in place for life... just patch the angle from resolver direct into spaceVector or sine-pwm DQ algorithm (actually just Q since D is fixed in BLDC controller). anyway.. that's all just controller stuff.

basically what you are after is some way to be able to have confidence you are getting the max torque possible for your system. huh.. i should have just opened with that statement instead. :idea:
 
zombiess said:
Success!

Drive mode 1,2 and 3 are all working. Transition from sensor to sensorless occurs at 3500 erpm in 600mS. Works beautifully on my test motor. No FOC yet, I don't understand it so I haven't played with it yet.
Awesome dude SO now you can tell this is not for everyone lol.
It is exciting and getting this far you can see how this is a hard thing to Sell to make money around here. I have lots of people who want this on the forums here but they want it for china controller prices. :roll:

Zombies said:
Next up, maybe FOC, not quite sure what advantage it offers? Then my favorite, the annoying task of working with metal to make proper heat sinks so I can enclose this beast and try riding a bike with it. I still need to add a CA V3 harness, that's on the short list, it needs to be CA DP compatible.
Look back though lebowski's and my threads I think he explains it. I think it is for better smoother start up in drive one and I think there is something for drive three as well because he told me adding a higher inductance value will advance the timing.
 
Arlo1 said:
zombiess said:
Success!

Drive mode 1,2 and 3 are all working. Transition from sensor to sensorless occurs at 3500 erpm in 600mS. Works beautifully on my test motor. No FOC yet, I don't understand it so I haven't played with it yet.
Awesome dude SO now you can tell this is not for everyone lol.
It is exciting and getting this far you can see how this is a hard thing to Sell to make money around here. I have lots of people who want this on the forums here but they want it for china controller prices. :roll:

Zombies said:
Next up, maybe FOC, not quite sure what advantage it offers? Then my favorite, the annoying task of working with metal to make proper heat sinks so I can enclose this beast and try riding a bike with it. I still need to add a CA V3 harness, that's on the short list, it needs to be CA DP compatible.
Look back though lebowski's and my threads I think he explains it. I think it is for better smoother start up in drive one and I think there is something for drive three as well because he told me adding a higher inductance value will advance the timing.

Certainly not for everyone right now, but it's getting there and I see a path Lebowski could take to make it more user friendly. It's not too bad to setup if you are technically inclined, but it does need better documentation with step by step procedures. I had no idea I needed to convert my sampled BEMF into a fundamental sine to get it to work. One of your old posts with video showing the exact same problem I had and Lebowskis response had me up and running in sensor mode in about 2 mins.

This for China controller prices, nope, not going to happen, at least not with a decent gate driver / power stage design. It's worth a lot more than the Chinese "Happy Fun Lucky Controller Company" brand controllers, just not as user friendly. I had been planning on doing a lower end, boot strapped, non fault tolerant, non isolated power supply gate driver with active miller clamp based on an Avego part (ACPL-H342), but I have now scrapped that idea and came to my senses (but own some of the drivers which are pretty nice, needed them to verify board layout). For the price/feature difference it's just not worth it. I'll stick with the TD350E and probably 2 isolated supplies. The TD350E can be boot strapped, but isolated supplies make life easy and cost $5 ea for 2W versions.

Doing the layout was worth it though as I improved my skills and now have a good foundation for doing gate driver layouts, so many little devils to look out for.
 
This for China controller prices, nope, not going to happen, at least not with a decent gate driver / power stage design.
don't be too hard on yourself, it was never even your intention to compete on cost with this gate driver (and i refused to help design one that could compete on cost). so far as i knew it was your intention to learn first and end up with something that worked (with minimal wasted time troubleshooting) second . so for that reason i suggested the TD350 chip because its a great choice for those two goals as it forces you to learn about all the elements that make up a great gate drive while simultaneously integrating the functions so they just work without much fuss.

if you are forced to make some comparison to china controller...
your gate driver is rated for much higher power capability than what you are so far using and it is designed to last 20 years without fail (knock on wood). it is not even close to the same thing as a china controller, it is light years beyond. if you want to realize where the real value is, don't ask this gate driver to drive a few discrete mosfets.. put the boost stage back in and drive a 6-pack module, 30kW continuous rated.

anyway, this is your first attempt.. i'm sure the first china controllers did not perform so well.. so keep it up and don't get discouraged. you never know where this knowledge & experience will take you next :)
 
Just an update, I sorted out some minor wiring bugs that were causing me major issues and everything works much better now. Even managed to get it to start in push start sensorless mode a few times.
 
I was just looking at your schematic, and I think it has been mentioned before, but is it really necessary to put gate pull down resistors on both high side and low side FETs? If e.g. all the low side FETs are held off during a power off, there is no chance of shoot through when connecting the battery anyway.
Also 4.7k seems like a real low value to me, I usually use 100k but maybe that is way of?
 
Futterama said:
I was just looking at your schematic, and I think it has been mentioned before, but is it really necessary to put gate pull down resistors on both high side and low side FETs? If e.g. all the low side FETs are held off during a power off, there is no chance of shoot through when connecting the battery anyway.
Also 4.7k seems like a real low value to me, I usually use 100k but maybe that is way of?

Yes, it is important to have the pull down resistors G-S. I asked this exact same question to HighHopes while he was helping me with this design and it turns out there is a mathematical reason for it as well. The G-S resistor value can be caluclated, but in actual practice he said he found 4.75k to usually be a good value. BTW, my schematic is slightly out of date, I only have 1 single 4.75k G-S resistor per parallel set.

This resistor helps to define a known state at power up.
Keep in mind that when I started this project I had only some experience in the realm of analog design and no hands on with gate divers, just some theory with some very useful information gained from the knowledgeable people on here and app notes. I don't remember exactly how it started, but eventually during discussions with HIghHopes he offered to teach me his basic gate driver design method (what I posted is a basic gate driver design that any pro could probably turn out in about a week, it gets much more complex than this :shock: ) which have been proven up to 80kW (this is not an 80kW design), the only catch was the design had to be made public afterwards. He said he was teaching me in his spare time, but I know it had to take up quite a bit of time to answer my endless questions and explain the math. He gave me 2 options, a quick setup that will spin a motor or a complete lengthy walk through. I delayed my build for many months while he taught me his method though PMs, figured a free education on a subject I had strong interest in was the deal of a lifetime. He changed my entire design thought process and took it to an entirely new level adding in reliability, fault modes, consequences and how to handle them, etc. He showed me the math to justify a parts existence in a circuit and the math to show why the value is what it is. I'm not an expert on this subject matter but I have at least cut my teeth and managed to pull off a working (so far so good) 1st attempt design which required virtually no modification, just tuning. Typical design process often involves 3 build revisions is what I am told, not sure if I'm out of the woods yet, but it's looking like I have a 1st attempt winnder... knock on wood.

Here is the PM he sent me during our design discussions on why the G-S resistor is there and how its value is determined. That reminds me, I need to add these formulas to my gate driver spreadsheet I am working on. Your design is your design and you can do what ever you desire, just figured it was worth telling my own story. We decided to keep the initial design process private to cut down on off topic discussions and side bars. I have over 100 PMs from him saved for reference material / notes. I give most of the basics and explain each component in the document included with the design zip file. BTW, the most important part of the entire design IS THE GATE DRIVER. You can do what you would like on the MOSFET side, experiment with parallel configs etc, but the gate driver design is the most critical to its success. I chose a linear array because it worked for me in this 1st design. I have new things I will be trying after this is proven, but my basic gate driver design will remain the same now that I know how to use it properly.

HighHopes said:
you mentioned in the post that the gate-source resistor is used to define the state as OFF for when the gate driver suddenly losses power for some reason and/or during system power up/down. that's true.. and i always found that 4.75k was good value to use. there is a bit of math behind that if you are interested:

I = C*dV/dt

Vth/Rgs = Cgd*dV/dt <-- here the dv/dt is the rate of voltage rise of your gate drive power supply on initial power up (check the datasheet, my guess is something like 15V/10mS easy enough to determine with your fancy new Oscope), Vth is your mosfet theshold voltage (when it starts to turn ON), Rgs is your pull down resistor gate-to-source Cgd is Mosfet gate-drain capacitance

re-arrange equation:

Rgs = Vth/Cgd * dt/dv <-- actually we don't want the gate resistor to just be equal.. like right on the threshold of turning ON, no, we want some margin so we will say that Rgs must be LESS than ..

Rgs < Vth/Cgd * dt/dv

anyway.. just thought i would give you more view... it is also the part that makes designing so overwhelming sometimes. because each part - no matter how insignificant - seems to play an important role in gate driver.
 
ZombieSS, can you give an example of the calculation? I don't know the rise time of the gate driver power supply yet, and I can't find the gate-source capacitance in my MOSFET datasheet.

I was also thinking about something else. I my controller, I will always pre-charge the input capacitors through a resistor in a separate battery wire, so IF the FETs for some reason are on and would create a shoot through, the current would be limited by my pre-charge resistor. When I was thinking about the pre-charge resistor, I also got the idea to implement a "voltage good" LED indicator so I won't connect the primary battery wire before the voltage in the system is stable, and it won't get stable if there was a shoot through. Kind of a diagnostics LED that checks the voltage levels in the controller.

But still, are the gate pulldowns really necessary on BOTH high side and low side? What could go wrong if all the low side FETs are off due to the resistor, and one or more of the high side FETs are on if they didn't have the resistor? As soon as the gate driver is powered to a functioning state, it will pull the gates low due to the UVLO circuit. I'm really just curious to know if the high side pulldowns are required for functioning/reliability.
 
I don't know the rise time of my power supply either, I'd have to measure it, that's what scopes are for ;) I just went with HighHopes recommendation on the 4.75k G-S resistor. Both high and low side. Your precharge resistor doesn't really help once the energy is stored up in the caps. They should be on both high and low side. They don't do any harm, but they always tie the gate to it's respective ground when there is no PWM.

Gate to Source capacitance is on the spec sheet, at least on mine but I had to do some math. Cgs = Ciss-Crss. In my case for an IRFB4115 that means 5270pF - 105pf = 5165pF.

If you want to use G-S resistors in your design it's your call, but it's only 2 resistors, less than 2 cents worth of components that can add some protection. I didn't even debate it. Almost everything in my gate driver setup is really cheap to implement, I priced out the parts last night. It's under $40 for all the components in my 6 gate driver circuits excluding the PCB and that's buying small quantities, not 100 pieces of each. How much doe blown up MOSFETs cost to replace?
 
Teh Stork said:
Arlo1 said:
Awesome dude SO now you can tell this is not for everyone lol.
It is exciting and getting this far you can see how this is a hard thing to Sell to make money around here. I have lots of people who want this on the forums here but they want it for china controller prices. :roll:

You should read Crossing the Chasm: Marketing and Selling Disruptive Products to Mainstream Customers.
LOL yeah... I will have to learn to not be so closed minded. Im just happy to see Zombies get this going. But Its hard as hell to get one of these together with all the R&D then sell it for a low price... Whats cool is Zombies lernt a skill.
 
Arlo1 said:
LOL yeah... I will have to learn to not be so closed minded. Im just happy to see Zombies get this going. But Its hard as hell to get one of these together with all the R&D then sell it for a low price... Whats cool is Zombies lernt a skill.[/quote]


Learning the skill was the main reason I did this. I could just buy what ever controller I want, but I won't learn much and learning is one of my hobbies. A few years ago many people started controller projects (most projects died), but no one was doing gate driver / power stage design and I wondered why, so I started researching it and found out it's kind of a black art, but not as much voodoo as RF engineering, that stuff get's crazy.

I will eventually make some money with this skill, but that was not my main motivator, it's a secondary and I'm approaching that right now. Working on something right now, just checking in on this thread while my desoldering iron heats up. I'm a geek and learning how things work is a passion of mine. I love theory, especially when I can convert that theory into something usable. I've learned more electronics in the past 8 months than I have in the past 8 years!
 
How is the box coming along ? When do you plan to have your first ride with this controller ?

I did lots of metal work this weekend for the controller for the recumbent. Made the mounting to the bike,
drilled the box for the interal cable operated throttle assembly and drilled the 'carrier' for the FETs (unlike
the one from the low inductance output stage thread, this time the motor wires come through the mounting
plate from the bottom so that the copper busbars can be closer together.)
 
Lebowski said:
How is the box coming along ? When do you plan to have your first ride with this controller ?

I did lots of metal work this weekend for the controller for the recumbent. Made the mounting to the bike,
drilled the box for the interal cable operated throttle assembly and drilled the 'carrier' for the FETs (unlike
the one from the low inductance output stage thread, this time the motor wires come through the mounting
plate from the bottom so that the copper busbars can be closer together.)

I haven't even started beyond having the metal pieces in my lab. You have no idea how much I dread working with metal. I wish I knew someone who I could just pay to do the drilling / tapping of everything I need. I'm ready to do a full load test too, but the metal work is going to hold me back for a while.

I haven't been able to find a single machine shop in this town that will work on anything that doesn't pay at least $3k. They are only here to service the oil industry.
 
ZombieSS,

Post some measurements and desired enclosure details. There might be a way to use available boxes, perhaps joining several to get what you need without a custom machine shop solution or at least reduce the machine shop hours.
 
Back
Top