Continue to Site

AC speed/frequency controller with Arduino

Status
Not open for further replies.

Prince Charming

Member level 1
Hello, I've been designing a ventilation system where the speed of the fan must be controlled with a control signal coming from an Arduino. An AC motor speed must be controlled with frequency, also the AC motor's V/f ratio must be kept constant. That's why I've designed an rectifier-inverter cascade system. The frequency will be determined by inverter switching frequency and the voltage of the motor will be determined by the duty cycle of the same MOSFETs. The design is shown below:

I aimed for a 220V single phase induction motors which will draw 3A at most (which is generally more than enough for a window fan) and has 50 Hz input frequency. After being filtered the voltage is rectified and sent to the inverter. The low MOSFETs are driven with a dedicated driver (TC4427) and this layer is isolated from the microcontroller by an optocoupler. I've put current limiting resistances around the optocoupler. The high MOSFET's are driven by a bootstrap circuit and this was my first time doing one. I wanted to aim for 1Hz motor drive which is an extreme point. So I chose 220 uF capacitors to have enough time even at 1Hz. I assumed 220uF capacitors will charge fully in 1/60 seconds. I hope that's true assumption.

I've put RCD (D23,C22,R28,R41,C32,D15) snubbers to prevent voltage spikes that are caused by motor inductance when MOSFETs are turned off. I didn't know how I should have chose the values as each motor is different. So I didn't know how much capacitance is enough. I've just considered that the resistances are going to waste power so I wanted to keep them as high as possible while giving snubber capacitors enough time to discharge at 60 Hz. So I chose resistances as 1M which consumes 320^2/1000000 = 0.1 Watts of energy. The capacitance is 42 nF at most so I chose an 33nF. I would be glad if you could tell me if 33nF is too small or too big.

BTW: Pin10 and 11 are PWM signals coming from arduino

My biggest concern is that 12V supply in bootstrap is relative to ground and I would be concerned if the source voltage happens to be around 320V relative to ground, that would force the capacitor to charge to the reverse way. And probably destroy it with 320-12 = 308V reverse voltage. But I couldn't connect the bootstrap supply voltage to 320V because that would mean that I try to drive a MOSFET which has max 30V Vgs with 320V, that would BOOOM the MOSFET too. I really want to get rid of the confusion here I would be glad if you clarify my thoughts about bootstrapping.

Also I would like to hear any other concerns of yours about rest of the circuit.

Thanks.

Last edited:

I certainly agree with the BOOOM comment.

The drive signals to the MOSFET gates have to be referenced to the source pin of that MOSFET, not some other 'ground' that isn't galvanically isolated. You also need to consider that even at low motor speeds, the rise and fall of the gate voltages must be fast to charge and discharge the gate storage. You will never achieve that with your present circuit, even if the relative gate/source voltages could be reached. The dynamic gate currents could be in Amps so expecting a CMOS gate or 10K resistor to pass that current is unreasonable. If you don't drive the gates with enough current the devices will spend too long in 'shoot through' state where top and bottom MOSFETS are both conducting and that equals a short across the supply.

I suggest you look at gate drivers with bootstrap supplies like the IR2100 series and use the optocouplers to isolate the signals between the MCU and driver instead. That will give you the drive capability you need and the safety isolation too.

Brian.

Hi,

I surely don´t want to discourage you to do electronics at all.
But please don´t do high power (and that´s what 230V AC is) applications like this now.
Please learn and do it later.

There are a lot of mistakes. If you connect this on mains power, please inform the fire brigade first.

Just a well meant recommendation. I hope you don´t mind me leaving this thread.

Good luck. Stay healthy.

Klaus

IR2100 series ICs look cool, I will learn how to use them. Do you see any problem with output or input filters. Maybe I could increase C15 for example because line frequency is quite low or C19 is too large or small and it will break sinus wave shape. Actually this circuit will work in different frequency so idk if it is possible to determine one optimum capacitance.

Thanks.

