4

I'm trying to have a DS18B20 working with my Raspberry Pi Model B Revision 1.0, and it doesn't work.

No matter what I try I still see nothing in /sys/bus/w1/devices/ besides:

pi@raspberrypi ~ $ ls /sys/bus/w1/devices/
00-280000000000  00-c80000000000  w1_bus_master1

The 00-xxx are changing every once in a while.

  • I have tried with dtoverlay=w1-gpio in /boot/config.txt (with pullup, without, with gpiopin without...).
  • I've tried to disable DT but no luck.
  • I've also tried to go back to an old kernel using rpi-update ba43047bec24d5f0a4150f09a37884240f8926d2 no luck either (and it breaks my wifi dongle).
  • I've tried to use port 4 (default) and port 5.
  • I've tried one 2 metter sensor waterproof sensor from aliexpress and a 1 metter waterproof sensor from amazon.

FYI, I'm able to switch on and off leds from port 4 and 5 if I switch them in out mode (and disable the w1-gpio).

Interesting parts of dmesg:

[   17.175551] Driver for 1-wire Dallas network protocol.
[   17.207547] w1-gpio onewire@0: gpio pin 4, external pullup pin -1, parasitic power 0
[   17.207613] w1_add_master_device: set_pullup requires write_byte or touch_bit, disabling
[...]
[   68.290649] w1_master_driver w1_bus_master1: Family 0 for 00.800000000000.8c is not registered.
[  127.602306] w1_master_driver w1_bus_master1: Family 0 for 00.400000000000.46 is not registered.
[  174.963571] w1_master_driver w1_bus_master1: Family 0 for 00.c00000000000.ca is not registered.
[  246.225280] w1_master_driver w1_bus_master1: Family 0 for 00.200000000000.23 is not registered.
[  305.536334] w1_master_driver w1_bus_master1: Family 0 for 00.a00000000000.af is not registered.

and so on.

Some details:

pi@raspberrypi ~ $ lsmod | grep w1
w1_gpio                 4295  0
wire                   31227  1 w1_gpio

pi@raspberrypi ~ $ cat /boot/config.txt | grep -v ^# | grep -v ^$
arm_freq=700
dtoverlay=w1-gpio
core_freq=250
sdram_freq=400
over_voltage=0
dtparam=spi=off
dtparam=i2c_arm=off

The breakboard I use: http://fr.aliexpress.com/item/1Set-Raspberry-PI-GPIO-Extension-Board-26-Pin-Cobbler-Extension-Flat-Ribbon-Cable-Wire-400pt-Breadboard/32341989972.html?isOrigTitle=true

This is the cabling I use enter image description here

With this wiring I can see that GPIO4 has power coming in, when I unplug it goes back to 0.

pi@raspberrypi ~ $ gpio readall
 +-----+-----+---------+------+---+-Model B1-+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   0 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |
 |   1 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 0 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |
 |  21 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 1 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+-Model B1-+---+------+---------+-----+-----+

my linux version:

pi@raspberrypi ~ $ uname -a
Linux raspberrypi 4.1.13+ #826 PREEMPT Fri Nov 13 20:13:22 GMT 2015 armv6l GNU/Linux

For what it's worth, here's the output of the debug when adding:

dtoverlay=w1-gpio 
dtdebug=on

in the /boot/config.txt

