I'm trying to read temperature through long wire, using raspberry pi.
I use mcp3008 that I power using one of my rpi 5V pins.
I use the same 5V pin to operate my LM35 temperature sensor.
The Vout
of my lm35 goes into channel 0 of the mcp3008, and I use some method to read the values (irrelevant to the story)
The sensor Vout= 10mV/C
, i.e 0.215V= 21.5 celcius
When I attach the sensor directly to my circuit, and try to read the values, I see the values are correct.
When I later use a twisted copper pair (telephone line), over around 5-10meters, my circuit wouldn't measure it correctly.
The readings are very inaccurate, goes around between 15-30 degrees, every second something else.
If I use a multimeter, I see the voltage is very steady, around what I sampled before (0.215V)
I have two questions in this matter:
-
How does the mcp3008 samples the input channel? because the voltage is OK
-
What simple measures I can take in order to fix it?
Best Answer
The large variations suggest that your sensor is oscillating. The wire presents a capacitive load to the output, that can me make it go unstable.
Put a resistor of 2k in series with the output of the LM35 as suggested in the datasheet.
Check the section "Capacitive Drive Capability" for more information.