TMP36 unstable when controlling 12V led strip

Hello, I'm controlling 12V LED strip using a tmp36 temperature sensor. The idea is: when it gets too hot -> turn the LEDs off or vice versa.
I've found a very helpful youtube video, based on which I setup the whole thing like this:

Only in my case instead of the little lamp I've got an LED strip and instead of a motion sensor I've got a temperature sensor.
Now everything is fine when I run it without the 12V power source - tmp36 is pretty stable and accurate, but as soon as I plug that 12V power source, the temperature sensor becomes unstable. Among a couple correct ones it starts reporting random incorrect values, even negative ones. I alleviated the issue a little bit by using 2 different grounds on my Arduino uno - one for the temp sensor and one for everything else. It helped, but it's still not perfect.
Does anyone know what is happening here and how do I fix it?

A TMP36 requires the use of 1.1volt Aref to be stable.
So do you have this in setup().
analogReference(INTERNAL); // switch to 1.1volt Aref
Leo..

1 Like

Thank you! I've also found another post by you in the forum with more info regarding analogReference(INTERNAL).
I've added the line and switched to different temperature calculation. Now it seems to be more stable.
As a reference for how to measure and calculate temperature I used Arduino projects book from the starter kit, but it seems there are better ways to measure temperature.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.