My motor driver blew up. Why?

If that really is 2 turn primary, then its DC resistance is likely a few milliohms, and that immediately explains the H-bridge exploding.

The driver is 13A continuous, probably can only handle 20 to 30A peak (stall current).

If your transformer is, say, 100 milliohm, and you have 24V supply, the "stall current" of
your transformer is 240A! Result, !>bang<!

Note that ferrite transformers saturate easily, and once saturated you just have a piece of
wire, with only the DC resistance to impede current flow. When you initially turn on an H-bridge
there current will build up rapidly limited by the inductance of the transformer core (if secondary open), or jump instantly to some value (if the secondary has a resistive load),
or jump instantly to a very high value (if the secondary has a capacitive load).

You may well be driving the corrent AC frequency for this, but start-up transients have a
DC component that may lead to saturation (which you cannot tolerate in this situation).

So is there a stable, proper way to boot up or start up the circuit so that I can limit any transients and achieve steady-state operation? Perhaps as long as my frequency is properly tuned for the primary's inductance, I should not get a short circuit in theory right? Should I just have a chopper on the main DC source that starts at 0 volts and ramps up to 24 while the arduino's waveform achieves a stable oscillation in the coil?

Is it safer to have the secondary open or resistive? I had thought open would be the lowest current.

The only thing you can do when the core is saturating is to lower the v/Hz ratio.

I may be totally out in left field on this one but there appears to be enough info here to do some back of the napkin spitballing so I’ll take shot at quantifying it. I’d appreciate any and all corrections.

A 3B97 ferrite saturates at 410 mT as stated in your spec. Ferrite is typically run at less than half saturation to allow for temperature rise. That would put things in a practical range of 100-150 mT to allow for all “rules of thumb” factors.

What would it take to saturate this 410 mT, 280 mm^2 core? Since we know voltage, frequency and core area, we could calculate that based on:

T = Wb / m^2 (Tesla = Webers • core area in meters ^2)

Plug in your core area (280mm^2) and you end up needing 115E-6 Wb to reach 410 mT (saturation). Then knowing:

Wb = V•s (Webers = volts • seconds)

We can plug in 24 volts and the amount of time for 1/2 cycle of 20 KHz which yields 600E-6 Wb. That’s a flux density of 2.14T with one primary turn. As the density goes down by the number of turns, the primary would have to be at least 2.14 / 0.41 or 5.2 turns for saturation. Realistically, to hit the more realistic 0.15T density, you’d need 15 turns (2.14 / 0.15).

A factor I ignored is that by using the motor driver, you effectively doubled the flux density because of the polarity reversal putting the total voltage swing at 48 volts. That doubles all the numbers above.

What we know points to saturation. Probably at about 9 volts with 2 turns and 20 KHz. But, that’s just a SWAG based on the available information.

1 Like

Thank you for that. It really helps.

Let's assume your calculations are more or less accurate. Let's assume that I'm using the full saturation and not a nominal saturation level). Let us also assume that until my 2nd prototype, I'm stuck with the core and physical geometry. What could I do to move the voltage up? Increase frequency? I want to be able to get the voltage as high as possible without saturating.

Yes. If voltage goes up, frequency must go up to keep a constant v/Hz ratio.

A proper lab power supply with adjustable voltage and current limits would lower the drama associated with power electronics.

Thank you. I'm going to try to attenuate the pwm duty as a means of voltage control so that I can monitor the current levels. The board says 20kHz max but I'm going to scope it at higher frequencies to see if it comes out any higher as well.

It's odd because the design tool I used solved for all the inputs I entered without complaining of over-saturation. Is there perhaps a better core than the 1 I have picked, giving due consideration to size, my primary design constraint? Maybe some neodymium or other more efficient material could achieve higher saturation in a small size? Number of turns seems to be limited mostly by wire gauge to pass the requisite current or I'd have increased that.

I think it is more like that your design tool uses ideal components rather than real ones. Unless you have to specify such things as the type of core and induction windings resistance in the design tool then it is not taking these into consideration.

Actually it had a drop-down menu containing a pre-selected list of cores and their properties and another section with inefficiencies. As far as widgets go on the internet, I was rather impressed... it may have been some university project or something. I should have bookmarked it.

