# Self-Diagnosing Power Inverter with MAX31875 (#MakeWithMaxim Contest)

Introduction
Power Inverters (PI) are becoming more popular everyday. From creating an AC outlet in your car, generating AC power for your house from Solar charged batteries or driving Hybrid or Electric vehicles' motors, this device plays a major role in several applications. The advances in IGBTs and the research for materials, like SiC devices, opens possibilities and enhance the system's overall efficiency, a big concerne nowadays, mainly for Electrical Vehicles (EV).
This project, initially intended for EV applications, may be useful in a great range of equipaments. The main focus here are the PI which drives motors. It may be an elevator or escalator motor, industrial machines and, the inspiration of it all, EVs.

In high power applications, a fail in any inverter's leg may be catastrophic, not only for itself but for the device connected to. So, the ability of self-monitoring and self-diagnosing may prevent accidents and bigger damages. And here is where MAX31875 saves the day.
The tiny package allows precise monitoring of each IGBT, making possible not only just monitor the system but predict failures and adjust power output to work always at the most efficient range. An additional sensor measuring ambient temperature may give one more info to the system, helping it to adjust its behavior for every environment condition.

So, this project documents the idea of using a small, precise and low-power temperature sensor to allow the main controller to monitor, adjust and predict the behavior of power invertes dedicated to run AC motors, preventing overtemperature damages and enhancing system's efficiency and reliability.

BOM
The project has five parts: Power supply, inverter, driver, sensor and main controller.
To build a prototype, I suggest the following parts:

Inverter board:
- 6x IKA06N60T 600 V, 6 A IGBT;
- 6x FFPF10UP60S 10A, 600 V Ultrafast Diode;
- 1x 10 pins, 90° pin header.

Driver board:
- 3x IR21094D IC;
- 3x 1N5819 Diodes;
- 6x MBRS140T3G Diodes;
- 6x 10 Ohms 1/4 W resistors;
- 3x 22 uF 50 V electrolytic capacitors;
- 6x 47 uF 50 V electrolytic capacitors;
- 1x 10 pins, 90° pin header;
- 1x 8 pins, 90° pin header.

Rectifier (in case you don't have a battery to power your motor):
- 6x 10A06 diodes;
- 1x 10 A fuse (with holder);
- 1x 10 A 47uH inductor (value not optimized yet);
- 1x 330uF 400V Electrolytic capacitor.

Main Controller (suggestion):
- 1x tactile switch;
- 1x DC power jack;
- 1x 14 pins 90° pinheader;
- 1x 8 pins 90° pinheader;
- 9x 0.1 uF ceramic;
- 1x 100 uF 50 V electrolytic capacitor;
- 1x 10 uF 16 V electrolytic capacitor;
- 1x 1 kOhm linear potentiometer;
- 1x 1 kOhm 1/4 W resistor;
- 3x CD4066 IC;
- 3x 470 Ohms 1/4W resistor;
- 1x 4k7 Ohms 1/4W resistor;
- 3x 3mm standard LEDs;
- 1x L78L33 voltage regulator;
- 1x PIC16LF1934P microcontroller.

Sensor:
- 6x Thermo 6 Click Board;

All these parts were found online at Mouser website.

Schematics

All the four schematics are here, but just remembering: the main controller is just a suggestion. It isn't the focus here. And you won't need the rectifier if you have a battery to power your motor.
All schematics and PCBs were created with Autodesk EAGLE 8.6.0 (with Premium license).

Instructions

All the circuits here shown were designed to handle up to 10 A of load per phase, but the idea is theoretically scalable to any power level.
First, let's talk about each part.

The inverter
As seen at the first schematic, there's not too much to talk about it. We have six IGBTs, responsible for switching the DC Bus voltage and thus, drive the load. Each IGBT has its own associated freewheeling diode. As we won't power pure resistive loads, they are required for deal with voltage spikes during switching time, protecting the IGBTs. One connector (JP1) is used to control the IGBTs and the other (X1) to supply this board.
UW, VW and WW are the outputs, labeled this way for motor connections.
If you are missing the DC Bus Capacitor, don't worry: it is at the next board.

The rectifier
Unfortunately, I don't have a high voltage battery (some Tesla owner would do me a favor?), so, we need to rectify the AC mains voltage to DC. Looking at the second schematic, you see how we'll do it.
Six diodes rectifies the three phases to DC voltage. Why three phases? Simple: less ripple with smaller capacitor and lower phase currents.
The fuse avoids IGBTs blowing away in case something goes wrong.
The inductor along with the capacitor form a LC filter to reduce the DC Bus ripple.
To deal with In-Rush current, one Solid State Relay (SSR) with Zero Cross Detection (ZCD) per phase must be used. They may be triggered with an auxiliary 5 V power supply or using the 3V3 output on the main controller board. Just don't forget current limiting resistors!

Main controller
As already said, it just a suggestion. Any microcontroller board may be used here. Fell free to choose. As I'm used to use PIC microcontrollers, I designed this circuit seen at the third picture.
As input we have just one potentiometer. It controls the inverter's frequency as also shuts it down.
As output for the user, the circuit has three LEDs: PWR_ON (indicates when the board is powered on), RUN (warns when the inverter is working) and ERROR, which will blink in different patterns indicating which IGBT failed (or will fail) and Overtemperature. No voltage or current feedback are given once it's not the purpose here. We are interessed in analysing temperature data from the inverter. A more complete design MUST have at least current feedback as safety resource.
Reset circuit has the needed pullup resistor (R1) for normal operation of microcontroller and a reset switch (S1). R2 and C1 debounces S1 signal.
The voltage regulator is built around a simple linear regulator. C2 and C5 are filter capacitors and C3 and C4 are decouple capacitor. As the others decoupling capacitors, remember to keep them as near as possible of each IC.
We have two connectors: one connects this board to the driver board (we'll talk about it later) and the other connects the 6 Thermo 6 Click Boards.
MAXIM says in future they will sell MAX31875 with different device address. If these become available, we would dispense the 3 CD4066 ICs responsible for switching which board will connect to I2C lines (see "Sensor selector interface" block at the diagram). This would simplify a lot the design. For now, we need or a I2C bus expander or switch them with biderectional switches.

The driver board
This board here has 3 IR21094 half-bridge drivers to control the IGBTs based on main controller's signals. R1, R2 and R3 adjusts the deadtime of each IC. If you don't worry about deadtime adjusts, just use other driver IC like IR2109. The power is supplied by the main controller board. The power and signal input is taken via JP1 and JP2 connects to inverter board. Any model of diode can be used instead those indicated, but remember to use Schottky or fast types.

Now, let's hook it all together and watch nothing happens because we need a program running on microcontroller.

"Are you OK, inverter?"
The block diagram below shows how everything connects as well as the closed-loop between the inverter and main controller.

The following fluxogram outlines the main controller firmaware principle.

As can be seen, the program has to deal with two different conditions:
1) Is the IGBT operating at the specified operating temperature range?
2) Is the IGBT temperature aproaching to it's temperature limit?

