- Discrete LEDs
- Dot/Bar LEDs
- Matrix LEDs
- 7-Seg LEDs
- Serial -- Software
- Serial -- Hardware
- RS-232 via the MAX3232
- I2C -- EEPROM
- I2C -- DS1307 Real Time Clock
- 1-Wire -- DS18B20, Powered, Single-Drop
- 1-Wire -- DS18B20, Powered, Multi-Drop
- 1-Wire -- DS18B20, Parasitic, Multi-Drop
- TI Link Protocol -- Calculator Demo
- Infrared Communication
- MIDI -- Output Demo
- MIDI -- Input Demo
- MIDI to Analog Synth
1-Wire -- DS18B20, Powered, Single-Drop
In this, and the following three exercises, we'll explore communications along the so-called 1-Wire bus invented by Dallas Semiconductor. Truly minimalist, all it requires is one port line (and ground, of course), yet we're able to address and communicate in both directions with many devices on the bus.
This particular exercise fires up the DS18B20 temperature sensor in the simplest way possible. To wit, we'll only put one unit on the bus and moreover run it in normal powered mode. More complex arrangements are handled in succeeding exercises.
We'll poke around in the chip using a serial terminal; see previous projects for more info on how to hook up and use one of these. Here follows the schematic:
As we've seen before, we'll use a pair of transistors to buffer and protect the connection to the COM port on the computer running the terminal software.
The DS18B20 temperature sensor itself connects to Port B.3. Be sure to note R3, the pull-up resistor. It's essential to the bi-directional communication.
The PMP software is a snap now, because I've written two library units to manage things. The first provides eleven new Pascal commands to orchestrate the DS18B20. The second is a more powerful alternative to PMP's 1-Wire library unit. As usual, be sure to examine the source for both of these; I've given each detailed introductions explaining their use.
When I was writing the code for the library units, I found the following slide show presentation from Maxim useful in sorting things out:
Just run the circuit with your terminal program to get started. A menu with instructions guides you through the exercise. Here's what a sample run looks like:
One very practical aspect of this exercise is the ability to read the unique serial number in any 1-Wire device. Jot it down, for you might need it in a later project.
Click to get the source code.
Click to get the schematic PDF.
Next Project: 1-Wire -- DS18B20, Powered, Multi-Drop