Ok a good news update for a change.

The board above, despite being rated for 20khz is quite capable of 30. I'm not surprised TBH. So using a crappy little 9v battery, which shorted can't put out more than 2 amps, I connected a new board to my arduino and this time I made sure the AVR was fully booted up and running before connecting power. Once that was accomplished I saw a perfect waveform on my scope when probing the output of the motor driver.

Now the next challenge is going to be hooking up the transformer and stepping up the battery. To prevent another Chernobyl, I'm using a POT to scale my entire duty array from essentially 0 up to whatever the board can handle. I have an amp clamp that I can use to monitor current while I step up the duty and we'll see where this thing tops out. I plan to learn a thing or 2 before giving up on this transformer. If it craps out too early, and I can't software my way out of the problem, then at least I know I need a bigger transformer (for more windings) or a higher frequency (which will require stress testing the motor driver.

I'm at a bit of a crossroads.

I was able to get everything hooked up and working to a certain degree.

  • I was able to make the arduino output a good looking carrier, modulated at 60Hz by a duty array, which itself can be attenuated by a potentiometer using linear scaling.

  • I was able to feed that into the motor driver and get a 24V output that somewhat matched the input. There does seem to have been some degradation or something because I hear a faint audible noise as I increase the attenuation factor to 1:1

  • I was able to connect the transformer to the motor driver and get some kind of output on the secondary. However, with no filtering, the waveform looks like a bunch of spikes vaguely shaped like a sine wave and since I don't have an appropriate capacitor, I used one from a TV power supply rated at 480V but the capacitance was fairly high and this pretty much nullified the wave altogether except for a vague ripple and that's it.

If I have the capacitor connected or no transformer at all, there's almost no noise. If I connect the transformer without the cap, there is a very loud grating noise coming from... I think the transformer and the current seems to climb exponentially with my attenuation factor, reaching 13A at let's say 2/3 of full strength.

So herein lies my dilemma. First of all, I think my transformer needs to be re-wound because it's drawing too much current, making testing difficult. Alternatively I could get a better motor driver board with 100kHz limit so that I can raise the frequency but this will limit power output I think. Also my arduino signal seems to be getting degraded along the way for reasons I haven't yet determined.

Since there is no singular root-cause for my poor results I'm not exactly sure what the most cost-effective "next-step" should be since pursuing all of the above would be costly in time and money and I'd rather make incremental improvements for less of an investment than throw the kitchen sink at it now. Any suggestions?



It also occurred to me that when I look at transformers in daily life, like the power adapters that come on many appliances or video game consoles or whatever, they are plugged into the wall all day long (in open circuit on the secondary of course) and they don't burn up. If they are tuned right, the current in the primary doesn't short but is mostly converted into field impedance, right? So if I'm getting 15A through my primary with no load attached to the other side, something's got to be wrong with my transformer or I'm feeding it the wrong frequency? When I crank down the voltage supply, to be sure there's no over-saturation going on, the current drops, but then I barely register any sort of output on the secondary at all.

I'm curious as to the actual waveform feeding the transformer. Would you please post a functional program? The code in post #1 does not generate anything on an Uno. The original 20 KHz target would be fine.

Also, do you have the actual transformer turns data and wire gauge specs? Additionally, what shape is the core? I’m just curious if it could be gapped as the estimated flux density doesn’t make sense. Did you discuss the switching arrangement with the transformer winder so they were aware of the full potential across the primary? It just seems odd to do a single ended primary on a LV dc powered inverter.

That's odd. I mean I'm using a nano but that is my code verbatim. It generates 31.25 kHz because that's all I could get on Timer2 but it works. What error are you getting?

The transformer data is:
Ferrite 3C97
0.41T
280mm^2
f = 20kHz
Np = 1.75
Ns = 17.55
Ip = 16.17A
Is = 1.47A

... so 1.75 turns and 17.55 turns. Whire gauge is 16 AWG.

The actual waveform feeding the transformer is screenshot 2 of 3 above (middle one). That's what's coming out of the motor driver. The core is a Ferroxcube 3C97. The datasheet is here:
https://www.ferroxcube.com/en-global/download/download/94 so hopefully all the dimensional data you're asking about is in there.

