89c51 ds1820 based digital thermometer

Not rated 24,381

Circuit Image

The hardware configuration for utilizing multiple 1-Wire temperature sensors, such as the DS1820, is straightforward. Communication between the microcontroller and the temperature sensors occurs over a single-wire bus, which can also supply power to the devices. An extensive number of 1-Wire devices can be connected to this bus, as each device features a unique 64-bit ROM code identifier for addressing. Temperature measurement is a fundamental function performed by microcontrollers, and the DS1820 sensor operates within a temperature range of -55 °C to 125 °C, achieving an accuracy of 0.5 °C. Data transfer to the microcontroller employs a specialized serial communication method known as 1-Wire. The widespread usage of these sensors means that commands for their operation are encapsulated in functions within the One_Wire library. Users do not need to delve into the manufacturer's documentation to implement this sensor; copying relevant functions into the program suffices. The OneWire library offers routines for communication via the Dallas OneWire protocol, specifically with DS18x20 digital thermometers. The OneWire protocol operates on a Master/Slave basis, requiring only a single wire for all communication. Devices compatible with OneWire should utilize open collector drivers with a single pull-up resistor on the shared data line. Each OneWire device possesses a unique 64-bit registration number, comprising an 8-bit device type, a 48-bit serial number, and an 8-bit CRC, allowing multiple slave devices to coexist on the same bus.

The configuration of multiple DS1820 sensors on a microcontroller's 1-Wire bus offers a versatile solution for temperature monitoring applications. The simplicity of the 1-Wire protocol facilitates easy integration, requiring minimal wiring and setup. Each DS1820 sensor can be connected in parallel on the same data line, and the microcontroller, acting as the master, can communicate with each sensor individually through its unique ROM code. This unique addressing capability eliminates the need for additional lines for each sensor, significantly reducing complexity in circuit design.

The DS1820 sensor is designed to operate in a wide temperature range, making it suitable for various applications, including environmental monitoring, HVAC systems, and industrial temperature control. The sensor's accuracy of 0.5 °C ensures reliable readings for most practical applications.

In terms of programming, the One_Wire library simplifies interaction with the DS1820 sensors. The library includes functions for initiating temperature conversions, reading temperature values, and managing sensor addresses. This abstraction allows developers to focus on application logic rather than low-level communication details. Furthermore, the library's routines ensure compatibility with the Dallas OneWire protocol, enabling reliable data transmission.

When designing a circuit with the DS1820 sensors, it is essential to include a pull-up resistor on the data line to ensure proper signal levels. The recommended value for the pull-up resistor typically ranges from 4.7 kΩ to 10 kΩ, depending on the number of devices on the bus and the length of the wiring. Additionally, the circuit should be designed to accommodate the power requirements of the sensors, which can be powered directly from the 1-Wire bus or through an external power supply if necessary.

Overall, the integration of multiple DS1820 sensors via a 1-Wire bus provides a scalable and efficient solution for temperature measurement, with a focus on ease of use, reliability, and minimal hardware requirements.The hardware configuration when using multiple 1-Wire temperature sensors like the DS1820 is very simple, as illustrated in the block diagram below. A single-wire bus is used for communication between the microcontroller and the temperature sensor. It is also possible to power the devices direclty via this 1-Wire bus. An almost unlimited number of 1-WireTM devices can be connected to the bus because each device has a unique 64-bit ROM code identifier which is used to address each sensor Temperature measurement is one of the most common tasks performed by the microcontroller. A DS1820 sensor is used for measurement here. It is capable of measuring temperature in the range of -55 °C to 125 °C with 0. 5 °C accuracy. For the purpose of transferring data to the microcontroller, a special type of serial communication called 1-wire is used.

Due to a simple and wide use of these sensors, commands used to run and control them are in the form of functions stored in the One_Wire library. There are three functions in total: Concretely, you don`t have to study documentation provided by the manufacturer in order to use this sensor.

It is sufficient to copy some of these functions in the program. The OneWire library provides routines for communication via the Dallas OneWire protocol, e. g. with DS18x20 digital thermometer. OneWire is a Master/Slave protocol, and all communication cabling required is a single wire. OneWire enabled devices should have open collector drivers (with single pull-up resistor) on the shared data line. Each OneWire device has also a unique 64-bit registration number (8-bit device type, 48-bit serial number and 8-bit CRC), so multiple slaves can co-exist on the same bus.

🔗 External reference