$ sudo vcdbg log msg
000935.684: HDMI:EDID error reading EDID block 0 attempt 0
000936.947: HDMI:EDID error reading EDID block 0 attempt 1
000938.206: HDMI:EDID error reading EDID block 0 attempt 2
000939.464: HDMI:EDID error reading EDID block 0 attempt 3
000940.722: HDMI:EDID error reading EDID block 0 attempt 4
000941.981: HDMI:EDID error reading EDID block 0 attempt 5
000943.239: HDMI:EDID error reading EDID block 0 attempt 6
000944.498: HDMI:EDID error reading EDID block 0 attempt 7
000945.757: HDMI:EDID error reading EDID block 0 attempt 8
000947.014: HDMI:EDID error reading EDID block 0 attempt 9
000948.037: HDMI:EDID giving up on reading EDID block 0
000951.077: HDMI:Setting property pixel encoding to Default
000951.097: HDMI:Setting property pixel clock type to PAL
000951.117: HDMI:Setting property content type flag to No data
000951.137: HDMI:Setting property fuzzy format match to enabled
000966.166: gpioman: gpioman_get_pin_num: pin LEDS_RUNNING not defined
000966.190: gpioman: gpioman_get_pin_num: pin LEDS_NAND_ACTIVITY not defined
000966.212: gpioman: gpioman_get_pin_num: pin LEDS_USB_ACTIVITY not defined
000966.232: gpioman: gpioman_get_pin_num: pin LEDS_FATAL_ERROR not defined
000966.254: gpioman: gpioman_get_pin_num: pin LEDS_APP_OK not defined
000966.276: gpioman: gpioman_get_pin_num: pin LEDS_APP_FAILED not defined
000966.296: gpioman: gpioman_get_pin_num: pin LEDS_HDCP_AUTH not defined
000966.319: gpioman: gpioman_get_pin_num: pin LEDS_HDCP_UNAUTH not defined
000966.341: gpioman: gpioman_get_pin_num: pin LEDS_HDMI_ON not defined
000966.363: gpioman: gpioman_get_pin_num: pin LEDS_DVI_ON not defined
000966.385: gpioman: gpioman_get_pin_num: pin LEDS_HDMI_HPD_UP not defined
000966.406: gpioman: gpioman_get_pin_num: pin LEDS_REMOTE_CONTROL not defined
000966.427: gpioman: gpioman_get_pin_num: pin LEDS_ARM_CONTROLLED not defined
001120.885: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state                                                                                         instead
001120.912: hdmi: HDMI:>>>>>>>>>>>>>Rx sensed, reading EDID<<<<<<<<<<<<<
001121.321: hdmi: HDMI:EDID error reading EDID block 0 attempt 0
001122.588: hdmi: HDMI:EDID error reading EDID block 0 attempt 1
001123.851: hdmi: HDMI:EDID error reading EDID block 0 attempt 2
001125.114: hdmi: HDMI:EDID error reading EDID block 0 attempt 3
001126.377: hdmi: HDMI:EDID error reading EDID block 0 attempt 4
001127.640: hdmi: HDMI:EDID error reading EDID block 0 attempt 5
001128.903: hdmi: HDMI:EDID error reading EDID block 0 attempt 6
001130.166: hdmi: HDMI:EDID error reading EDID block 0 attempt 7
001131.429: hdmi: HDMI:EDID error reading EDID block 0 attempt 8
001132.692: hdmi: HDMI:EDID error reading EDID block 0 attempt 9
001133.718: hdmi: HDMI:EDID giving up on reading EDID block 0
001133.752: hdmi: HDMI: No lookup table for resolution group 0
001133.769: hdmi: HDMI: hotplug attached with DVI support
001133.829: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state                                                                                         instead
001134.205: hdmi: HDMI:EDID error reading EDID block 0 attempt 0
001135.466: hdmi: HDMI:EDID error reading EDID block 0 attempt 1
001136.727: hdmi: HDMI:EDID error reading EDID block 0 attempt 2
001137.988: hdmi: HDMI:EDID error reading EDID block 0 attempt 3
001139.249: hdmi: HDMI:EDID error reading EDID block 0 attempt 4
001140.510: hdmi: HDMI:EDID error reading EDID block 0 attempt 5
001141.771: hdmi: HDMI:EDID error reading EDID block 0 attempt 6
001143.032: hdmi: HDMI:EDID error reading EDID block 0 attempt 7
001144.293: hdmi: HDMI:EDID error reading EDID block 0 attempt 8
001145.554: hdmi: HDMI:EDID error reading EDID block 0 attempt 9
001146.578: hdmi: HDMI:EDID giving up on reading EDID block 0
001146.643: hdmi: HDMI: hotplug deassert
001146.658: hdmi: HDMI: HDMI is currently off
001146.672: hdmi: HDMI: changing mode to unplugged
001146.694: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state                                                                                         instead
001147.475: *** Restart logging
001148.429: Read command line from file 'cmdline.txt'
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=d                                                                                        eadline fsck.repair=yes rootwait
001149.206: Loading 'kernel.img' from SD card
001389.282: Kernel trailer DTOK property says yes
001389.378: Loading 'bcm2708-rpi-b.dtb' from SD card
001433.252: Loaded overlay 'w1-gpio'
001433.343: dtparam: spi=off
001436.617: dtparam: i2c_arm=off
001453.269: dtparam: arm_freq=700000000
001454.497: Unknown dtparam 'arm_freq' - ignored
001454.534: dtparam: core_freq=250000000
001458.959: dtparam: uart1_clkrate=500000000
001460.189: Unknown dtparam 'uart1_clkrate' - ignored
001460.207: dtparam: cache_line_size=32
001493.081: gpioman: gpioman_get_pin_num: pin SDCARD_CONTROL_POWER not defined
002439.176: vchiq_core: vchiq_init_state: slot_zero = 0x4bc80000, is_master = 1
002443.373: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state                                                                                         instead
002448.004: gpioman: gpioman_get_pin_num: pin LEDS_RUNNING not defined
002448.031: gpioman: gpioman_get_pin_num: pin LEDS_NAND_ACTIVITY not defined
002448.056: gpioman: gpioman_get_pin_num: pin LEDS_USB_ACTIVITY not defined
002448.079: gpioman: gpioman_get_pin_num: pin LEDS_FATAL_ERROR not defined
002448.100: gpioman: gpioman_get_pin_num: pin LEDS_APP_OK not defined
002448.120: gpioman: gpioman_get_pin_num: pin LEDS_APP_FAILED not defined
002448.142: gpioman: gpioman_get_pin_num: pin LEDS_HDCP_AUTH not defined
002448.163: gpioman: gpioman_get_pin_num: pin LEDS_HDCP_UNAUTH not defined
002448.184: gpioman: gpioman_get_pin_num: pin LEDS_HDMI_ON not defined
002448.204: gpioman: gpioman_get_pin_num: pin LEDS_DVI_ON not defined
002448.225: gpioman: gpioman_get_pin_num: pin LEDS_HDMI_HPD_UP not defined
002448.248: gpioman: gpioman_get_pin_num: pin LEDS_REMOTE_CONTROL not defined
002448.271: gpioman: gpioman_get_pin_num: pin LEDS_ARM_CONTROLLED not defined

