onewire example

  • when we use onewire example for DS18X20
    but without any connected sensor we go two issues:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "", line 11, in <module>
      File "", line 190, in read_temp_async
    IndexError: list index out of range

    this is because of this line rom = rom or self.roms[0]
    2. after exception when we rerun sample we got memory allocation error

    with sensor connected all is ok :)

  • @livius Both antennas were connected.
    Today I unpacked a brand new LopY ... and we did again the tests. Same results also with this new one.
    I send to Daniel the script... you ca do it yourself and see the issue with your own eyes .

  • @Colateral
    Strange that you have this difference
    because wipy is near equal to lopy
    but have you connected antenas? especially to lora?
    Without antena for lora it is possible to got interference and also damage board(low possible but..)

  • @livius I Know why I typed wrong the release name ... The downloaded pycom firmware update file is pycom_firmware_update_1.1.1.b1.exe .... that install 1.5.1.b1 firmware

  • @livius Yes. Deeply sorry for the typo... ideed the build is 1.5.1b1. I tried also with other pin and I got the same. It is higher probability that is a timing (microseconds) microseconds issue related to LoPy.

    On WipY is working fine: same expansion board same pin and DS1B20.

  • @Colateral said in onewire example:


    Do you mean 1.5.1?
    I do not have Lopy only Wipy - bot maybe someoune else can point you.

    One question - did you tried with different pin then P23?
    Maybe something interfering.

  • Hello,

    On LopY, with build 1.1.1b1, onewire code is not reading anymore the DS1B20 sensor.
    We simply upgrade Lopy that has connected the DS1B20 sensor(with pll pul rezist) on P23, GND, 3.3V ...

    Unplug LopY and plug WiPy with the same code and same build... everything is working fine.

    Do you have any idea how to fix this regression on LOpY?


  • @abilio
    another error is for negative temperature for adress 28
    code should be like this

            elif rom0 == 0x28:
                temp = (temp_msb << 8 | temp_lsb) * 100 // 16
                if (temp_msb & 0xf8) == 0xf8: # for negative temperature
                    temp -= 0x1000
                return temp

    i have created pull request as i see that now this is on github as libs

  • @livius, as usual, thanks for your help :) , I think no one had used the script like that before ;) . We'll have a look at it.

Log in to reply

Pycom on Twitter