3

The DS2482-100 and DS2482-800 are I2C to 1-Wire bridges which are useful for driving complex 1-Wire networks.

These are natively supported by a number of packages in Linux so you can interface easily with them on a Raspberry Pi.

I was surprised to find there is not an obvious library for accessing them on an Arduino however.

I have found the following:

  • An Arduino library - has some quirks and not-maintained.
  • Part of AVR-Liberty - less quirks, not sure if maintained, not "Arduino" as such, more AVR.

It is helpful to be able to rely on maintained libraries to deal with any changes to the Arduino environment.

Arduino libraries are often easier to use than ones designed for AVR in general, which means more people are able to use the software.

Is there a better library available?

Cybergibbons
  • 5,420
  • 7
  • 34
  • 51

2 Answers2

2

I believe the library linked by Cybergibbons has a bug in

uint8_t OneWire::wireSearch(uint8_t *address)

A discrepancy at i = 0 (bit zero in this library, id_bit_number = 1 in a Maxim example) only follows the direction = 1 path and fails to find ROM addresses where bit zero = 0 (i.e. even family codes are missed when mixed devices, some with even and others with odd family codes, are present on the 1-wire bus).

A fix I have just implemented and appears to work is to modify the library to declare searchLastDiscrepancy and last_zero as int8_t (not uint8_t), initialise/reset them to -1 (not zero) and, near the end of the method

    if (!last_zero) 
            searchLastDeviceFlag = 1;

becomes

    if (last_zero == -1)
            searchLastDeviceFlag = 1;

I hope that helps.

Close20
  • 21
  • 2
1

I have implemented a library, based on the Paeaetech one linked to above, but tidying up defines, fixing the listed issue, adding lookup table based CRC and support for passively powered sensors.

Cybergibbons
  • 5,420
  • 7
  • 34
  • 51