Hey everyone this is my first time reaching out to the community for help, and I am really stuck. Basically I am trying to make my own ESC for a BLDC before anyone says the commercial solution is cheaper and easier, I'm doing it to try learn more and make a customisable version that's all my own work so lets get into the issue.
The problem is although I'm using a 20khz Pwm signal at a variable duty on the high side input generated by direct timer control on the nano, to try "chop"/control the current and keeping the lowside fully grounded, the MOSFETs I'm using (N-channel irf1405s that are 55V and 160A rated) are getting really really hot and so is the motor like over 150 degrees Celsius hot even after only running for 30 seconds. The actually motor spins just fine however I can even change the speed using a timed step change (although I do have the hardware and did have the software for BEMF step changing too I disabled it to try simplify things since the heating issue is my main priority).
I've attached my code and schematic as well as a picture of my circuit if anyone can see something on this that I can't it would be much appreciated because I'm at my wits end here ive tried adding lots of different changes to the hard and software with no luck as at the end of it all I still can't seem to stop the MOSFETs and motor from getting really hot because of what I assume is excessive current draw (possibly building up in the coils and trying to ground through the FETS body diode? maybe?) , if I increase the duty to 70%+ the MOSFETs also just straight up explode even with dead time coded in using delay functions.
I'm using a 12V 6.5Ah lead acid battery for testing as its close to the power supply I would use the ESC with normally.
if anyone with experience in power electronics or any ideas on how to fix my heating issue is reading this please help. Thank you, Harry.
From where does the electrical design come?
It doesn't look good using N channel MOSFETs like that. An N channel can switch the low side but not the high side.
Its been a number of years since I designed our brushless motor controller.
However looking at your circuit, its not clear how your Virtual Zero is created and how the Phase Voltages are sensed. I seem to recall there was some small capacitance on the feedback for noise abatement.
You didn't mention if the motor is spinning and if so is it smooth or staccato?
Not an issue, this is exactly how to use MOSFETs with a high-low gate driver chip - read the IR2101 datasheet.
I suspect the problem is either shoot-through or incorrect phasing.
You don't happen to have waveforms from the phases? Or even current sensing in the phases?
If its shoot-through you need to change the timing so that LIN and HIN have enough dead-time between then - the IR2101 isn't a great chip as it doesn't have built-in shoot-through prevention (lots of gate driver chips do have this very handy feature).
If it phasing then getting it wrong and you might be treating the motor as a heater, accounting for excessive currents and heating. The phasing should always be leading by 90 degrees (electrically), so the rotor is being pulled round (rather than held in position like a stepper). Otherwise you aren't turning that current efficiently into rotation, but mainly into heat.
A quick browse of your code suggests you are not using BEMFA/B/C in a feedback loop - this is required, the timing comes from the motor, not from the code. The code uses the motor speed in a control loop to adjust the PWM drive level, the motor's natural speed should be commutating the phases.
The only time open-loop control is used is to get the motor moving from standstill, with an accelerating frequency for a fraction of a second, thereafter you have to close the loop before the motor burns out...
[ BTW there is open-source BLDC driver and ESC code around - worth looking at examples that do this closed-loop control for inspiration ]
Hey I’m using the resistor block shown in the diagram to get the virtual zero but thats not my issue I understand how to do that and had it working until I decided the heating problem was more important so I removed it until i can fix that issue
Hey I’m not sure I understand how to set the phasing up correctly. Is it something done in the code or hardware? And il have to get a scope. Do you know of any resources i can learn more about the phasing from ?
I'm sure if you google you will find many resources. If I recall Microchip had a good app note for one of their DSP processors that had some special capability for BLDC drive.
The motor spins fine like it rotates smoothly and doesn't jitter, the speed can even be changed via the delay function which is shown in the code the only problem is it gets very very hot.
Do you have a scope to check your gate signals and timing?
Where are your protection fuses to the battery supply, it can output 100s of Amps into a short, hence blow the guts out of everything, including PCB and components.
I you may need to have current limit/monitoring circuitry to protect your motor and controller.
Can you please post image(s) of your project so we can see your component layout?
If you have a PCB, can you please post an EXPORTED jpg image of it too?
As I said you need to use closed loop control for such a motor (except during the brief start-up time).
The back EMF is sensed to determine the actual position of the rotor and used to time commutation. That way the drive phase can be kept correct and the back-EMF will act to limit the current drawn when running.
Your code assumes you can select when to commutate without refering to the rotor position - you can't with this class of motor (its not a stepper motor). The winding resistance in these motors is so small that with getting this right the currents that flow are extremely large and will burn out the motor and the MOSFETs in a short space of time.
As I said find an open source ESC or BLDC driver to see how its done, or mug up on motors - plenty of resources out there. Some BLDCs have Hall sensors to determine the phasing, but most RC motor don't and you have to use that resistor array to measure the back-EMF on the idle winding instead (which only works above a certain speed).
If you look at a brushed DC motor you'll see how the physical commutator fixes the phase between the permanent magnet field and the armature's field at 90 degrees of so. In a brushless motor the same thing has to be done by external switching.
yeah I do have a small scope I will be posting the photos of the results when I get a chance to work on it tomorrow and as per the comment by @6v6gt I will go over the steps code again and possibly just write the TCCRA1 and TCCRA2 registers to just straight 0 instead of messing with the respective COMxx and COMxx bits to turn it off. Also in respect to your following comment thank you so much Ive been thinking I should go to a jaycar and get a bunch of diodes and a THT 30a fuse holder to try or maybe just go online. So anything ultrafast will work? and is there some maths I can do to help me find the best one? Again thank you for taking the time to try help me with this.
yeah I have read a bit about that and its logical because staying on a step longer than needed makes no sense and I understand everything your saying up until
armature's field at 90 degrees or so. In a brushless motor the same thing has to be done by external switching
how do I determine when to undertake this switching and what FETS do I switch is it related to the back emf and the steps timing or something else? ive googled BLDC phasing and read some but still can't get any good idea of it. thanks for giving me a new path to consider though and il do some further research and testing.