SECHA: A Smart Energy-Efficient and Cost-Effective Home Automation System for Developing Countries

Home automation systems are gaining a lot of attraction globally and changing the way we live. Tey simplify our lives, reduce workloads, improve home safety and security


Introduction
Te Internet of Tings (IoT) is already a part of our lives, with billions of devices connected to it, and the projection is that this number will only grow in the years to come. Tis advancement can bring many benefts and conveniences for us in our daily lives. A rapid increase in the global number of IoT devices is expected, from 9.7 billion in 2020 to 29 billion by 2030 [1]. While many developed countries are already leveraging the benefts of IoT technology, most developing and underdeveloped nations are still at the beginning stages of implementation. Despite its relatively recent arrival, IoT has started to open doors and provide immense possibilities for a range of new possibilities that can have a huge impact on our lives. Due to the lack of existing infrastructure, the growth of IoT is hindered by several challenges, the most important of which are the relatively high cost of IoT devices and equipment, a lack of strength, and unstable Internet connections [2,3]. For example, in a developing country such as Ethiopia, power cuts are frequent, and this is expected to limit the country's population's access to electricity [4,5]. Te high energy demands of IoT devices combined with human abuse, such as turning on lights in an empty room, make this limited energy scarce. It is essential to design and implement cost-efective and energy-efcient IoT systems that are easily accessible and fexible. Understanding how to use the Internet of Tings (IoT) can help us reduce energy loss and thus potentially become more efcient [6].
Several other home automation projects are also underway in various countries. All of them are unique in terms of design, features, equipment, elements, and algorithms. Tey were developed in response to specifc requirements and component availability in the respective regions. Some are cheap, while others are quite expensive. Te availability of hardware and software used in developing countries was also a requirement. Despite the fact that most of these research papers are useful in some form or the other, we feel compelled to develop an all-inclusive, simple, and easy-to-implementIoT-based home automation system.
As a result, we developed SECHA, a smart, energyefcient, and cost-efective home automation system in this article. It ofers a straightforward and practical method for utilizing the majority of IoT home automation and security technologies. We plan to present a home automation architecture in SECHA that makes use of a single microcontroller, mobile connection, and an Android app. Even when a user is not online, SECHA uses quicker SMS communication ofered by Android to deliver emergency messages from anywhere in the world. In addition to smart home automation, we will focus on an energy consumption management solution made up of low-voltage sensors and components that will save a signifcant amount of energy while also allowing consumers to avoid excess energy consumption by remotely managing equipment. It also prioritizes afordability by utilizing low-cost sensors and components. Tis can help users save money by reducing appliance energy waste. All costs are kept as low as possible, making it afordable to middle-class families in developing countries, such as Ethiopia.
Te objective is to design a prototype using economical and power-efcient equipment that establishes wireless remote control over a network of home appliances. Te application software is designed to run on easily accessible Android smartphones and includes voice command control and the ability to check the equipment's status directly from the application. Te system can be used in any residence, business, institution, or mall and has a wide range of uses. Smart house devices can be controlled via the Internet or by manually connecting them to switches, and the system can notify users or the fre department in case of an emergency even when no Internet connection is available.
By applying efcient scheduling skills, users can save money as well as conserve energy. Te Internet of Tings home energy management system provides consumers with optimal results at the lowest possible cost. We designed SECHA to be easily upgradeable and degradable based on user preferences, as some functionality is not applicable to all users. Tis type of advantage can not only save energy but also unnecessary expenditures, making it more efcient. As a result, users can easily and cost-efectively implement the IoT-basedenergy-saving home automation system concepts discussed in this article.

