Page 2 of 5

Re: Onewire and DS18B20

Posted: Thu Oct 22, 2015 8:16 am
by danicampora
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.

Re: Onewire and DS18B20

Posted: Thu Oct 22, 2015 7:45 pm
by lucien2k
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.

Re: Onewire and DS18B20

Posted: Thu Oct 22, 2015 9:56 pm
by lucien2k
Just spotted some interesting discussion in the micropython board forum: http://forum.micropython.org/viewtopic.php?f=6&t=903

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

Re: Onewire and DS18B20

Posted: Thu Oct 22, 2015 11:42 pm
by cswiger
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.

Re: Onewire and DS18B20

Posted: Fri Oct 23, 2015 5:46 am
by danicampora
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

Re: Onewire and DS18B20

Posted: Sat Oct 24, 2015 8:38 pm
by Saran
Cany anyone give me pointers how to get to the bottom of this problem?

Re: Onewire and DS18B20

Posted: Sun Oct 25, 2015 8:44 pm
by danicampora
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

Re: Onewire and DS18B20

Posted: Sun Oct 25, 2015 11:50 pm
by Damien
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.

Re: Onewire and DS18B20

Posted: Mon Oct 26, 2015 1:27 pm
by danicampora
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

Re: Onewire and DS18B20

Posted: Mon Oct 26, 2015 2:11 pm
by danicampora
One more remark, a 4K7 pull-up resistor must be connected to the data line, as the onewire spec says.