Onewire and DS18B20

Questions and discussion about The WiPy board.
You can buy one at the store.
Target audience: Users with a WiPy.
User avatar
danicampora
Posts: 341
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Onewire and DS18B20

Postby danicampora » Thu Oct 22, 2015 8:16 am

OK just ordered a couple of those sensors, I'll get them tomorrow. In the meantime, I'll work on smtplib, hope to have it ready this evening.

lucien2k
Posts: 24
Joined: Sun Oct 11, 2015 5:34 pm

Re: Onewire and DS18B20

Postby lucien2k » Thu Oct 22, 2015 7:45 pm

I got a new sensor, still having the same issue.

I've committed a small fix to the code based on what I learned from the reset pulse but it hasn't helped.

lucien2k
Posts: 24
Joined: Sun Oct 11, 2015 5:34 pm

Re: Onewire and DS18B20

Postby lucien2k » Thu Oct 22, 2015 9:56 pm

Just spotted some interesting discussion in the micropython board forum: viewtopic.php?f=6&t=903

The library breaks with cpus under 120mhz, which might explain what is going on!

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

Re: Onewire and DS18B20

Postby cswiger » Thu Oct 22, 2015 11:42 pm

That makes sense - I juggled some things around and got what looks like it *should* work from what little I understand:

http://swigerco.com/TempSensor_fixed-still-fails.jpg

Just for comparison, here's an arduino rom scan, a lot tighter:

http://swigerco.com/Arduino_ROM_SCAN.JPG

The difference on the two pulses returned after the 0xF0 scan command are pretty slight.
Running WiPy in an empty loop and irq off I get about 16uSec pulses.

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

Re: Onewire and DS18B20

Postby danicampora » Fri Oct 23, 2015 5:46 am

Hi guys,

I will test asap, and if I can't get the Python library working, I'll implement a one wire class in C. Thanks for hanging in there.

Cheers,
Daniel

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

Re: Onewire and DS18B20

Postby Saran » Sat Oct 24, 2015 8:38 pm

Cany anyone give me pointers how to get to the bottom of this problem?

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

Re: Onewire and DS18B20

Postby danicampora » Sun Oct 25, 2015 8:44 pm

Hi all,

Damien made a serious overhaul to the onewire.py library and also made it compatible with the machine module. After I fixed a small issue in the CC3200 Pin implementation, one wire it's working now :-). We'll release a new firmware version shortly, so after updating, you will be able to hook up a DS18B20 to the WiPy (The new onewire lib from Damien is not yet public, but will be soon).

Cheers,
Daniel

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

Re: Onewire and DS18B20

Postby Damien » Sun Oct 25, 2015 11:50 pm

I have a new 1-wire driver that should work on the WiPy (and also on the pyboard). Attached is the driver. It has a OneWire class as well as a DS18X20 class for temp sensors. There is a small test function at the end of the file to show how it works (you may need to adjust the pin numbers to the ones that your device is connected on).

Let us know how/if the driver works for you! Once it's know to be working we can add it to the main code repository and write some docs for it.
Attachments
onewire.zip
(2.03 KiB) Downloaded 169 times

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

Re: Onewire and DS18B20

Postby danicampora » Mon Oct 26, 2015 1:27 pm

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. In Damien's test function he is using GP1, GP2 and GP3, where GP1 creates the GND point for the DS18B20, GP2 is the data pin, and GP3 is VCC for the sensor. Since GP1 and GP2 are the default pins for the UART that is used in the expansion board, I recommend changing them.

Cheers,
Daniel
Attachments
mcuimg.zip
(123.47 KiB) Downloaded 60 times

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

Re: Onewire and DS18B20

Postby danicampora » Mon Oct 26, 2015 2:11 pm

One more remark, a 4K7 pull-up resistor must be connected to the data line, as the onewire spec says.


Return to “The WiPy”

Who is online

Users browsing this forum: No registered users and 1 guest