Go Down

Topic: Arduino-OWI: 1-Wire Master/Slave Library (Read 2891 times) previous topic - next topic


This library implements the 1-Wire protocol with the standard rom commands (e.g. alarm, search, match). Both hardware and software bus managers (master mode) are supported. The hardware bus manager uses the DS2482, and the software bus manager Arduino-GPIO. Both can be used with device drivers (i.e. device drivers do not need to be changed). An example device driver for DS18B20 is available.

The library also support slave mode. This allows a simple communication protocol between boards (e.g ATtiny) or emulating a 1-Wire device. Please see the example sketches.

Please see github for source, examples and on-line documentation.



Oct 25, 2017, 12:42 am Last Edit: Oct 26, 2017, 11:03 am by kowalski
The latest update of the Arduino-OWI (One-Wire Interface) library contains additional support for slave devices. The examples includes an emulation of the DS18B20 and a Remote Arduino with the core functions (e.g. pinMode, digitalRead, digitalWrite, analogRead, somewhat like Firmata but using 1-Wire).

1. Slave OWI Class
2. DS18B20 Slave sketch
3. OWI Remote Arduino Driver Class
4. OWI Remote Arduino Master sketch
5. OWI Remote Arduino Slave sketch



A thing of beauty!

One problem I've seen in the past has been an extremely short pulse from the master during SEARCH_ROM. If the Arduino slave misses it, emulation doesnt work.  How short a pulse can the GPIO spin reliably detect?

Seriously, another nice clean design and implementation.
Really, I used to be /dev.  :(


How short a pulse can the GPIO spin reliably detect?
The new GPIO library allows pulse detection below 1us as the pin read is actually a single instruction (62.5 ns @ 16 MHz). The major trick in the OWI slave class is actually leaving enough time after each 1-wire bit read/write to allow processing possible interrupts. Blocking for a full transaction with reset pulse and for instance SEARCH_ROM would miss several timer interrupts (for millis).

My "test rig" includes one DS18B20 module, three DS18B20 on a breadboard and an Arduino Leonardo running as an emulated DS18B20 with 25 m telephone grade cable connect. I also use this setup for the remote Arduino test. A Saleae Logic Analyzer is used to monitor the 1-wire bus.

Please put the library to the test. I welcome your feedback and improvement suggestions. BW I will be adding a 1-wire based LCD module to further demonstrate how the 1-wire slave can be used.


Go Up