1
\$\begingroup\$

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:

  1. How does the mcp3008 samples the input channel? because the voltage is OK

  2. What simple measures I can take in order to fix it?

\$\endgroup\$

1 Answer 1

4
\$\begingroup\$

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.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Agreed. See page 8. \$\endgroup\$
    – Transistor
    Feb 28, 2016 at 23:20
  • \$\begingroup\$ @Mario Thanks. I didn't realize that wiring adds capacitance. I know it has resistance but I forgot that one. So I'll use a 2k resistor between my Vout to CH0 input. But what would be my new equation to measure the temp? I couldn't calculate the current there, so how am I suppose to calculate the voltage drop on the resistor? \$\endgroup\$
    – e-r-a-n
    Feb 29, 2016 at 5:38
  • \$\begingroup\$ The input of the ADC (in this case) is again a capacitor. It has a value of 20pF. There is also a sampling switch at the input that adds some resistance. You have to consider the R*C time constant and the frequency of the ADC to determine the maximum allowed resistance. I think the error will be small to negligible. If the 2k resistors works, try a smaller one and see if that still works. \$\endgroup\$
    – Mario
    Feb 29, 2016 at 5:58
  • \$\begingroup\$ @Mario I used 2KOhm resistor in between Vout to ch0 and unfortunately readings still variates alot. I see that it is also suggested in the spreadsheet to use a 0.1mF capacitor in parallel, between ch0 and GND, but I'm not sure if it will work? The whole point is to increase the capacitance between the two parts, right? How is a capacitor between ch0 to ground increases the capacitance? Also, I'm not sure I understand your point regarding RC time and determining the maximum allowed resistance \$\endgroup\$
    – e-r-a-n
    Mar 1, 2016 at 2:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.