womble123
Posts: 1
Joined: Sat Jul 25, 2020 7:20 pm

DIY Temperature Sensor

Sat Jul 25, 2020 7:27 pm

Hello,

I have been researching around it most temperature sensors are analog based from what I have read meaning you need a Arduino between the sensor and the Pi (RPi3 in my case).

I have bought one of these sensors: https://www.ebay.co.uk/itm/Digital-Wate ... 2749.l2649 and was wondering if I could open it up and solder it directly to some of the Pi pins?

Would that work? I could be wrong but as its a 'Digital' sensor then it should work with the Pi? If so, which pins etc would I need to use? I have a volt meter so I can check the internals of the sensor. I also don't mind butchering it (no display etc) just so I can get some readings into the Pi which would then display on Home Assistant (that's a separate matter which I am happy doing).

Cheers

jim1961
Posts: 39
Joined: Sun Dec 17, 2017 8:31 pm

Re: DIY Temperature Sensor

Sun Jul 26, 2020 4:25 am

I used the DS18B20 temp sensors inside our birdhouses. They connect directly to GPIO and there is easy to use Python code.

https://www.amazon.com/Aideepen-DS18B20 ... NrPXRydWU=

Jim

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: DIY Temperature Sensor

Sun Jul 26, 2020 8:21 am

Please be warned that a lot of the cheap DS18B20 sensors you see online are copies or factory rejects. They usually do work, but their accuracy may not quite be within the official specifications.

Having said that, unless a degree or two is critical to you, they are fine to use (except for the ones that don't work at all, but they are less common).

All you need is one 4.7K Ohm resistor and the wires to connect it to your Pi. Enable the 1-wire interface in the configurator (or sudo raspi-config -> Interfacing Options -> 1-Wire) and you're done.
Unreadable squiggle

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: DIY Temperature Sensor

Sun Jul 26, 2020 10:15 am

womble123 wrote:
Sat Jul 25, 2020 7:27 pm
Hello,

I have been researching around it most temperature sensors are analog based from what I have read meaning you need a Arduino between the sensor and the Pi (RPi3 in my case).

I have bought one of these sensors: https://www.ebay.co.uk/itm/Digital-Wate ... 2749.l2649 and was wondering if I could open it up and solder it directly to some of the Pi pins?

Would that work? I could be wrong but as its a 'Digital' sensor then it should work with the Pi? If so, which pins etc would I need to use? I have a volt meter so I can check the internals of the sensor. I also don't mind butchering it (no display etc) just so I can get some readings into the Pi which would then display on Home Assistant (that's a separate matter which I am happy doing).

Cheers



For anything more sophisticated or valuable I would normally reply: ask the vendor for a datasheet. But realistically you are not going to get anything useful about a 2.49ukp device from a seller named "sskwarehouseclearance"!



It seems to me you are in the realms of pure experimentation/investigation. There are 3 broad options -

Do nothing. You keep a working RPi3 and a working Temperature Sensor/Display module.


Try and fail. You end up with no temperature sensor and a potentially damaged RPi3.


Try and succeed. You end up with a temperature sensor for your RPi3, and an LCD display that you might also be able to reuse.

jim1961
Posts: 39
Joined: Sun Dec 17, 2017 8:31 pm

Re: DIY Temperature Sensor

Sun Jul 26, 2020 11:49 am

rpdom wrote:
Sun Jul 26, 2020 8:21 am
Please be warned that a lot of the cheap DS18B20 sensors you see online are copies or factory rejects. They usually do work, but their accuracy may not quite be within the official specifications
Interesting. Do you have a preferred brand/source for DS18B20? I don't need super accuracy but I sure need reliability.

Indeed I do use the one-wire interface with the pull-up resistor you mention. There was some handy Python code for reading the temp:

Code: Select all

from w1thermsensor import W1ThermSensor
Jim

User avatar
rpdom
Posts: 17173
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: DIY Temperature Sensor

Sun Jul 26, 2020 2:03 pm

jim1961 wrote:
Sun Jul 26, 2020 11:49 am
rpdom wrote:
Sun Jul 26, 2020 8:21 am
Please be warned that a lot of the cheap DS18B20 sensors you see online are copies or factory rejects. They usually do work, but their accuracy may not quite be within the official specifications
Interesting. Do you have a preferred brand/source for DS18B20? I don't need super accuracy but I sure need reliability.

Indeed I do use the one-wire interface with the pull-up resistor you mention. There was some handy Python code for reading the temp:

Code: Select all

from w1thermsensor import W1ThermSensor
Jim
I just buy the cheapest ones I can get from ebay. I haven't yet had any that don't work or are incorrectly wired (in the case of the pre-wired waterproof ones). Temperature readings drift a degree or so between allegedly identical sensors.
Unreadable squiggle

JohnsUPS
Posts: 172
Joined: Fri Jul 06, 2018 2:13 am
Location: USA

Re: DIY Temperature Sensor

Mon Jul 27, 2020 2:16 am

I have used the Dallas/Maxim DS18B20's a bit and have experience sourcing them from various vendors.
The first two batches I purchased were from Banggood.com (trying to go cheap - bad move), but from two different vendors who sell on that site. These sensors varied quite a bit from each other. Well out of spec.
I needed sensors that I could rely upon, and sourced them from Mouser. I am sure that other large, reputable component sellers such as Digi-Key (and surely others) will source directly from Dallas/Maxim, and you will get authentic parts.
Although the sensors I purchased cost a bit more from Mouser (I think the price was about the same at Digi-Key), in the long run it was the better thing to do.

Return to “Automation, sensing and robotics”