No errors, it compiles fine, it just doesn’t do anything on an Uno. IIRC, two of the pins are always high, the other two alway low. Using an older 1.8 IDE but I cannot imagine that being an issue

Turns: 2 and 20 is possible but not 1.75 and 17.55. Gauge is equally nonsensical as well. So it sounds like you don’t actually know what you have.

The datasheet only provides information on the material, it does not answer my question so I think it is time for a photograph of the transformer with something in the frame to provide scale.

The screenshots don’t provide any useful information which brings us full circle back to my first paragraph. If I had a working program, I wouldn’t have to keep asking questions that are turning in a lather, rinse, repeat cycle.

Here is the latest code I have just scoped. Since it requires a POT, I have commented out a single line in the ISR so that it will work for you without a POT.

You should not get any output on any pin except pin 11.

unsigned int index = 0;
boolean flag = true;
float dutyfactor = 1;           // factor to attenuate the duty

unsigned int duties[] = {
15,
30,
45,
60,
75,
90,
105,
120,
135,
150,
165,
180,
195,
210,
225,
240,
240,
225,
210,
195,
180,
165,
150,
135,
120,
105,
90,
75,
60,
45,
30,
15
};
unsigned int timestamps[] = {
418,
837,
1259,
1687,
2122,
2566,
3023,
3495,
3988,
4507,
5060,
5661,
6331,
7113,
8113,
10486,
10486,
8113,
7113,
6331,
5661,
5060,
4507,
3988,
3495,
3023,
2566,
2122,
1687,
1259,
837,
418
};


void setup() {

  pinMode(7, OUTPUT);
  digitalWrite(7, LOW);
  
// This 8 bit timer2 code is for the 60Hz sine wave generation
  DDRB |= (1 << PB3);       // Pin 11
  DDRD |= (1 << PD3);       // Pin 3

  DDRB |= (1 << PB1);       // Pin 9 output
  DDRB |= (1 << PB2);       // Pin 10 output

  cli();

  TCCR2A = 0;
  TCCR2B = 0;
  TCNT2 = 0;
  
  OCR2A = 127;                    // Channel A duty
  OCR2B = 127;                    // Channel B duty

  TCCR2A |= (1 << WGM20);       // Mode 7
//  TCCR2A |= (1 << WGM21);   
//  TCCR2B |= (1 << WGM22);

//  TCCR2A |= (1 << COM2A0);    // Non-Inverting Mode on Pin A
  TCCR2A |= (1 << COM2A1);
//  TCCR2A |= (1 << COM2B1);


  
  TCCR2B |= (1 << CS20);        // Prescaler 1

//  TIMSK2 |= (1 << OCIE2A);
//  TIMSK2 |= (1 << OCIE2B);
//  TIMSK2 |= (1 << TOIE2);

// This 16 bit timer1 code is so we can count and keep track of when to change the duty on Timer2

  TCCR1A = 0;                   // Clear register
  TCCR1B = 0;                   // Clear register
  TCNT1 = 0;

  OCR1A = 0;                    // Define OCRA for timekeeping.  This will be modulated by Timer2.

  TCCR1A |= (1 << WGM10);
  TCCR1A |= (1 << WGM11);       // Mode 15, Fast PWM with OCR TOP
  TCCR1B |= (1 << WGM12);
  TCCR1B |= (1 << WGM13);

  TCCR1A |= (1 << COM1A1);      // Non-inverting on A pin

  TCCR1B |= (1 << CS10);        // Prescaler 1

  TIMSK1 |= (1 << OCIE1A);      // Enble Timer 1 Channel A compare match interrupt
//  TIMSK1 |= (1 << OCIE1B);

  sei();
  
}

void loop() {

  dutyfactor = 1 + analogRead(A0)/8;
 
}

