Hi all, my first post here.
Trying to learn Arduino programming by working on my first project.
I tried asking the question on Arduino stack exchange but I haven't received all that much input there (arduino uno - PWM fans causing temp sensor erroneus values (interference?) - Arduino Stack Exchange) and I hope that the community here may be able to help me.
Basically I am trying to control PWM chassis fans (their speed) based on temperature.
I'ce got everything setup and code logic seems to work fine. Instead I am having problems with the temperature sensor TMP36 that was included in the official Arduino begnner's kit.
So, I have connected the fans exactly as in the picture in the attachement. Taken from
Picture source
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 al the time 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 (Datasheet TMP36) 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 spinning 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 fwith ans 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!