Hardware Reference
In-Depth Information
Raspberry Pi, but more on that later. It has the same number of legs as a transistor as well. Take a look at Table 3-2 to
see what each leg (pin) of the DS18B20 is used for.
Table 3-2. The pins of the DS18B20
Pin Number
Function
1
Ground
2
DQ (data input/output)
3
Vdd (optional)
You will notice I've left the Vdd as optional in Table 3-2 . How can Vdd be optional? The DS18B20 can support
parasite power. This means that with only one wire you can power and transmit data to and from the device. This is
part of the 1-wire protocol. I have not listed a protocol or talked about the protocol that the DS18B20 uses. Unlike the
DHT11, the DS18B20 uses an industrial standard called the 1-wire bus.
The Amazing 1-Wire Bus
What exactly is a 1-wire bus? Excluding the ground connection of the 1-wire device, both data and power can be
transmitted across one wire, hence the name “1-wire.” The 1-wire bus was developed by Dallas Semiconductor, now
called Maxim Integrated. The 1-wire bus has been around for a very long time. It's been used in public mass transport
systems all the way down to simple security tokens. Its main benefit over other similar low-speed buses is that the
1-wire device can be on the end of a very long cable run without too much signal degradation. Like other bus systems
the 1-wire bus supports more than one device on the bus, which is referred to as multidrop in 1-wire deployments.
Each 1-wire device has a unique 64-bit serial code embedded into the device. This is how the controller device can
identify each device on the 1-wire network. The embedded serial code can be broken up into three distinct segments.
The first segment is called family code; this segment identifies what type of device it is and it's
eight bits wide. There is a set device list that all 1-wire devices must comply with.
The middle segment is called the ID segment and it's 48 bits wide. This 48 bits of data must
be unique within the given family of devices. This is what gives you the ability to have many
1-wire devices on the same wire.
The remaining eight bits of serial code are a cyclic redundancy check, or CRC, checksum and
must match the rest of the address.
See Table 3-3 for an example of a serial address.
Table 3-3. Example of a 1-wire address
Family Code
ID
CRC
8 bit
48 bits (unique to family)
8 bits
10
0008027e34
ca
In Table 3-3 the full 1-wire serial code would be “100008027e34ca.” This is very simple to break down.
 
 
Search WWH ::




Custom Search