Onewire and DS18B20

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
lucien2k
Posts: 24
Joined: Sun Oct 11, 2015 5:34 pm

Re: Onewire and DS18B20

Postby lucien2k » Mon Oct 26, 2015 11:19 pm

It works (tried using the new library that Damien supplied)

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

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Onewire and DS18B20

Postby danicampora » Tue Oct 27, 2015 6:46 am

Awesome! Thanks for the feedback :-)

Saran
Posts: 15
Joined: Thu May 28, 2015 6:52 pm

Re: Onewire and DS18B20

Postby Saran » Tue Oct 27, 2015 8:19 pm

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 ;) ).

Damien
Site Admin
Posts: 530
Joined: Mon Dec 09, 2013 5:02 pm

Re: Onewire and DS18B20

Postby Damien » Tue Oct 27, 2015 10:15 pm

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?

User avatar
dhylands
Posts: 2388
Joined: Mon Jan 06, 2014 6:08 pm
Location: Shuswap, BC, Canada
Contact:

Re: Onewire and DS18B20

Postby dhylands » Tue Oct 27, 2015 11:37 pm

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.

Saran
Posts: 15
Joined: Thu May 28, 2015 6:52 pm

Re: Onewire and DS18B20

Postby Saran » Wed Oct 28, 2015 9:57 am

This is the "test setup":
20151028_072821.jpg
20151028_072821.jpg (204.22 KiB) Viewed 2128 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.

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Onewire and DS18B20

Postby danicampora » Wed Oct 28, 2015 10:27 am

Could it be that there's an error in the temp calculation?

User avatar
kfricke
Posts: 330
Joined: Mon May 05, 2014 9:13 am
Location: Germany

Re: Onewire and DS18B20

Postby kfricke » Wed Oct 28, 2015 4:10 pm

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.

cswiger
Posts: 13
Joined: Fri Oct 16, 2015 9:51 pm

Re: Onewire and DS18B20

Postby cswiger » Tue Feb 09, 2016 11:45 pm

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')]

nui_de
Posts: 40
Joined: Fri Oct 23, 2015 3:27 pm

Re: Onewire and DS18B20

Postby nui_de » Wed May 18, 2016 5:43 pm

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?


Return to “The WiPy and CC3200 boards”

Who is online

Users browsing this forum: No registered users and 1 guest