Share this

Building automation temperature measurement and control system based on LonWorks fieldbus

2026-04-06 06:02:52 · · #1

Abstract: This paper introduces the features and principles of LonWorks fieldbus and the single-wire digital temperature sensor DS18B20. A host-based Neuron node is constructed using CY53120 and AT89S52, and a multi-point temperature measurement and control system is designed. The hardware and software implementations are presented.

Keywords: LonWorks; fieldbus; building automation; Neuron chip; DS18B20

Abstract: The principle and features of LonWorks fieldbus and single-wire digital temperature sensor DS18B20 are introduced. Neuron nodes of host based are structured by using CY53120 and AT89S52 ,And a multi-point temperature measure & control system is designed.The implementation of hardware and software is given.

Key words: LonWorks;fieldbus;building automation;Neuron chip;DS18B20

0 Introduction

Fieldbus Control Systems (FCS) transform distributed system control into field control, forming an open control network. Applying FCS to Building Automation Systems (BAS), a crucial component of intelligent buildings, overcomes the severe shortcomings of traditional methods that rely on proprietary communication protocols like RS-232 and RS485, resulting in "automation silos." This paper utilizes LonWorks fieldbus technology and the DS18B20 single-wire digital temperature sensor to design an intelligent node and system for temperature measurement and control in building automation, effectively achieving real-time monitoring and regulation of indoor temperature.

1-Wire Digital Temperature Sensor DS18B20

1.1 DS18B20 Structure

The DS18B20 is a new generation of digital temperature sensors based on a 1-Wire single-bus architecture, manufactured by Dallas Semiconductor. This series includes the DS1820, DS1822, DS18S20, and DS18B20, with the DS18B20 offering the best performance. Its temperature conversion data bits are programmable up to 12 bits. The DS18B20 primarily uses a 3-pin TO-92 package, resembling a small-power transistor. Because each DS18B20 has its own unique 64-bit chip ID serial number, multiple digital sensors can be connected to a single signal line. Figure 1 shows the internal structure of the DS18B20. The bus can also parasitically power the connected DS18B20 via DQ without requiring an external power supply. In this case, the VDD terminal must be grounded, and the bus port must be kept high when idle to allow for parasitic charging. This simplifies the temperature measurement circuit, eliminating the need for any external hardware. It overcomes the drawbacks of analog sensors requiring A/D converters and other complex external circuits for microcomputer interfaces, resulting in a convenient, low-cost, small-sized, and highly reliable temperature control system. The DS18B20 has a temperature measurement range of -55 to 125°C. When the temperature conversion data is programmed to 9 bits, the accuracy is 0.5°C (within the range of -10 to 85°C), while with 12 bits, it can resolve to 0.0625°C. The measured temperature and the converted 12-bit digital value are represented in two's complement, with D0 to D10 representing magnitude and D11 representing the sign. The maximum temperature conversion time is 750ms. Users can set the upper and lower limits of the temperature alarm, and the alarm search command can identify which DS18B20 exceeds the temperature limit.



1.2 DS18B20 Single-Bus Communication

In a single-bus system, the master device first initializes the DS18B20 to confirm its online presence and readiness for operation. Then, it executes ROM function commands (5 commands in total), followed by memory function commands (6 commands in total) to perform control functions such as temperature conversion and memory operations. The DS18B20 employs a strict single-bus communication protocol to ensure data integrity. This protocol defines several signal types: reset pulse, acknowledge pulse, read/write 0, and read/write 1. All signals, except the acknowledge pulse, are generated by the master as synchronization signals. Commands and data are byte-wise least significant first. The initialization timing is shown in Figure 2. The master first pulls the bus low for at least 480μs to generate a (Tx) reset pulse signal. Then, the master releases the bus and enters receive mode (Rx), pulling the single-bus high using pull-up resistors. After detecting the rising edge, the single-bus device delays for 15–60μs, then pulls the bus low for 60–240μs to generate an online acknowledge pulse. In addition, the DS18B20 read/write timing, temperature measurement principle, ROM command and MEMORY command are described in detail in the literature [2], and will not be repeated here.



