Onewire and DS18B20
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: Onewire and DS18B20
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
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.
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
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!
The library breaks with cpus under 120mhz, which might explain what is going on!
Re: Onewire and DS18B20
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.
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.
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: Onewire and DS18B20
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
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
Cany anyone give me pointers how to get to the bottom of this problem?
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: Onewire and DS18B20
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 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
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.
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 6211 times
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: Onewire and DS18B20
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
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 5095 times
- danicampora
- Posts: 342
- Joined: Tue Sep 30, 2014 7:20 am
- Contact:
Re: Onewire and DS18B20
One more remark, a 4K7 pull-up resistor must be connected to the data line, as the onewire spec says.