DS18x20 and OneWire

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Robert
Posts: 2
Joined: Tue Jan 16, 2018 4:50 pm

DS18x20 and OneWire

Post by Robert » Tue Apr 03, 2018 11:41 pm

Hi everyone!

I'm using the PyBoard and sensor DS18x20 with Damien library:

https://github.com/micropython/micropyt ... ds18x20.py
https://github.com/micropython/micropyt ... onewire.py

It works when the frequency of the PyBoard is 168MHz, but if I change this value, for example, to 48MHz appears this error:

MicroPython v1.9-32-g4d2778c9 on 2017-06-07; PYBv1.0 with STM32F405RG
Type "help()" for more information.
>>>
PYB: sync filesystems
PYB: soft reboot
devices: []
Traceback (most recent call last):
File "main.py", line 6, in <module>
File "onewire_d.py", line 254, in <module>
File "onewire_d.py", line 251, in test
File "onewire_d.py", line 170, in read_temp
IndexError: list index out of range
MicroPython v1.9-32-g4d2778c9 on 2017-06-07; PYBv1.0 with STM32F405RG
Type "help()" for more information.

I have this configuration:

def test(gnd, dat, vdd):
gnd = machine.Pin(gnd, machine.Pin.OUT, value=0)
dat = machine.Pin(dat)
vdd = machine.Pin(vdd, machine.Pin.OUT, value=1)
ow = OneWire(dat)
ds = DS18X20(ow)
print('devices:', ds.roms)
print('temperatures:', ds.read_temp())

test('Y11', 'Y10', 'Y9')

Thank you

Post Reply