An Overview of Research Papers on Low-Cost IoT
Tis section is devoted to a brief overview of subsequent IoT papers that have been chosen because they state low cost as a requirement. As we are going to see, this symptom is more often than not linked to a perspective of the issue, which in general gets ignored, and as often as not entirely justifed.
Most of the papers included in this section are from developing countries, indicating that IoT is considered to improve their quality of life, as well as fll the gap with developed countries. Home automation is the use of technology in the home environment to provide convenience, comfort, security, and energy efciency to its occupants. Many research papers present various methods for home automation. Each of these has some distinctive features as well as some drawbacks. Some of these papers are discussed further below: Te authors of a study [7] proposed energy-efcient home automation using IoT. Te study implements an intelligent home automation approach using the Internet of Tings, which would greatly improve the current energy usage difculties. To do this, a low-cost, low-power ESP8266 with an integrated Wi-Fi module is used to control a relay channel. Te major drawback to utilizing ESP8266 is that its near cousin, the ESP32, performs better and has several features that ESP8266 lacks while costing almost as much.
Te author of reference [8] provides a low-cost, efective automatic energy management system for households using an Arduino UNO microcontroller board. It combines instruments to deal with natural disasters such as fre in addition to ofer a cost-efective solution for managing household energy. Te sole drawback of utilizing Arduino UNO is that, in comparison to ESP32, it consumes less power, making it unsuitable for use with a battery. Even without the Wi-Fi shield, the ESP32 is signifcantly less expensive than the Arduino UNO-about fve times less so. Similarly, the authors of reference [9] propose an Arduinobased greenhouse monitoring and control system. Te DHT11, soil moisture, LDR, and PH sensors are the primary sensors used in this project, and they provide precise values for temperature, humidity, moisture content, light intensity, and soil PH. Tis system is designed to control and monitor environmental parameters in a greenhouse via SMS sent from anywhere on the GSM network. Although the majority of the sensors used are low-cost and energy-efcient and the system also operates ofine via GSM800; using Arduino is not the most cost-efective or energy-efcient method, as it is relatively expensive and difcult to fnd in developing countries. Te article focuses on using IoT for plant growth monitoring and control rather than general home automation.
A similar study on the development of an IoT-based system for monitoring the electrical energy consumption of smart and rental houses was conducted in Tanzania [10]. Although they used the ESP32 as their main microprocessor and GSM for ofine messaging, the article only aims to add value to smart technology rental house users by providing them with a system that provides them with full detailed information about each appliance or power line in their houses, as well as the power consumption of each room. Even though these will assist users in understanding total house power consumption and eliminating unnecessary or unused devices from the consumption line, the article falls short of providing a solution for a diverse range of communities in developing countries.
A comprehensive strategy was adopted in reference [11] to create a low-cost IoT. Te holistic idea that the existence of a single low-cost component does not ensure that the same property holds true for the entire project served as the writers' driving force. Although our main focus was on home automation and security systems, which can be used in any developing or underdeveloped country, this was consistent with the system concepts we had in place.

SECHA's Architecture
In this section, we provide an overview of SECHA, a smart, energy-efcient, and cost-efective home automation system for any average-earning household in developing or underdeveloped countries by addressing the main issues facing the IoT: afordability, power outages, and unstable internet connections. At SECHA, we attempted to achieve this by bringing together different technologies from diferent companies that ofer low-cost, power-efcient, and easy-to-implement devices and integrating them into a single system that seems to work together. We also tried to reduce the number of sensors and devices required by incorporating most of the home automation while keeping the cost low.
SECHA is built around an ESP32 microcontroller, which processes data from multiple sensors and sends it to a realtime database, which then sends it to the user's Android app to receive instructions. In this project, we created a general prototype that can perform most of the basic home automation tasks by using a single ESP32 as the main microcontroller and connecting it to all of our sensors and gadgets to create a home automation system. We attempted to demonstrate that even with a limited budget, scarce electricity, and an unstable internet connection, as is common in developing countries, an IoT home automation and security system can be implemented. We also designed the SECHA system to be easily upgradeable and degradable, which means that a user can easily add more features by connecting a new sensor or appliance to any relay module that is connected to ESP32, or they can remove unnecessary features based on their preferences, giving SECHA more fexibility.
SECHA's fundamental architecture is divided into multiple phases, which include sensors, gateway connection, processing of data, cloud, and user interface application software ( Figure 1). To begin, physical devices such as sensors, appliances, and microcontrollers collect and interpret data from their surroundings. Tese data are then sent and processed in the cloud, which then sends them to the user using a UI and receives the data as a command. Tis command is then passed to the microcontroller, which commands the sensors and appliances. In the IoT architecture, microcontrollers and sensors operate as transmitters, transforming energy from one form to another. In our prototype, we used ESP32, ESP32-CAM, SIM800 Module, PIR Sensor, DHT11, MQ2 Gas Sensor, and LDR Sensor as our main components, and we developed an Android app that controls home automation using the Firebase real-time database.

