Page 3 of 5

Re: Onewire and DS18B20

Posted: Mon Oct 26, 2015 11:19 pm
by lucien2k
It works (tried using the new library that Damien supplied)

Thank you very much guys, now to actually make something awesome with it.

Re: Onewire and DS18B20

Posted: Tue Oct 27, 2015 6:46 am
by danicampora
Awesome! Thanks for the feedback :-)

Re: Onewire and DS18B20

Posted: Tue Oct 27, 2015 8:19 pm
by Saran
danicampora wrote:Thanks Damien for the library, and for changing the output to fixed point :-).

I am attaching the beta WiPy firmware that needs to be used in order to test the library.
Works. Thanks for sorting this out :)

Although, I think there is an issue with the reading...

The WiPy reading:

Code: Select all

devices: [bytearray(b'(\xfd\xa0\x05\x05\x00\x00\xa1'), bytearray(b'(\x94\xb4\x00\x05\x00\x00\x16')]
temperatures: [2212, 2218]
(yes, two DS18B20 are connected to the WiPys 1-wire "bus")
Room thermometer: 21.2 deg C
Raspi DS18B20: 21.5 deg C

I'm puzzled with this reading offset. Can you explain the 1 deg C offset from temperature measured with a room thermometer and one other DS18B20 connected via Raspberry Pi.
All three sources of measurement are in the same microclimate (5 cm from one another ;) ).

Re: Onewire and DS18B20

Posted: Tue Oct 27, 2015 10:15 pm
by Damien
Great that the driver works!

It's strange to have a discrepancy... Can you check if it's a constant 1 degree difference by making them all hotter (say 30 degrees) using the same heat source at the same time?

Re: Onewire and DS18B20

Posted: Tue Oct 27, 2015 11:37 pm
by dhylands
If I stand near one of my room thermostats, the heat from my breath can cause it to go up.

So I wouldn't necessarily be surprised that the RPi one is a bit warmer (the RPi itself will run hotter and some of that heat may be getting to the sensor).

The DS18B20 datasheet https://www.maximintegrated.com/en/prod ... 18B20.html says +/-0.5 degree accuracy so your readings are within the specs.

Re: Onewire and DS18B20

Posted: Wed Oct 28, 2015 9:57 am
by Saran
This is the "test setup":
20151028_072821.jpg
20151028_072821.jpg (204.22 KiB) Viewed 13306 times
I've measured (with cheap IR temp meter) WiPy at 26.9 C, so I believe it can't that much influence the sensor.

@Damien: I tried with hairdryer (up to ~30C). Same relative discrepancy.

@dhylands: I don't have the problem with discrepancy of DS and analog thermometer. I've tested up to 4 DSes on the same bus and on the same spot (milimeters away) with the Raspi and their results were within 2% of each other (or ~0.05 C).

What bothers me is that the same sensor now shows 0.8 C difference when the only difference is that it's connected via WiPy.

Re: Onewire and DS18B20

Posted: Wed Oct 28, 2015 10:27 am
by danicampora
Could it be that there's an error in the temp calculation?

Re: Onewire and DS18B20

Posted: Wed Oct 28, 2015 4:10 pm
by kfricke
Maybe there is a difference in Vcc (both 3.3V or 5V), which causes that deviation? I do use a lot of those sensors for years and they differ in temperature readings all across the board within the already mentioned tolerance. So imo their readings are to be interpreted "relative" only.

There might also be a reason hidden in parasite-powered mode of them!?

In the last iteration of our sensor network (spread across 6 data-centers) we decided to not use them in parasite-powered mode, which makes them far more reliable in means of reading performance.

Re: Onewire and DS18B20

Posted: Tue Feb 09, 2016 11:45 pm
by cswiger
ds18b20 works here with the new onewire.py and latest firmware. Just using regular gnd and 3v3 vdd instead of GP1 and GP3, that did not work for me. 4k7 pullup. Reading in ice water got as low as 200, not a precision device.

Looking forward to the LoRa device - why I'm brushing up on MicroPython :geek:

Code: Select all

>>> from machine import Pin
>>> from onewire import OneWire, DS18X20
devices: [bytearray(b'(j\x8b\x8d\x04\x00\x00s')]
temperatures: [2656]
>>> dat = Pin('GP2') 
>>> ow = OneWire(dat)
>>> ds = DS18X20(ow)
>>> ds.read_temp()
2643
>>> ds.read_temps()
[2650]
>>> ds.roms
[bytearray(b'(j\x8b\x8d\x04\x00\x00s')]

Re: Onewire and DS18B20

Posted: Wed May 18, 2016 5:43 pm
by nui_de
Hi,

I do use the library from Damien and it works pretty good so far.

Code: Select all

...
data = ow.read_bytes(9)
data
bytearray(b'\x0f\x00\x00\xcb\x004\x00\x00\xe8')
sometimes I do get such a result - in this case data[4] is printed as \x004, how can that be?