Open Source IoT Based SCADA System For R
Open Source IoT Based SCADA System For R
Abstract—An open source and low-cost Supervisory Control and core of the IoT-based SCADA server proposed in this paper is the
Data Acquisition System based on Node-RED and Arduino Node-RED server deployed on a local computer. [5-7]
microcontrollers is presented in this paper. The system is designed for
monitoring, supervision, and remotely controlling motors and sensors The case study is a low flowrate oil well driven by an electric
deployed for oil and gas facilities. The Internet of Things (IoT) based
motor and powered by solar energy. Fig. 1 shows the schematic of
SCADA system consists of a local computer on which the server is
deployed using the Node-RED programming tool and two terminal units the project in the case study. The scenario consists of a single well
connected to it: Arduino Uno and Arduino Mega. The Arduino Uno artificially lifted with a jack pump. In this scenario, the produced fluid
collects and communicates the data acquired from the temperature, is collected and accumulated into a single tank. The essential nature
flowrate, and water level sensors to the Node-Red on the computer of oil production requires continuous site monitoring to acquire, log,
through the serial port. It also uses a local liquid crystal display (LCD) to and process the data so that timely intervention can ensure continuous
display the temperature. Node-RED on the computer retrieves the data and optimal operation.
from the voltage, current, rotary, accelerometer, and distance sensors
through the Arduino Mega. Also, a web-based graphical user interface
(GUI) is created using Node-RED and hosted on the local server for
parsing the collected data. Finally, an HTTP basic access authentication
is implemented using Nginx to control the clients’ access from the
Internet to the local server and to enhance its security and reliability.
I. INTRODUCTION
SCADA stands for Supervisory Control and Data Acquisition. It
is a general term used to refer to groups of hardware and associated
software devices that enable the supervision and control of
operational processes, typically in manufacturing plants and
industrial settings. The collection and aggregation of data are
Fig. 1. Schematic diagram showing elements of the proposed system.
followed by processing, logging, and visualization of the collected
data. The instrumentation and control of critical operational Accurate tracking of the flowrate from the tubing and monitoring
parameters in most oil and gas production processes are made of the tank level is also needed for logging daily, monthly, and annual
possible by deploying field instrumentation devices such as production from the well of interest. Logging and appropriately
transmitters, receivers, sensors, actuators, pumps, and valves. The tracking the fluid flowrate could lead to early detection of sand and
collection of data and communication of corrective action to field wax in the tubing. The temperature of the produced fluid at the
instrumentation devices is made possible by the deployment of wellhead and the storage tank will also need to be closely monitored
microprocessors/microcontrollers in the SCADA system. to avoid wax formation and deposition. These are a few reasons that
Programmable logic controllers (PLC) and terminal units (TUs) help justify this research for remote low flowrate oil wells.
to route the collected data through communication channels to the
central SCADA computers called master terminal units (MTUs). The II. LITERATURE REVIEW
software on MTUs provides a suitable human-machine interface Production from oil wells driven by artificial lift is complicated
(HMI) for analysis, interpretation, and visualization of process and requires instrumentation, metering, supervision, and control. The
variables. Indicators and alerts also help operators to identify and level of fluid produced requires close monitoring to optimize fluid
react to trigger events [1-4]. Traditional SCADA deployed in oil field level in the tank between the upper and lower limit and hence
operations are generally limited in terms of upgrading, minimize or prevent leakages, spills, and environmental pollution [8].
programmability, and efficiency of network administration. Regular Flowrate monitoring also helps to estimate the gross volume of
SCADA systems are also relatively expensive, preventing their produced fluids and to compare with flowrates recorded downhole for
adoption in low flowrate wells. The SCADA architecture employed early detection of wax formation. Measurement and control of
in this work is a fourth-generation SCADA based on the Internet of temperature at different nodes in the production process directly
Things framework. By deploying software and electronics to sensors impacts the phase behavior and flow assurance of the produced fluids.
embedded in critical processes, distributed computing resources in Critical interventions such as chemical injection, dewaxing, heating,
the IoT SCADA can aggregate, log, process, and visualize the data and production adjustment require temperature monitoring for flow
collected either on-site or remotely using internet connectivity. The assurance and asset integrity [9]. Industrial automation and IoT
978-1-7281-8416-6/20/$31.00 ©2020 IEEE technology provide a sustainable, secure, and scalable alternative for
low-cost monitoring, supervision, and control of several operational state, mode, and read signals. The design methodology is to develop
parameters in remote oil and gas operations [10-12]. Data acquisition, a web-based application that serves as a human-machine-interface
data logging, aggregation, and visualization are generally required for (HMI) for visualization and enables an operator to remotely read, log,
making important decisions, hence the adoption of SCADA systems. and monitor field sensor conditions over the Internet.
In terms of licensing, there are two classes of SCADA, proprietary V. EXPERIMENTAL DESIGN OF PROPOSED IOT SCADA SYSTEM
and open source system. In open source, the system is entirely built The IoT based open source SCADA system consists of three
from scratch using modularized and often freely licensed subsystems, a master terminal unit and two terminal units, as shown
applications. It is beneficial because adding and replacement of in Fig. 2.
components is cheaper and more manageable without the need for
special expertise and training. By using open standards,
interoperability is enhanced, and the system lifecycle cost can be
reduced. On the contrary, a proprietary or “closed” system is
developed and managed by a vendor, with upgrade and modifications
dependent on the availability of the specific vendor and the license
stipulating the terms and conditions of service [13].
Although cloud server architecture is increasingly deployed for
hosting, logging, aggregation, storage, supervision, and control of
data received by embedded sensors, cybersecurity is a major concern,
as leveraging of cloud architecture exposes the system to cyberattacks
with a significant risk of data loss, data corruption or disruption of
service [12]. This work adopts a local on-premises server running Fig. 2. Schematic diagram of the proposed IoT-based SCADA System
Node-RED for collection, aggregation, logging, monitoring, and
control of data. Remote access to the local server is controlled by A. Master Terminal Unit (MTU)
setting up an authentication request for username and password. The The MTU is a local server that hosts the Node-RED interface. It
internet protocol (IP) address of the server is also concealed from the serves as the database for logging and aggregation of sensor data. In
client by using a reverse proxy server called Nginx. It enhances the addition to the dashboard, a graphic user interface is also hosted on
security and reliability of the local server; hence by running the the MTU for real-time visualization. The MTU controls and
application on an on-premise machine, the user can take advantage of influences the operation of the terminal units, which are directly
most of the required features of cloud-based architecture without long connected to the field instrumented devices (sensors, actuators, and
term subscription costs and reduced risk of cyberattacks [14-16]. on-site display). It logs, aggregates, and publishes sensor data from
the IoT devices onto a web interface for visualization and
III. THE PROPOSED SCADA SYSTEM DESIGN interpretation.
The design and implementation of the SCADA system entail
hardware and software selection. At the subsystem level, the sensor B. Terminal Units (TUs)
hardware is connected to the Arduino microcontrollers through base The Arduino microcontrollers used in this work are both
shields and breadboards; each sensor is then programmed in the connected to the host server on the computer via a USB port. The
Arduino integrated development environment (IDE). The decision to Arduino microcontrollers model or represent the field-deployed
adopt two terminal units stems from the need for redundancy and the terminal units. Arduino Mega is used as the first terminal unit (TU1).
limitation of available input and output Arduino nodes in Node-RED. In this subsystem, the voltage, current, rotary, accelerometer, and
In terms of reading/write of the Arduino pins capability, Node- distance sensors are all connected to the Arduino mega and read
RED can manage digital and analog input and outputs, PWM, and through Node-RED using Firmata to the local server. Also, the
servo over the Arduino pins via the use of both Firmata protocol and motors are controlled through Node-RED using Arduino nodes and
serial communication. The design methodology is to develop a web Firmata. Arduino Uno is used as the second terminal unit (TU2). In
application that serves as both a dashboard and a graphical user this subsystem, an Arduino sketch is uploaded to read the fluid level,
interface, enabling an operator to remotely read, log, and monitor flowrate, and temperature sensors’ values connected to the Arduino
field sensor conditions over the Internet. Uno, display them on the on-site LCD, and send them to the Node-
RED local server via the serial port connection.
IV. IMPLEMENTATION METHODOLOGY
The proposed SCADA system consists of a master terminal unit C. Voltage Sensor Module
(MTU) and two other terminal units (TUs). Each instrumentation The sensor uses the principle of a voltage divider to measure an
device is connected to the terminal units (Arduino microcontrollers) input source voltage. Due to its simple design, the voltage sensor is
through base shields and breadboards. The Arduino microcontrollers low-cost, an output voltage (Vout) from 0 to 5V is produced and
collect the data and messages acting as the clients to the master supported by the Arduino. In this work, the signal pin (S) of the
terminal unit, which aggregates and processes the received data as a voltage sensor is connected to the analog pin A9; the plus and minus
host. The USB connection is adopted as the communication channel sign pins are connected to the 5V and GND pins, respectively on the
between MTU and TUs. Serial communication is used in the Arduino Arduino. GND and the input pins of the sensor are connected in
Uno, while the Arduino Mega microcontroller implements the parallel across the output of the solar panel to measure the PV output
Firmata protocol in firmware. Standard Firmata is used on the voltage.
Arduino Mega. For the connected accelerometer, distance, position,
voltage, and current sensors. Therefore, using the Firmata protocol, D. ACS 723 Hall-Effect current sensor
the Node-RED server on the host computer interacts with the Arduino ACS 723 is a high precision current sensor that is economical and
Mega and is thus able to access Arduino pins directly and change the fully integrated. The principle of the Hall-Effect is employed. Such
that when a single supply voltage VCC of (4.5 to 5.5V) is applied H. Fluid Level Sensor
across the inputs: IP+ and IP- (copper conduction path), a resulting Grove water level sensor is a low power sensor that adopts the
current flow is produced, which generates a magnetic field. The principle of capacitance and 2, 8-bit microcontroller units:
magnetic field is sensed by the Hall-Effect IC to produce a ATTINY1616 MCUs. It consists of capacitive pads embedded on a
proportional current. Hence there is electrical isolation between the printed circuit board and sealed to be completely waterproof. It
sensed circuit and the sensing circuit. A high-power sensed circuit measures the water level up to 10 cm. The analog input from the
arrangement with either DC or AC sources is thus compatibly sensed capacitors is converted into a digital signal by three (3) comparators.
by a low power sensing circuit. The two input pins: VCC and GND It communicates over the I2C bus of the Arduino and is typically
of this sensor are connected in series to the solar panel, while the deployed in water level sensing applications. VCC and the GND pins
output signal is read from the analog pin A10 on the Arduino Mega. of this sensor go to the supply and ground of the Arduino Uno,
respectively, and I2C serial communication is used.
E. Rotary Position Sensor
The rotary sensor turns continuously and hence behaves like a I. Flowrate Sensor
potentiometer. It is also called the shaft encoder, enabling the precise The YF-S401 is a low-cost fluid flow sensor with a flow range of
measurement of motors’ rotation, with less temperature drift and 0.3-6 L/min. It consists of a hall effect sensor and a fluid rotor
higher precision. The rotary sensor used in this work produces an enclosed in a plastic valve casing. Fluid flowing through the rotor
analog signal value based on the angular displacement or motion of causes a magnetic rotor to spin. The resulting rotating magnetic field
the shaft with an output voltage range from 0 to 5V DC. It is used as cuts across a solenoid wire, causing a current flow and producing a
a position monitoring device in this work. The VCC and the GND voltage at the terminals of the hall effect sensor. The resulting voltage
pins of this sensor go to the supply and ground of the Arduino Mega is proportional to the rate of flow of fluid across the rotor and hence
respectively, and the output signal is read by the analog pin A8 of the serves as a suitable measure of flowrate. The output pulse width
Mega. signal of the sensor is connected to the microcontroller. The signal
output pin is connected to the digital pin D3 and is programmed to
F. ADXL335 Accelerometer trigger the interrupt 1 on the Arduino Uno to calculate the flowrate.
The accelerometer works on the principle of the piezoelectric
effect. The ADXL335 is a low cost, low power, and highly integrated J. Temperature Sensor
3-axis accelerometer. It measures both static and dynamic Grove - Temperature Sensor V1.2 is used in this research. It has
acceleration. Static acceleration is the acceleration due to gravity, an operating voltage range from 3.3 to 5V and detects from -40 to
which enables the device to be used as a tilt sensor, hence enabling 125ºC. The ambient temperature is detected by the chip. The
the device to detect free fall and measure tilt. In contrast, dynamic resistance of a thermistor will decrease when the ambient temperature
acceleration results from motion, vibration, or shock. In this work, increases. This relationship is useful for predicting the ambient
the accelerometer. The output signals are analog voltages from three temperature with an accuracy of ± 1.5ºC and is suitable for the
pins X, Y, and Z, which are proportional to the acceleration and application. Vout signal is read by the analog pin A0 of the Arduino
directly integrated with the analog pins A13, A12, and A11, Uno.
respectively.
K. Liquid Crystal Display (LCD)
G. SharpIR GP2Y0A21YK0F Distance Sensor The LCD is used as a local display to show the temperature value.
The Sharp infrared sensor is a low-cost distance measuring sensor It is connected to the Arduino Uno via the I2C bus. The LCD is useful
unit of the analog output type. It is an integrated unit that combines for reading and displaying temperature value on-site. Also, the
an infrared emitting diode with a position-sensitive detector and flowrate and the water level can be displayed here.
signal processing unit. The detectable distance for this sensor ranges
from 10 - 80cm. This device can also be used as a proximity sensor L. Microcontroller 1 (Arduino mega)
and outputs a voltage corresponding to the detection distance. The The first terminal unit (TU1) is essentially Arduino Mega with
VCC and GND pin of this sensor is connected to the supply and Firmata through serial port connection to the Node-RED installed on
ground of the Arduino Mega, respectively, while the Vout signal is the local server computer. The voltage, current, rotary encoder,
read by the analog pin A7 of the Mega. accelerometer, and distance sensors are read by the microcontroller
making five (5) field instrumented devices connected to TU1, as
G. DC Motor shown in Fig. 2. Besides, the two motors, A and B, are connected to
The prime movers on the Arduino Mega (controller 1) are two DC the Arduino Mega via a motor shield and are controlled through
gear motors. They are connected to the Arduino Mega via the Node-RED.
Arduino motor shield, which models the variable frequency drive as
implemented. The Arduino motor shield REV3 is based on the L298P M. Microcontroller 2 (Arduino Uno)
motor controller chip and contains a dual full-bridge driver. The base The second terminal unit, TU2, is an Arduino Uno with serial port
shield has an operating voltage range of 0.5-12V and is powered by a connection to the Node-RED running on the local server. Four field
9V regulated power supply from the DC solar panel. The shield instrumented devices are connected to TU1, including three sensors
provides a suitable hardware interface between the Arduino mega and (temperature, flow, level) and a liquid crystal display (LCD). The
the DC motors for independent direction control, speed control, and advantage of using the serial connection in TU2 is that it permits the
braking. The pins D3, D9, and D12 of the Arduino Mega are used for creation and execution of functions in the Arduino IDE, allowing for
driving Motor A, and the pins D8, D11, and D13 of the Arduino Mega complex computations to be executed within the code and only the
are used for driving Motor B. desired outputs printed over the serial ports.
N. Node-RED IoT Platform on the Local Server
The flow of data between interconnected devices is implemented
in Node-RED, a web-based programming tool. By wiring nodes
together, JavaScript objects and functions are created, flows are built
and instantly deployed and consists of a node.js based runtime. The
graphic user interface (GUI) is also available in Node-RED and
contains a dashboard with logs and charts for visualization of sensor
data in real-time. [14,15]. Port forwarding is used in the router to
forward requests to the IP address of the router with a given port
number to the specific device (i.e., the host computer) where the
server is deployed. This option exposes the Node-RED server on the Fig.8. Process flow for the level, flowrate and temperature sensor
internet for remote access. After that, a basic access authentication is
implemented using Nginx. Nginx requires the internet client to VI. RESULTS
provide a username and password before access to the Node-RED The results are shown by subsystems as follows:
server is granted hence improving the security, as shown in Fig. 3 Subsystem 1: The dashboard for sensors connected to Arduino Mega
[17,18]. The process flows for position, current and voltage sensors, is shown in Figs. 10 and 11. The dashboard for this subsystem
accelerometer, motors, distance, fluid level, flowrate and temperature includes gauge and chart outputs for current, voltage, distance, rotary
sensors are shown in Figs—4 to 9, respectively. position, and accelerometer sensors. In this work, the user interface
shows the received sensor data, both as a gauge and a chart.
Fig.3. NGINX client access authentication page when logging in to the server
Fig.10. Charts and gauges for current, voltage, and distance sensors.
Fig.12. Charts and gauges for water level, flowrate, and temperature sensor.
REFERENCES
[1] L. D. Cuayo, J. Kerbee Culla, J. Gualvez, S. E. Padua and
R. John Gallano, “Development of a Wireless Microcontroller-
based SCADA RTU, “TENCON 2018 - 2018 IEEE Region 10
Conference, Jeju, Korea (South), pp. 2566-2570, 2018.
Fig.13. Dashboard panel to control motors A and B [2] L. O. Aghenta and M. T. Iqbal, “Low-Cost, Open Source
IoT-Based SCADA System Design Using Thinger.IO and
Fig. 14 shows the experimental setup. As shown in this figure, the ESP32 Thing”. Electronics. 8. 822.
Arduino Mega and Uno are connected to the computer via USB ports. 10.3390/electronics8080822, 2019.
In addition, all the sensors, motors, and display in this figure are laid [3] M. Zamanlou and M. T. Iqbal, “Development of an
out according to the Fig. 2 in this experimental setup. Economical SCADA System for Solar Water Pumping in
Iran,” IEEE International IoT, Electronics and Mechatronics
Conference (IEMTRONICS) 2020
[4] N. Lal and A. Purohit, “Data Acquisition of Solar Power Plant
Using Scada System,” International Journal of Engineering
Trends and Technology (IJETT), vol. 23, no. 4, pp. 189-194,
2015.
[5] http://www.eecs.berkeley.edu/Pubs/TechRpts/2014/EECS-
2014-123.html
[6] https://insights.sei.cmu.edu/sei_blog/2018/03/12-risks-threats-
vulnerabilities-in-moving-to-the-cloud.html
[7] https://www.sierrawireless.com/applications/energy/oil-and-
gas/
[8] https://www.scadalink.com/products/satscada/single-well-oil-
battery-monitoring-system/
[9] C. B. Cardoso, I. N. Alves, G. S. Ribeiro,“Management of
Flow Assurance Constraints”. Offshore Technology
Conference, 2003.
Fig.14. Experimental setup of the proposed IoT based SCADA system [10] A. Adeyinka, A. Tsakporhore, A. Oduwole, S. Jumbo, F.
Odusote, S. Aliyev, T. Eme, “Re-positioning Mature Fields for
VII. DISCUSSION Sustainability: Deriving Additional Value by Applying the
Monitoring of the oil well site parameters such as flowrate from Internet of Things via Remote Well Monitoring,” Society of
the producing well and comparing it with the speed of the electrical Petroleum Engineers.2020.
motor is imperative to diagnose problems in an actual producing well. [11] W. G. Elmer, & J. B. Elmer. “Pump-Stroke Optimization: Case
When the speed of the electric motor is high, and the flow rate of the Study of Twenty-Well Pilot,” Society of Petroleum Engineers.
produced fluid is declining, it could be an indicator of a fluid pound 2018.
or gas lock in the rod pump downhole. It could also point to sand [12] A. Vijay, and V. S. Unni, “Protection of Petroleum Industry
production at the producing interval or issues in reservoir production. from Hackers by Monitoring and Controlling SCADA
Early-onset of flow assurance problems such as wax and paraffin System,” Society of Petroleum Engineers. 2012.
formation could also be detected by tracking and monitoring the [13] https://electrical-engineering-portal.com/three-generations-of-
behavior of the voltage and current drawn by the electric motor and scada-system-architectures\
mapping trends, which could be further corroborated with flow rate [14] “Node-RED,” https://nodered.org/
and cross-referenced with downhole temperature and pressure [15] M. Lekic, G. Garadasevic, “IoT sensor integration to
gauges. When the IoT devices are mounted on an actual 3D model NodeRED platform,” East Sarajevo, Infoteh-Jahorina, 2018.
and data acquired logged appropriately, these sensor trends could be [16] S. Chanthakit and C. Rattanapoka, “MQTT Based Air Quality
aggregated into historical data and analyzed for prediction of failure Monitoring System using Node MCU and Node-RED,” 2018
or monitoring production performance. Seventh ICT International Student Project Conference (ICT-
ISPC), Nakhonpathom, pp. 1-5, 2018.
VIII. CONCLUSION [17] www.sitepoint.com/configuring-Nginx-ssl-node-js/
A low-cost IoT based SCADA system is presented in this work; [18] https://www.Nginx.com/resources/glossary/Nginx/
the Arduino Mega and Uno microcontrollers are deployed as terminal
units to communicate with and aggregate data from a total of eight
(8) sensors, namely the water level, flowrate, temperature, current,
voltage, distance, rotary position, and accelerometer sensors. The
electric motor and the LCD on-site display are also transducers whose
operation and outputs are controlled by the MTU through the terminal