Hi
PWM control H-bridge has its technic with complementry output + dead time.
Arduino Un (Atmega328 MCU) support this mode.
You will don't need the large boostrap capacitor as 220uF. This will cause slowly charge, when few first PWM to open highside mosfet with too low voltage Vgs, this can burn up your Mosfet.
If duty of PWM never reach 100% (<95%) boostrap capacitor will be charged each PWM cycle. Use higher Vdc for boostrap will get higher MAX DUTY, as 18V.
You can directly use Opto Driver like TLP250, TLP350 to control mosfet with boostrap. But you should use PWM_BREAK pin to stop PWM when over-current or SHUTDOWN pin of IR21xx driver for safety protection.
Warnning is diode use for boostrap should be fast recover type if you want to quickly block high voltage between 12V vs 311Vdc.
Suggest PWM frequency for motor control under 10kHz. PWM here is not output ac frequency. You still adjust as low as 0.1Hz for ac output frequency.
Don't care so much spike. If has, it will go through body diode of N-fet to charge Vdc capacitor. You need film capacitor to quickly charge and discharge for high frequency.
Use small capacitor with power resistor in parallel with motor to reduce ringing of EMI is OK. Don't need diode there. They need place closely motor to absort noise. The value will be decide of real frequency which is ringing on motor. Use oscilloscope to measure and design RC snubber with cutoff frequency under that ringing frequency.
When directly rectify from AC 220V input, you will never inverter output 220Vac with full power Iout = 3A. You need a pump/ PFC to achieve 400V (450Vdc) then PWM. The peak of 220Vac is ~311Vdc. Should use double fusese for L & N ac input for safety leakage/short of ac output to Earth.
Take care that, work with high voltage often need current feedback to protect short circuit current or overload. Before system BOOOM.
EMI/Noise is problem of this kind. MCU often reset, hanging. Layout is very important. Control carefully dv/dt, di/dt.
Optimize turn on/off or rise/fall time of mosfet is key of this inverter. Motor has its parallel capacitor in real model. So, spike on current is problem. Insert small inductor for output is suggested.

I wanted to aim for 1Hz motor drive

Extreme Ampere levels are likely when we run an inductive or partially inductive load (motor) at slower frequency than it's designed for. The same principle underlies the advice to avoid subjecting a 60Hz motor or transformer to 50 Hz, unless you reduce power by reducing voltage or other means.

The same principle causes surge current as a motor starts up, due to interaction of the slow rps with the inductive time constant.

The diodes D13,14 protect the 12V supplies from the high voltages

a good idea to run the motor off 48VDC first, also phase shift control is better as it shorts out the motor in between pulses - allowing it to rotate - 1Hz is unreasonable without multi pulse pwm to keep the currents in check - this is commonly done, e.g. 15kHz pwm with a 1Hz ac modulation, again phase shift, not straight pwm.

also - loose the 1uF cap C19 - it will add to the blow ups of the mosfets - as this is a big spike current every time diagonal pair turn on.
--- Updated ---

p.s. make sure you have 500nS of deadtime ... for all switches
--- Updated ---

p.p.s. the 10k in the upper gate drive should be 1 ohm

Sorry I was dealing with the Arduino code for some time. I figured out that my design was very hard. I used IR2110 IC to make the H bridge and my new circuit is as below, waiting for suggestions:

Suggest PWM frequency for motor control under 10kHz
I don't understand this PWM signal. I thought I was only going to need a PWM frequency which is same with AC output frequency.
When directly rectify from AC 220V input, you will never inverter output 220Vac with full power Iout = 3A.
3 Amps was an overkill but 0.5 Amps is okay, 1A would be good, after all it is just to power a 50W-100W fans. I just realized my parts can support 3 Amps so why not limit the max current to 3A. Higher currents might be needed when the motor starts but I don't know how large they will get. Btw I thought 220VAC as RMS values would have 320 VDC peak values and by inverting this signal, we can have a Ac voltage which has 320V peaks which means 220V in RMS. There will be losses during conversions that can be ignored I think because fans don't need big torques anyway. Can you explain why I need to pump the DC voltage to 400V-450V?
Voltage will be adjusted by duty ratio.
loose the 1uF cap
How can I smoothen the square wave into sinusoidal without that cap. I don't want SPWM as it is a complex concept to implement and it increases switching frequency