Why ESP32?
Te ESP32 microcontroller is a low-cost, low-power system-on-chip microcontroller that supports Wi-Fi and Bluetooth and has a highly integrated structure powered by dual-core microprocessors. Te ESP32 is an excellent choice for IoT devices due to its performance and low cost. Te ESP32, a microcontroller board used to connect all of the sensors, is at the center of our design. Te ESP32 board is programmed with the project's source code. Te operational voltage range of the ESP32 is 2.2 to 3.6 V, and it has on-chip memory that can be used to store the source code directly on the chip. Te ESP32 will deliver 3.3 V to the chip during typical operation [12]. Te ESP32 microcontroller has two cores and can execute many tasks at once. Internal sensors, such as capacitive touch and hall efect sensors, are also included. Te ESP32 chip's key benefts are its broad deployment capabilities and compatibility with Wi-Fi protocols. Te ESP32 is a 32-bithexacore microcontroller developed for Internet of Tings (IoT) devices. It boasts a large computational capability for such a small chip, as well as on-chip SRAM memory for data and program instructions. It also supports external memory, making it appropriate for more demanding activities such as connecting to cameras, voice recognition, streaming data, image recognition, and IoT sensors. You may read more technical information on why the ESP32 is the best microcontroller at [13,14].

ESP32 Sleep Modes.
When the ESP32 is not in use, it may enter a power-saving mode called "sleep mode," which stores all data in RAM. Any unneeded peripherals will be turned of, and the RAM will be given enough power to maintain its contents. Te ESP32 features fve programmable power modes as a result of its advanced power management: active mode (160∼260 mA), modem sleep mode (3∼30 mA), light sleep mode (∼0.8 mA), deep sleep mode (∼6.5 µA), and hibernation mode (∼4.5 µA). Te chip may transition between these several power modes depending on the power needed. Te ESP32 can operate in these modes at currents even lower than 4.5 µA. ESP32 power-management technology is efcient and adaptable, allowing for the optimal balance of power consumption, wakeup latency, and available wakeup sources. Users can choose from fve predetermined power modes of the main processors to meet the application's demands. Furthermore, commands may be conducted by the ultralowpower coprocessor (ULP coprocessor) while the main processors are in deep-sleep mode to conserve power in power-sensitive applications [15].

ESP32 vs. Arduino Uno vs. ESP8266
. Te ESP32 can run for an astonishingly long time on batteries, making it perfect for developing countries, whereas the Arduino Uno has inefcient power consumption, making it unsuitable for use with a battery. Additionally, compared to the Arduino Uno, it features more GPIO pins. Additionally, the ESP32 has Wi-Fi and Bluetooth built in, removing the need for extra radio modules that are included on most Arduino boards. Te ESP32 is also around fve times cheaper than the Arduino Uno without taking into account the external peripherals required for the Arduino Uno.
Te ESP32 also surpasses its close cousin, the ESP8266, thanks to extra capabilities such as a CPU core, faster Wi-Fi, Bluetooth (BLE), touch sensitivity pins, built-in hall efect sensors, and a temperature sensor. Te ESP32 has more GPIO pins than the ESP8266. Te ESP32 features ten capacitive GPROs that sense touch and may be used to trigger events while maintaining around the same price as the ESP8266.

Why ESP32-CAM?
Te ESP32-CAM is a simple, lowcost development board based on the ESP32. It has a built-in TF card slot and an OV2640 camera. Te ESP32-CAM is suitable for a wide range of smart IoT applications, such as wireless video monitoring, Wi-Fi picture upload, and QR recognition. Both of the high-performance32-bit LX6 CPUs and all three Wi-Fi, conventional Bluetooth, and low-power BLE are integrated. Its main frequency adjustment spans from 80 MHz to 240 MHz, and additional features include an on-chip sensor, a hall efect sensor, a temperature sensor, and other features. It also includes a 7-stage pipeline design. Te ESP32-CAM is suited for our projects as it is afordable, simple to use, and ideal for Internet of Tings (IoT) devices that require an advanced camera functionality such as face recognition and surveillance [16].

