The 1-Wire system is the invention of Dallas Semiconductors, who were acquired by Maxim in 2001. 1-Wire and iButton are essentially two implementations of the same technology, the former being manufactured in traditional IC packages and the latter in a robust stainless steel package (shaped in like a button). This section focuses on the 1-Wire devices and networks.
'1-Wire' is a bit of a misnomer, since the bus in fact requires two wires. One wire is a ground wire and the the second carries both power and data. Many 1-Wire sensors are inexpensive and bus-powered, using a small capacitor to accumulate charge while the bus is idle and then using this stored energy to communicate with the bus master when polled. More complex sensors require a regulated 5V supply or unregulated 12V, both of which can be supplied along with the serial bus through a single Cat-5 cable. The power is usually injected into each branch of the serial network by a hub.
Rather than duplicate much of the information found on the Internet, I'm going to link to this page.
A 1-Wire network isn't going to do everything but there are some things that it are particularly good at and for for which there is good support, with clever devices. Its inherent simplicity, low power consumption and fairly low speed, mean that it is well suited to basic monitoring situations and the main things I'm using it for are:
- Temperature sensors
- Door contact sensors
- Mains power present sensor
- Weather instruments
- Switching on/off devices/lighting
When running a 1-Wire bus, Dallas recommend that you use an unshielded Cat5 cable for the bus. Do not use shielded cable as the capacitance increase will upset the network.
If you intend to have a large 1-Wire network, it is important that you design the network correctly, otherwise you will have problems with timing/reflection issues and loss of data. You must connect each sensor to a single continuous cable which loops from sensor to sensor in turn (daisy chain). This will reduce potential mis-reads due to reflections in the cable. Each sensor should have a maximum of 50mm (2") of cable connected off this main network. Even when using this method, connecting more than 10-15 sensors will still cause problems due to loading of the data bus. To minimise this effect, place a 100-120Ω resistor in series in the data line of each sensor before connecting to the network.
In the UK we have kind of standardised on 568B wiring of Cat5 cables. All of the cables used are wired 'straight through', so the actually colour of wires between the pins is not hugely important.
Connectors & Wiring
We have 'simplified' the wiring in my house by assuming RJ45 connectors throughout. An RJ45 connector looks like an RJ11 but with two more pins. This approach means that you can run Cat5 or Cat8 cable throughout your house and it can be used for the 1-Wire network, phone network or Ethernet networks. As shown in this picture, pin 1 is on the right. Each node passes through all 8 wires, so that power can also be sent down the Cat5 cable.
We have used the following wiring convention:
There are various ways of interfacing a PC to a 1-Wire network. We initially used the DS9097U-S09 which plugs into a PC serial port and provides an RJ11 socket to attach the 1-Wire network to. We subsequently upgraded to the DS9490R which connects to a USB port.
The One Wire Viewer is a Java test application that locates devices on your network. This needs to know what COM port the 1-Wire interface is on and then it searches for devices. We attached a DS1820 to the 1-Wire network and it was located with the unique address of 10:D4:96:48:00:08:00:42.
If you have long 1-Wire network runs and are having problems with glitches you should add a Schottky diode to the end of your network. Typically a 1N5817 diode reverse biased across sensors will acheive this. Solder the side with the stripe to pin 2 and the other side to pin 1 of the DS18S20.