In first scenario, there's not too much to be done: if the component is overheated, the system must shutdown the inverter and don't allow another turn on until the temperature normalizes. Both the proposed diode and IGBT has a maximum operating juntion temperature of 175°C, but we don't want to hit that spot, so we have to set a safety value, in example, of 100°C. I mentioned the diode because probably the IGBT and the diode will share the same heatsink, so we must look at the lowest maximum value of both components.
But, if the component is not overheated yet, It doesn't mean everything is OK. Here is where this design's difference appears: the second scenario.

The main controller program will gather temperature data and analyse the curve: if the temperature tends to increase and it is reaching the safety value, the system has to limit the output power, thus limiting temperature increase. If this measure doesn't change curve profile, the inverter has to be shutdown.
On the other hand, if the curve shows a decrease in temperature increase without exceeding safety range, the inverter will run with limited output power until the temperature drops below warning threshould. This point may be, in example, 80°C when the maximum safety temperature is 100°C, which will give the system a hysteresis. When the system returns to stable and safe conditions, the output power may be increased or restored.
The expected system's behavior is exemplified on the graph below:

This prediction of temperature behavior keep components away from overheat and thermal damage, increasing system lifespan and its reliability.

If something goes wrong, would be nice to know where is the problem, and that is why we have ERROR LED. When the system detects or predicts an overtemperature condition, after shutting down the inverter the LED will blink (125 ms ON, 125 ms OFF) n times, where n is the number of faulty IGBT (1 to 6), pauses for one second then blink again until the system is reset.

When I say "reset", I don't mean pressing RESET button. The system turns on and off based on potentiometer position. Instead of using one more switch, we just create a deadzone in potentiometer value. This region will be responsible to shut down the inverter. So, resetting means bringin the potentiometer back to deadzone and then to "run" position. When out of deadzone, the main controller will translate that value to output frequency, adjusting the motor speed.

Why not NTCs or other simple temperature sensor?

Instead wasting time sampling and converting voltage signals with internal or external ADC, we let the MAX31875 do the job with low power consumption. It gives us the temperature in two’s complement format, so it's easy to work with the data without converting it to floating point format, what also reduces power consumption and CPU instructions needed, allowing even the weaker CPUs to handle the task.
It also simplifies the design, because we no longer need to worry about interference in analog signals, noise and etc. because the sensor communicates with the MCU using digital signals, giving all the data ready to use. We also avoids calibration and floating-point format to work with exponentials and logarithmic functions needed to convert NTC's signal into temperature.
The MAX31875 also includes an overtemperature indicator with programmable threshold and hysteresis, reducing even further the CPU efforts. Just read the configuration register and we know if the temperature exceeded the limits.
Last but not least important, it's very tiny, allowing to measure the temperature as close as possible to each component. Custom heatsinks would integrate the sensor board without much effort.
So, this especial temperature sensor fits flawlessly here and the Thermo 6 Board allows us to develop the inverter board without wasting time, effort and money designing some development sensor board. Also, this board has easy connections, both for cables and for pinheaders/connectors.

Video

Source Code
Unfortunately, shipping time for all these parts is longer than the deadline of this contest. So, I couldn't write any code, because I have no way to debug and make sure it's running as it should. But the fluxogram shown above and other infos given here allows anyone to understand and write their own code.

Code:
No code today
No CAD files were generated for this project as it won't be built as above stated. Also, heatsinks, cases and boards should be designed following each application needs.

Author