I had two of these running fine, but now they've stopped. From reading I've done I think this has something to do with kernel updates and device tree. There seems to be about half a dozen options now with numerous permutations of config, but I haven't got it working at all.
I have a Pi B+ and I've wired:
- 4.7kΩ Resistor between pin 1 (3.3V) and pin 7 (GPIO 4)
- pin 1 (3.3V) to the +ve of the DS18B20
- pin 6 (GND) to the ground of the DS18B20
- pin 7 (GPIO 4) to the data of the DS18B20
I am running updated Raspian Linux raspberrypi 4.1.7+ #817 PREEMPT
From what I've read the options are:
- modules, and possibly parameters, in
/etc/modules
- blacklist statements in
/etc/modprobe.d/raspi.blacklist.conf
device_tree=
or not in/boot/config.txt
, and if not, thendtoverlay
statement that includesw1-gpio-pullup
orw1-gpio
gpiopin=X
whereX
is usually 4extpullup=Y
or ommitted whereY
is a pin number?
The device(s) is(are) never listed under /sys/bus/w1/devices/
where they used to be. I mostly just have w1_bus_master/
in there.
Things I've tried:
1. Without Device Tree (attempting to go to original config)
device_tree=
in /boot/config.txt
.
/etc/modules
including:
w1-gpio
w1-therm
This was an attempt to revert to the settings that worked before.
2. Without Device Tree but with more module params
device_tree=
in /boot/config.txt
.
/etc/modules
including:
w1-gpio pullup=0 gpiopin=4 extpullup=1
w1-therm strong_pullup=1
3. With Device Tree (hay, it's obviously the cool thing to do)
/boot/config.txt
contains: dtoverlay=w1-gpio,gpiopin=4
I've also tried various combinations of blacklisting and listing in /etc/modules
the wp-gpio
and wp-therm
modules.
Things I've read that have only muddied my understanding(!)
Not least because I have a Pi B+ whereas many are working with Pi2 which I don't have.
[EDIT] As suggested in comment:
/etc/modules
empty./boot/config.txt
does not havedevice_tree=
, thus enabling device tree. It does not contain anyw1-*
lines at all.
Result: lsmod
shows that neither w1-gpio
nor w1-therm
are there (nor wire
which is usually there when the other two are).
After sudo modprobe w1-gpio; sudo modprobe w1-therm
there is still nothing in /sys/bus/w1/devices/
, not even the w1_bus_master
one.
...
And with dtoverlay=w1-gpio-pullup,gpiopin=4
in /boot/config.txt
...reboot...
Now lsmod
shows wire
and w1_gpio
and w1_therm
. ls /sys/bus/w1/devices/
has the devices! Thanks @Joan!