2 LonWorks Fieldbus

2.1 Basic Information

LonWorks technology, developed by Echelon Technologies, Inc., is a Local Operating Network (LON) that encompasses all the technologies needed to design, configure, and maintain a network: the 3120/3150 Neuron chip; the Neuron C programming language; the LonTalk protocol; LonWorks transceivers; and the LonBuilder and NodeBuilder development tools. A LonWorks network system consists of intelligent nodes, each including a neuron chip, sensors, control devices, transceivers, and power supplies. Communication between nodes supports multiple media, including twisted-pair cable, power line, fiber optic cable, and infrared, adheres to the ISO/OSI seven-layer model protocol, and communicates according to the standardized LonTalk protocol, with communication rates ranging from 300 bps to 1.5 Mbps.

2.2 Structure and characteristics of Neuron 3120/3150

The Neuron chip is the core of LonWorks technology, managing communication as well as providing input, output, and control capabilities. The 3120 and 3150 series chips are primarily manufactured by Motorola, Toshiba, and Cypress. The internal block diagram of the Neuron chip is shown in Figure 3, containing three 8-bit pipelined CPUs. The Media Access Control (MAC) CPU handles layers 1 and 2 of the LonTalk 7-layer protocol, including driving the communication subsystem hardware and executing the MAC algorithm. The Network CPU handles layers 3 to 6 of the LonTalk protocol, including handling network variable addressing transactions, authentication, background diagnostics, software timers, network management, and routing, while also controlling network communication ports and physically sending and receiving data packets. The Application CPU executes user-written code in Neuron C and operating system commands called by the user code. The three CPUs communicate through on-chip network and application buffers. The chip provides 11 pins from I/O0 to I/O10, which can be programmed to be configured into 34 different objects, allowing direct connection to various sensors, A/D converters, actuators, etc. The network communication ports CP0-CP4 are used to connect transceivers, enabling network communication. The 3120 chip includes E2PROM, RAM, and ROM. The ROM contains built-in LonTalk communication protocol firmware, making it very convenient to build small systems with user applications no larger than 2KB. The 3150, however, requires external ROM expansion, and its LonTalk communication protocol needs to be configured using the NodeBuilder toolkit for more complex application systems.



3 Hardware Design of Temperature Measurement and Control System

3.1 Network Topology

The network structure of the building automation temperature monitoring and control system in this design is shown in Figure 4. The system employs a two-level computer monitoring system, consisting of a host computer, a LonTalk adapter, and multiple intelligent nodes. The central PC control node uses an Echelon PCLTA-10PCLonTalk adapter card, a high-performance 16-bit ISA bus LonWorks interface card. The communication medium in the system is twisted-pair cable. The network adopts a LonWorks bus-based network model, and the number of nodes can be increased or decreased according to monitoring needs. The network topology uses a bus approach. When the communication rate is set to 78.125 kbps, the communication distance between any two nodes on the LonWorks bus can reach 2700 m, which fully meets the communication requirements of the building automation system. The host computer is connected to the LonWorks bus via the LonTalk adapter for centralized monitoring, management, analysis, and network communication detection of the entire system.



3.2 Intelligent Temperature Node Design

The system employs a host-based LonWorks intelligent node, and Figure 4 shows the structure of node 1. The Atmel enhanced Flash microcontroller AT89S52 is selected as the main processor to complete the main measurement and control tasks. It has an embedded 8K FlashROM and is hardware and software compatible with the AT89C52, but its most significant feature is its integrated ISP interface, allowing direct in-system programming on the target board, greatly facilitating the user. The DS18B20 connected to the single bus uses an external VCC. The system utilizes a non-parasitic power supply method to ensure accurate operation not only for normal room temperature measurements but also in abnormal situations such as the initial stages of a fire. It employs the 8155 microcontroller for I/O expansion, interfacing with display, keyboard, and over-temperature alarm circuits. Furthermore, a temperature control output unit controls valves in the air conditioning unit for fresh air intake, exhaust, and spray pipes, achieving temperature control. The Neuron chip used is the Cypress CY53120, which serves as the core, with the FFT-10A transceiver handling LonTalk protocol data transmission. Event scheduling is used to perform various user-defined calculations, I/O event processing, and network message processing. The transceiver connects nodes to the network via a Lon network interface. The AT89S52 microcontroller and the Neuron CY53120 communicate in parallel. Port P1 is connected to pins I00-I07 of the CY53120 as an 8-bit data bus. P3.2 is connected to I08 of the 3120, serving as the signal line for the microcontroller to request data transmission and the acknowledgment line for receiving temperature conversion commands from the 3120. P3.3 is connected to I09, serving as the acknowledgment signal for the 3120 to receive data. P3.4 is connected to I010, serving as the signal line for the 3120 to send temperature conversion commands. This ensures strict synchronization between the AT89S52 and the 3120.

