# rPi 3 w/thermistor

#### Do you have a question? Post it now! No Registration Necessary

•  Subject
• Author
• Posted on
Hi, I am trying to use a  2 lead thermistror (not a temp/humidity sensor) with

I cannot find any instructibles or any rpi python code examples anywhere.  What
I did so far is connect the ground to one lead, vcc to the other lead using a Y
union and put an inline 1-K ohm rewsitor to a third lead as signal [GPIO 23).
Is there any code magic that can read the digital signal and convert it to
tempature?

Alleycat! BBS - telnet://alleycat.synchro.net

Re: rPi 3 w/thermistor

The setup you describe provides a variable analog voltage output. Non of
the raspberry pi have the capability to directly read an analog voltage,
breakout board, or chip in a breadboard.

Googling

raspberry pi using a thermistor to measure temperature

gave a few hits such as ...

https://www.hackster.io/ahmartareen/iot-temperature-sensor-with-raspberry-pi-2-and-thermistor-7e12db

https://www.instructables.com/id/Raspberry-Pi-Temperature-Sensor/

Jim

Re: rPi 3 w/thermistor

You don't need an ADC, you can do it via timing a capacitor.

Wire up something like this:

GPIO0 -=thermistor=-----+---||----- GND
R           |    C
GPIO1

Set GPIO0 low, wait a while.
Now set GPIO0 high and start timing
When GPIO1 goes from 0 to 1, stop the clock

If you know the time, capacitance C, the GPIO output high voltage, and the
low-to-high threshold voltage for GPIO inputs, you can solve the capacitor
charging equation to find R.

Putting the midpoint into a comparator with a more precise threshold would
help with accuracy over using GPIO1 directly.  Using its reference voltage
as GPIO0 divided exactly in half via a potential divider would make the
system independent of I/O voltage variations.

Theo

Re: rPi 3 w/thermistor
On 02/27/2020 09:12 AM, Theo wrote:

IIRC Thermistors can be quite non-linear. Check the datasheet for the
thermistor you are using. Over your specific temperature range it may be
linear enough.

Re: rPi 3 w/thermistor

That applies to voltage sensing circuits too.  Once you know the current
resistance of the thermistor, either by timing or measuring the voltage of a
potential divider, you then should look up the thermistor curve to find out the
temperature.  Although as you say it may be linear enough for part of the
range.

Theo

Re: rPi 3 w/thermistor
On 27/02/2020 15:12, Theo wrote:

Low to high threshold is probably more temperature dependent than the
thermistor!

A better bet is to construct an RC oscillator with the thermistor as
part of the R and measure frequency, but this is not a simple thing -
you need a fair few components

The best bet is to buy this:

I2C interface ..

--
You can get much farther with a kind word and a gun than you can with a
kind word alone.

We've slightly trimmed the long signature. Click to see the full one.
Re: rPi 3 w/thermistor
On a sunny day (27 Feb 2020 15:12:58 +0000 (GMT)) it happened Theo

Cool!

Re: rPi 3 w/thermistor
On Thu, 27 Feb 2020 09:08:45 -0400, Gregg Somes wrote:

Pi's don't have any analog to digital convertors. The simplest
solution is most likely to be a 1-Wire temperature sensor:

https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf

Plenty of code out there to work with them (and many of the other
1-Wire devices).

--
Cheers
Dave.

Re: rPi 3 w/thermistor
On 02/27/2020 12:23 PM, Dave Liquorice wrote:

One wire?
BULL! I quote the referenced pdf "... one data line (and ground)".
And as a PRACTICAL point you need another wire to power the device.
That makes it a *THREE* wire device.

Re: rPi 3 w/thermistor
On 28/02/2020 10:19, Richard Owlett wrote:

Yebbut there is only one DATA wire. :-)

You are probably not old enough/in te wrong country to have listened to
the exploits of Larry the Lamb and Dennis the Dachsund in Toytown, on

There was a character called IIRC the Inventor who complained 'the
trouble with this  wireless is that it involves such a lot of WIRE!!!"

https://www.bbc.com/historyofthebbc/anniversaries/july/toytown-first-transmitted

--
Microsoft : the best reason to go to Linux that ever existed.

Re: rPi 3 w/thermistor
On 02/28/2020 04:43 AM, The Natural Philosopher wrote:

ty

ROFL

o

I was in college by time it ended. But on the wrong side of the Pond.

!!!"

ansmitted

Re: rPi 3 w/thermistor
On Fri, 28 Feb 2020 04:19:38 -0600, Richard Owlett wrote:

