Getting access to 1-Wire devices
In the next section, we will manage a 1-Wire device using both an emulated 1-Wire controller and a real one connected by I2C to the main CPU.
Using the GPIO interface
To show you how the 1-Wire bus works, we can use a really simple chip: the temperature sensor DS18B20. There are two possible ways or modes by which the chip can be powered: a parasite version (that is, the one that works in the parasite mode) with two wires only and a normal version with a dedicated power pin, which uses three wires instead. In our example, we will use the three wires and a waterproof version of this chip. There is a special packaging of the chip so that it can be used in hostile environments (look at the following image to see the packaging version of the two chips):
Note
The device can be purchased at http://www.cosino.io/product/waterproof-temperature-sensor or by surfing the Internet.
The datasheet is available at http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf...