I am learning Arduino programming and my current project for real use is to connect 10-17 PC chassis PWM fans to be temperature controlled by the arduino.

So, I have connected the fans exactly as in the picture. Taken from https://www.racedepartment.com/threads/easy-diy-wind-simulator-for-assetto-corsa.133999/

PWM Fan connection diagram

The temperature sensor is a TMP36 (included in the official Arduino beginner's kit). It is connected to +5V and GND on the Arduino Uno R3. Middle pin is the output and is connected to A0 on the Uno.

Temperature readings seem to work well up until the point the fans start spinning. When they do, the output pin on the TMP36 sensor outputs junk values. Such as 0V or 700mV and it fluctuates up and down if I try probing it with a multimeter. When fans some to a stop however, the output once again stabilizes to a fairly correct value.

I am no expert in electronics interference, but electric motors I suppose cause some electrical noise? I had hoped that PC Chassis fans would already have electric components inside the hub to prevent such though... Currently I am trying to run 2 fans at the same time but I wish to use 10-17 later once this works.

The fans I am using are Arctic 92mm PWM Rev 02.

I have checked the datasheet (https://www.arduino.cc/en/uploads/Main/TemperatureSensor.pdf) for TMP36 (TO-92 package type) and tried adding a ceramic 0.1µF capacitor between +5V and GND and also add resistor of varying values to the output pin. I believe I got some stabilization out of it but not enough. Especially when the fans start spinnig faster than 20% duty cycle on pwm it starts to flip out.

I have tried to disconnect power to fans to check if PWM signal may cause it too, but this is not the case as the TMP36 remain stable with PWM on but fans disconnected.

Can someone please help me with explaining what is probably going on and how I can mitigate the problem in a preferably easy way? Do I need to add diodes, capacitors, resistors? Where? Or should I change to a different temperature sensor (which)?

Thankful for help!

  • Quick thought: It may be that trying to do both is causing problems. That is, you may be using the same processor resource(s) for both features. Like a timer or a serial port. Just because an Arduino program compiles doesn't mean that the libraries you include will work with one another.
    – st2000
    Commented Jun 11, 2018 at 13:58
  • BTW, you are using a second power supply to power the Arduino, right? I say this as I realize 2 things. 1) I assume you have copied a working project exactly. So there is precedence that the included libraries work together. -and- 2) There is no second power supply in the diagram. I think the original author just assumed there would be one.
    – st2000
    Commented Jun 11, 2018 at 14:04
  • @st2000 Hmmm, I only use PWM (analogWrite) and AnalogRead to read the temperature value. It feels like a very "simple case" for it to collide? That would cause lots of problems in projects of all kinds then. I tried to use an LDR instead of a TMP36 and fetch analog values and that worked like a charm. The Arduino is powered via USB (PC connection). The fans are powered via external wall adapter as in the picture. So power for fans is drawn from the power adapter. Commented Jun 11, 2018 at 14:48
  • The LDR would have needed a pull up or pull down resistor. (Did you use one?) Where as, I assume, the TMP36 would not. I didn't look at the TMP36 spec, my bad, I didn't realize it developed an analog output. I thought it was one of the common temperature probes which communicated over an I2C bus. Double check that you have connected to the correct pins of the TMP36. Note the TO92 case is a bottom view whereas the other case views are from the top.
    – st2000
    Commented Jun 12, 2018 at 0:25
  • @st2000 You are correct, yes I had a resistor in series with the LDR (10kOhm) while the TMP36 did not need one (although in the datasheet I then found a section towards the end regarding high inductive loads showing a capacitor of 01µF and a resistor of 750 Ohm). Maybe is stailized things a tiny bit but as soon as fans spin up above 20% or so the TMP36 starts acting up. The connections to the TMP36 should be correct because it works fine when fans are not spinning. I feel that there's something missing, like some capacitor or diode or something for the fans maybe? Commented Jun 12, 2018 at 7:02

1 Answer 1


In case anyone has the same problem, I solved it. Turns out is was a bad PSU. Buying a new, higher quality one made everything work. So the issue was high ripple I suspect, or at least high enough when applying some load (which is why I noticed that things got worse after the fans started spinning at greater than 20% duty cycle) for the temperature sensor to flip out.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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