D
D
Denis2019-05-09 13:51:59
Electronics
Denis, 2019-05-09 13:51:59

Raspberry Pi 3b+ not seeing DS18b20 over 1Wire?

Problem : The new raspbian kernel does not detect the DS18b20 sensor on the 1wire bus. This is due to the Device Tree that was added to Kernel 3.18.8 ( Kernel 3.18.8 breaks 1-wire )
What is available :
Raspberry Pi 3b+ Kernel: 4.14.98-v7+
DS18b20 working, checked on arduino
The signal is pulled up + through a resistor 4.7 to Ω (tested with 1k Ω )
Tested for 3.3v and 5v

Connection photo
5cd40d167d5b6465463756.jpeg
Bottom line : To take readings, you need to add dtoverlay=w1-gpio to /boot/config.txt and for the new kernel this is enough for the sensor to be detected on GPIO4 and the wire, w1-gpio, w1-therm modules are loaded
After that, in / sys /bus/w1/devices directory appears whose name starts with 28-* this is the place where the readings in the w1_slave.
Identical issue on stackexchange
Q : Why is my Raspbury not detecting the sensor and adding it?
Everything related to this issue was re-read, and the last advice on the forum was to score on raspberi along with this sensor.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2019-05-13
@mrtall

So there is an answer, but without explaining why this is how the
Clean system works, add it to /boot/config.txt
Next $ pip3 install W1ThermSensor

And here is the working script:
# DS18B20_test28 tlfong01 2019may10hkt2137 ***
# Raspbian stretch 2019apr08, Python 3.5.3
# W1ThermSensor V0.3.0

# dtoverlay=w1-gpio,gpiopin=14

from w1thermsensor import W1ThermSensor

def findSensor():
    for sensor in W1ThermSensor.get_available_sensors():
        print('  Sensor ID =', sensor.id)
    return

def getTemperature():
    sensor = W1ThermSensor()
    temperature_in_celsius = sensor.get_temperature()
    print('  Temperature in Celsius =', temperature_in_celsius)
    return

# *** Main Test ***

print('Begin Testing Ds18B20, ...')
findSensor()
getTemperature()
print('End   Testing DS18B20, ...')

'''
Sample Output - tlfong01 2019may10hkt2150
>>> 
 RESTART: /home/pi/Python Programs/Python_Programs/test1198/ds18b20_test27_2019may1001.py 
Begin Testing Ds18B20, ...
  Sensor ID = 021312ca3baa
  Temperature in Celsius = 25.562
End   Testing DS18B20, ...
>>> 

'''

# *** End of program ***

Read more here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question