An Arduino three phase inverter is a circuit which produces a 3 phase AC output through a programmed Arduino based oscillator.
In this post I have explained how to make a simple microprocessor Arduino based 3 phase inverter circuit which could be upgraded as per user preference for operating a given 3 phase load.
We have already studied an effective yet simple 3 phase inverter circuit in one of our earlier posts which relied on opamps for generating the 3 phase square wave signals, while the 3 phase push pull signals for driving the mosfets was implemented using specialized 3 phase driver ICs.
In the present concept also we configure the main power stage using these specialized driver ICs, but the 3 phase signal generator is created using an Arduino.
This is because creating an Arduino based 3 phase driver can be extremely complex and is not recommended. Moreover, it is much easier to get off-the-shelf efficient digital ICs for the purpose at much cheaper rates.
Before building the complete inverter circuit, we first need to program the following Arduino code inside an Arduino UNO board, and then proceed with the rest of the details.
Arduino 3 Phase Signal Generator Code
void setup() {
// initialize digital pin 13,12&8 as an output.
pinMode(13, OUTPUT);
pinMode(12,OUTPUT);
pinMode(8,OUTPUT);
}
void loop() {
int var=0;
digitalWrite(13, HIGH);
digitalWrite(8,LOW);
digitalWrite(12,LOW);
delay(6.67);
digitalWrite(12,HIGH);
while(var==0){
delay(3.33);
digitalWrite(13,LOW);
delay(3.33);
digitalWrite(8,HIGH);
delay(3.34);
digitalWrite(12,LOW);
delay(3.33);
digitalWrite(13,HIGH);
delay(3.33);
digitalWrite(8,LOW);
delay(3.34);
digitalWrite(12,HIGH);
}
}
Original Source: http://forum.arduino.cc/index.php?topic=423907.0
The assumed waveform using the above code could be visualized in the following diagram:
Once you have burned and confirmed the above code in your Arduino, it's time to move ahead and configure the remaining circuit stages.
For this you will need the following parts which hopefully you might have already procured:
Parts Needed
IC IR2112 - 3 nos (or any similar 3 phase driver IC)
BC547 transistors - 3 nos
capacitor 10uF/25V and 1uF/25V = 3 nos each
100uF/25V = 1no
1N4148 = 3nos (1N4148 is recommended over 1N4007)
Resistors, all 1/4 watt 5%
100 ohms = 6nos
1K = 6nos
Constructional Details
To begin with, we join the 3 ICs to form the intended 3 phase mosfet driver stage, as given below:
Once the driver board is assembled, the BC547 transistors are hooked up with the HIN and LIN inputs of the IC, and illustrated in the following figure:
Once the above designs are constructed, the intended result could be quickly verified by switching ON the system.
Remember, the Arduino needs sometime to boot, therefore it is recommended to switch ON the Arduino first and then switch ON the +12V supply to the driver circuit after a few seconds.
How to Calculate the Bootstrap Capacitors
As we can see in the above figures, a circuit requires a couple of external components near the mosfets in the form of diodes and capacitors. These parts play a crucial role in implementing precise switching of the high side mosfets, and the stages are called bootstrapping network.
Although already given in the diagram, the values of these capacitors could be specifically calculated using the following formula:
How to Calculate the Bootstrap Diodes
The above equations can be used for calculating the capacitor value for the bootstrap network, for the associated diode we have to consider the following criteria:
The diodes activate or are enabled in the forward bias mode when the high side mosfets are turned on and the potential around them is almost equal to the BUS voltage across the full bridge mosfet voltage lines, therefore the bootstrap diode must be rated enough to be able to block the full applied voltage as specified in the specific diagrams.
This looks fairly easy to understand, however for calculating the current rating, we may have to do some math by multiplying the gate charge magnitude with the switching frequency.
For example if the mosfet IRF450 is used with a switching frequency of 100kHz, the current rating for the diode would be around 12mA. Since this value looks quite minimal and most diodes would have a much higher current rating than this normally, specific attention may not be essential.
Having said that, the over temperature leakage characteristic of the diode can be a crucial to be considered, especially in situations where the bootstrap capacitor may be supposed to store its charge for reasonably sustained amount of time. In such circumstance the diode will need to be a ultra fast recovery type to minimize the magnitude of charge from being forced back from the bootstrap capacitor towards the supply rails of the IC.
Some Safety Tips
As we all know that mosfets in 3 phase inverter circuits can be quite vulnerable to damage due to many risky parameters involved with such concepts, especially when inductive loads are used. I have already discussed this elaborately in one of my earlier articles, and it is strictly advised to refer to this article and implement the mosfets as per the given guidelines.
Using IC IRS2330
The following diagrams are designed to work as a 3 phase PWM controlled inverter from an Arduino.
The first diagram is wired using six NOT gates from the IC 4049. This stage is used for bifurcating the Arduino PWM pulses into complementary high/low logic pairs so that the a bridge 3 phase inverter driver IC IC IRS2330 can be made compatible with the fed PWMs.
The second diagram from above forms the bridge driver stage for the proposed Arduino PWM, 3 phase inverter design, using the IC IRS2330 bridge driver chip.
The inputs of the IC indicated as HIN and LIN accept the dimensioned Arduino PWMs from the NOT gates and drives the output bridge network formed by 6 IGBTs which in turn drive the connected load across their three outputs.
The 1K preset is used for controlling the over current limit of the inverter by suitably adjusting it across the shut down pin of the I, the 1 ohm sensing resistor may be reduced appropriately if the current a relatively higher current is specified for the inverter.
Wrapping Up:
This concludes our discussion on how to build an Arduino based 3 phase inverter circuit. If you have any further doubts or questions on this subject please feel free to comment and get the replies quickly.
For the PCB Gerber Files and other related files you can refer to the following link:
https://drive.google.com/file/d/1oAVsjNTPz6bOFaPOwu3OZPBIfDx1S3e6/view?usp=sharing
The above details were contributed by "cybrax"
Dave X says
What do you think the delay(6.67) statement does in the code? It looks like it was copied from someone who doesn’t know what they are doing.
The Arduino delay() routine doesn’t do floating point:
https://www.arduino.cc/reference/en/language/functions/time/delay/
Swagatam says
Hi, I cannot see any delay(6.67) statement in the code, can you please show me where exactly it is mentioned?
Although even my Arduino knowledge is not good, I would still like to investigate this.
Please let me know…
Davex says
There are several floating point delays in loop():
void loop() {
int var=0;
digitalWrite(13, HIGH);
digitalWrite(8,LOW);
digitalWrite(12,LOW);
delay(6.67);
digitalWrite(12,HIGH);
while(var==0){
delay(3.33);
digitalWrite(13,LOW);
delay(3.33);
digitalWrite(8,HIGH);
delay(3.34);
digitalWrite(12,LOW);
delay(3.33);
digitalWrite(13,HIGH);
delay(3.33);
digitalWrite(8,LOW);
delay(3.34);
digitalWrite(12,HIGH);
}
The delay(6.67) will be truncated to delay(6) and the delay(3.34)s will be truncated to delay(3) and the code will run about 10% faster than planned.
Swagatam says
Since I am not good with Arduino, I asked “Google Gemini” about this, and here’s what it said:
Yes, the statement is correct.
Here’s a breakdown of why:
Floating-point Delays: The delay() function in Arduino is designed to take an integer argument representing the delay time in milliseconds. When you pass a floating-point value like 6.67 or 3.34, the compiler will truncate it to the nearest integer, which in this case is 6 and 3, respectively.
Impact on Timing: This truncation will result in the delays being slightly shorter than intended. Since the delays are truncated by approximately 10% (from 6.67 to 6 and 3.34 to 3), the overall execution time of the loop will be about 10% faster than if the exact floating-point values were used.
To ensure accurate timing it’s recommended to use integer values for the delay() function or consider using alternative timing mechanisms that can handle floating-point values more precisely.
DaveX says
Are you saying that some AI thing says my statement was correct? It’s still silly to use floating point values because all of the alternative timing mechanisms are based on integers: integer milliseconds, integer microseconds, or integer clock cycles.
The easiest alternative timing mechanism is to use https://www.arduino.cc/reference/en/language/functions/time/delaymicroseconds/ (which has a limitation of 16383us, so it isn’t very flexible) To use it, you’d replace the delay(X) with delayMicroseconds(Y) with Y being the corresponding number of microseconds:
delay(6.67) -> delayMicroseconds(6667)
delay(3.33) -> delayMicroseconds(3333)
Then you are using integers which do not look foolish.
If you needed to adapt to lower speeds, with delays larger than 16383us, you might use something based on micros():
// delay for longer than delayMicroseconds()’s 16383us upper limit:
unsigned long startMicros = micros();
while(micros() – startMicros < 123000){
; // do nothing
}
…
Swagatam says
Ok got it! Thanks for your feedback, I hope the readers will find the information helpful!
Dr Krollspel says
Hi,
+ Does the circuit have a feedback loop?
+ What about the frequency compensation?
Swagatam says
Hi,
No the circuit does not include a feedback loop or compensation, it is just a basic 3 phase inverter circuit. However, since here an
Arduino is used to generate a constant frequency, compensation may not be required.