Raspari Pi DS18B20 DIRECT Connect

The Pi has internal weak pull up (and down) ‘virtual resistors’ and it seems that a short script / mod could be made to make the DS18B20 digital temperature probes Direct Connect’ to the Pi GPIO header with No interfacing circuit (4k7 pull up resistor) People might like to try this for a simple no fuss approach, esp using the 1m / 3m leaded industrial DS18B20 probes you can now get:


I soldered the three (+ve 3.3 -ve and 1w wires direct to a handy 5 way SIL socket

A few lines of code will activate the WPU resgister, in this case set it and exit leaving the WPU active until restart / reboot.

Save this as a program.py which can also auto execute using cron at boot up.
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM) # set up BCM GPIO numbering
GPIO.setup(4, GPIO.IN, pull_up_down=GPIO.PUD_UP)

I have tested this with multiple DS18B20 and works fine.

~ Andrew

1 Like

you might want to go through this The use of 4.7kOhm resistor with DS18B20 temperature sensor - Arduino Stack Exchange

The tech is well understood this end thanks :slight_smile:)
The link is a good refference to how the DS18B20 and 1w system works. I was being perhaps a little visually cryptic…
Point I am making is this is a very fast and virtual a ‘No Parts or Circuit’ sensor and how simply it can be made. Philosophically this is called the ‘Software / Hardware’ trade off. I am hinting that if WPU was activated on this pin within the standard Cayenne install setup then people could simply plug in a temperature probe and get max benefit from instant high quality factory calibrated high res temperature data. Bread boards and jumpers are a barrier to complete beginners. This is virtually ‘no parts’ and would marry well with the auto initialise / auto detect / auto add DS18B20 that works so well with the Pi Dashboard. That trick is fabulous, brilliant and always a show stopper in my books. Adding Auto WPU on pin 4 1w bus might be worth thinking about as apossible improve / mod for future release ? If any other reason simple temperature measurement is probably key or a part of a lot of projects
~ Andrew

2 Likes