i connected a one wire ds18b20 temperature sensor to my pi 3b+.this is the code

import time
from w1thermsensor import W1ThermSensor
sensor = W1ThermSensor()
while True:

        temperature = sensor.get_temperature()

and this is the error i get

Raise NoSensorFoundError("Could not find any sensor")
Could not find any sensor
Please check cabling and check your /boot/config.txt for

i connected the gnd wire to pin 9 power supply to pin 1 (3.3v) and data wire to pin7 i connected a 330 ohms resistor between supply and data wire but i dont get any response . i tried to reverse the power and supply connection to see if the temp sensor heats up and it does,idk what else to do

1 Answer 1


Your pull up resistor is to low. Start with a 4.7K resistor from data to +3.3. Heating the sensor as you did can and probably did destroy it. Semiconductor integrated circuits do not like reverse power. Try the 4.7K resistor and if it does not work use another DS1B20 sensor. Since its output is an open drain A pull-up resistor must be added to get stable data from the data line. Note: The DS18B20 can take its power entirely from a data line pin requiring no positive supply other than that pin. this allows you to place it in locations that do not have an easily accessible power source. You need to add a 4.7k or reasonable value (see data sheet) pullup as the devices are open drain and the idle state is bus high.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.