SlideShare a Scribd company logo
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

What's hot (16)

PDF
Microcontroller projects
keerthanapothula
 
DOCX
project report on embedded system
ram avtar
 
DOCX
Auto dial-er Home security
vaibhav jindal
 
PDF
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
IOSR Journals
 
DOCX
Smart door project report shivnaresh likhar
Shivnaresh Likhar
 
DOC
Project report on dtmf based door opening system
Mukul Mohal
 
PDF
IRJET- Power Theft Detection and Monitoring using GSM Technology
IRJET Journal
 
PDF
training report on embedded system and AVR
Urvashi Khandelwal
 
PDF
Microprocessor-Based Automatic Door Opener
Jitendra Choudhary
 
DOC
Sms based patient report from remote place1
Atul Uttam
 
PPTX
microcontroller and embedded system
pradeep rana
 
DOCX
Home automation using dtmf
Pratik Gupta
 
PPTX
Smart door project ppt shivnaresh likhar
Shivnaresh Likhar
 
PPTX
Development of a Low Cost, Reliable & Scalable Home Automation System.
imtiyazEEE
 
PDF
Paper id 21201423
IJRAT
 
PDF
Minor Project Report: Automatic Door Control System
Saban Kumar K.C.
 
Microcontroller projects
keerthanapothula
 
project report on embedded system
ram avtar
 
Auto dial-er Home security
vaibhav jindal
 
Implementation of an Improved Microcontroller Based Moving Message Display Sy...
IOSR Journals
 
Smart door project report shivnaresh likhar
Shivnaresh Likhar
 
Project report on dtmf based door opening system
Mukul Mohal
 
IRJET- Power Theft Detection and Monitoring using GSM Technology
IRJET Journal
 
training report on embedded system and AVR
Urvashi Khandelwal
 
Microprocessor-Based Automatic Door Opener
Jitendra Choudhary
 
Sms based patient report from remote place1
Atul Uttam
 
microcontroller and embedded system
pradeep rana
 
Home automation using dtmf
Pratik Gupta
 
Smart door project ppt shivnaresh likhar
Shivnaresh Likhar
 
Development of a Low Cost, Reliable & Scalable Home Automation System.
imtiyazEEE
 
Paper id 21201423
IJRAT
 
Minor Project Report: Automatic Door Control System
Saban Kumar K.C.
 

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
IJERA Editor
 
PDF
M44096368
IJERA Editor
 
PPTX
Industrial Data Network-modbus-Protocol.pptx
SeekayAlaisKaruppaia
 
PDF
A Microcontroller Framework For PC Based Electrical Appliance Control System
Stephen Faucher
 
PDF
Design &Implementation of I2C Master Controller Interfaced With RAM Using VHDL
IJERA Editor
 
DOCX
Design of wireless sensor network for building management systems
TSriyaSharma
 
PDF
IMPROVING WORK EFFICIENCY BY REDUCING INTERFACE NOISE GENERATION EXPERIENCED ...
Dhammika Vidanalage
 
PDF
Assembler4
Omar Sanchez
 
PDF
Using%20 modbus%20for%20process[1]
Manel Montesinos
 
PDF
IJSRED-V2I2P59
IJSRED
 
PPTX
communicaiton concepf of Rs 485 modbus commun
ssuser325d67
 
PPTX
Data Acquistion and Soft Communication.pptx
ssuser325d67
 
DOCX
project 3 full report
Shubham Shivhare
 
PDF
An Implementation of I2C Slave Interface using Verilog HDL
IJMER
 
PDF
Current System
Kartik Padmanabhan
 
PDF
Industrial Monitoring System Using Wireless Sensor Networks
Associate Professor in VSB Coimbatore
 
PPT
Introduction to microcontrollers
EdwardOmondi4
 
PDF
Development of Distributed Mains Monitoring and Switching System for Indus Co...
iosrjce
 
PDF
A010610109
IOSR Journals
 
PPT
I2C Protocol
Anurag Tomar
 
E044081720
IJERA Editor
 
M44096368
IJERA Editor
 
