This is going to be a long question but I don't want to leave any loose ends.

I'm developing an incubator which includes a hot air pump to conduct heated air through a hose to a closed chamber (~100 ml volume.)

The heater module is made of two 40W-12V 3D printer resistors and one 15W-10 Ohm wirewound resistor (all later on called Rparallel) which is controlled by PID system with an Arduino UNO (Brett Beauregard's library.)

The air flow is generated by a 12V-2.9W PC cooler (SUNON MagLev KDE1206PKVX) which is controlled by an Arduino pin (set at 5V when user starts the assay) with the following circuit (220 ohm resistor instead of 1k):

Air flow fan control. 220 ohm resistor instead of 1k

In addition to these, I have a 20x4 LCD screen (with I2C module), a rotary encoder, one temperature sensor(LM35DZ) next to the heater module (to prevent overheating,) one temperature sensor (Si7021 with I2C module) in the closed chamber, and an extra PC cooler (2W-12V) to cool down the PCB board. I'm using a 12V-10A switching power supply.

When the PID is at 100% the voltage in the resistor (Rparallel= 1.5 Ohm) is supposed to be 12V, but due to the cables and transistor (IRF540N) drop, the maximum voltage is around 10V. All in all, in maximum behaviour I would be drawing 66.6 W + 5W (from coolers)= 71.6W. The PID circuit is as follows:

PID Circuit

Not shown in the previous picture there are a 0.1 uF, 10 uF and 100 uF capacitors between Cable 2 (1) and Cable 2 (2) at the PCB board.

The display and encoder work together to build a user interface where you can set the desired setpoint temperature in the chamber; start/stop the PID system and check the different temperatures through the assay; check the chamber's temperature (Si7021) before assay. I have a 100 nF capacitor at both ends of the LCD I2C display between VCC and GND (connected to the board with a 7 mm cable.) I have a 100 nF capacitor between pin A/ GND and between pin B/GND of the rotary encoder.

It is worth mentioning as well that the Si7021 sensor is conected to the PCB with a 4 pin-80 cm ribbon cable (I think that what it's called) with 100nF capacitor at both ends; air pump cooler and LM35DZ are connected to the PCB board with a 5 pin - 1m shielded cable; the heater module (Rparallel only, the PID circuit is at the board) is connected to the PCB with a 30 cm cable (the one that comes with the 3D printer resisor, a waxed one.) Data from the sensors is sent to a PC through a serial port.

The power supply conects to the PCB through a MOLEX connector and an array of decoupling capacitors is next to it:

Decoupling capacitors

Digging into the problem. SOMETIMES when I use the device at my house the thing works perfectly fine, no lagging, overheating, or anything. But when I take the device to the lab where I work the assay starts (air pump starts, Arduino PID starts, LCD and rotary encoder work well, temperature sensors working fine) for a few minutes and then everything suddenly freezes. The LCD is frozen, the serial TX and RX leds from Arduino stop working, the pin outputs for PID and air pump freeze at the value they were working. When I disconect the power supply and reboot Arduino the code seems to be corrupted or the Arduino behaves in a dumb way. I may have to reupload the code to get the thing working again.

At the beginning I thought it was the I2C modules that were the cause of these problems (I did a little research and found they are quite sensitive to interference) but last night I left the system running without the 12V power supply (this means only LCD,rotary encoder, Si7021) working for 12 hours and the freezing didn't occur.

I then decided to do a new test, everything connected but the Rparallel. This means that the PID circuit encounters an open circuit so the ~7 A draw didn't happen. I have to emphasize that the air pump cooler was turned on and working perfectly. With this test, the Arduino didn't freeze (discards interference from the air pump.)

The problem seems to be the power supply when the load is present across the MOSFET. I guess that when the power supply has to deliver all that power, spikes or something appears that micrcontroller cannot stand. I guess the reason for the thing working for long period of times is consistent voltage in the AC outlet or something (just guessing). It is not a cheap power supply. After spending the entire afternoon adding capacitors everywhere (the ones mentioned in the PID circuit and I2C modules) I'm out of ideas. I don't have an oscilloscope or a regulated lab power supply. I do have a fancy multimeter.

Before you suggest discarding the power supply and replacing it for a gel battery for example, the assays I need to run with the device (~7A in max behaviour) have to be at least 16 hours long. Is there a way to keep using this power supply without risk of frying the Arduino's chip by filtering someway?

Note: Where I am from we're still in quarantine so buying fancy things is not an option.

Hope I was thorough enough with my explanation. I don't consider it necessary to add the Arduino code, I've already quintuple checked it.

Entire schematics, I know it's not the best thing you've ever seen but it's the best I could do:

Schematics for the entire thing

At the moment the Arduino is not being powered by the 12V power supply but by the PC collecting data (I might have blown up the voltage regulator.)

Some real pictures from the PCB:

Picture 1 Picture 2

EDIT: So I've change both transistors in the circuit for the one recommended in the comments: IRFZ44. This greatly improved the efficency of the heating system. On the other hand I added 2 optocouplers (4N25) in the following way:

Fan and PID circuit modification

Obviously I isolated both circuits (disconnected the Arduino's ground and Vcc from the 12V power supply) and powered the Arduino UNO with a cellphone charger//PC.

The Arduino doesn't seem to freeze (I haven't try it in the lab where the problem appeared), nevertheless when collecting data through USB port something weird occurs (it happened before the modifications as well): When the PID system starts and the switching power supply has to deliver the ~7A the cursor of my PC starts moving erratically when I touch the mousepad. If I turn the PID off, the movement stops. Video here

It is obvious it has to do with power supply/ MOSFET switching noise... but, if there is no physical connection between Arduino and power circuit (thanks to optocouplers) why is this thing happening? Could EMI be so strong to mess with the cursor behaviour through USB? If yes, this could be the same reason for my Arduino freezing earlier? Is there a way to solve this in a way that doesn't need changing everything?

(I've try powering the Arduino with a cellphone charger and using a HC-05 to collect the data and it seems to work well, but sometimes the module freezes)

  • \$\begingroup\$ It would help to show a complete schematic. You may not have adequate Vgs on D3 which needs about 10V+. EMI issues are likely but without details. I cannot help \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jul 2 '20 at 23:02
  • 1
    \$\begingroup\$ That's a massive wall of text.. Have you tried powering the Arduino separately? i.e. using the high power PSU for the high power stuff and a smaller 12V or 5V PSU for the Arduino and other low power interfaces, sensors. (Tie both grounds together..) (Also please don't use GND pointing up and so on, there are resources online how to draw schematics). \$\endgroup\$ – Wesley Lee Jul 2 '20 at 23:03
  • \$\begingroup\$ @TonyStewartSunnyskyguyEE75 D3 is the output from an Arduino PWM pin. It's state is controlled by the PID system (max 5V). I can see that the transistor is being polarized because I measure arround 10 V across Rparallel. \$\endgroup\$ – Shupper Jul 2 '20 at 23:12
  • 1
    \$\begingroup\$ @TonyStewartSunnyskyguyEE75 you lost me there. Why would I need to shift gate voltage to 12V? According to the datasheet at a Vgs voltage of 5V I could get up to 15A throug Drain-source.Would you say this transistor proper for Arduino 5V logic? \$\endgroup\$ – Shupper Jul 2 '20 at 23:20
  • 1
    \$\begingroup\$ You can measure the power supply ripple with an oscilloscope. \$\endgroup\$ – user253751 Jul 3 '20 at 9:34

Your IRF540 is not really the right thing for 5V drive. Also the LM35 should have a series resistor as shown on the datasheet (maybe it does). Neither of those things are causing your problem.

It's probably related to the layout. A possible fix is, when you replace that IRF540 with a logic-level MOSFET, to slow down the switching significantly by adding some series resistance such as 10K or 20K (and increase the pull-down resistor to 100K or 200K). Slower switching means that there will smaller spikes from inductance and less EMI to cause problems.

  • \$\begingroup\$ Thanks for the response! Do you happen to know a good MOSFET I could use in this case? At the beginning of the project I was using a TIP122 (darlington) transistor but it didn't deal with the power I was handling that well.... Is there a way to slow down the switching for this transistor? Is a MOSFET the best alternative in this case? The spikes you mention are coming from the power supply of from the transistor it self (dumb question)? \$\endgroup\$ – Shupper Jul 3 '20 at 0:06
  • 1
    \$\begingroup\$ Spikes can come from fast switching itself. Voltage increases with the product of rate of change of current and inductance, so reducing the inductance (good layout) is similarly effective as slowing the switching. A common logic-level MOSFET for 5V use is the IRLZ44, which is okay for your current. There are much better ones, especially in SMT packages, such as CSD16327Q3. \$\endgroup\$ – Spehro Pefhany Jul 3 '20 at 0:39

Your system is not well designed. The fan is not just a cooler but a heat transfer device, so keep that at a constant speed independent of the heat control but only at a minimal speed sufficient to raise the temperature slightly faster than it cools down from ambient insulation.

The heat control driver is the big EMI problem that interference with by conducted voltage drop in V+ or rise in Gnd by your routing and layout. Use direct paths to PSU not shared by your Arduino and Fan and hopefully twisted pairs in case of oscillations.

Perhaps already mentioned bt your Fan driver would burn out Q2 Vbe , so I re-routed it. I don't see a good reason for R7, so , I bypassed that. PID ought to be pulsed on and off so it doesn't get hot and your do not need anything more than Proportional control pulsing on and off. It doesn't have to be fast like 20kHz . It could be 1 Hz but if you try to linear regulate 95W you can expect at some midpoint the FET will dump 40W, so not good. So learn to use PID or just P using PWM.

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.