ISR (TIMER1_COMPA_vect) {

  TCNT1=0;
  TCNT2=0;
  index++;                            // Increment the index

  if(index > 31) {                // Check if the end of the array has been reached
    index = 0;                    // If so, immediately go back to the first entry
//    TCCR2A ^= (1 << COM2A1);      // A should start generating a waveform while B shuts off and vice versa
//    TCCR2A ^= (1 << COM2B1);      // When Sine is +, channel A will produce only positive pulses, when Sine is - channel B will produce only negative pulses
    PORTD ^= _BV(PD7);            // Flip pin 7 for the motor controller direction pin
  
  }

  OCR1A = timestamps[index];          // Update the time interval till the next duty change
  
  OCR2A = duties[index];             // Update the duty of Channel A
//  OCR2A = duties[index]/dutyfactor;             // Update the duty of Channel A
//  OCR2B = duties[index];                      // Update the duty of Channel B
  
  
  
}

While I still believe the transformer needs to be re-wound, I am becoming increasingly suspicious of the Arduino/code. When I programmed it upstairs it looked fine. Then I took it downstairs and it sucked. Then I brought it upstairs and scoped it and it had a wicked distortion on it that I couldn't get rid of by swapping arduinos. With this latest code, it looks cleaner but not totally clean. When I attenuate the duty array using the POT, it looks good but when it approaches full strength ( I suppose as the denominator approaches the whole number 1 ), a DC offset causes the entire waveform to sink a couple volts or so and a 60 Hz wave gets added on top of the waveform. You'll see what I mean in the video:

On a bit of a tangent, not that it's critically important but there's other weirdness too like within a single period there are these random glitches where the duty will be stuck at 100% for a small segment of the wave for no particular reason. Also, even though the duty and time arrays are 100% symmetrical, the wave itself is not for some reason, which is why in a previous iteration I biased the wave by 10% in the other direction by array manipulation. These arrays however are symmetrical.

Agree there is some odd behavior in that code, I also see an always present very low frequency change in the duty cycle.

I would take a step back and simplify. Focus on the input, not the output.

Drive the primary with a basic square wave of constant frequency and fixed duty cycle of 49%. I would assume the motor driver would manage dead time but it’s cheap insurance when doing initial testing and you’re trying to avoid blowing stuff up.

Start at the design target of 20 KHz. If you don’t have a current limited supply, add enough resistance in series with the primary to keep the current within the driver range, only for as long as needed to understand switching behavior.

Bahh.. I'm wasting my time on this shit. I came up with a substantially improved algorithm that instead of modulating 1 wave with another, it draws each pulse of the entire sinusoid manually 1 at a time and does so with only 1 array and 1 timer. On the scope it looked markedly better than the prior method. However once again it turns into a bag of puke once I hook it up through the motor driver and transformer. The motor driver isn't doing too much harm to the wave but by the time it comes out the secondary of the transformer there's no trace of the original signal or the wave it represents. It's just a 60 Hz series of noisy fuzz balls. That and the fact that open-circuit, I'm drawing so much current that smoke is coming from every wire after 0.1 seconds.

The only way this isn't a complete fail is if I get a new transformer, feed it only 50% duty, get my high voltage, rectify it, filter it and then H-Bridge that, which means now I have to design and build a high voltage bridge from scratch because I can't find one anywhere for less than a million dollars.

How the heck do these Canadian tire "power packs" work anyway? Is it all solid state switched mode stuff?

No idea what you are talking about.

There are plenty of courses on power supply engineering, online and otherwise, its a big topic.

Did you ever post your circuit BTW?

Further reflection on this thread suggests you are trying to use the transformer at much lower frequencies than 20kHz by modulating the duty cycle - no dice I'm afraid, that will guarantee saturation and failure.

Please be upfront about exactly what you are trying to do, this may have been a case
of the xyproblem from the start.

Hi,

If you are talking about these;


There is no transformer involved I think, its all pure Lithium power, only for a few seconds, not hours.
The only transformer involved may be the little mains to battery voltage charger, SMPS.
There are MOSFETs in some, but they are huge and are not PWM or any sort of modulation, just HARD switch ON.

https://realtooltalk.com/how-do-jump-starters-work/#:~:text=The%20pack%2C%20when%20connected%20to,engine%20of%20the%20disabled%20vehicle.

Tom... :grinning: :+1: :coffee: :australia:
PS. Isn't google wonderful.. :grinning:

I was referring to this thing:

https://www.canadiantire.ca/en/pdp/motomaster-eliminator-powerbox-2000-0112028p.html

and just the AC portion of it.