Hardware Reference
In-Depth Information
The first part of the address, “10,” maps to the “high precision digital thermometer” class;
you will need access to the list of devices and their family for this. You can find the device and
family table at http://owfs.sourceforge.net/commands.html .
The next 48 bits (“0008027e34”) compose the unique address.
Finally, the “ca” is the CRC checksum of the address.
The 1-wire network is called a micro LAN. On the micro LAN there can only be one master controller and many
slave devices. A key feature about the 1-wire bus is that it's implemented at a software level. You don't need special
hardware or a special bus to be able to run the 1-wire devices. In fact the 1-wire bus at a hardware level is very boring
and very simple. This makes it perfect for your first project. Take a look at Figure 3-5 . You can see an example of a
1-wire bus using parasite power for two temperature sensors.
Pull up
Resistor
Two DS1820
Temp Sensors
Pull up
Resistor
Vdd
Data Bus Line
Ground
Figure 3-5. An example of a 1-wire bus
Parasite power is a magic part of each 1-wire device. Without this you would need a minimum of three wires for
each device. A 3-wire bus sounds nowhere near as impressive as a 1-wire bus, now does it?
How can you have Vdd and data signals on the same bus? It's simple really; it's all a matter of timing, but you
can't have them at the same time. Whenever the 1-wire device is not communicating with the controller, the data
bus is pulled high. When this state occurs, an internal capacitor inside the 1-wire device will receive a charge from
the data bus. This internal capacitor will take care of itself and you won't even know it's there. Now when the 1-wire
device wishes to communicate with the controller it will pull the data bus low. At this point in time the 1-wire device
will use the stored charge from the capacitor to power the circuit inside the 1-wire device. In our case it will power the
DS1820B's temperature probe and logic.
You will notice that there is a resistor between Vdd and the data line. What's that for? That's the pull-up resistor.
Its job is to grab the data bus line and pull it high at all times. This allows the 1-wire client device to pull the bus
down when needed or to release the bus when not needed, thus letting the data bus be pulled up. In this chapter
I will use a 1.0K ohm resistor. How did I come to this value? Well, I didn't: I read the data sheet of the DS18B20. From
the data sheet I can work out this value. The value was picked to work well in parasitic mode and standard mode.
If you wanted just standard mode I would recommend a 4.7K ohm or a 10K ohm resistor. Data sheets are your new
friends as of this chapter. Find them, read them, and keep them handy! You will notice that a lot of 1-wire projects
use the same value of the pull-up resistor as well. It's a fairly common value in 1-wire projects and will allow you to
use a Vdd of 5.0 V or lower without a worry. For the Raspberry Pi you should be sticking with 3.3 V if you intend to
keep the magic smoke in.
 
 
Search WWH ::




Custom Search