Go Down

Topic: Unstable Temperature Sensor Reading (Read 185 times) previous topic - next topic

simonyh103

Hi everyone, I have just started playing around with Arduino recently. I want to hook up an industrial temperature sensor that I have lying around the house to the Mega and display temperature readings to a Nextion display. The sensor takes 25V dc and output a 0-5V to the Mega's analog pin. Everything seems to work fine when I have the sensor hookup to the board and runs the code. However, as soon as I wire up the Nextion Display, the temperature would fluctuate and would be off by several degrees Celcius. As I am hoping to hook up several sensors and relays, any help on how to fix this would be great.
p.s I am supplying power to the Mega via usb cable.

analogRead() would produce the following readings:
572.00
572.00
573.00
572.00
569.00

When I plug in the Nextion Display
598.00
605.00
632.00
648.00



groundFungus

#1
Sep 21, 2020, 04:04 pm Last Edit: Sep 21, 2020, 04:05 pm by groundFungus
Do not use Serial (USB) for the display.  You have 3 other hardware serial ports for that.

If that does not help, post your code.  Read the how to use this forum-please read sticky to see how to properly post code.  Remove useless white space and format the code with the IDE autoformat tool (crtl-t or Tools, Auto Format) before posting code.
You will save everyone's time if you read and follow the forum guidelines.  :)          
https://forum.arduino.cc/index.php/topic,148850.0.html
and
https://forum.arduino.cc/index.php?topic=97455.0

Wawa

"A 0-5volt sensor output" could mean that you are using the potentially unstable Arduino 5volt supply as reference.
Then any variation in the 5volt supply (caused by the display) will also be seen in the temp readout.

You could switch to one of the stable internal references of the Mega (1.1volt, 2.56volt) in setup(),
and bring sensor output down to this voltage with a voltage divider.

If you want more help, then post your code, with code tags, and post a link to the temp sensor.
Leo..

simonyh103

"A 0-5volt sensor output" could mean that you are using the potentially unstable Arduino 5volt supply as reference.
Then any variation in the 5volt supply (caused by the display) will also be seen in the temp readout.

You could switch to one of the stable internal references of the Mega (1.1volt, 2.56volt) in setup(),
and bring sensor output down to this voltage with a voltage divider.

If you want more help, then post your code, with code tags, and post a link to the temp sensor.
Leo..
Thanks for the quick reply WaWa. Indeed, if I power the Nextion display from an external 5v power source, the problem goes away. I am interested in trying out the internal reference 2.56volt if that gets me more stable and reliable readings. What voltage divider do I need to step my sensor output down to 2.56? Is there a way to do this more efficiently if I have multiple sensors?

johnerrington

#4
Sep 25, 2020, 06:48 pm Last Edit: Sep 26, 2020, 10:48 am by johnerrington
Your fritzing doesnt show power supply to the arduino.

The internal reference depends on which arduino you are using as different models offer different internal reference.

My page here will show you how to reduce the voltage from the sensor to match the reference.

http://www.skillbank.co.uk/arduino/measure1.htm

so if you are using a UNO, MEGA, or nano you will have a 1.1V reference; if you are using a Micro Pro or other 32U4 based board, a 2.56V reference.


I have just tried this on my Uno;  the Uno & nano have a 3.3V output you could use as a reference. Its looking very stable by comparison with the internal 1.1V reference.  I'm getting a value of 3181mV with a standard deviation of 2.5
I'm trying to help. If I find your question interesting I'll give you karma. If you find my input useful please give me karma (I need it)

Go Up