Why SIM800 Module?
Te SIM800 is the most recent version, with extra features such as Bluetooth and enhanced signal reception, as well as being less expensive. It is a GSM modem that can be used in a variety of IoTprojects. You can use this shield to do almost anything a standard cell phone can do: send SMS text messages, make or receive phone calls, connect to the Internet via GPRS, TCP/IP, and more! To top it all of, the shield supports a quad-band GSM/GPRS network, which means it will work almost anywhere in the world. Te SIM800L is a compact cellular module that can transmit GPRS, send and receive SMS, and make and receive voice calls. Te low cost, small size, and quad band frequency capabilities of this module make it a great alternative for any project requiring long-distance communication. Te SIM800 was developed with power-saving techniques, with current usage as low as 1.2 mA in sleep mode [17]. We used SIM800 in our project because it was useful for sending emergency messages to the user in the event of an unstable connection. Although we could have used an ESP32 with a built-in SIM800 (TTGO T-Call board) to simplify our system and save even more energy, it was more expensive than purchasing the ESP32 and SIM800 modules separately, which contradicted our goal of making our system afordable.

Why PIR Sensors?
Te passive infrared sensor (PIR) detects both humans and animals up to 10 metres (30 ft) away. Te sensor can be used to detect the presence of humans in the room and at the front gate by detecting infrared light generated by a warm body and sending a signal to the ESP32 [12]. Because the PIR sensor is passive, it is unnoticeable and works well in low-light conditions. It detects motion consistently indoors, day or night, and consumes less energy (0.8 W to 1.0 W) than a microwave sensor. Tey are less expensive than microwave sensors and are suitable for electrical applications in smaller and more compact spaces. When compared to existing intrusion detection systems, it is perfect to install an IoT system using PIR sensors for intrusion detection that consumes less power, is low cost, simply operable, and easy to install [18].

Why DHT11?
Te DHT11 is a low-cost digital temperature and humidity sensor. Tis sensor is simple to connect to any microcontroller. Te DHT11 humidity and temperature sensor is a low-cost peripheral capable of sensing relative humidity between 20 and 90% RH with an accuracy of 5% RH throughout an operational temperature range of 0 to 50°C. Te temperature is also measured with a 2°C precision in the range of 0 to 50°C. Both values are returned with a resolution of 8 bits. Te gadget consumes 0.5 to 2.5 mA. For those worried about battery longevity, its standby current is specifed at 100 to 150 A [19]. Te DHT11 is a simple and cheap digital temperature and humidity sensor. It measures the surrounding air with a capacitive humidity sensor and a thermistor and outputs a digital signal on the data port (no analogue input connections are required), and it is pretty simple to operate.

Why MQ2 Gas Sensors?
Te gas sensor (MQ2) module detects H2, LPG, CH4, CO, alcohol, smoke, or propane leaks. Because of its high sensitivity and short reaction time, measurements may be carried out as efectively as possible. Te MQ2 gas sensor, which is commercially available in most developing nations' local markets, makes it easier and more cost efective than preordered sensors from abroad. When compared to using many sensors per pollutant, this sensor detects 7 distinct types of gas components, saving the node 1/7 of the power used [20].

Why LDR Sensors?
LDRs are light-sensitive devices that are frequently employed to detect the presence or absence of light or to measure the intensity of light. According to previous research, by utilizing LDR sensors, which require very little power and voltage for operation, a system may save an average of 71.39% power consumption while having a low cost, a simple structure, and easy employment [21]. Te LDR has numerous advantages: it is inexpensive, simple to install, and has a high light-to-dark resistance ratio. Tey are also compact in size, have very basic hardware, simple LDR connections, a low frequency response, and only need a low voltage to operate.

