keil rtos based embedded web server for real time …€¦ · · 2017-11-10taking the control...
TRANSCRIPT
http://www.iaeme.com/IJMET/index.asp 553 [email protected]
International Journal of Mechanical Engineering and Technology (IJMET) Volume 8, Issue 10, October 2017, pp. 553–560, Article ID: IJMET_08_10_062
Available online at http://www.iaeme.com/IJMET/issues.asp?JType=IJMET&VType=8&IType=10
ISSN Print: 0976-6340 and ISSN Online: 0976-6359
© IAEME Publication Scopus Indexed
KEIL RTOS BASED EMBEDDED WEB SERVER
FOR REAL TIME INDUSTRIAL MONITORING
A.Yogaraj
Associate Professor ECE, veltech Dr RR& Dr SR University, Chennai
C.S.Sivanthiram
Assistant Professor ECE, Sree Sastha Institute of Engineering and Technology, Chennai,
S.Dhananjeyan
Assistant Professor EEE, Veltech Multitech Engineering College Chennai
S.Suresh
Assistant Professor ECE, Sree Sastha Institute of Engineering and Technology, Chennai
ABSTRACT
With the advent of smart systems in industries and the number of catastrophic
incidents occurring in day to day basis, real time monitoring and controlling actions
in a timely manner in case of emergency scenarios is a challenging and an important
issue to be considered. Moreover, the scheduling of the parameters monitored and
taking the control action in the smallest possible delay, the priority assignment and
scheduling of the monitoring and actuation must be done in a deterministic nature to
avoid catastrophes. The design of a real time data acquisition system is done using
ARM processor and built-in web server application. A reliable scheduling mechanism
with multitasking functionality is needed for handling multiple processes. The main
essence of this project is to design and implement an embedded web server for data
acquisition and controlling system using ARM CORTEX M3 CORE(LPC1768)
running on Keil RTX and TCP/IP Ethernet connection for industrial monitoring
applications that could prevent accidents. The LPC 1768 board acts as an embedded
web server and the data from the sensors which are simulated to measure different
parameters is communicated to the Central Monitoring System via ETHERNET.
Keywords: Keil RTX, Ethernet, multitasking, data acquisition
Cite this Article: A.Yogaraj, C.S.Sivanthiram, S.Dhananjeyan and S.Suresh, Keil
RTOS based Embedded Web Server for Real Time Industrial Monitoring,
International Journal of Mechanical Engineering and Technology 8(10), 2017,
pp. 553–560.
http://www.iaeme.com/IJMET/issues.asp?JType=IJMET&VType=8&IType=10
A.Yogaraj, C.S.Sivanthiram, S.Dhananjeyan and S.Suresh
http://www.iaeme.com/IJMET/index.asp 554 [email protected]
1. INTRODUCTION
Since the systems in industries are very complex it is required to monitor the system state in
real time. To make the system more flexible, microcontroller can be used for the system
design which could make the system more reliable enhancing the performance of the system.
The advanced RISC machines (ARM) architecture is based on Reduced Instruction Set
Computer (RISC) principles, and the instruction set and related decode mechanism are much
simpler than those of micro programmed Complex Instruction Set Computers (CISC). This
simplicity results in a high instruction throughput and impressive real-time interrupt response
from a small and cost-effective processor core.
Real Time Operating System is an Operating (RTOS) System used for real time
application for processing of data without any delays. RTOS is on computational environment
that gives response or reaction for an event in a specific time. It depicts not only on the logical
correctness but as well on the time correctness of the system. The deadline for producing the
result is depicted at the instant of time evolution of an event.
Operating System (OS) is a system program that acts as an interface between the hardware
and the application programs. The common features of OS comprise of: Synchronization,
Multitasking, Inter-task Communication, Interrupt and Event Handling, Input/ Output, Timers
and Clocks and Memory Management. Thus RTOS is an operating system that is used in real-
time applications and embedded systems for providing logically correct result before the
deadline. This depicts deterministic timing behaviour and resource utilization of an RTOS.
Real time kernel is simple and stable. RTOS can cut a complex application into several
mutually independent tasks based on task priority and it also has its own limitations. RTOS,
include the task management, task scheduling, interrupt handling etc.
Industrial application requires multiple tasks to be executed. Controlling the industrial
system, processing of data, storing of the data and transmission of the data with polling
technique require more time so use of multi-tasking is involved. When ARM processor
combined with RTOS with timing constraint can be realized for the data acquisition and
transmission of data.
2. DESIGN METHODOLOGY
The system is based on ARM processor running on Keil RTX. The web server configuration
is based on CGI scripting which gives the interface between the system and the software.
A. Proposed Architecture
Most of the controlling applications are designed with processor based real-time embedded
systems. This system is design to monitor the various parameters of an industry such as
temperature, pressure, humidity, etc. The real time embedded system continuously senses
these parameters by carrying out these tasks with certain timing constraints making the
system real time. The proper scheduling mechanism is applied after an analysis on various
real time scheduling mechanisms. The data transmission between the sensing areas to the
central monitoring system is carried through an embedded web server with hypertext transfer
protocol (HTTP). This is shown in the Fig.1. The proposed system consists of16/32-bit RISC
microprocessor LPC1768 a product of PHILIPS which is a high performance and cost
effective microcontroller that can be used for general purpose applications.
Keil RTOS based Embedded Web Server for Real Time Industrial Monitoring
http://www.iaeme.com/IJMET/index.asp 555 [email protected]
B. The Principle of Embedded Web Server
An Embedded web server means importing n internet based Web Server with the support of
proper hardware and software platforms for transferring and monitoring data of distributed
components. It uses TCP/IP protocol as its underlying communication protocol and also it
uses Web server technology as its core technology.
A specifically designed embedded web server is needed to handle multiple user requests
with increased functionality. The Apache web server which is used in Linux is not enough to
handle the multiple user requests. So HTTP based embedded web server can be used which
has high capability. The HTTP web server implements HTTP protocol. With this the
distribution and acquisition of information which has to be displayed through web service
using extensible markup language (XML) or hypertext markup language (HTML) is possible.
Figure 1 Overall System Architecture
The HTTP has other advantages also such as it is cross- platform protocol and HHTP
clients are readily available with all latest computers. The internet of things (IoT) can be
achieved using embedded web server.
C. Data Transmission Using TCP/IP Networking Suite
The Keil MDK has RLTCPnet networking suite as one of its key middleware components in
the RL-ARM library. RLTCPnet library is a full networking suite designed for ARM based
microcontrollers. This networking suite is based on Transmission Control Protocol/Internet
Protocol (TCP/IP) that can be used for private networks. It also consists of Ethernet drivers
for the supported. It supports both UDP and TCP based communication which makes the
networking protocol to be customized.
It also has a feature of adding application layersfor enabling common services, such as
simple mail transfer protocol (SMTP) clients for sending emails, domain name system (DNS)
and dynamic host configuration protocol (DHCP) clients for enabling automatic
configuration. RLTCPnet also enables a microcontroller to act as embedded web server with
HTTP, FTPand TELNET protocols which help in data transmission between server and the
clients. Thus data acquisition and monitoring could be achieved with the TCP/IP networking
suite and the acquired data is displayed in the monitoring system with HTML web page
application.
A.Yogaraj, C.S.Sivanthiram, S.Dhananjeyan and S.Suresh
http://www.iaeme.com/IJMET/index.asp 556 [email protected]
Figure 2 explains how API functions can be used for TCP connection and data transfer.
The socket communication can be opened in two different modes either passive or active
mode. This can be done using API function “TCPPassiveOpen()” for passive mode and
“TCPActiveOpen()” for active mode. The API function “TCPPassiveOpen()” puts the stack
into “Listen” or “Server” mode and it waits for a connection from a remote host. The API
function “TCPActiveOpen()” will try to establish a connection with a remote host.
The data to be transmitted should be placed in the transmit buffer TCP_TX_BUF after
checking it to be empty. This can be done by checking the flag TX_BUF_RELEASED. Data
is copied into transmit buffer TCP_TX_BUF if it is empty. The number of bytes to be
transmitted should be assigned to the variable TCPTxDataCount. Then the function
TCPTransmitTxBuffer() should be called which sends data to the remote host and then it
clears the TX_BUF_RELEASED flag. After the remote host acknowledges the transmitted
datagram this flag is set again as depicted in Figure 3.
Figure 2 Use of API functions for TCP connection
Figure 3 Transmission of Data
The reception of any new datagram is indicated by the flag SOCK_DATA_AVAILABLE.
If this flag is set, the number bytes received is indicated by the flag TCPRxDataCount.
The data is then copied out of the receive buffer TCP_RX_BUF. The API
TCPReleaseBuffer() should be called to free the receive buffer for the next data. This is
shown in the Figure 4.
Keil RTOS based Embedded Web Server for Real Time Industrial Monitoring
http://www.iaeme.com/IJMET/index.asp 557 [email protected]
Figure 4 Receiving of Data
Figure 5 RTX Tasks & System Window(RR Scheduling)
3. SCHEDULING MECHANISMS USING KEIL RTX
The Keil RTX (Real Time eXecutive) is a free RTOS. Itis a deterministic real time operating
system designed for ARM and Cortex-M devices. It has RL-ARM, the Real View Real-Time
Library (RL-ARM) as one of its components which has real time functions.
A. Round Robin Scheduling
For creating a round-robin-based scheduling scheme the round robin option should be enabled
in the RTX_Config.c file. Each task should be declared with the same priority. The tasks in a
round robin RTOS will run for a fixed period, or time slice, or until they reach a blocking OS
call. The CPU will be allocated to a specific task for a fixed amount of time before executing
the next ready task. If a task blocks before its time slice has expired, the execution will be
passed to the next ready task. The round robin scheduling is done for four tasks and results are
analysed.
Figure 5 shows the RTX tasks and system window where the tasks are listed and their
switching can be seen. In Fig. 6 a graphical representation of timing of each task is shown in
Event Viewer.
B. Priority Pre-emptive Scheduling
The round robin option should be disabled in the RTX_Config.c file. Each task should be
declared with a different priority. Since each task is assigned different priorities the CPU is
allocated to the task which has the highest priority. In a pre-emptive RTOS, the lower priority
task will be pre-empted by a higher priority task and also if it reached a blocking OS call. This
A.Yogaraj, C.S.Sivanthiram, S.Dhananjeyan and S.Suresh
http://www.iaeme.com/IJMET/index.asp 558 [email protected]
task will run till it is blocked by an event flag, semaphore, or other object. When it blocks, the
next ready task with the highest priority will be scheduled and will run until it blocks, or a
higher priority task becomes ready to run.
The four tasks namelyt_phaseA,t_phaseB, t_phaseC,t_phaseD,are created. The four tasks
are to measure different sensor value like:
• t_phase A - Temperature sensor
• t_phaseB - Pressure sensor
• t_phase C – Humidity sensor
• t_phase D – Gas sensor
The tick timer is set to 10 mS and the round robin timeout is set to 50 mS. The tasking
switching occurs as the time slice.
Figure 6 Event Viewer Window(RR Scheduling)
Figure 7 RTX Tasks & SystemWindow(Pre-emptive Scheduling)
The pre-emptive scheduling is done for three tasks temperature, pressure and humidity
sensors with different priorities and the simulation result of the pre-emptive scheduling is
shown in Figure 7.
Keil RTOS based Embedded Web Server for Real Time Industrial Monitoring
http://www.iaeme.com/IJMET/index.asp 559 [email protected]
4. IMPLEMENTATION OF EMBEDDED WEB SERVER
The web server is implemented on the LPC 1768 board. In this case analysis the
potentiometer is taken as the input. The analog input is given to the ADC which converts the
analog values into digital. The data is then transmitted through the Ethernet to the monitoring
system. The real time value is displayed in the web page. The implementation of web server
in LPC1768 board is shown in the Figure 8.
The HTML pages display the measured values obtained from the web server at the
monitoring system. The real time scheduling mechanism has to be implemented to perform
multi-tasking and to make the system more reliable.
Figure 8 Web Server Implementation
5. CONCLUSION
In this paper, the design of the real time embedded web server based on ARM has been
discussed. Analysis of round- robin and priority pre-emptive scheduling has been done along
with simulation results. The design of data acquisition system is based on web server which
enables data transmission between the instrumentation and Ethernet through existing
computer networks. It also supports CGI which improves system security, enables user
interaction and enhances creation of dynamic web pages.
REFERENCES
[1] Nan Xie; Haibo Zhang; Weimin Chen; Yan Ma; Jinghua Tian, Research and Design of
Industrial Ethernet Intelligent Gateway Based on ARM, Embedded Software and Systems
Symposia, 2008. ICESS Symposia '08. International Conference on , vol., no., pp.324,327,
29-31 July 2008.
[2] Yakun Liu; Xiaodong Cheng, Design and implementation of embedded Web server based
on arm and Linux, Industrial Mechatronics and Automation (ICIMA), 2010 2nd
International Conference on , vol.2, no., pp.316,319, 30-31 May2010.
[3] Gan-ping Li, Design of an embedded control and acquisition system for industrial Local
Area Networks based on ARM, Computer Science and Education (ICCSE), 2010 5th
International Conference on , vol., no., pp.35,39, 24-27 Aug2010.
[4] Daogang Peng; Hao Zhang; Kai Zhang; Li, Hui; Fei Xia, Research of the embedded
dynamic web monitoring system based on EPA protocol and ARM Linux, Computer
Science and Information Technology, 2009. ICCSIT 2009. 2nd IEEE International
Conference on, vol., no., pp.640-644, 8-11 Aug. 2009.
A.Yogaraj, C.S.Sivanthiram, S.Dhananjeyan and S.Suresh
http://www.iaeme.com/IJMET/index.asp 560 [email protected]
[5] Mo Guan; MinghaiGu, Design and implementation of an embedded web server based on
ARM, Software Engineering and Service Sciences (ICSESS), 2010 IEEE International
Conference on ,vol., no., pp.612,615, 16-18 July2010.
[6] Zhu Fande; Chen Hongjian, μCLinux-based webserver realization on ARM platform,
Computing, Communication, Control, and Management, 2009. ISECS International
Colloquium on, vol.1, no., pp.253, 256, 8-9 August 2009.
[7] PinkeshPachchigar, P.Eswaran, Amol KashinathBoke, Design and Implementation of
Deadline based EDF Algorithm on ARM LPC2148 IEEE Conference on Information and
Communication Technologies (ICT), 2013.
[8] Bo Qu; Zhaozhi Wu, Design and implementation of embedded secure web server for
ARM platform, Electronic and Mechanical Engineering and Information Technology
(EMEIT), 2011 International Conference on , vol.1, no., pp.359,362, 12-14 Aug. 2011.
[9] InduHariyale, VinaGulhane, Development of an Embedded Web Server System for
Controlling and Monitoring of Remote Devices Based on ARM and Win CE International
Journal of Recent Technology and Engineering (IJRTE), ISSN: 2277-3878, Volume-1,
Issue-2, June 2012.
[10] Liu Yang; Linying Jiang; Kun Yue; Heming Pang, Design and Implementation of the Lab
Remote Monitoring System Based on Embedded Web Technology, Information
Technology and Applications (IFITA), 2010 International Forum on , vol.2, no.,
pp.172,175, 16-18 July 2010.
[11] Shema Mathew, Tessin Baby and Juney M George, Implementation of Memory Protection
in Rtems Rtos, International Journal of Electronics And Communication Engineering &
Technology (IJECET), Volume 5, Issue 10, October (2014), pp. 80-85
[12] Manav Jaiswal, Akshay Gavandi, Kundan Srivastav and Dr. Srija Unnikrishnan, Motion-
Sensed Rtos-Based Application Control Using Image Processing, International Journal of
Computer Engineering & Technology (IJCET), Volume 4, Issue 6, November - December
(2013), pp. 337-346