Industrial Data Network-modbus-Protocol.pptx
SeekayAlaisKaruppaia
 
A Microcontroller Framework For PC Based Electrical Appliance Control System
Stephen Faucher
 
Design &Implementation of I2C Master Controller Interfaced With RAM Using VHDL
IJERA Editor
 
Design of wireless sensor network for building management systems
TSriyaSharma
 
IMPROVING WORK EFFICIENCY BY REDUCING INTERFACE NOISE GENERATION EXPERIENCED ...
Dhammika Vidanalage
 
Assembler4
Omar Sanchez
 
Using%20 modbus%20for%20process[1]
Manel Montesinos
 
IJSRED-V2I2P59
IJSRED
 
communicaiton concepf of Rs 485 modbus commun
ssuser325d67
 
Data Acquistion and Soft Communication.pptx
ssuser325d67
 
project 3 full report
Shubham Shivhare
 
An Implementation of I2C Slave Interface using Verilog HDL
IJMER
 
Current System
Kartik Padmanabhan
 
Industrial Monitoring System Using Wireless Sensor Networks
Associate Professor in VSB Coimbatore
 
Introduction to microcontrollers
EdwardOmondi4
 
Development of Distributed Mains Monitoring and Switching System for Indus Co...
iosrjce
 
A010610109
IOSR Journals
 
I2C Protocol
Anurag Tomar
 
Ad

More from IJITCA Journal (20)

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

Recently uploaded (20)

PPTX
Computer network Computer network Computer network Computer network
Shrikant317689
 
PDF
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
 
PPTX
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
PPTX
Alan Turing - life and importance for all of us now
Pedro Concejero
 
PDF
Module - 5 Machine Learning-22ISE62.pdf
Dr. Shivashankar
 
PPTX
template.pptxr4t5y67yrttttttttttttttttttttttttttttttttttt
SithamparanaathanPir
 
PDF
Decision support system in machine learning models for a face recognition-bas...
TELKOMNIKA JOURNAL
 
PDF
LLC CM NCP1399 SIMPLIS MODEL MANUAL.PDF
ssuser1be9ce
 
PDF
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
PPTX
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
 
PDF
13th International Conference on Artificial Intelligence, Soft Computing (AIS...
ijait
 
PDF
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
PDF
Plant Control_EST_85520-01_en_AllChanges_20220127.pdf
DarshanaChathuranga4
 
PPTX
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
 
PDF
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
PPTX
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
PDF
13th International Conference of Security, Privacy and Trust Management (SPTM...
ijcisjournal
 
PDF
Designing for Tomorrow – Architecture’s Role in the Sustainability Movement
BIM Services
 
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 
Computer network Computer network Computer network Computer network
Shrikant317689
 
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
lesson4-occupationalsafetyandhealthohsstandards-240812020130-1a7246d0.pdf
arvingallosa3
 
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
Alan Turing - life and importance for all of us now
Pedro Concejero
 
Module - 5 Machine Learning-22ISE62.pdf
Dr. Shivashankar
 
template.pptxr4t5y67yrttttttttttttttttttttttttttttttttttt
SithamparanaathanPir
 
Decision support system in machine learning models for a face recognition-bas...
TELKOMNIKA JOURNAL
 
LLC CM NCP1399 SIMPLIS MODEL MANUAL.PDF
ssuser1be9ce
 
Authentication Devices in Fog-mobile Edge Computing Environments through a Wi...
ijujournal
 
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
 
13th International Conference on Artificial Intelligence, Soft Computing (AIS...
ijait
 
Python Mini Project: Command-Line Quiz Game for School/College Students
MPREETHI7
 
Plant Control_EST_85520-01_en_AllChanges_20220127.pdf
DarshanaChathuranga4
 
Engineering Quiz ShowEngineering Quiz Show
CalvinLabial
 
輪読会資料_Miipher and Miipher2 .
NABLAS株式会社
 
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
13th International Conference of Security, Privacy and Trust Management (SPTM...
ijcisjournal
 
Designing for Tomorrow – Architecture’s Role in the Sustainability Movement
BIM Services
 
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
 

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.