System Block Diagram.
Based on SECHA's architecture, we designed a system structure, as shown in the block diagram ( Figure 2). Te system is meant to be as simple and afordable as possible by employing a single ESP32 microcontroller. However, it is linked to numerous sensors in order to demonstrate its many capabilities and a wide range of applications that deliver various types of features based on the needs of the customers. It may also be customized with new features and functionality, as well as up to 16 relays for controlling any household appliance. If necessary, our system also supports Alexa, Siri, and Google Voice Commands. All of the sensors and components were individually and collectively tested to guarantee that they would continue to function even if one or more components failed. Te ESP32 was programmed directly with its inbuilt USB driver before being integrated into a single IDE.

Working Principles and Flowchart of the System
(1) Setting Up Door Security and Unlocking. When the PIR sensor detects movement in front of the door, it calibrates and activates the ESP32-cam. Te ESP32-CAM is programmed using camera.py, enabling it to capture images and stream live video to the user's phone. Te OV2640 on the EPS32-CAM records at 12.5 to 25 frames per second depending on the resolution and streams it to the Android app. Photos and videos taken by the ESP32 camera can be shared in real time with the user, uploaded to a server, and stored on an SD card, making them accessible even if the internet connection is unstable. When there is no motion detected by the PIR, it remains in deep sleep mode and ceases video streaming after a certain time of inactivity to conserve resources.
To unlock the door, the system uses TTL (GT-521F32) fngerprint recognition technology, which may also be managed via the Android app. When the main door button is pressed, the ESP32 transfers voltage to the central controller, which activates the door solenoid latch and opens the door. It is also programmed to close the door automatically after fve seconds and to sound a buzzer if the fngerprint does not match. A sonar sensor and the ESP32-CAM's facial recognition feature may both be used to automate the opening of the door, but we observed that this approach was less secure. A fowchart of door security is given in Figure 3.
(2) Detecting Flammable Gases, Smoke, and Fire. MQ-2 sensors were used to detect smoke and combustible gases, while fame sensors were used to detect fre. When the sensors' readings surpass the threshold, the system activates the buzzer, which sounds to notify the user of rising smoke/gas levels or fre, while the GSM module sends an emergency message to the user or fre department, and an automated water sprinkler will be activated if the fame sensor reading is very high. Te temperature was measured using a DHT11 temperature sensor. Te DHT11 sensor value is used to switch on and of the fan in the event of a high temperature (more than 30 degrees Celsius in our scenario), and the MQ-2 reading is used to turn on the fan in the event of a large concentration of smoke or gas in the house. A fowchart of fammable gases, smoke, and fre detecting and alarming is shown in Figure 4.
(3) Controlling Lighting and Household Appliances. All of the lights and household appliances were controlled by the user's Android app, but the outdoor light was also confgured to turn on and of automatically. When a user presses a button on the Android app, the ESP32 sends a voltage signal to the central controller, which compares it to the threshold voltage and either activates or deactivates the relay module, which controls the on/ of of home appliances. To automate the outside light, we used a light-dependent resistance (LDR) sensor to measure the intensity of the outside light and send a signal to the ESP32, which then sends out a signal to the relay module. If the LDR sensor value is greater than the threshold value (0.3 lux in our prototype), the outside light will be turned of. However, if the light intensity value is equal to or less than the threshold value, the outside light will be turned on automatically. Figure 5 shows the fowchart of light control.

Circuit Design.
We used the ESP32 as the microcontroller unit. All components and modules are connected according to the circuit diagram ( Figure 6). In this system,

Materials Used.
To design the SECHA, we have used the materials given in Table 1:

Software Requirements.
Our systems are programmed using a variety of applications and programming languages. Te ESP32 is coded directly using the C programming language, while the ESP32-CAM OV2640 is programmed using cam.py, and then integrated into the Arduino IDE. To transfer data between the ESP32 and the user's Android app in real time, we used Google's Firebase database and cloud servers. Te Android app is developed using MIT App Inventor, which enabled us to quickly design and implement an Android application that is also easily customizable by the user.

Arduino IDE.
It is a free and open-source software development environment that we use to code our ESP32 board in the C programming language. Tis ofers us access to the vast Arduino library, which is continually growing as a result of its large user base. It also simplifes programming our ESP32 board as it can be used to upload code ofine, making it ideal for users with unstable or no internet access [22].