Last edited:

"
How can I smoothen the square wave into sinusoidal without that cap. I don't want SPWM as it is a complex concept to implement and it increases switching frequency"

you need to understand a lot more about power electronics - re-read my post perhaps ...
--- Updated ---

imagine what currents will flow at 1Hz with 0.5 sec each way - not to mention the spike in the cap going from 325V one way to 325V the other ( 650 V change ) i/c = dv/dt, so 650V / 250nS = i / 1uF => gives I = 2500 amps .... even 200A will damage your fets - think about it ....

"

How can I smoothen the square wave into sinusoidal without that cap. I don't want SPWM as it is a complex concept to implement and it increases switching frequency"

you need to understand a lot more about power electronics - re-read my post perhaps ...
--- Updated ---

imagine what currents will flow at 1Hz with 0.5 sec each way - not to mention the spike in the cap going from 325V one way to 325V the other ( 650 V change ) i/c = dv/dt, so 650V / 250nS = i / 1uF => gives I = 2500 amps .... even 200A will damage your fets - think about it ....
Oh I now understand, from the capacitor current formula. But wait a second, why did you take dt as 250 ns? My maximum switching frequency is 60hz that means 16.6 milliseconds actually and by applying the formula:
I= Cdv/dt --> I = 10^-6 * 650/(0.0166) = 0.039 Amps

Am I wrong at some point? I don't want to explode

Thanks.

How fast is the applied edge when one side of the H bridge goes up and the other down ?

Voltage will be adjusted by duty ratio.

How can I smoothen the square wave into sinusoidal without that cap. I don't want SPWM as it is a complex concept to implement and it increases switching frequency

Consider a series inductor (choke) for shaping square pulses into a smoother waveform. Your H-bridge needs to provide a low-impedance path for current to flow between power pulses.

My simulation illustrates the concept. In reality this is where experimentation is needed as to the Henry value, since the fan motor may contribute some amount of choke effect.

For additional smoothing you can install a capacitor in series or across the load. In the vicinity of 33 uF, say, non-polarized.

Both choke and capacitor must be robust enough to tolerate the same Ampere level as your fan.

Your power supply is a custom project, delivering hundreds of Watts. Your load characteristics are uncertain. Expect to spend a lot of effort, checking performance at various speeds, supply voltages, duty cycles, etc. Always be alert to temperature rising too high.

Did you check whether reducing supply voltage causes your fan speed to slow down or remain the same? I have a window fan whose motor runs slower when I hook up my step-down autotransformer. It provides 50 percent of house voltage without changing mains frequency. Yet my fan speed is not dependent on mains frequency.

How fast is the applied edge when one side of the H bridge goes up and the other down ?
Hmmm I see now, that happens almost in an instant. But we can charge capacitors with DC voltage with no resistor (almost at an instant) and they don't blow up, is frequency important here?
For additional smoothing you can install a capacitor in series or across the load.
The capacitor will slow down the voltage change and thus increase dt and decrease the capacitor current? Did I get it right?
In the vicinity of 33 uF
Isn't it too high for non polarized capacitor? The non polarized ones are so expensive at that capacitance and voltage rating. I can still add the highest I can around 1uF but I am afraid if it will get filled up and start blocking the current. Well I used to switch that fan on and off with a pure relay with no snubber and the fan didn't die so I think it can tolerate bad inputs (oh wait a second but the frequency is much higher now compared to the relay example)
since the fan motor may contribute some amount of choke effect
Yeah I thought that too, well, I'll experiment but my chance to use an oscilloscope is low, there is one at the basement but is not mine. I may put a random inductance around 33mH (or 330mH if it is not hard to wind that kind of an inductance, I don't have experience in inductors and I don't have the equipment to measure inductance, I will buy premade inductor and it is less likely to find 330 MH I guess, I need to research). The guy who implemented this device in the internet didn't use any output filter anyway. The video:
Did you check whether reducing supply voltage causes your fan speed to slow down or remain the same?
I don't have a AC chopper though I could hook the fan to a light dimmer Still, it is a bad way to control AC motor speed, is it linear for example? Because I've implemented a PID controller in Arduino and I'm not sure if it will work with AC chopper. And I am not sure if I am competent to design an AC chopper, it seems easy because all I know is connecting a TRIAC and a parallel snubber circuit but in reality the TRIAC will fire randomly or fail to fire at required moments so chopper doesn't do me much favour.

