1

Recently, I bought a DS18B20 temp sensor to monitor my fermentation temp of my beer and assumed I could just hook up the power, ground and data to their respective pins on the Pi but I could never get it to work. I looked online and there were a lot of tutorials that suggest the modprobe terminal approach but very few (if any) that gave a straightforward GPIO.setup, GPIO.input approach. Is there a reason for this? Is the Dallas 1-wire protocol more complex than I’m assuming? Thanks!

coco
  • 13
  • 2
  • I don't understand the question. Which are "their respective pins on the Pi" and what did you do to "get it to work"? – joan Sep 01 '19 at 16:20
  • Have you enabled the right device tree overlay dtoverlay=w1-gpio or dtoverlay=w1-gpio-pullup in /boot/config.txt? https://pinout.xyz/pinout/1_wire – Dougie Sep 01 '19 at 21:23
  • These two posts might help: (1) https://raspberrypi.stackexchange.com/questions/100203/pi-cant-find-5th-ds18b20 (2) https://raspberrypi.stackexchange.com/questions/102078/ds18b20-temperature-sensor-rj-x. – tlfong01 Sep 02 '19 at 03:25
  • @Dougie this is exactly what I was looking for! Thank you! – coco Sep 02 '19 at 11:07

1 Answers1

1

To enable 1-wire (with or without parasitic power) you need

dtoverlay=w1-gpio

dtoverlay=w1-gpio-pullup

in /boot/config.txt

Dougie
  • 5,301
  • 10
  • 19
  • 28