2

I'm trying to connect my 18B20 temperature sensor to my Raspberry Pi, but I couldn't find any videos or guides to learn from about how to connect this to my Raspberry Pi 3.

This is how the sensor looks like:

Sensor image (See 2nd row - 2nd column)

How I can connect this sensor to my Raspberry Pi 3?

When I tried to use Google for help, I found only useful information for DS1B20: https://www.tweaking4all.com/wp-content/uploads/2014/03/ds18b20-waterproof.jpg

This is what I got:

https://i.imgur.com/cyRfWX1.jpg

No idea how to wire or connect each to other

migrated from iot.stackexchange.com Oct 1 '17 at 9:11

This question came from our site for builders and users of networked sensors and control devices in the contexts of smart homes, industry automation, or environmental sensors.

  • learn.adafruit.com/… or google.com/… -1 for lack of effort. – Steve Robillard Oct 1 '17 at 9:13
  • 1
    @SteveRobillard, I wonder if you even read my question. The links you just provided show nothing about the 18B20, the pictures in your comment show totally different sensor then the image I just posted – TheUnreal Oct 1 '17 at 10:33
  • 1
    @TheUnreal The sensor is the same. It's just a different form factor. The 3 pins on the sensor in your picture corresponds to 3 pins on a DS18B20, so you should be able to use any old guide to connect one to a Raspberry Pi. – Lawrence Oct 1 '17 at 11:20
5

I've written a blog post detailing how to connect DS18b20 temperature sensors to a Pi here, but the short version is this:

The sensor has 3 pins:
Sense
3.3V
Ground

Which is which should be indicated on the PCB, with ground labeled as - and Sense labeled as S I'm not sure whether the PCB itself has a 4K7 resistor already on the board or not.
If it doesn't have a 4K7 resistor, then you'll need one across VCC and Sense.

If it does, it's just a simple matter of wiring VCC to 3.3v on the Pi, Ground to Ground on the Pi, and Sense to a GPIO pin on the Pi.

After that, activate the w1-gpio dtoverlay to get the sensor picked up by the OS.

The sensor should show up in /sys/devices/w1_bus_master1.

The values can be retrieved by using the cat command on the w1_slave node under sensor ID.
In my case, it looks like this

# cat /sys/devices/w1_bus_master1/28-0215012018ff/w1_slave 57 01 55 00 7f ff 0c 10 05 : crc=05 YES 57 01 55 00 7f ff 0c 10 05 t=21437

  • Thank, but what do you mean by "wiring"? This is what I got: i.imgur.com/cyRfWX1.jpg – TheUnreal Oct 3 '17 at 7:22
  • Wiring as in connecting. Putting wires between the sensors and the Raspberry Pi. You could make your own with crimp connectors, or you could buy something premade like this - gearbest.com/3d-printer-parts/pp_626779.html, but you'd need to modify one end for the Pi. – Lawrence Oct 3 '17 at 7:39
  • If I'll buy something like you suggested, what else I will have to modify on the pi? – TheUnreal Oct 3 '17 at 7:46
  • You'll need to split the ends on the wiring that goes to the Pi as the pins on the Pi aren't next to each other, and depending on whether that little sensor board has a resistor built in or not, you might need to add a 4K7 resistor on. – Lawrence Oct 3 '17 at 7:56
  • Thanks @Lawrence. I see that in any video about how to wire both there is a white board (See i.imgur.com/PL1xiDa.png). The Pi and the sensor both connected through it. What is the purpose of it and do I need it in order to wire the temp sensor? – TheUnreal Oct 3 '17 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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