fluctuating temperature readings when getting power from inverter

Hi all.

I have a sketch running measuring the temperature of my fridge using a thermistor.
When running the sketch while the arduino is powered via sub the readings are pretty accurate and consistent.

However this fridge is located in my campervan and there it’s being powered by a standard 5v phone charger. This fridge and charger are being powered by an inverter.
If I monitor the temperature I read a lot of fluctuations of sometimes all most half a degree Celsius, this being above or below actual temperature.

I monitored the temperature and saved the visual result of the plotter and when powered by usb the line of rising temperature is smooth, the line is jagged like a saw (not sure how to explain this decently in englis) when powered by inverter.

So the question is, any idea what might be going on and how to solve this?

I believe what you are seeing is electrical noise on the analog input to the arduino. The noise is likely coming from the camper inverter which by their nature generate a lot of electrical noise.

I would suggest you start by connecting a 0.01µf capacitor between gound and very close to the arduino analog input. The ground should also be very close to the arduino ground.

If you google “noisy inverters” you will find a lot of related information.

To help understand the problem you are having I will make up some numbers that might not be exactly what you have but will show the concept.

So at 25 °C the arduino analog input would measure 1.054 volts.
And 26°C would measure 1.068 volts.

So every 1 °C change would be 1.068-1.054 = 0.014 volts

The noise pickup only has to be 0.007 Volts to give you a 1/2 0176C error.

If the noise you pickup on your wires from the inverter looks like the attached, you can see every time you take a reading it will be a little different.

The 0.01 µF will average out some of the noise.

@Johnson thank you for your reply. I searched a bit for noise inverters and I see now. On top of that it isn't a pure since inverter so that might be helping even more with my problem.

So I'll start with the cap. When you say "very close to the analogy input" my first thought is I'll solder it on the analogy pin I use. Same with the ground, I'll use the closest ground pin on the arduino.

Another thought I had, was to put a capacitor on the power input of the arduino? So maybe the incoming power might be stabilised a bit?

Thanks again for your great example it was easy to understand.

Could somebody maybe let me know if I have the right cap placement in mind?

Bringamosa:
@Johnson thank you for your reply. I searched a bit for noise inverters and I see now. On top of that it isn't a pure since inverter so that might be helping even more with my problem.

So I'll start with the cap. When you say "very close to the analogy input" my first thought is I'll solder it on the analogy pin I use. Same with the ground, I'll use the closest ground pin on the arduino.

That counts as very close, with a cm of the pin...

Another thought I had, was to put a capacitor on the power input of the arduino? So maybe the incoming power might be stabilised a bit?

Yes, lots of electrolytic decoupling and perhaps a little series resistance before it (a few ohms). 220uF or more
might be a starting point.

Thanks again for your great example it was easy to understand.

Awesome thanks a lot for the fast answers, I love this forum!