They|some can be 'parasitically' powered from the data line's pull up ...

so one wire ... and a ground that is everywhere - ish :-)

Avpx

--
'You've got the loudest silences I ever did hear from anyone who wasn't
We've slightly trimmed the long signature. Click to see the full one.
Re: rPi 3 w/thermistor
On 02/28/2020 09:17 AM, Nick Norman wrote:

Yeah. BUT the spec sheet shows it as a three terminal device.

Re: rPi 3 w/thermistor

- as in DS18B20, parasitic temperature chip, most easily used as a 3-pin
TO-92 package...

--
Mark J
From RISCOS 5.27 on a BeagleBoard-xM and Raspberry Pi2B
We've slightly trimmed the long signature. Click to see the full one.
Re: rPi 3 w/thermistor
On 2020-02-28 02:19, Richard Owlett wrote:

I've used the DS13B20 in many applications with parasitic power.

ONE WIRE (plus ground).  One.  Uno.  Hitotsu.  Ein.  Un.  It works.

As I recall, you use a 2k resistor between 3.3v and the data line, and
connect data and ground to the correct GPIO and ground on the RPi.  The
1-wire interface should be able to handle devices that use parasitic power.

but if you want to split hairs over terms, *whatever*...
(most people find nit-pickers to be irritating)

--
(aka 'Bombastic Bob' in case you wondered)

'Feeling with my fingers, and thinking with my brain' - me

We've slightly trimmed the long signature. Click to see the full one.
Re: rPi 3 w/thermistor
On a sunny day (Thu, 27 Feb 2020 09:08:45 -0400) it happened "Gregg Somes"

First question is what do you want to measure
if it is temperature below / above some point MAYBE,
but thermistors are highly non-linear,
so you want to either measure voltage across your resistor and then calculate
the resistance / and then whatever that represents

so you need what is called an analog to digital converter (board?).

The GPIO as _digital_ input sees a 'logic zero' below some voltage and a 'logic one' above  some voltage.
Th exact voltage can vary,  also  depends on temperature and production  spread,
but is somewhere between 0 and 3.3 V

So UNLESS you want o measure a dead cold versus a red hot thermistor is not of much use.

An external ADC (analog to digital converter) also will need a stable external reference voltage
I have done all sort of things with temperature sensors using Microchip PICs as ADC.. connected
to serial port... but that needs some electronics and programming knowledge,
http://panteltje.com/panteltje/pic/th_pic/

Of course there are other ways, for the fun ..
I wrote a program that converts a digital clock display read by a camera to time as text,
you could use it to read a multimeter :-)

Anyways to interface and ADC to GPIO takes some electronics knowledge and some programming knowledge,
preferably C,

But maybe there exists a board 'HAT?'for that?

Re: rPi 3 w/thermistor
On 28/02/2020 11:39, Jan Panteltje wrote:

Of course there dies, Or rather an 12c interface board which is handier
since you can mount it where you want to measure temps..

--
?it should be clear by now to everyone that activist environmentalism
(or environmental activism) is becoming a general ideology about humans,
We've slightly trimmed the long signature. Click to see the full one.
Re: rPi 3 w/thermistor
declaimed the following:

Presuming common CMOS thresholds of 30 and 70%: <0.99V is LOW, >2.31V
is HIGH. What the circuit does between those thresholds is indeterminate
(I'd hope it holds the last valid state until the far threshold is
crossed).

--
Wulfraed                 Dennis Lee Bieber         AF6VN
snipped-for-privacy@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

Re: rPi 3 w/thermistor
On 28/02/2020 17:27, Dennis Lee Bieber wrote:

#
A fairly presumptuous presumption.

<0.99V is LOW, >2.31V

No, it is perfectly possible to have the output between '0' and '1'. At
hear all digital circuits are in fact analogue, just as all analogue
circuits at the quantum level are in fact digital :-)

It does not.

--
"Anyone who believes that the laws of physics are mere social
conventions is invited to try transgressing those conventions from the
We've slightly trimmed the long signature. Click to see the full one.
Re: rPi 3 w/thermistor
On Fri, 28 Feb 2020 12:27:48 -0500, Dennis Lee Bieber wrote:

that is exactly what does NOT happen.
the logic sate will flip at some in-determinant point between the two
thresholds. The thresholds are simply points at which the state is
guaranteed.

--
This restaurant was advertising breakfast any time. So I ordered
french toast in the renaissance.
We've slightly trimmed the long signature. Click to see the full one.