some troubles with the DS18B20-PAR temperature sensor
Posted: Mon Feb 18, 2019 6:50 pm
Hi everyone,
First, sorry for my poor english (i'm a french guy...).
I'm actually new with micropython coding and pyboard hardware, and i need some help with my temperature sensors. They are DS18B20-PAR https://datasheets.maximintegrated.com/ ... 20-PAR.pdf and by mounting them like is describe in the datasheet, with an 4.7kohms resistor betwen DQ an Vpu, ds.scan() returns only "[]" instead the three sensor's bytearrays . When i swap the resistor with another of 1kohm, ds.scan() give me the sensor's bytearrays.
>>> ds.scan()
[bytearray(b'(\xb6\x10\xd7\n\x00\x00:'), bytearray(b'(\xd4\x06\xd7\n\x00\x00w'), bytearray(b'((\x1b\xd7\n\x00\x00\xe8')]
but now, when i'm reading temperatures with the ds.read_temp(), i only have 85 for all my sensors, and no other temperatures... I don't know what 's happening, i think it's come from the Parasite-Power, but i don't know know what kind of stuf i can do to fix this problem... so can someone help me ?
For information, i'm actually doing an diffusion chamber to look at the moving muons and other atomic and cosmic rays.
I give you my main.py
First, sorry for my poor english (i'm a french guy...).
I'm actually new with micropython coding and pyboard hardware, and i need some help with my temperature sensors. They are DS18B20-PAR https://datasheets.maximintegrated.com/ ... 20-PAR.pdf and by mounting them like is describe in the datasheet, with an 4.7kohms resistor betwen DQ an Vpu, ds.scan() returns only "[]" instead the three sensor's bytearrays . When i swap the resistor with another of 1kohm, ds.scan() give me the sensor's bytearrays.
>>> ds.scan()
[bytearray(b'(\xb6\x10\xd7\n\x00\x00:'), bytearray(b'(\xd4\x06\xd7\n\x00\x00w'), bytearray(b'((\x1b\xd7\n\x00\x00\xe8')]
but now, when i'm reading temperatures with the ds.read_temp(), i only have 85 for all my sensors, and no other temperatures... I don't know what 's happening, i think it's come from the Parasite-Power, but i don't know know what kind of stuf i can do to fix this problem... so can someone help me ?
For information, i'm actually doing an diffusion chamber to look at the moving muons and other atomic and cosmic rays.
I give you my main.py
Code: Select all
import machine
import onewire, ds18x20
dat = machine.Pin('X1')
ow = onewire.OneWire(dat)
ds = ds18x20.DS18X20(ow)
while True:
roms = ds.scan()
ds.convert_temp()
oled.fill(0)
#oled.text("CPU tmp: " +("%2.1f"% ((esp32.raw_temperature()-32.0)*5/9))+"C", 0,1)
oled.text("Temp : "+"%2.3f"% ds.read_temp(roms[0]) +"C", 0, 1)
oled.text("Temp2 : "+"%2.3f"% ds.read_temp(roms[1]) +"C", 0, 10)
oled.text("Temp3 : "+"%2.3f"% ds.read_temp(roms[2]) +"C", 0, 19)
ow.reset()
oled.show()
pyb.delay(500)