One-Wire Network Controls Remote SPI Peripherals
Many 1-Wire-compatible peripherals are available, but for those that lack the 1-Wire capability, the Figure 1 circuit illustrates one way you can implement it. The example shown allows a remote LED display to be controlled by the 1-Wire network via an SPI-compatible display controller.
Figure 1. Three 1-Wire switches (IC1–IC3), three XOR gates (IC4), and the associated components enable a 1-Wire network to control this display via the SPI peripheral IC5.
To produce the 3-wire SPI interface required by a MAX7221 display controller (active-low CS, DIN, and CLK), the 1-Wire network serially addresses three 1-Wire switches (DS2413). The first switch creates Chip Select directly (active-low CS), the second creates the serial-data line directly (DIN), and the third switch—with the help of three exclusive-OR gates—creates the serial clock (CLK).
The edge detector and one-shot (IC4A-C) combine the outputs of IC2 (DATA1 and DATA0) to create a clock signal for the SPI interface. This one-shot clock-generation circuit improves the data rate by requiring only a single 1-Wire transaction per SPI bit, instead of the three transactions (data, clock low, and clock high) that would be required if the IC2 output were used directly as a clock signal.
To transmit data to the SPI inputs, first set the output of IC1 low. Then, transmit the data bits using the following rules:
- If the current data bit differs from the previous bit, set IC2's DATA1 output accordingly.
- If the current data bit is the same as the previous bit, toggle IC3's DATA0 output.
This circuit allows a 1-Wire network to control a remote temperature display, but similar techniques can provide an interface to I²C-compatible devices, and to other SPI peripherals such as ADCs and DACs. You can also produce a bi-directional data capability by using additional DS2413 output(s). Note that the SPI data rate is not very fast, and updates to the peripheral are relatively slow, but speed is not an issue for many remote-monitoring applications.