I've designed a PID fan control system which takes air quality measurements via sensors and sets the AC fan motor speed by changing the H bridge frequency.
Circuit is as below:
Full:
Top:
Bottom:
Working principle: The Arduino gives a PWM signal that is two times more faster than the desired because the same PWM will control both half cycles of the AC signal.
The CD4013 inverts the output with each rising edge (that's why the duty ratio is limited up to 99.6 % but not 100 %.) The 74HCT08 is just an "AND" gate. It forces the output to turn off when there is no input from Arduino, that allows me to control the duty ratio. Pin10 and !pin10 are the outputs of the AND gates. They are applied to MOSFET drivers. The duty cycle of the PWM is related to the PWM signal frequency. There is a constant V/Hz ratio "220/50 = 4.4" to not overheat or underdrive the fan.
While I was testing the circuit, I used a 220 V neon light instead of a fan. I noticed that the light didn't light up, probably because the MOSFETs weren't firing. I saw 310 V across the capacitor as expected but the load wasn't taking it. One more thing I noticed was that when I plug the AC input in to outlet, the Arduino turns on but the OLED screen displayed only a portion of the text and rest of the screen was whitish grunge. This didn't occur with USB power. I thought it was because of the unstable voltage at the first instance when I plugged it in. I didn't care much because the screen was normal when the second page is loaded. The sensors were giving normal measurements and the display was showing that normal AC frequencies were being applied by the Arduino.
I prepared to take measurements. I plugged in the system this time I saw that the power supply LED, the Arduino power LED and sensor LED were blinking. I was surprised, I thought the power supply was corrupted and it was giving positive output then zero output in turns. I unplugged it but I couldn't think of what to do so I plugged it back in. The blinking occurred again, I didn't care this time, I just wanted to take measurements from the H bridge so I approached the system. When I sat down near it I noticed a burning smell and unplugged the system. I thought the power supply was just dead, it was a cheap low power supply after all (12 V 6 W 0.5 A LED driver.)
I was constantly touching the IR2110, CD4013, 74HCT08N and ATmega chip after I unplugged the system. They weren't hot. I didn't touch the voltage regulator during tests but I remember I felt hot air over it. I was concerned if it was going to affect the temperature sensor, I wasn't more concerned.
I waited for the capacitor to discharge, then I connected the Arduino to USB. I touched the regulator and it burned my finger. I removed the power supply and tested the Arduino alone. It burned my finger again. I turned my focus to the power supply. I tested the power supply with a multimeter and a 12V LED and surprisingly it was working perfectly. I measured the resistance between Arduino VCC and GND pin and it was only 10 ohms. Something was basically penetrated by current (if that's the right term.) I removed the regulator and this time I saw only 18 ohms. I plugged in the USB cable, as there was no voltage regulator, this time, the ATmega chip burned. I desoldered everything that's connected to VCC pin but still the resistance between VCC and GND was 18 ohms. The MOSFET drivers (IR2110) are completely fine. I checked the resistance between their output and ground pins, it was large.
On the voltage regulator it says: 4MBD and I don't know what model that is.
My question is:
What could possibly cause the Arduino to burn like that? Does my cheap Arduino clone have a poor regulator that can't handle 12 V raw input? Does the cheap LED driver have voltage spikes at start up and that killed the regulator? Did the 310VDC find a way to Arduino (this option is unlikely because the Arduino performed normally for some time during tests, if 310 V were there it would die instantly, right? The LED and screen weren't brighter than they should've been.)
Note: The power supply is removed and VCC pin of Arduino is desoldered.
I GUESS I FOUND THE ANSWER
Let's take a look at the datasheet of IR2110:
Both the Vss and COM pins are tied to ground. VSS is the ground for VDD (which is responsible to charge the bootstrap capacitor, in my example VDD = 12V which is supplied by the power supply which also feeds the Arduino). That's why Vss will be connected to the power supply ground, also this is the Arduino's ground. What about the COM ground, it's the ground of the H bridge, not the ground of Vdd. That's why COM and VSS must be considered separately. In most cases people will connect H bridge ground and Arduino to the same line so that Vss and COM can be connected together but in my case I didn't connect H bridge ground and VDD ground that's why there was always a potential difference between these two grounds.
My mistake might be to connect VSS and COM pins together to the power supply ground:
This might have created high voltages at the ground of Arduino and burned it.
My second question:
Should I connect the power supply ground to the H bridge ground with a wire as below, is it that simple?
-----------------------------------------Final-------------------------
The answer to my second question is "Yes".
IR2110 tried to drive the low MOSFETS with 12V voltage difference not between the source and gate but the Arduino ground and gate, that's why the 220V light didn't turn on. I'm still unsure about why the Arduino burned but there might me tons of things going wrong beyond my level of understanding.
Diagnosis: Uneven Grounds (probably)