1

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?

  • The only thing i know of is the wire library, but I2c to TWI. There are some teensy onewire libraries out there as well, but it looks like that is not what you are looking for. This may be a good time to start your own library :-) – Faux_Clef Feb 15 '14 at 22:08
  • An unmaintained library does not necessarily mean a bad library. If it is feature-complete and flawless, then it does not have to be maintained. Also, the fact that no commit occurs for a long time does not always mean that there's nobody to maintain it. – jfpoilpret Feb 16 '14 at 10:27
  • At least, with an open source library you can easily change the code yourself if it is buggy or does not fit your needs. The DS2482 datasheet can help for that. – jfpoilpret Feb 16 '14 at 10:28
  • No, unmaintained doesn't always mean bad, but when there are issues with it and it hasn't been updated for several years, it generally is bad. – Cybergibbons Feb 16 '14 at 10:42
  • @Cybergibbons have you tried it? Some issues may not be relevant to all library users. As far as I see, there's only one issue open on the mentioned Arduino library, and it is just one month old; I would not consider that unmaintained (yet). – jfpoilpret Feb 16 '14 at 11:47
1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.