Critique my (simple) motor driver circuit

I am interested in the mentioned higher pwm levels: +15khz, as the audible switching noise can be a bit annoying on some applications.

see attached

// Arduino UNO DDS

#include <PWM.h>

int32_t frequency_9 = 12000; //frequency (in Hz)
int32_t frequency_3 = 16000; //frequency (in Hz)
 

void setup()
{

InitTimersSafe(); 

SetPinFrequencySafe(9, frequency_9);
SetPinFrequencySafe(3, frequency_3);
 
}

void loop()
{
 
 int dutyC =512; // Duty Cycle 0 (0%) - 1023(100%)
 pwmWrite(9, dutyC / 4);
 pwmWrite(3, dutyC / 4);
 delay(30);
 
 }

Frequency_Generator_PWM_LIB_12khz_16khz.ino (390 Bytes)

Marty_DK:
Finally, I'm driving the motor with the standard arduino PWM frequency, which I believe is 500Hz.
I was hoping that relatively low switching speed would make a dedicated driver unnecessary - If I also used a suitable mosfet, like the IRL3034, for example..

500Hz is about all you can expect from the irlb3034 one. To find out what current you need to drive a mosfet is fairly simple.

Gate charge (coloumbs) / current (amps) = Time to charge (seconds).

for the irlb3034 for example. And a gate resistor of 270 Ohms. 5v/270 Ohm = 0.019A or 19 mA.
(there is a small resistance of the gate itself but quite small 2.1Ohm in this case)

gate charge = 108nC typical ( from datasheet Qg).
108/0.019 = 5685 ns or 5.68 us to charge or discharge the gate at that current.

To switch it on and off takes 11.4us

Pwm frequency at 500Hz has a period of 2000us. It would only spend less than one percent of the time switching, no worries (1/175).

Now if you tried to drive it at 20Khz = 50us period, It would spend 1/5 of the time just turning on and off.. massive switching losses .. bad news

I like to keep switching time to less than 1 percent ( some people say even less ).

So if you did want to drive this mosfet at 16Khz and have it switch efficiently.. working backwards..
16Khz = 62.5 us period.

62.5 / 100 = 0.625us ideal time spent switching, 312ns for charge time and discharge.

108nC / 312ns = 0.346Amps or 346mA.

So a mosfet driver capable of 350mA output would be needed to run this mosfet at 16Khz with one percent time spent switching.

These are ideal numbers switching times, I have used the irlr7843 ( 34nC Qg) direct from the output of an atmega switching at 16Khz with a 50 Ohm gate resistor, it works, the atmega might not last long but whatever..

Thanks man! What a nice explanation.
Looks like I'll be looking for a driver - Barely feasible is cutting it a little too close.

Agreed! that is a really great explanation, thanks!

I'm going to copy that post to a text doc, just so I don't forget it, seriously. :slight_smile:

Now...if only there was one that good about getting the correct freewheeling diode... :wink:

@Marty,

I wanted to include a pic of the PCB i mentioned earlier where the hefty diode started smoking
after about 10A, to give an idea of my interpretation of a larger than normal diode:

at 12 o'clock- 7805 reg (smd converted to dip)
10:00 - Attiny85
6:30 & 7:00 - low RDS mosfets (smd converted to dip)
4 o'clock - the 'beefy' diode

most parts robbed from scrap pcbs for the cheap proto

Bill

I'm glad you found it useful, There's is a little more to it than that but that will give you a ballpark when selecting drivers and designing motor controllers.

I have been way off with calculations before though so please check and make sure ( i am terrible with converting between us, ns, ms)

The "rules" get broken all the time in RC speed controllers. Barely feasible still sounds like 100 percent possible to me.

I am interested in the idea of running parallel mosfets off separate pins of the arduino. Unless i am overlooking something major might be a cheap and easy way to control higher current.

I think the freewheeling diode should be rated for the same current as the motors forward current.

@bill: Thanks for the picture - The diode I'm using is in the same type of housing as the one in your picture, so apparently we have the same definition of beefy :slight_smile:
Always a pleasure to be able to learn from other peoples' experiences rather than having to go through them myself.

@alka: About the freewheeling diode... The schematic I posted the protective diode+cap from is for a very widely used 3 phase motor controller in my workplace. The funny thing about that controller is that while there is room for FW diodes on the PCB, they haven't been mounted, so I guess the designers decided to depend on the diode internally in the mosfets for freewheeling, and it seems to work fine.
I guess that means the mosfet will have to dissipate effect from both running the motor, but also the energy generated when the motor is breaking?
If this is possible, is there even a reason to have a dedicated FW diode?
(I hope you understand my description :slight_smile: )

