| ||
Shopping Cart Download Website |
Home | Products | Teensy | Blog | Forum |
You are here: 8051 Tools Development Board Example Code Temperature |
|
Using 1-Wire Temperature SensorsDallas Semiconductor (owned by Maxim Integrated Products) makes several 1-wire temperature sensors, and other devices using their "1 wire" communication protocol. This page shows how to interface some of these temperature sensors to the 8051 development board.
Connections To Port PinsEven though they are called "one wire", you can see in the photo these sensors actually have 3 wires, where 2 are power and ground. You must connect at least the ground and signal lines. The power line is optional.The easiest approach is to connect all 3 wires, so the sensor gets +5 volt power on its power pin. Then all that is necessary is a 4.7k pullup resistor on the signal line, and of course connecting the signal to a port pin (P1.7 for the example code below).
It is also possible to not use the power pin, and the sensor will get its power from the signal pin. However, the 4.7k resistor is not able to power the sensor while it makes the measurement. The standard 8051 port pins provide only a weak pullup, so a PNP transistor is needed to apply a strong pullup to the signal pin during the measurement. In the example code, this transistor is controlled by pin P1.6.
If the sensor is used a long distance from the board, connecting 2 wires instead of 3 can be nice. However, if you are having difficulty getting the sensor to work, the 3 wire connection is a lot simpler and easier than using a PNP transistor. Example Code
|