Firebase Cloud Server.
Te Firebase cloud server platform enables us to do real-time data transfer and device connectivity. Tis platform includes a real-time database, performance monitoring, analytics, networking, and crash reporting capabilities. Because Firebase is supported by Google, it has the greatest level of security. Te user's personal data will be adequately safeguarded and free of the risk of being hacked. Firebase Cloud Messaging is a powerful technology for sending notifcations to mobile applications through data messages. It can be used to change the behavior of Android applications that are installed on the phone. Firebase is better at saving time on sending data to any mobile application, making it efcient with a low transmission period. Firebase will transmit data whether or not the Internet is available. Te beneft of this technology is that when the app connects to the Internet, the cloud will deliver updated data. Te Firebase notifcation is the best in terms of bandwidth use since it pulls the update as soon as the app receives the alert [23].

Android Application Design.
We created an Android app to control home appliances and enable security monitoring. Tis platform is the most prevalent among both developed and developing countries, ofering a secure experience. Users can login by using their particular and unique login ID and password. We used MIT's App Inventor tool [24] to develop the Android app. MIT App Inventor is a simple-to-use visual programming environment that enables anybody to design fully working apps for smartphones and tablets. Te Android application's block diagram is provided in reference [25]. An overall view of the Android application is given in Figure 7.

Implementation and Results
We frst tested the home automation during the implementation process. Sensors were used as inputs, ESP32s as controllers, and lights as outputs in home automation ( Figure 8). Te optimal and automatic modes are tested independently. Te Android app is used to turn ON and OFF the light (Figure 9). We used the app to control the status of the lights in real time. Te user activates the security     If smoke or fre is detected, an SMS will be sent to the user's phone. We used a lighter near the fame sensor to test the fre alarm system (Figure 12). Te LCD screen displays the current temperature and humidity levels, as Resistors 220 ohm 5 20 Jumper wires -12   well as a text message sent to the user. SMS alerts are also sent in the case of theft alarms. Te Piezo buzzer will start to sound when all of the sensors' detection values are high.
To control the light, we frst measure the intensity of the outside light. We used a light-dependent resistor (LDR) to measure light intensity. According to the LDR value, the system will remain of during the day, turn ON automatically when it gets dark, and turn OFF when it gets too dark ( Figure 13).

System Cost and Power Consumption.
Te cost and power consumption of the system is given in Table 2.

Conclusion
Te Internet of Tings is already visible in almost every home, and it is inevitable that it will be the next technological wave in the near future. Tis necessitates the design of a system that enables IoT home automation in developing and underdeveloped countries. In this article, we propose SECHA, an IoT architecture that can be used as a framework to build a low-cost smart home security system. Te main goal of this system is to use cutting-edge technology to make people's lives easier and more comfortable. Te system is designed with developing and underdeveloped countries' IoT challenges and opportunities in mind. Te system's cost was kept as low as possible when it was designed. Only the most essential features that facilitate home automation while also ensuring resource efciency are included. Using the SECHA system, we demonstrated that any developing or underdeveloped country can implement an afordable, energy-efcient, and simple IoT system. We connected all of our sensors to a single ESP32, which sends data to the Android app we developed via a real-time database, making the system as cheap, energy-efcient, and simple to implement as possible. In the event of an emergency, the system could use GSM SIM800 to send SMS notifcations even without an Internet connection. Our system can be upgraded or downgraded based on individual cost preferences, and it can also be implemented nationally by institutions or governments or personally by the user.
6.1. Future Scope. Tis project is a work in progress in the feld of IoT applications in home automation systems. In the future, there may be devices that are more reliable, faster, and less expensive. Te components we used can be replaced with the most recent device, but it must have the appropriate software and driver. Tis project's tasks have all been successfully accomplished. We were able to achieve our objectives as outlined in this article. We had time and fnancial constraints, but we hope that it will serve as a foundation for bringing IoT technologies to developing and underdeveloped countries. Tere is always room for improvement as technology advances. Machine learning and artifcial intelligence can be implemented in various machine operations in the future. New innovations can occur in waste management, efcient water management, and wastewater management. More work and research will be required to accomplish these projects.

Data Availability
Te data used to support the fndings of this study are included in this research article. For simulation, we have used data from other research papers which are properly cited.

Conflicts of Interest
Te authors declare that there are no conficts of interest.