You are right. A three phase motor will need 3 half bridges to work, even if it only goes one direction. A brushed motor controller thats bi-directional uses 2 half bridges. Either of these will have mosfets on the high side with a body diode that can handle the current so no additional diode is required.

When you have a bridge configuration like this you have choices about how you want to direct that current. Instead of just turning it off and having the current flow through the diode. You can turn on mosfets and direct the current path through them instead of their body diodes.

This is called the decay mode.

This paper explains it better than i can http://www.ti.com/lit/an/slva321/slva321.pdf

With asynchonous decay the mosfet body diode will be addding to the heat too.

With a single mosfet on the bottom for a one direction brushed motor the freewheel diode is the only path for cuurent flow when power is off. Must be included.

Thanks for the explanation, I'll read that document as soon as I get off from work.

Starting this thread has turned out to be quite educational :smiley:

Marty_DK:
a very widely used 3 phase motor controller in my workplace.

This has sparked my curiosity...as my biggest interest is in 3phase dc motor control. Care to share more info about these controllers you use at work??

I have torn down many R/C brushless controllers to try and reverse engineer what they do. I do intend to design my own and build it, regardless of how inexpensive they have become, simply for educational purposes. I've made some attempts, but so far I have done nothing but smoke lots of components :frowning:

+1 agreed with alka: When using half-bridges, as in for bi-directional brushed control, or for 3 phase bldc, the flyback diode is not needed, though I don't fully understand the intimate details of it, other than there exist paths within the mosfets to allow dissipation of the flyback energy.

Bill

billcat:
I have torn down many R/C brushless controllers to try and reverse engineer what they do. I do intend to design my own and build it, regardless of how inexpensive they have become, simply for educational purposes. I've made some attempts, but so far I have done nothing but smoke lots of components :frowning:

I have made quite a few brushlless controllers, its addictive, I don't care how cheap they are either. I love the heart pounding feeling you get when you first plug it in after spending hours ( days ) on it and having it either work properly or nuke itself.

If you are interested I will happily share my work, they are all designs that can be soldered by hand on a two layer board so a hobbyist can make them. They aren't really arduino related so I haven't posted them as projects. Some can be made even cheaper than buying them from China!

billcat:
+1 agreed with alka: When using half-bridges, as in for bi-directional brushed control, or for 3 phase bldc, the flyback diode is not needed, though I don't fully understand the intimate details of it, other than there exist paths within the mosfets to allow dissipation of the flyback energy.

Its very simple, every power MOSFET has an integral diode across drain and source, its a feature of the
silicon architecture and cannot be avoided. In a half-bridge each device's diode acts as free-wheel diode
for the other device. Non-power MOSFETs are different.

In high voltage bridges IGBTs are used, which don't have a body diode, so you have to use diodes (or buy
the IGBTs that come pre-packaged with a diode). Most IGBT bridge modules have the diodes.

At low voltage high current you sometimes see schottky diodes added to a MOSFET bridge to reduce
the losses across the diodes if using decay-modes (schottky diodes have lower forward voltage).

MarkT:
Its very simple, every power MOSFET has an integral diode across drain and source, its a feature of the
silicon architecture and cannot be avoided. In a half-bridge each device's diode acts as free-wheel diode
for the other device. Non-power MOSFETs are different.

The big question is, for a simple low side driver like the one I'm building, is there any point in using a schottky diode for flyback?
Why/why not? (just in simple ELI5-terms)

Marty_DK:
The big question is, for a simple low side driver like the one I'm building, is there any point in using a schottky diode for flyback?
Why/why not? (just in simple ELI5-terms)

I think the important thing is to have a fast recovery. If you take a look at some diodes that are meant for freewheel spikes like BYT08PI. They have reverse recovery time under 100 nano seconds.

Another is the HER306 .

There are many other fast acting rectifiers out there suitable for freewheeling purposes.

alka:
If you are interested I will happily share my work,

yes, I am for sure interested in what you've done!

@MarkT, thanks for the clear explanation, helps clarify a bit.

@Marty, well I could be mistaken, but I believe since Power= I x E, for a given forward voltage drop on your diode, at a given current level, the diode with the lower drop = less wasted heat.
Schottky's with lower drops equate to less waste heat in the diode.

Marty_DK:
The big question is, for a simple low side driver like the one I'm building, is there any point in using a schottky diode for flyback?
Why/why not? (just in simple ELI5-terms)

It doesn't get as hot as a pn-junction diode. But if your power level is low that might not matter, with 20A
it is everything.

I thought that would be the answer, but I needed to hear it from one of you more knowledgeable guys :slight_smile: