Low-Cost ESP32, Raspberry Pi, Node-Red, and MQTT Protocol Based SCADA System
Low-Cost ESP32, Raspberry Pi, Node-Red, and MQTT Protocol Based SCADA System
Low-Cost ESP32, Raspberry Pi, Node-Red, and MQTT Protocol Based SCADA System
Abstract— Growing energy cost and demand has motivated utilizes reliable and commonly available components to
many organizations to achieve smart ways to monitor, control, fulfill the four main functions of a SCADA system: Data
and save energy. Smart automation can reduce costs while still collection, network data communication, data presentation,
satisfying energy demand. The residential, commercial, and and remote monitoring and supervisory control [4].
industrial sectors can utilize the technologies of the Internet of
Things (IoT) to manage energy consumption better. This paper Several researchers around the world have designed
presents a low-cost, open-source, and reliable Supervisory SCADA systems based on IoT architecture in the past. Lekic
Control and Data Acquisition (SCADA) system for home et al. [5] performed an IoT-based SCADA system with the
monitoring and control system. The presented SCADA system Raspberry Pi3. Temperature and humidity sensors acquired
consists of analog sensors, ESP32, Node-RED, and Message the desired data, and the IBM Bluemix cloud platform was
Queuing Telemetry Transport (MQTT) through local Wi-Fi to utilized to receive, visualize, and manage the collected
remotely access and control appliances. This system helps the sensor data via the web while using the Node-Red and Web
users to monitor various conditions in the home, such as Socket protocols for data exchange and communication
temperature, humidity, pressure, and light intensity. Thus, between the cloud platform and sensors connected to the
users can remotely monitor various devices such as lights, fans, Raspberry Pi.
heating/cooling systems, make decisions based on the feedback
of sensors. In [6], Rai et al., Using IoT, implemented a system to
provide the end-users with a cost-effective and portable
Index Terms—ESP32, Internet of Things (IoT), Wi-Fi intelligent monitoring system and enable devices remotely.
network, MQTT, Node-RED, Sensors The proposed system required a low-resolution video camera
module interfaced with the Arducam ESP32 UNO board.
I. INTRODUCTION AND LITERATURE REVIEW The resulting video was streamed using ESP32 integrated
Nowadays, the fraction of automation systems in the Wi-Fi to display on the 1.8-inches SPI TFT Adafruit display
residential sector is rising rapidly because of numerous life module.
improvements such as comfort, convenience, centralized
control of appliances, cost reduction, energy-saving, security, M. Al-Kuwari et al. [7] demonstrated sensing and
and safety. As a home automation system enhances the life monitoring platform on smart and IoT-based home
quality for users, especially for the elderly, differently abled automation system, where the authors presented a basic
persons, and people who want to monitor and manage their concept of how home automation can be deployed using IoT.
home devices' operation, it is quietly important to have a Pravalika et al. [8] implemented a home automation
proper control system. SCADA technologies implement a system through the Wi-Fi module, Massachusetts Institute of
unique platform that senses and monitors remote devices, Technology (MIT) app, and a web page server using ESP32
acquires data from them, and sends limited control to monitor home devices.
instructions. Besides that, this system allows users to
discover the status of devices and their residence conditions In [9], the MQTT-based home automation system using
remotely. ESP8266 Node MCU was established for remote monitoring
and controlling through a standard gateway. This system was
Home automation systems using SCADA consists of four designed utilizing the GSM (Global System for Mobile
major parts. The first part is the sensing devices placed at Communications) network.
several locations throughout the home to measure the desired
variables. The second part is Remote Terminal Units (RTUs) In [10], Kodali demonstrated IoT-based smart
for acquiring remote data from sensors. The third one is environment monitoring using Arduino and C embedded
Master Terminal Units (MTUs) to process the received data programming devices, which were remotely controlled with
and deal with Human Machine Interfaces (HMI) [1]. The last the Internet. Temperature, humidity, light level, vibration,
part of SCADA is the communication channel to connect the and air quality sensors connected to the controller for
RTUs to the MTUs [ 2 ,3]. measurement and ESP8266 Node MCU for the Wi-Fi
network.
SCADA technology has been developed over the past
years to remotely monitor and control processes. In this Pujari et al. [11] demonstrated a smart home system that
work, an open-source and low-cost SCADA system based on uses Wi-Fi to connect to the Internet, remotely monitor and
the Internet of Things is introduced. This SCADA system control the appliances, and surveillance. Sensors were
connected to ESP32 to collect data. All acquired data was
Authorized licensed use limited to: University College London. Downloaded on October 13,2020 at 10:29:56 UTC from IEEE Xplore. Restrictions apply.
uploaded to Firebase via the ESP32's built-in Wi-Fi, making sensors data with specific topics to the MQTT broker
it possible to control the home environment using the (Mosquitto broker), while personal computers and mobile
developed applications. devices subscribe to the topics to visualize the published data
In [12], the IoT-based SCADA system proposed which the on the server. MQTT protocol makes the supervisory control
Raspberry Pi3 and Intel Edison board used for acquiring possible in this project.
sensor inputs. Collected sensor data are transmitted to
Amazon Web Services (AWS) through MQTT brokers in
Node-Red. On the AWS IoT platform, several monitoring
and control schemes inducted using Amazon's Voice Service
named Alexa.
In this work, a low-cost and open-source SCADA system
is developed that uses Wi-Fi, the MQTT protocol, and Node-
Red. The proposed system can provide detailed
measurements of temperature, pressure, humidity, and light
density. Besides that, the states of the devices at home are
being traced. Therefore, users can understand the status of
their home devices such as lights, fans, air conditioners, or
heating/cooling systems then remotely control them.
II. SYSTEM DESIGN Fig. 2. MQTT Architecture.
The proposed SCADA system block diagram is presented
in fig.1. It is implemented using ESP32 as the sensor B. Raspberry Pi
gateway and RTU and Raspberry Pi2 as a local server. The Raspberry Pi2 model B is used as the local server at a
SparkFun Atmospheric Breakout Sensor-BME280 sensor local network, including MQTT broker, Node-Red, SQLite.
and an LDR are connected to ESP32 to acquire the desired
data and the dashboard to receive, visualize and manage the C. ESP32 Thing
acquired sensors data over the web while using Node-Red The ESP32 Thing is developed by SparkFun Electronics.
and MQTT protocol for data exchange and communication It is one of the most low-cost, low-power, and small
between the MQTT clients such as end-users and the ESP32 microcontrollers included Wi-Fi and Bluetooth modules. Fig.
connected sensors while the acquired data are being stored in 3 shows a picture of the SparkFun ESP32 board.
SQLite as a web server. Each component is described in
detail as following:
Authorized licensed use limited to: University College London. Downloaded on October 13,2020 at 10:29:56 UTC from IEEE Xplore. Restrictions apply.
Client Library called PubSubClient. The program is such that Lux= (500/VO)-50 (3)
the board collects the measured real-time values of desired
variables, displays the values on the Arduino IDE Serial The obtained Lux value is being used for controlling the
Monitor, and continuously publishes real-time data to the LED.
MQTT broker.
D. SparkFun Atmospheric Sensor Breakout BME280 F. Node-Red
The SparkFun BME280 Atmospheric Sensor Breakout is Node-RED is an open-source programming tool used for
used to measure pressure, humidity, and temperature wiring together hardware devices, APIs, and online services
readings, all with a tiny breakout. It is shown in Fig. 4. The smartly [5]. It can be installed on a Linux-based platform,
BME280 Breakout is designed to be deployed in and it provides a browser-based editor that makes it easy to
indoor/outdoor navigation, home automation, etc. The on- wire together flows using various nodes in the palette that
board BME280 sensor measures atmospheric pressure, can be deployed to its runtime.
humidity, and temperature. The breakout presents a 5V
G. Database and dashboard
tolerant I2C interface (with a pull-up resistor to 3.3V to be
cooperative with ESP32). An SQLite database using the litedb node on the Node-
RED platform is installed to create database tables and store
data. As a very lightweight relational database, SQLite does
not need complex setup procedures, making it an ideal
database management system to use for embedded systems
and rapid prototyping. In this work, SQLite is set up to
generate database, then stored data an easy to use dashboard
(Node-Red dashboard) is used to read the acquired data
from the data base.
Fig.4. SparkFun Atmospheric Sensor Breakout BME280.
Since the sensor data are constructed data type as MQTT
messages that will be published to an MQTT broker,
E. Light Dependent Resistor (LDR) Arduino IDE sketch and Node-Red flow are used to transfer
The LDR is a variable resistor. Fig. 5 presents LDR and its those MQTT messages and then stores them in the database.
step-down resistor connection. The resistance of the LDR Node-Red dashboard is a web-based data monitoring tool
inversely proportionates to the light intensity. It shows that can be combined to SQLite.
maximum resistance in the absence of light and minimum
III. SYSTEM TESTING AND RESULTS
resistance in the presence of light. Considering this
characteristic, in this project, during the nighttime, LDR The home automation system's proposed design is used to
turns the LED ON and reversely makes the LED OFF during monitor and control the house appliances while maintaining
the daytime. the minimum expected comfortable living conditions.
The flow chart of the proposed system is shown in Fig. 6.
Accordingly, a prototype is shown in Fig. 5 is made to
measure the desired variables. This prototype can be located
in each room of the house. The sensors acquired data is
being processed and used to control smart appliances such
as smart LEDs, air conditioners, fans, etc.
RL = 500/Lux (1)
VO = (10*RL)/(RL+10) (2)
Authorized licensed use limited to: University College London. Downloaded on October 13,2020 at 10:29:56 UTC from IEEE Xplore. Restrictions apply.
As shown in Fig. 7, the LDR is darken using a piece of
paper to change the state of the LED which is presented in
Fig. 8.
Authorized licensed use limited to: University College London. Downloaded on October 13,2020 at 10:29:56 UTC from IEEE Xplore. Restrictions apply.
Automatic control & computer engineering - STA'2014, Hammamet,
Tunisia, December 21-23, 2014. [Accessed 21 September 2014].
[2] B. S.S. Tejesh and S. Neeraja, "A Smart Home Automation system
using IoT and Open Source Hardware", International Journal of
Engineering & Technology, vol. 7, no. 27, p. 428, 2018. Available:
10.14419/ijet.v7i2.7.10856.
[3] L. Aghenta and M. Iqbal, "Low-Cost, Open Source IoT-Based
SCADA System Design Using Thinger.IO and ESP32
Thing", Electronics, vol. 8, no. 8, p. 822, 2019. Available:
10.3390/electronics8080822.
[4] A. Sajid, H. Abbas and K. Saleem, "Cloud-Assisted IoT-Based
SCADA Systems Security: A Review of the State of the Art and
Future Challenges", IEEE Access, vol. 4, pp. 1375-1384, 2016.
Fig. 10. The user remotely turned the Red LED on. Available: 10.1109/access.2016.2549047.
[5] M. Lekić and G. Gardašević, "IoT sensor integration to Node-RED
IV. CONCLUSION platform," 2018 17th International Symposium INFOTEH-
JAHORINA (INFOTEH), East Sarajevo, 2018, pp. 1-5, doi:
The design of a low-cost and flexible and reliable IoT 10.1109/INFOTEH.2018.8345544.
home automation system is presented. This proposed [6] P. Rai and M. Rehman, "ESP32 Based Smart Surveillance
SCADA system is suitable for monitoring and controlling System," 2019 2nd International Conference on Computing,
Mathematics and Engineering Technologies (iCoMET), Sukkur,
multi devices at home automatically and remotely. The Pakistan, 2019, pp. 1-3, doi: 10.1109/ICOMET.2019.8673463.
system works in three phases. In the first one, the system [7] M. Al-Kuwari, A. Ramadan, Y. Ismael, L. Al-Sughair, A. Gastli and
monitors the temperature, pressure, humidity, and light M. Benammar, "Smart-home automation using IoT-based sensing and
intensity and uploads the data to database storage (SQLite) monitoring platform," 2018 IEEE 12th International Conference on
Compatibility, Power Electronics and Power Engineering (CPE-
by using MQTT protocol and Node-Red installed on POWERENG 2018), Doha, 2018, pp. 1-6, doi:
Raspberry Pi, then to the database connected dashboard. In 10.1109/CPE.2018.8372548.
the next phase, the system automatically controls the LED [8] V. Pravalika and Ch. Rajendra Prasad, "Internet of Things Based
when the light intensity level exceeds the high or low Home Monitoring and Device Control Using Esp32", International
Journal of Recent Technology and Engineering (IJRTE), vol. 8, no. 4,
predefined value of light intensity using a microcontroller pp. 58-62, 2019.
(ESP32). In the last one, the supervisory control is achieved; [9] R. K. Kodali and S. Soratkal, "MQTT based home automation system
the end-user can monitor and control the home devices using ESP8266," 2016 IEEE Region 10 Humanitarian Technology
Conference (R10-HTC), Agra, 2016, pp. 1-5, doi: 10.1109/R10-
through the web interface or mobile application. Once the HTC.2016.7906845.
message is sent through Node-Red along with the MQTT [10] R. K. Kodali and S. Soratkal, "MQTT based home automation system
protocol to the microcontroller, it will be executed by ESP32 using ESP8266," 2016 IEEE Region 10 Humanitarian Technology
and turns the devices ON/OFF. The developed system cost is Conference (R10-HTC), Agra, 2016, pp. 1-5, doi: 10.1109/R10-
HTC.2016.7906845.
low, simple to operate, and is simply embedded with home
[11] U. Pujaria, P. Patil, N. Bahadure and M. Asnodkar, "Internet of
devices. Things based Integrated Smart Home Automation System", SSRN
Electronic Journal, 2020. Available: 10.2139/ssrn.3645458.
[12] A. Rajalakshmi and H. Shahnasser, "Internet of Things using Node-
ACKNOWLEDGMENT Red and alexa," 2017 17th International Symposium on
Communications and Information Technologies (ISCIT), Cairns,
The authors would like to thank the School of Graduate QLD, 2017, pp. 1-4, doi: 10.1109/ISCIT.2017.8261194.
Studies, Faculty of Engineering and Applied [13] K. Chooruang and P. Mangkalakeeree, "Wireless Heart Rate
Science, Memorial University and Pooya Pajouhan Nirouye Monitoring System Using MQTT", Procedia Computer Science, vol.
Golpa Company. 86, pp. 160-163, 2016. Available: 10.1016/j.procs.2016.05.045.
[14] D. NAGARAJU, C. KIREET, N. KUMAR and R. JATOTH,
"Performance Comparision Of Signal Conditioning Circuits For Light
Intensity Measurement", World Academics Journal of Engineering
REFERENCES Sciences, vol. 01, no. 02, pp. 2007 (1-10), 2014. Available:
10.15449/wjes.2014.2007.
[1] Lamine and H. Abid, "Remote control of domestic equipment from an
Android application based on Raspberry Pi card", IEEE transaction
15th international conference on Sciences and Techniques of
Authorized licensed use limited to: University College London. Downloaded on October 13,2020 at 10:29:56 UTC from IEEE Xplore. Restrictions apply.