Please help!!!

benbbh
  • 41
  • 1
  • 1
  • 6
  • 1
    Are you sure it is a standard DS18B20 and not a parasitic power version? Do you have a link to your purchase? – joan Nov 25 '15 at 22:27
  • http://fr.aliexpress.com/item/1pc-2M-Waterproof-Digital-Temperature-Temp-Sensor-Probe-DS18b20-E5M1/1966569513.html?isOrigTitle=true and http://www.amazon.fr/gp/product/B00OPPZI8U?psc=1&redirect=true&ref_=oh_aui_detailpage_o00_s00 – benbbh Nov 26 '15 at 09:29
  • (not enough reputation to add the links in the question itself) – benbbh Nov 26 '15 at 19:21
  • They look like DS18B20 so they should work. 3V3 power, 4k7 pull up on the data line to 3V3, and ground. The only other "standard" error is to plug the cable into the cobbler back to front. Have you tried without the cobbler? – joan Nov 26 '15 at 19:55
  • Thanks for your answer. I tried without the cobbler but it's still the same (also when I do gpio read 1 I get 1 when wired and 0 when not). – benbbh Nov 26 '15 at 20:21
  • Edited my post and added the output of sudo vcdbg log msg with dtdebug=on in /boot/config.txt – benbbh Nov 26 '15 at 21:38
  • Verified with a multimeter: resistor is 4.7k, voltage between sensor red and black is 3.3V, between black and yellow: 3V. Tested with another raspberry pi B rev 1 with kernel 3.12.35+ nothing in the /sys/bus/w1/devices except w1_bus_master1 (I don't have the 00-* folders in this one). Only explanation I can find is: sensors are not working or my cabling is wrong. – benbbh Nov 28 '15 at 18:52
  • You seem to have tried everything. Perhaps the sensor is faulty. – joan Nov 28 '15 at 18:55
  • I tried with 3 different sensors (1 from aliexpress, 2 from the 5 I ordered from amazon), it doesn't make any difference. – benbbh Dec 02 '15 at 16:10
  • Also tried to reduce the resistor value to something like 1k (by adding 4 4,7k resistor in derivation, because I don't have a 1k resistor) as seen somewhere on the internet and it still doesn't work. – benbbh Dec 02 '15 at 16:11
  • Tried with a ~10k resistor as seen somewhere else on the internet, it is still not working, I'm going to see if I can try with a ESP8266. – benbbh Dec 06 '15 at 10:15
  • This might be the same issue as reported at https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=82603 in which case your P7 pin is actually connected to GPIO4. Everything else looks correct. – patthoyts Dec 08 '15 at 22:38
  • The picture in the site you mention shows breakout in v2.0 mine is v2.2 and I'm able to switch on a led when plugged on the same pin. – benbbh Dec 10 '15 at 16:54
  • I have the same issue, any resolution to this issue. –  Dec 14 '15 at 09:22
  • Any news about this issue? I have exactly the same problem and preconditions as described in the initial comment. Fighting two evenings without any success... –  May 31 '16 at 20:32
  • Unfortunately, I wasn't able to do anything. – benbbh Jun 02 '16 at 05:40
  • I had the same trouble with a previously working 1 wire setup using 4 x DS18B20 probes and a 4.7k pull up resistor. Removing 2 of the probes fixed it for me. – David Tinker Jun 20 '16 at 05:40
  • Are you saying it could be related to a low voltage/amperage issue ? – benbbh Jun 21 '16 at 07:58

1 Answers1

2

I had the same issue and spend two evenings before finding this link: http://www.reuk.co.uk/DS18B20-Temperature-Sensor-with-Raspberry-Pi.htm

It looked like every other howto, but in middle of the text, I found this:

NEW 6th May 2015 Update

Since the Raspbian operating system was updated back at the end of January 2015 (kernel 3.18.8 and higher) which enabled Device Tree, the above steps do not result in the temperature sensor(s) being detected.

Now you need to enter the following at the command prompt: sudo nano /boot/config.txt to open the /boot/config.txt file for editing. Then scroll down to the bottom of the file, and add the line: dtoverlay=w1-gpio

Ctrl-X to save the amended file. Finally reboot the Raspberry Pi so that the changes take effect.

Voila:

$ ls /sys/bus/w1/devices/
28-0000063707b6  w1_bus_master1

So it seems that all the howto's are obsolete now and needs to be updated...

Zopper
  • 21
  • 1
  • Thanks for your answer. I tried that, actually it is in my message, I'm editing it so that it looks more obvious. – benbbh Dec 09 '15 at 16:35