So I updated load side as:

Last edited:

Wait a sec what I've planed is wrong, must be wrong, the inductors will cause voltage spikes as the MOSFETs turn off, the motor already has an inductor and my additional inductor will damage the system.

Alright, I hope this output configuration is good enough:

The resistance limits the current and the inductor of the motor can continue current flow through the capacitor.

I believe the aim of your h-bridge is to apply a power pulse, then follow it by attaching low impedance to the motor. Your mosfets shall be gated to achieve this. I’m quite sure the YouTube video does it this way. Since current isn’t shut off abruptly It avoids generating severe inductive spikes.

I don’t think he turns off all mosfets between power pulses.

attaching low impedance to the motor
What does that mean. Should I connect a small resistance parallel to the motor? Or C and R in combination?
Your mosfets shall be gated to achieve this.
Well hopefully I will manage to do it with a single PWM pin. More code complexes everything but I couldn't figure a part out about that, can you check: https://www.edaboard.com/threads/1-input-2-output-on-off-switch-gate.403546/#post-1738366
I don’t think he turns off all mosfets between power pulses.
Well normally if you change the frequency of AC motor you must keep V/HZ ratio constant thus change the voltage proportionally (as far as I know). That's why I would really happy if I can build that output current filter for the motor.

Thanks.

Diagram showing four steps, how to switch an H-bridge so as to apply a modified sine wave to your load. (That is the conventional term for this type of inverter.)
At no time is the inductive (or partially inductive) load totally disconnected.

If you wish to obtain a sine wave, either add the capacitor in series, or there is the second style of filter involving a separate inductor. The cap should not be exposed to full current.
Rather than splurge for non-polarized caps, there's the handy trick of placing two electrolytic types back-to-back. (Plus-to-plus or minus-to-minus. Try each arrangement to find if one creates correct polarity in the center.)

As an alternate way to obtain a sine wave...
Bias your H-bridge with waveforms which create a sine wave. This means the mosfets spend a certain amount of time performing resistive drop. Hence they generate heat. This method Is inefficient although it's one of several you can experiment with.

Hi

1. PWM frequency is modulation frequency. It often higher 5 times of base frequency. In your design using directly modulate when f_pwm = f_base. This will creat square wave output. This method is simple but make motor hot, audiable.
In this graph, square wave is PWM control signal, after LC filter you will get sine wave. In your case, the inductance of motor is very high, so no need C for output. You will get current nearly sine wave, but voltage shape like PWM control signal.

2. You can use voltage directly after rectifying from 220Vac. As said before, to ensure boostrap circuit still work, need duty_max < 100% theory. In each half cycle of frequency, H-brigde acts as synchronous buck converter, when buck operate with high duty > 80%, it is very hard to control and stable output voltage/current. The second reason, high voltage on capacitor bulk is to store energy when output load plug/ change/startup. Energy = 1/2*C*U^2 . That why I suggest boost up to 400V or higher.

You will get current nearly sine wave, but voltage shape like PWM control signal.
And is this a problem? I mean, having a sinusoidal shaped current is nice but will the square voltage create problems?
to ensure boostrap circuit still work, need duty_max < 100%
Mine will work at max %99.6 duty ratio so I guess no problem.
That why I suggest boost up to 400V or higher.
The project is too complex for me already, I am trusting that fans have small loads so they can tolerate low voltages. I'll add boost circuit for the next design if I want to continue developing.

Since reduced voltage is acceptable, here's a topology that might be called cousin to a full H-bridge, except that one side consists of a two-capacitor stack.

The remaining half-bridge is biased by square pulses.