International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
DOI:10.5121/ijitca.2016.6201 1
MONITORING AND CONTROL SYSTEM FOR
BUILDING APPLICATION USING MODBUS
REMOTE TERMINAL UNIT PROTOCOL WITH
AVR AT MEGA FAMILY MICROCONTROLLER
UNIT
Arief Wisnu Wardhana1
, Eka Firmansyah ST. M.Eng, Ph.D2
and Addin
Suwastono ST. M.Eng3
1
Postgraduate Master Student at Department of Electrical Engineering, Engineering
Faculty, Gadjah Mada University
2,3
Lecturer at Department of Electrical Engineering, Engineering Faculty, Gadjah Mada
University
Jalan Grafika 2 Yogyakarta 55281 Indonesia
ABSTRACT
This paper presents the design of a monitoring and control system that will be installed in buildings and
used as a building management system for monitoring dan controlling mechanical and electrical devices
embedded in the building.
The system implements the master slave RS485 multidrop configuration. The system hardware consists of
sensor, controller, and actuator. Arduino board with AT Mega series microcontroller unit (MCU) is used
as controller. MCU’s ADC will be used as sensor. MODBUS remote terminal unit is used as protocol and
implemented inside the master and slave progam inside the MCU.
At the end of this paper, the result of transmission with various baud rate setting, various cable length,
multiple message frames and are presented.
KEYWORDS
Building management system, MODBUS RTU, Multidrop, RS-485, master slave, Microcontroller Unit,
Analog to Digital Converter
1. INTRODUCTION
Monitoring and control network has been gaining many applications in our daily life. The
network could be a system applied in industrial area to control and monitor various devices in the
area. Within automotive area, the system is used to control and monitor various sensor and
actuator on modern vehicles. For building application, it is used as a building management
system. This research is about monitoring and control system for building application.
Building management system is an electronic - information based control system which is
installed in buildings, which will control dan monitor mechanical and electronic devices on the
buildings
Some kind of communication protocol is needed for this network. The protocol connects sensors,
controller, and actuators. The already known MODBUS communication protocol is used here.
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
2
Many publication discussing about monitoring and control for building application have
been done [6][11][12] dan and some of them utilises MODBUS protocol [5][8][10]
The hardware part of this Building management system consists of sensors, controller, and
actuators. Communicstion protocol will build up the software part.
The research emphases on the utilisation of Microcontroller Unit (MCU) as a hardware controller
devices. The objective is to build a monitoring and control network for building application using
MODBUS Remote Terminal Unit protocol. The final result is a controller with an embedded
software inside which is ready for monitoring and control function.
2. THE SYSTEM
2.1 SYSTEM OVERVIEW
A master slave configuration with RS485 physical medium is used for this network, as depicted
in the figure 1 below [7]
.
Figure 1. RS485 multidrop configuration for building management system application
It consists of one sensor, one master controller, and two slave controllers with their corresponding
actuator. They are all connected with a twisted pair RS - 485 cable.
The Master controller is connected to sensor and gives command to the slave controllers. Slaves
are connected to actuators and will control the actuators according to master’s command. Master
concroller is installed at a particular place in a building while the slave controller are placed in
some other location in the building.
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
3
2.2 SYSTEM IN DETAIL
2.2.1 Sensor
Sensor acts as a device which respond to physical stimuli. It could be in the form of temperature
sensor, pressure sensor, etc. It will convert analog signal into digital signal. Sensor is connected to
the build-in Analog to Digital Converter (ADC) fiture of the MCU.
2.2.2 Controller
Controller is the main part of this system. There are three controller, one is a master controller,
and the other two are the slave controllers. Master controller is used to receive the signal from
sensor and then give command to the slave. Slave controller receives the command from master
and using it to control the actuator.
2.2.3 Actuator
Actuator is connected to slave controller. Figure 2 below is a typical circuit used for controlling
actuator from MCU. As shown, I/O node is connected to the PORTn to be controlled.
Figure 2. A circuit for controlling an actuator
2.3 HOW THE SYSTEM WORK
Sensor measures variable value from the surrounding building and transmits the output signal to
controller. The controller then uses the input signal which is transmitted to actuator direcly or via
controller. The actuator receive the signal from controller and acts accordingly.
2.4 COMMUNICATION
2.4.1 Sensor – Controller Communication
This is the monitoring part of the system. The communication between sensor and controller take
in the form of reading the sensor output signal. Build – in Analog to Digital Converter is used to
read the output voltage from sensor.
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
4
2.4.2 Master controller – slave controller communication [9]
This is the control part of the system. The communication between them uses the MODBUS
Remote Terminal Unit communication protocol, which can be briefly explained as follows.
To communicate with a slave controller, the master sends a message containing :
- Slave Address
- Function Code (the command for the slave what to do)
- Data field
- Error Check
Once the slave finish to do the command, it sends a respond back to master. The respond contains
- Slave address (so master knows who is responding)
- The requested Function code
- Data
- Error Check
2.5 SOFTWARE
The main part of the software is the serial communication, the role of which is accomplished by
USART fiture of the Microcontroller Unit. The following are some routines that build master –
slave software [3][4]
:
Transmission routine and its interrupt
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
5
Routine for receiver and its interrupt
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
6
3 RESULT AND DISCUSSION
3.1 SENSOR – CONTROLLER
When the conversion from analog to digital is completed, the result can be found as follows [1] [2]
:
ADC = Vin. 1024 (1)
VREF
where Vin is the voltage on the selected input and VREF is the reference voltage. The value 0x000
represents analog ground, and 0x3FF represents the selected reference voltage minus one LSB.
[1][2]
. Experiment was done for two input values, giving the following result :
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
7
Tabel 1 Result for various Analog to Digital Conversion input
ADC Input value
Vin
( Volt)
ADC output value (ADCW register) in ASCII
0 0x00
5 0Xff
3.2 CONTROLLER – ACTUATOR
The communication between controller and actuator is based on the following. If the sensor
output signal is 0 Volt, then, by referring to the set value in the software (program) at master
controller (master MCU), master controller will consider the output value from sensor lower than
the value already set. Master controller then sends a message to actuator (via slave controller) to
act accordingly.
On the other way, if the sensor output signal is 5 Volt, master controller will consider the output
higher than the set value. Master controller then sends a message to actuator via slave controller
for the output to act accordingly.
Message frame format from master controller to slave controller can be shown in the figure 3
below :
Slave
address
Function
Code
PORT address Number of bit in
PORT
Cylic
Redundancy Check
Figure 3. Message frame format
To send the message, a 9 - bit frame format is used. Firstly, master controller will send slave
address slot (byte). Then, in turn, function kode, PORT address, number of bit in the PORT, and
CRC-16 are sent.
The following table shows the result (slave controllers are given an address 0x41 (slave ‘A’) and
0x42 (slave ‘B’) :
Table 2. Result for various input (various message frame)
Slav
e
addr
ess
sent
ADC
Inpu
t
Vin
(Volt
)
PORT
address
Number of bit
at the PORT
Actuator
Output
0x41 0 PORTD upper nibble upper & lower nibble
OFF
0x41 0 PORTD lower nibble upper & lower nibble
OFF
0x41 5 PORTD upper nibble upper nibble ON
0x41 5 PORTD lower nibble lower nibble ON
0x42 0 PORTF
(ATMega
upper nibble upper & lower nibble
OFF
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
8
2560)
0x42 0 PORTF
(ATMega
2560)
lower nibble upper & lower nibble
OFF
0x42 5 PORTF
(ATMega
2560)
upper nibble upper nibble ON
0x42 5 PORTF
(ATMega
2560)
lower nibble lower nibble ON
The first byte is a field for slave address which is slave 0x41 or 0x42. The second byte is a field
for function code. The function code is a command. Which function code to be sent is depended
on the digital input from Analog to Digital Converter. The third byte is a field for PORT address
(which PORT on the addressed slave) to be controlled. The fourth byte is number of bit at the
controlled PORT (which bit at that PORT which going to be controlled).
Table 3. Result of CRCLo byte and CRCHi byte for some messages
Message CRCLo byte CRCHi
Byte
0x41, '-', 'P', 'a', 'n', 'a', 's', '-', 0x43,
'-', 0x52, '-'
0x86 0xD6
0x41, '-', 'P', 'a', 'n', 'a', 's', '-', 0x43,
'-', 0x51, '-'
0x86 0x26
0x41, '-', 'D', 'i', 'n', 'g', 'i', 'n', '-' 0x32 0xC3
0x42, '-', 'P', 'a', 'n', 'a', 's', '-', 0x43,
'-', 0x52, '-'
0x82 0xD2
0x42, '-', 'P', 'a', 'n', 'a', 's', '-', 0x43,
'-', 0x51, '-'
0x82 0x22
0x42, '-', 'P', 'a', 'n', 'a', 's', '-', 0x46,
'-', 0x52, '-'
0x82 0x1E
0x42, '-', 'P', 'a', 'n', 'a', 's', '-', 0x46,
'-', 0x51, '-'
0x82 0xEE
0x42, '-', 'D', 'i', 'n', 'g', 'i', 'n', '-' 0x26 0x33
The last byte of the message frame is for error checking CRC-16. Examples of CRCLo byte and
CRCHi byte (in HEX) for some messages are shown at table 3 above.
The two bytes CRCLo and CRCHi are then added to the message being sent, appended after the
last data byte of the message.
3.3 TRANSMISSION CHECK
To guarantee the robustness of the system, transmission check was done. There are three
trasmission check. The first one is by using various baud rate value. With oscilation frequency of
16 MHz, the following baud rate values were tried : 2400, 4800, 9600, 19200, 38400, 57600 and
115200 bps. The result can be shown in table 4 :
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
9
Tabel 4. Result for various baud rate setting
Baud
rate
(bps)
Result Baud rate error
(in %)
2400 Functioning - 0.1
4800 Functioning 0.2
9600 Functioning 0.2
19200 Functioning 0.2
38400 Functioning 0.2
57600 Functioning 2.1
115200 Data succesfully sent, but error -3.5
It can be shown that the system was sucessfully run for baud rate values of 2400, 4800, 9600,
19200, 38400, and 57600 bps.
Baud rate error was calculated by using the following equation [1] [7]
:
Error (%) = (Baud RateClosest Match – 1) . 100% (2)
Baud Rate
The next transmission checking is by using various cable length (various distance). With a fix
baud rate value of 9600 bps, we have the following result :
Table 5 Result for various cable length
Distance / cable
length (in meter)
Result
10 Functioning
20 Functioning
The last transmission check is sending with more than one message. This was done at the
program, both master MCU and slave MCU.
This test was done to check the Multiprocessor Communication Mode fiture. Also for testing with
different messages, with inter frame time between message. Master firstly sends a number of
message to slave number 1, and then continued with the next group of message to slave number 2.
The result were shown in table 6 below.
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
10
Table 6. Transmission with more than one message frame
Number of
messages
(jumlah frame)
Result
Four messages
for slave number
1
Succesfully sent, functioning
Four message for
slave number 2
Sucesfully sent, functioning
Eight messages,
the first four for
slave number 1
and the next four
for slave number
2
Succesfully sent, functioning. Slave number 1 receive the first
four message and ignoring the next four messages. Slave
number 2 ignores the first four message and receive the next
four messages
4. CONCLUSION
Some conclusion can be DERIVED from the above experiment :
1. A monitor and control network for building application has been designed in this research.
2. A master - slave multidrop RS – 485 configuration can be used as monitoring and control
system for building management (automation) system application
3. MODBUS RTU can be used as a communication protocol for this system. It works well when
using baud rate value of 9600 and 19200 bps.
4. Microcontroller Unit (MCU) as part of a development board can be used as controller.
5. Generally speaking, the system can be run well with baud rate setting of 2400, 4800, 9600,
19200, 38400, dan 57600 bit per second.
REFERENCES
[1] ATmega 48A/PA/88A/PA/168A/ PA/328/PA Atmel 8-bit Microcontroller with 4/8/16/32K Bytes
In-System Programmable Flash DATASHEET
[2] Atmel ATmega 640/V-1280/V-1281/V-2560/V-2561/V 8-bit Atmel Microcontroller with
16/32/64KB In-System Programmable Flash DATASHEET
[3] Barnett, Cox, and O’Cull, Embedded C Programming and The Atmel AVR, 2nd edition,
DELMAR CENGAGE Learning, 2007
[4] Code Vision AVR version 3.15 user manual, HP InfoTech, 1998 - 2014
[5] Cristian Spirleanu, Eugen Diaconescu, “Multi-Agent Distributed Infrastructure for Intelligent
Building Control”, in ECAI 2014 - International Conference – 6th Edition
[6] Gao Manru, Su Wei, Xue Lijun, “Engineering Design of Intelligent Building Management System
(IBMS)” in 2010 International Conference on Computer and Communication Technologies in
Agriculture Engineering
[7] Hein Marais, RS-485/RS-422 Circuit Implementation Guide, Application Note 960 (AN-960),
ANALOG DEVICES
[8] Kuo-Hsiung Tseng, Chin-Liang Hsieh, Yun-Fei Lien, “Solution of a Newly Built Monitoring
Automation System In Parallel to the Original Automation Management System” in 2015 27th
Chinese Control and Decision Conference (CCDC)
[9] “MODBUS over Serial Line Specification and Implementation Guide V1 02”, MODBUS
Organisation, 2006
International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016
11
[10] R. S. Hsiao, D. B. Lin, H. P. Lin, C. H. Chung and S. C. Cheng, “Integrating Zigbee Linghting
Control Into Existing Building Automation Systems”
[11] S. Tepic*, P. Pejic*, J. Domšic*, H. Mihaldinec*, H. Džapo*, “IBMS - Intelligent Building
Management System Framework” in MIPRO 2015, 25-29 May 2015, Opatija, Croatia
[12] Wolfgang Kastner, George Neugschwandtner, Stefan Soucek, and H. Michael Newman,
“Communication Systems for Building Automation and Control”
Author
Arief Wisnu Wardhana was born in Solo, Indonesia in 1972. He received his
engineering degree in Electronic and Information from The University of
Huddersfield, Huddersfield, The United Kingdom in 1997. Since 2005, he is with
Department of Electrical Engineering, Faculty of Engineering, Jenderal Soedirman
University Purwokerto, Indonesia. His current interest is in embedded system and
embedded programming. Starting from September 2013, he has been doing his master
degree in Department of Electrical Engineering, Engineering Faculty, Gadjah Mada
Universiaty, Yogyakarta, Indonesia.

More Related Content

PDF
Industrial Process Management Using LabVIEW
PDF
Design and Implementation of a Stand-Alone Remote Terminal Unit
PDF
Arm Based Real Time Monitoring and Controlling of Industrial Parameters Using...
PDF
SOCIAL NETWORK FOR SMART DEVICES USING EMBEDDED ETHERNET
PDF
D05111923
PDF
I45015153
DOC
Project
PDF
E04834649
Industrial Process Management Using LabVIEW
Design and Implementation of a Stand-Alone Remote Terminal Unit
Arm Based Real Time Monitoring and Controlling of Industrial Parameters Using...
SOCIAL NETWORK FOR SMART DEVICES USING EMBEDDED ETHERNET
D05111923
I45015153
Project
E04834649

What's hot (16)

PDF
Microcontroller projects
DOCX
project report on embedded system
DOCX
Auto dial-er Home security
PDF
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
DOCX
Smart door project report shivnaresh likhar
DOC
Project report on dtmf based door opening system
PDF
IRJET- Power Theft Detection and Monitoring using GSM Technology
PDF
training report on embedded system and AVR
PDF
Microprocessor-Based Automatic Door Opener
DOC
Sms based patient report from remote place1
PPTX
microcontroller and embedded system
DOCX
Home automation using dtmf
PPTX
Smart door project ppt shivnaresh likhar
PPTX
Development of a Low Cost, Reliable & Scalable Home Automation System.
PDF
Paper id 21201423
PDF
Minor Project Report: Automatic Door Control System
Microcontroller projects
project report on embedded system
Auto dial-er Home security
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
Smart door project report shivnaresh likhar
Project report on dtmf based door opening system
IRJET- Power Theft Detection and Monitoring using GSM Technology
training report on embedded system and AVR
Microprocessor-Based Automatic Door Opener
Sms based patient report from remote place1
microcontroller and embedded system
Home automation using dtmf
Smart door project ppt shivnaresh likhar
Development of a Low Cost, Reliable & Scalable Home Automation System.
Paper id 21201423
Minor Project Report: Automatic Door Control System
Ad

Similar to Monitoring and Control System for Building Application Using Modbus Remote Terminal Unit Protocol with AVR at Mega Family Microcontroller Unit (20)

PDF
E044081720
PDF
M44096368
PPTX
Industrial Data Network-modbus-Protocol.pptx
PDF
A Microcontroller Framework For PC Based Electrical Appliance Control System
PDF
Design &Implementation of I2C Master Controller Interfaced With RAM Using VHDL
DOCX
Design of wireless sensor network for building management systems
PDF
IMPROVING WORK EFFICIENCY BY REDUCING INTERFACE NOISE GENERATION EXPERIENCED ...
PDF
Assembler4
PDF
Using%20 modbus%20for%20process[1]
PDF
IJSRED-V2I2P59
PPTX
communicaiton concepf of Rs 485 modbus commun
PPTX
Data Acquistion and Soft Communication.pptx
DOCX
project 3 full report
PDF
An Implementation of I2C Slave Interface using Verilog HDL
PDF
Current System
PDF
Industrial Monitoring System Using Wireless Sensor Networks
PPT
Introduction to microcontrollers
PDF
Development of Distributed Mains Monitoring and Switching System for Indus Co...
PDF
A010610109
PPT
I2C Protocol
E044081720
M44096368
Industrial Data Network-modbus-Protocol.pptx
A Microcontroller Framework For PC Based Electrical Appliance Control System
Design &Implementation of I2C Master Controller Interfaced With RAM Using VHDL
Design of wireless sensor network for building management systems
IMPROVING WORK EFFICIENCY BY REDUCING INTERFACE NOISE GENERATION EXPERIENCED ...
Assembler4
Using%20 modbus%20for%20process[1]
IJSRED-V2I2P59
communicaiton concepf of Rs 485 modbus commun
Data Acquistion and Soft Communication.pptx
project 3 full report
An Implementation of I2C Slave Interface using Verilog HDL
Current System
Industrial Monitoring System Using Wireless Sensor Networks
Introduction to microcontrollers
Development of Distributed Mains Monitoring and Switching System for Indus Co...
A010610109
I2C Protocol
Ad

More from IJITCA Journal (20)

PDF
ANALYSIS AND GLOBAL CHAOS CONTROL OF THE HYPERCHAOTIC LI SYSTEM VIA SLIDING C...
PDF
HYBRID CHAOS SYNCHRONIZATION OF UNCERTAIN LORENZ-STENFLO AND QI 4-D CHAOTIC S...
PDF
INVESTIGATING HUMAN-MACHINE INTERFACES’ EFFICIENCY IN INDUSTRIAL MACHINERY AN...
PDF
AN ENVIRONMENT-VISUALIZATION SYSTEM WITH IMAGE-BASED RETRIEVAL AND DISTANCE C...
PDF
INVESTIGATING HUMAN-MACHINE INTERFACES’ EFFICIENCY IN INDUSTRIAL MACHINERY AN...
PDF
Effect of Different Defuzzification methods in a Fuzzy Based Liquid Flow cont...
PDF
DEVELOPMENT OF AN INTEGRATED TOOL THAT SUMMARRIZE AND PRODUCE THE SIGN LANGUA...
PDF
IMPROVED CONTROL DESIGN FOR AUTONOMOUS VEHICLES
PDF
CARE –AN ARCHITECTURAL APPROACH FOR A MULTIMEDIA ASSISTANCE SYSTEM FOR SINGLE...
PDF
16th International Conference on Web services & Semantic Technology (WeST 2024)
PDF
13th International Conference on Signal, Image Processing and Pattern Recogni...
PDF
International Journal of Information Technology, Control and Automation (IJITCA)
PDF
10th International Conference on Data Mining and Database Management Systems ...
PDF
International Journal of Information Technology Convergence and services (IJI...
DOCX
International Journal of Information Technology, Control and Automation (IJITCA)
DOCX
International Journal of Information Technology, Control and Automation (IJITCA)
PDF
International Journal of Information Technology, Control and Automation (IJITCA)
PDF
6th International Conference on Machine Learning & Applications (CMLA 2024)
PDF
The International Journal of Information Technology, Control and Automation (...
PDF
The International Journal of Information Technology, Control and Automation (...
ANALYSIS AND GLOBAL CHAOS CONTROL OF THE HYPERCHAOTIC LI SYSTEM VIA SLIDING C...
HYBRID CHAOS SYNCHRONIZATION OF UNCERTAIN LORENZ-STENFLO AND QI 4-D CHAOTIC S...
INVESTIGATING HUMAN-MACHINE INTERFACES’ EFFICIENCY IN INDUSTRIAL MACHINERY AN...
AN ENVIRONMENT-VISUALIZATION SYSTEM WITH IMAGE-BASED RETRIEVAL AND DISTANCE C...
INVESTIGATING HUMAN-MACHINE INTERFACES’ EFFICIENCY IN INDUSTRIAL MACHINERY AN...
Effect of Different Defuzzification methods in a Fuzzy Based Liquid Flow cont...
DEVELOPMENT OF AN INTEGRATED TOOL THAT SUMMARRIZE AND PRODUCE THE SIGN LANGUA...
IMPROVED CONTROL DESIGN FOR AUTONOMOUS VEHICLES
CARE –AN ARCHITECTURAL APPROACH FOR A MULTIMEDIA ASSISTANCE SYSTEM FOR SINGLE...
16th International Conference on Web services & Semantic Technology (WeST 2024)
13th International Conference on Signal, Image Processing and Pattern Recogni...
International Journal of Information Technology, Control and Automation (IJITCA)
10th International Conference on Data Mining and Database Management Systems ...
International Journal of Information Technology Convergence and services (IJI...
International Journal of Information Technology, Control and Automation (IJITCA)
International Journal of Information Technology, Control and Automation (IJITCA)
International Journal of Information Technology, Control and Automation (IJITCA)
6th International Conference on Machine Learning & Applications (CMLA 2024)
The International Journal of Information Technology, Control and Automation (...
The International Journal of Information Technology, Control and Automation (...

Recently uploaded (20)

PPTX
Principal presentation for NAAC (1).pptx
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PDF
Cryptography and Network Security-Module-I.pdf
PDF
20250617 - IR - Global Guide for HR - 51 pages.pdf
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PPTX
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
PDF
Computer System Architecture 3rd Edition-M Morris Mano.pdf
PPTX
CONTRACTS IN CONSTRUCTION PROJECTS: TYPES
PDF
Unit1 - AIML Chapter 1 concept and ethics
PPTX
CN_Unite_1 AI&DS ENGGERING SPPU PUNE UNIVERSITY
PDF
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
PPTX
Software Engineering and software moduleing
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PPTX
Module 8- Technological and Communication Skills.pptx
PPTX
PRASUNET_20240614003_231416_0000[1].pptx
PDF
MLpara ingenieira CIVIL, meca Y AMBIENTAL
PPTX
Petroleum Refining & Petrochemicals.pptx
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
Principal presentation for NAAC (1).pptx
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Cryptography and Network Security-Module-I.pdf
20250617 - IR - Global Guide for HR - 51 pages.pdf
August 2025 - Top 10 Read Articles in Network Security & Its Applications
Chemical Technological Processes, Feasibility Study and Chemical Process Indu...
Computer System Architecture 3rd Edition-M Morris Mano.pdf
CONTRACTS IN CONSTRUCTION PROJECTS: TYPES
Unit1 - AIML Chapter 1 concept and ethics
CN_Unite_1 AI&DS ENGGERING SPPU PUNE UNIVERSITY
Accra-Kumasi Expressway - Prefeasibility Report Volume 1 of 7.11.2018.pdf
Software Engineering and software moduleing
Exploratory_Data_Analysis_Fundamentals.pdf
Module 8- Technological and Communication Skills.pptx
PRASUNET_20240614003_231416_0000[1].pptx
MLpara ingenieira CIVIL, meca Y AMBIENTAL
Petroleum Refining & Petrochemicals.pptx
"Array and Linked List in Data Structures with Types, Operations, Implementat...
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK

Monitoring and Control System for Building Application Using Modbus Remote Terminal Unit Protocol with AVR at Mega Family Microcontroller Unit

  • 1. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 DOI:10.5121/ijitca.2016.6201 1 MONITORING AND CONTROL SYSTEM FOR BUILDING APPLICATION USING MODBUS REMOTE TERMINAL UNIT PROTOCOL WITH AVR AT MEGA FAMILY MICROCONTROLLER UNIT Arief Wisnu Wardhana1 , Eka Firmansyah ST. M.Eng, Ph.D2 and Addin Suwastono ST. M.Eng3 1 Postgraduate Master Student at Department of Electrical Engineering, Engineering Faculty, Gadjah Mada University 2,3 Lecturer at Department of Electrical Engineering, Engineering Faculty, Gadjah Mada University Jalan Grafika 2 Yogyakarta 55281 Indonesia ABSTRACT This paper presents the design of a monitoring and control system that will be installed in buildings and used as a building management system for monitoring dan controlling mechanical and electrical devices embedded in the building. The system implements the master slave RS485 multidrop configuration. The system hardware consists of sensor, controller, and actuator. Arduino board with AT Mega series microcontroller unit (MCU) is used as controller. MCU’s ADC will be used as sensor. MODBUS remote terminal unit is used as protocol and implemented inside the master and slave progam inside the MCU. At the end of this paper, the result of transmission with various baud rate setting, various cable length, multiple message frames and are presented. KEYWORDS Building management system, MODBUS RTU, Multidrop, RS-485, master slave, Microcontroller Unit, Analog to Digital Converter 1. INTRODUCTION Monitoring and control network has been gaining many applications in our daily life. The network could be a system applied in industrial area to control and monitor various devices in the area. Within automotive area, the system is used to control and monitor various sensor and actuator on modern vehicles. For building application, it is used as a building management system. This research is about monitoring and control system for building application. Building management system is an electronic - information based control system which is installed in buildings, which will control dan monitor mechanical and electronic devices on the buildings Some kind of communication protocol is needed for this network. The protocol connects sensors, controller, and actuators. The already known MODBUS communication protocol is used here.
  • 2. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 2 Many publication discussing about monitoring and control for building application have been done [6][11][12] dan and some of them utilises MODBUS protocol [5][8][10] The hardware part of this Building management system consists of sensors, controller, and actuators. Communicstion protocol will build up the software part. The research emphases on the utilisation of Microcontroller Unit (MCU) as a hardware controller devices. The objective is to build a monitoring and control network for building application using MODBUS Remote Terminal Unit protocol. The final result is a controller with an embedded software inside which is ready for monitoring and control function. 2. THE SYSTEM 2.1 SYSTEM OVERVIEW A master slave configuration with RS485 physical medium is used for this network, as depicted in the figure 1 below [7] . Figure 1. RS485 multidrop configuration for building management system application It consists of one sensor, one master controller, and two slave controllers with their corresponding actuator. They are all connected with a twisted pair RS - 485 cable. The Master controller is connected to sensor and gives command to the slave controllers. Slaves are connected to actuators and will control the actuators according to master’s command. Master concroller is installed at a particular place in a building while the slave controller are placed in some other location in the building.
  • 3. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 3 2.2 SYSTEM IN DETAIL 2.2.1 Sensor Sensor acts as a device which respond to physical stimuli. It could be in the form of temperature sensor, pressure sensor, etc. It will convert analog signal into digital signal. Sensor is connected to the build-in Analog to Digital Converter (ADC) fiture of the MCU. 2.2.2 Controller Controller is the main part of this system. There are three controller, one is a master controller, and the other two are the slave controllers. Master controller is used to receive the signal from sensor and then give command to the slave. Slave controller receives the command from master and using it to control the actuator. 2.2.3 Actuator Actuator is connected to slave controller. Figure 2 below is a typical circuit used for controlling actuator from MCU. As shown, I/O node is connected to the PORTn to be controlled. Figure 2. A circuit for controlling an actuator 2.3 HOW THE SYSTEM WORK Sensor measures variable value from the surrounding building and transmits the output signal to controller. The controller then uses the input signal which is transmitted to actuator direcly or via controller. The actuator receive the signal from controller and acts accordingly. 2.4 COMMUNICATION 2.4.1 Sensor – Controller Communication This is the monitoring part of the system. The communication between sensor and controller take in the form of reading the sensor output signal. Build – in Analog to Digital Converter is used to read the output voltage from sensor.
  • 4. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 4 2.4.2 Master controller – slave controller communication [9] This is the control part of the system. The communication between them uses the MODBUS Remote Terminal Unit communication protocol, which can be briefly explained as follows. To communicate with a slave controller, the master sends a message containing : - Slave Address - Function Code (the command for the slave what to do) - Data field - Error Check Once the slave finish to do the command, it sends a respond back to master. The respond contains - Slave address (so master knows who is responding) - The requested Function code - Data - Error Check 2.5 SOFTWARE The main part of the software is the serial communication, the role of which is accomplished by USART fiture of the Microcontroller Unit. The following are some routines that build master – slave software [3][4] : Transmission routine and its interrupt
  • 5. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 5 Routine for receiver and its interrupt
  • 6. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 6 3 RESULT AND DISCUSSION 3.1 SENSOR – CONTROLLER When the conversion from analog to digital is completed, the result can be found as follows [1] [2] : ADC = Vin. 1024 (1) VREF where Vin is the voltage on the selected input and VREF is the reference voltage. The value 0x000 represents analog ground, and 0x3FF represents the selected reference voltage minus one LSB. [1][2] . Experiment was done for two input values, giving the following result :
  • 7. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 7 Tabel 1 Result for various Analog to Digital Conversion input ADC Input value Vin ( Volt) ADC output value (ADCW register) in ASCII 0 0x00 5 0Xff 3.2 CONTROLLER – ACTUATOR The communication between controller and actuator is based on the following. If the sensor output signal is 0 Volt, then, by referring to the set value in the software (program) at master controller (master MCU), master controller will consider the output value from sensor lower than the value already set. Master controller then sends a message to actuator (via slave controller) to act accordingly. On the other way, if the sensor output signal is 5 Volt, master controller will consider the output higher than the set value. Master controller then sends a message to actuator via slave controller for the output to act accordingly. Message frame format from master controller to slave controller can be shown in the figure 3 below : Slave address Function Code PORT address Number of bit in PORT Cylic Redundancy Check Figure 3. Message frame format To send the message, a 9 - bit frame format is used. Firstly, master controller will send slave address slot (byte). Then, in turn, function kode, PORT address, number of bit in the PORT, and CRC-16 are sent. The following table shows the result (slave controllers are given an address 0x41 (slave ‘A’) and 0x42 (slave ‘B’) : Table 2. Result for various input (various message frame) Slav e addr ess sent ADC Inpu t Vin (Volt ) PORT address Number of bit at the PORT Actuator Output 0x41 0 PORTD upper nibble upper & lower nibble OFF 0x41 0 PORTD lower nibble upper & lower nibble OFF 0x41 5 PORTD upper nibble upper nibble ON 0x41 5 PORTD lower nibble lower nibble ON 0x42 0 PORTF (ATMega upper nibble upper & lower nibble OFF
  • 8. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 8 2560) 0x42 0 PORTF (ATMega 2560) lower nibble upper & lower nibble OFF 0x42 5 PORTF (ATMega 2560) upper nibble upper nibble ON 0x42 5 PORTF (ATMega 2560) lower nibble lower nibble ON The first byte is a field for slave address which is slave 0x41 or 0x42. The second byte is a field for function code. The function code is a command. Which function code to be sent is depended on the digital input from Analog to Digital Converter. The third byte is a field for PORT address (which PORT on the addressed slave) to be controlled. The fourth byte is number of bit at the controlled PORT (which bit at that PORT which going to be controlled). Table 3. Result of CRCLo byte and CRCHi byte for some messages Message CRCLo byte CRCHi Byte 0x41, '-', 'P', 'a', 'n', 'a', 's', '-', 0x43, '-', 0x52, '-' 0x86 0xD6 0x41, '-', 'P', 'a', 'n', 'a', 's', '-', 0x43, '-', 0x51, '-' 0x86 0x26 0x41, '-', 'D', 'i', 'n', 'g', 'i', 'n', '-' 0x32 0xC3 0x42, '-', 'P', 'a', 'n', 'a', 's', '-', 0x43, '-', 0x52, '-' 0x82 0xD2 0x42, '-', 'P', 'a', 'n', 'a', 's', '-', 0x43, '-', 0x51, '-' 0x82 0x22 0x42, '-', 'P', 'a', 'n', 'a', 's', '-', 0x46, '-', 0x52, '-' 0x82 0x1E 0x42, '-', 'P', 'a', 'n', 'a', 's', '-', 0x46, '-', 0x51, '-' 0x82 0xEE 0x42, '-', 'D', 'i', 'n', 'g', 'i', 'n', '-' 0x26 0x33 The last byte of the message frame is for error checking CRC-16. Examples of CRCLo byte and CRCHi byte (in HEX) for some messages are shown at table 3 above. The two bytes CRCLo and CRCHi are then added to the message being sent, appended after the last data byte of the message. 3.3 TRANSMISSION CHECK To guarantee the robustness of the system, transmission check was done. There are three trasmission check. The first one is by using various baud rate value. With oscilation frequency of 16 MHz, the following baud rate values were tried : 2400, 4800, 9600, 19200, 38400, 57600 and 115200 bps. The result can be shown in table 4 :
  • 9. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 9 Tabel 4. Result for various baud rate setting Baud rate (bps) Result Baud rate error (in %) 2400 Functioning - 0.1 4800 Functioning 0.2 9600 Functioning 0.2 19200 Functioning 0.2 38400 Functioning 0.2 57600 Functioning 2.1 115200 Data succesfully sent, but error -3.5 It can be shown that the system was sucessfully run for baud rate values of 2400, 4800, 9600, 19200, 38400, and 57600 bps. Baud rate error was calculated by using the following equation [1] [7] : Error (%) = (Baud RateClosest Match – 1) . 100% (2) Baud Rate The next transmission checking is by using various cable length (various distance). With a fix baud rate value of 9600 bps, we have the following result : Table 5 Result for various cable length Distance / cable length (in meter) Result 10 Functioning 20 Functioning The last transmission check is sending with more than one message. This was done at the program, both master MCU and slave MCU. This test was done to check the Multiprocessor Communication Mode fiture. Also for testing with different messages, with inter frame time between message. Master firstly sends a number of message to slave number 1, and then continued with the next group of message to slave number 2. The result were shown in table 6 below.
  • 10. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 10 Table 6. Transmission with more than one message frame Number of messages (jumlah frame) Result Four messages for slave number 1 Succesfully sent, functioning Four message for slave number 2 Sucesfully sent, functioning Eight messages, the first four for slave number 1 and the next four for slave number 2 Succesfully sent, functioning. Slave number 1 receive the first four message and ignoring the next four messages. Slave number 2 ignores the first four message and receive the next four messages 4. CONCLUSION Some conclusion can be DERIVED from the above experiment : 1. A monitor and control network for building application has been designed in this research. 2. A master - slave multidrop RS – 485 configuration can be used as monitoring and control system for building management (automation) system application 3. MODBUS RTU can be used as a communication protocol for this system. It works well when using baud rate value of 9600 and 19200 bps. 4. Microcontroller Unit (MCU) as part of a development board can be used as controller. 5. Generally speaking, the system can be run well with baud rate setting of 2400, 4800, 9600, 19200, 38400, dan 57600 bit per second. REFERENCES [1] ATmega 48A/PA/88A/PA/168A/ PA/328/PA Atmel 8-bit Microcontroller with 4/8/16/32K Bytes In-System Programmable Flash DATASHEET [2] Atmel ATmega 640/V-1280/V-1281/V-2560/V-2561/V 8-bit Atmel Microcontroller with 16/32/64KB In-System Programmable Flash DATASHEET [3] Barnett, Cox, and O’Cull, Embedded C Programming and The Atmel AVR, 2nd edition, DELMAR CENGAGE Learning, 2007 [4] Code Vision AVR version 3.15 user manual, HP InfoTech, 1998 - 2014 [5] Cristian Spirleanu, Eugen Diaconescu, “Multi-Agent Distributed Infrastructure for Intelligent Building Control”, in ECAI 2014 - International Conference – 6th Edition [6] Gao Manru, Su Wei, Xue Lijun, “Engineering Design of Intelligent Building Management System (IBMS)” in 2010 International Conference on Computer and Communication Technologies in Agriculture Engineering [7] Hein Marais, RS-485/RS-422 Circuit Implementation Guide, Application Note 960 (AN-960), ANALOG DEVICES [8] Kuo-Hsiung Tseng, Chin-Liang Hsieh, Yun-Fei Lien, “Solution of a Newly Built Monitoring Automation System In Parallel to the Original Automation Management System” in 2015 27th Chinese Control and Decision Conference (CCDC) [9] “MODBUS over Serial Line Specification and Implementation Guide V1 02”, MODBUS Organisation, 2006
  • 11. International Journal of Information Technology, Control and Automation (IJITCA) Vol. 6, No.2, April 2016 11 [10] R. S. Hsiao, D. B. Lin, H. P. Lin, C. H. Chung and S. C. Cheng, “Integrating Zigbee Linghting Control Into Existing Building Automation Systems” [11] S. Tepic*, P. Pejic*, J. Domšic*, H. Mihaldinec*, H. Džapo*, “IBMS - Intelligent Building Management System Framework” in MIPRO 2015, 25-29 May 2015, Opatija, Croatia [12] Wolfgang Kastner, George Neugschwandtner, Stefan Soucek, and H. Michael Newman, “Communication Systems for Building Automation and Control” Author Arief Wisnu Wardhana was born in Solo, Indonesia in 1972. He received his engineering degree in Electronic and Information from The University of Huddersfield, Huddersfield, The United Kingdom in 1997. Since 2005, he is with Department of Electrical Engineering, Faculty of Engineering, Jenderal Soedirman University Purwokerto, Indonesia. His current interest is in embedded system and embedded programming. Starting from September 2013, he has been doing his master degree in Department of Electrical Engineering, Engineering Faculty, Gadjah Mada Universiaty, Yogyakarta, Indonesia.