Hi there !
i'm gonna to write a program for a wheather station. The program show the temperature on one display , but at the same time i can show the temperature on my cellphone ( i configure ESP32 access point) the refresh of the web page right now is every 10Seconds . The program work well but afther while stop the work and gave me this error :
File "ds18x20.py", line 20, in convert_temp
File "onewire.py", line 23, in reset
OneWireError:
The sensor i use is DS18B20 watherproof
looks like the library have a problem i'm wrong ? right now i use this libray ds18x20.DS18X20(onewire.OneWire(Temp_pin)). There are other library ? some one have my same problem ?
thank you
Sergio
DS18B20 library problem
- CmdrDeLiver
- Posts: 27
- Joined: Thu Dec 05, 2019 6:30 pm
Re: DS18B20 library problem
Some code would probably help narrow down the problem, however I'm going to take a safe guess that your main loop is something like this?
Note the sleep for one second between requesting .convert_temp and .read_temp. Some folks use a smaller value there, however that often fails because the sensor doesn't finish processing quickly enough. The other issue that occurs frequently is the pull up resistor value is too small and the sensor resets if run in parasitic mode. Note that the code above is from this site and they have a pretty good tutorial on the ds18b20. I've bit banged them from an RS232 port and they're pretty darned robust. The Data Sheet is also a good read.
Code: Select all
mport machine, onewire, ds18x20, time
ds_pin = machine.Pin(4)
ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin))
roms = ds_sensor.scan()
print('Found DS devices: ', roms)while True:
ds_sensor.convert_temp()
time.sleep_ms(1000)
for rom in roms:
print(rom)
print(ds_sensor.read_temp(rom))
time.sleep(5)
Re: DS18B20 library problem
Thank you soo much
Sergio
Sergio