4 System Software Design

4.1 Software Structure Design

This system software consists of three parts. Part 1 is the upper-level software design, using VB6.0 and centered on a PC node. It enables system connectivity to a LAN and provides a user-friendly interface, allowing users to set operating parameters for each room in the building, query room temperatures and control equipment status, and view historical records and real-time operating costs. Part 2 is the lower-level software design, using assembly language and based on the AT89S52 microcontroller. It primarily handles keyboard scanning and output display, on-site temperature data acquisition, over-limit audible and visual alarms, configuring the AT89S52's operating mode, communication between the AT89S52 and AT89S52, temperature control algorithms, and control of temperature-regulating equipment. Part 3 is the communication program design, using Neuron C and based on the CY53120 microcontroller. This program facilitates external communication with other network nodes and the upper-level computer, as well as internal communication with the AT89S52.

4.2 Partial program flowchart and source code

Figure 5 shows the flowchart of the temperature measurement and control software. It should be noted that the temperature control subsystem is a major energy consumer in modern buildings. To save energy, the temperature control algorithm module employs a combination of incremental PID control and fuzzy control algorithms. When the deviation is large, the former algorithm is executed to quickly bring the temperature back to near the set value; when the deviation is small, the latter algorithm is executed to avoid the control device becoming overly sensitive to the controlled temperature and causing frequent actions or oscillations. In addition, energy-saving measures such as automatic control of the fresh/return air ratio, variable frequency speed regulation for variable air volume air conditioning control, and increasing the upper limit setpoint of the comfort air conditioning temperature are also adopted to achieve energy-saving goals.



The subroutine for writing to the DS18B20 is as follows.

WRITE: ; Write a subroutine, first executing the reset subroutine.

DATA_BIT EQU P2.7

CLR C; Clear DS18B20 online logo

MOV R1,#08H ;8 bits

WR1: CLR DATA_BIT ; Send write pulse to P2.7

MOV R7,#01H ; Delay 15μs

Call DELAY15

RRC A; The byte being written starts from the least significant bit.

MOV DATA_BIT,C; Send 1 bit to DS18B20

MOV R7,#01H ; Delay 15μs

Call DELAY15

SETB DATA_BIT ; Release the data line

NOP

DJNZ R1,WR1 ; Determine if 8 bits have been written

SETB DATA_BIT ; Release the data line

RET

5. Conclusion

This system utilizes LonWorks fieldbus technology, ensuring reliable and convenient communication within the building automation system. The adoption of the DS18B20, a new generation digital temperature sensor based on a 1-Wire single bus, makes the system simple, flexible, and convenient, offering significant advantages in ambient temperature measurement. In practical applications, the DS18B20 achieves a resolution of ±0.5℃ when using 9-bit digital conversion, and even ±0.0625℃ when using digital processing, meeting the varying control requirements of intelligent buildings. This system demonstrates clear advantages in ambient temperature measurement and control applications.

References:

[1] Xie Ruihe, Complete Guide to Serial Technology, Tsinghua University Press, 2003.4

[2] Ma Li, Intelligent Control and Lon Network Development Technology, Beijing University of Aeronautics and Astronautics Press, 2003.2

[3] Ling Zhihao, From Neuron Chips to Control Networks, Beijing University of Aeronautics and Astronautics Press, 2002.2

Read next

CATDOLL Tami Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22