Design and Implementation of ESP32-Based IoT Devices
Abstract
:1. Introduction
- The device must be able to acquire data from its surroundings and transmit it to other devices or directly to the Internet.
- The device must be able to react according to the current circumstances.
- The device must be able to receive information from the network.
- The device must support communication; IoT devices inherently belong to a network of devices that communicate with each other through nodes on the same network.
- The physical layer, which comprises sensors and actuators;
- The network layer, which interconnects the devices via networks all the way to the users;
- The application layer, which connects physical and network layers digitally and facilitates interactions between the user and other machines, thus allowing people to make decisions at a higher level of control or to automate selected tasks.
2. IoT in Education
- A smart environment to support learning;
- E-learning, teaching, and distance education management;
- Remote labs;
- Augmented reality learning and distance learning;
- Wireless robotic learning platforms;
- Distance attendance management systems;
- An IoT-enabled education service.
- For delivering teaching, to support students, lecturers, and management staff;
- For establish the content (subject) of the study, which allows students to play an active role. This includes the presented realization, which is described below.
3. Materials and Methods
3.1. Hardware
3.1.1. ESP32
- Processor: ESP32 (24 MHz dual core);
- Flash memory: 4 MB;
- Built-in microSD card connector;
- PSRAM (pseudo-static random access memory): 8 MB;
- Built-in Wi-Fi, Bluetooth, USB to serial converter (CP2104 or CH9102F);
- Built-in Li-ion/Li-Po battery charging circuit: TP4054 chip.
3.1.2. Analog Discovery 2
3.1.3. Custom Interface Boards
3.2. Software
3.2.1. Arduino IDE and the ESP32 Libraries
3.2.2. WaveForms
3.3. ESP32 Introductory Course
- Introduction to ESP32: students are introduced to the ESP32 microcontroller, its features, components, and applications.
- Software installation: students install the Arduino IDE, the ESP32 board support package for Arduino IDE, and USB drivers on their PCs.
- Getting started: students connect the ESP32 module to PC, deploy (upload) simple demo programs, and monitor variables in the serial monitor.
- Programming basics: students are introduced to the C programming language in a separate subject; therefore, only a summary of the C programming language (variables, data types, operators, program structures, and functions) is given in this part.
- GPIO (general purpose inputs and outputs): students perform simple algorithms to test digital inputs and outputs. In this part, they learn how to (1) configure GPIO pins as inputs or outputs, (2) use pull-up and pull-down resistors to stabilize input readings, and (3) read and write digital pins.
- Analog I/O: in this part, students perform programs to acquire analog inputs and set analog outputs. The ESP32 module is connected to Analog Discovery 2 using the developed and presented interface board. Using an Analog Discovery Waveform generator, students create stimulus signals and perform ESP32 programs to acquire the signals using analog inputs.
- PWM (pulse width modulation): students implement algorithms that generate a PWM signal on selected output pins, and they perform the acquisition of a generated signal using Analog Discovery 2 scope.
- Sensors and actuators: in this part, students connect the ESP32 module to the developed sensor expansion board, and then they create programs to retrieve data from connected Grove, STEMMA QT, or Qwiic sensors. In addition, students learn how to install and use open-source libraries.
- Data logging: students implement algorithms that store the acquired sensor data on the SD card.
- Wi-Fi connectivity: students learn how to create an access point using the ESP32 controller, and how to connect to an existing Wi-Fi network.
- Internet of Things (IoT): students work with selected IoT platforms and build IoT applications that interact with cloud services.
- Project: students combine their skills and knowledge gained throughout the course to build various projects, such as a weather station, home automation system, or a simple robot.
4. Results
4.1. Beehive Monitoring System
4.2. Wine Fermentation Monitoring Device
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Gul, S.; Asif, M.; Ahmad, S.; Yasir, M.; Majid, M.; Malik, M.S.A.; Arshad, S. A survey on role of internet of things in education. Int. J. Comput. Sci. Netw. Secur. 2017, 17, 159–165. [Google Scholar]
- IoT Analytics GmbH. State of IoT Spring 2023; IoT Analytics: Hamburg, Germany, 2023. [Google Scholar]
- Albița, A.; Selișteanu, D. A Compact IIoT System for Remote Monitoring and Control of a Micro Hydropower Plant. Sensors 2023, 23, 1784. [Google Scholar] [CrossRef] [PubMed]
- Andreadis, A.; Giambene, G.; Zambon, R. Low-Power IoT for Monitoring Unconnected Remote Areas. Sensors 2023, 23, 4481. [Google Scholar] [CrossRef]
- Palma, D.; Agudo, J.E.; Sánchez, H.; Macías, M.M. An Internet of Things Example: Classrooms Access Control over Near Field Communication. Sensors 2014, 14, 6998–7012. [Google Scholar] [CrossRef] [Green Version]
- Doukas, C. Building Internet of Things with the ARDUINO; CreateSpace: North Charleston, SC, USA, 2012. [Google Scholar]
- Babiuch, M.; Postulka, J. Smart Home Monitoring System Using ESP32 Microcontrollers; IntechOpen: London, UK, 2021. [Google Scholar]
- Jampana, J.G.; Praneeth, A.; Devi, J.H.; Rani, P.S. Smart Home Automation System with Status Feedback Based on Esp32 and IoT; Elsevier: Amsterdam, The Netherlands, 2022. [Google Scholar]
- Froiz-Míguez, I.; Fernández-Caramés, T.M.; Fraga-Lamas, P.; Castedo, L. Design, Implementation and Practical Evaluation of an IoT Home Automation System for Fog Computing Applications Based on MQTT and ZigBee-WiFi Sensor Nodes. Sensors 2018, 18, 2660. [Google Scholar] [CrossRef] [Green Version]
- Aghenta, L.O.; Iqbal, M.T. Low-cost, open source IoT-based SCADA system design using thinger. IO and ESP32 thing. Electronics 2019, 8, 822. [Google Scholar] [CrossRef] [Green Version]
- Ahmed, A.S.; Marzog, H.A.; Abdul-Rahaim, L.A. Design and implement of robotic arm and control of moving via IoT with Arduino ESP32. Int. J. Electr. Comput. Eng. (IJECE) 2021, 11, 3924–3933. [Google Scholar] [CrossRef]
- Ioannou, K.; Karampatzakis, D.; Amanatidis, P.; Aggelopoulos, V.; Karmiris, I. Low-Cost Automatic Weather Stations in the Internet of Things. Information 2021, 12, 146. [Google Scholar] [CrossRef]
- Megantoro, P.; Aldhama, S.A.; Prihandana, G.S.; Vigneshwaran, P. IoT-based weather station with air quality measurement using ESP32 for environmental aerial condition study. TELKOMNIKA (Telecommun. Comput. Electron. Control.) 2021, 19, 1316–1325. [Google Scholar] [CrossRef]
- Marques, G.; Miranda, N.; Kumar Bhoi, A.; Garcia-Zapirain, B.; Hamrioui, S.; de la Torre Díez, I. Internet of Things and Enhanced Living Environments: Measuring and Mapping Air Quality Using Cyber-physical Systems and Mobile Computing Technologies. Sensors 2020, 20, 720. [Google Scholar] [CrossRef] [Green Version]
- Ramírez-Faz, J.; Fernández-Ahumada, L.M.; Fernández-Ahumada, E.; López-Luque, R. Monitoring of Temperature in Retail Refrigerated Cabinets Applying IoT Over Open-Source Hardware and Software. Sensors 2020, 20, 846. [Google Scholar] [CrossRef] [Green Version]
- Park, Y.M.; Sousan, S.; Streuber, D.; Zhao, K. GeoAir—A Novel Portable, GPS-Enabled, Low-Cost Air-Pollution Sensor: Design Strategies to Facilitate Citizen Science Research and Geospatial Assessments of Personal Exposure. Sensors 2021, 21, 3761. [Google Scholar] [CrossRef]
- Fernández-Ahumada, L.M.; Ramírez-Faz, J.; Torres-Romero, M.; López-Luque, R. Proposal for the Design of Monitoring and Operating Irrigation Networks Based on IoT, Cloud Computing and Free Hardware Technologies. Sensors 2019, 19, 2318. [Google Scholar] [CrossRef] [Green Version]
- Glória, A.; Dionisio, C.; Simões, G.; Cardoso, J.; Sebastião, P. Water Management for Sustainable Irrigation Systems Using Internet-of-Things. Sensors 2020, 20, 1402. [Google Scholar] [CrossRef] [Green Version]
- Jan, F.; Min-Allah, N.; Saeed, S.; Iqbal, S.Z.; Ahmed, R. IoT-Based Solutions to Monitor Water Level, Leakage, and Motor Control for Smart Water Tanks. Water 2022, 14, 309. [Google Scholar] [CrossRef]
- Khandakar, A.; Mahmud, S.; Chowdhury, M.E.H.; Reaz, M.B.I.; Kiranyaz, S.; Mahbub, Z.B.; Ali, S.H.M.; Bakar, A.A.A.; Ayari, M.A.; Alhatou, M.; et al. Design and Implementation of a Smart Insole System to Measure Plantar Pressure and Temperature. Sensors 2022, 22, 7599. [Google Scholar] [CrossRef] [PubMed]
- Hoang, M.L.; Carratù, M.; Paciello, V.; Pietrosanto, A. Body Temperature—Indoor Condition Monitor and Activity Recognition by MEMS Accelerometer Based on IoT-Alert System for People in Quarantine Due to COVID-19. Sensors 2021, 21, 2313. [Google Scholar] [CrossRef] [PubMed]
- Franco, T.; Sestrem, L.; Henriques, P.R.; Alves, P.; Varanda Pereira, M.J.; Brandão, D.; Leitão, P.; Silva, A. Motion Sensors for Knee Angle Recognition in Muscle Rehabilitation Solutions. Sensors 2022, 22, 7605. [Google Scholar] [CrossRef]
- Campero-Jurado, I.; Márquez-Sánchez, S.; Quintanar-Gómez, J.; Rodríguez, S.; Corchado, J.M. Smart Helmet 5.0 for Industrial Internet of Things Using Artificial Intelligence. Sensors 2020, 20, 6241. [Google Scholar] [CrossRef]
- Baig, M.J.A.; Iqbal, M.T.; Jamil, M.; Khan, J. Design and implementation of an open-Source IoT and blockchain-based peer-to-peer energy trading platform using ESP32-S2, Node-Red and, MQTT protocol. Energy Rep. 2021, 7, 5733–5746. [Google Scholar] [CrossRef]
- Mandza, Y.S.; Raji, A. IoTivity Cloud-Enabled Platform for Energy Management Applications. IoT 2022, 3, 73–90. [Google Scholar] [CrossRef]
- Ibrahim, I.S.; Kenwright, B. Smart Education: Higher Education Instruction and the Internet of Things (IoT). arXiv 2022, arXiv:2207.02585. [Google Scholar]
- Xie, J.; Yang, Y. IoT-based model for intelligent innovation practice system in higher education institutions. J. Intell. Fuzzy Syst. 2021, 40, 2861–2870. [Google Scholar] [CrossRef]
- Mircea, M.; Stoica, M.; Ghilic-Micu, B. Investigating the impact of the internet of things in higher education environment. IEEE Access 2021, 9, 33396–33409. [Google Scholar] [CrossRef]
- Yawson, R.M.; Woldeab, D.; Osafo, E. Human Resource Development and the Internet of Things. arXiv 2021, arXiv:2107.04003. [Google Scholar]
- Zhou, X.; Li, X.; Su, N. Design and internet of things development of network teaching resource base system for educational technology. In Proceedings of the 5th International Conference on Computer Science and Information Engineering (ICCSIE 2020), Dalian, China, 23–25 October 2020; Volume 1769. [Google Scholar]
- Pervez, S.; Rehman, S.; Alandjani, G. Role of internet of things (lot) in higher education. In Proceedings of the 4th International Conference on Advances in Education and Social Sciences (ADVED 2018), Istanbul, Turkey, 15–17 October 2018; pp. 7791–7833. [Google Scholar]
- Kassab, M.; DeFranco, J.; Laplante, P. A systematic literature review on Internet of things in education: Benefits and challenges. J. Comput. Assist. Learn. 2020, 36, 115–127. [Google Scholar] [CrossRef]
- Pocero, L.; Amaxilatis, D.; Mylonas, G.; Chatzigiannakis, I. Open Source IoT Meter Devices for Smart and Energy-Efficient School Buildings; Elsevier: Amsterdam, The Netherlands, 2017. [Google Scholar]
- Gomathy, C.; Ruchitha, M.R.; Haritha, M.S. Smart Classroom with the Help of IoT. Int. J. Sci. Res. Eng. Manag. (IJSREM) 2021, 5, 1–5. [Google Scholar]
- Tan, P.; Wu, H.; Li, P.; Xu, H. Teaching Management System with Applications of RFID and IoT Technology. Educ. Sci. 2018, 8, 26. [Google Scholar] [CrossRef] [Green Version]
- Jacko, P.; Bereš, M.; Kováčová, I.; Molnár, J.; Vince, T.; Dziak, J.; Fecko, B.; Gans, Š.; Kováč, D. Remote IoT Education Laboratory for Microcontrollers Based on the STM32 Chips. Sensors 2022, 22, 1440. [Google Scholar] [CrossRef]
- Wang, H. Teaching quality monitoring and evaluation using 6G internet of things communication and data mining. Int. J. Syst. Assur. Eng. Manag. 2023, 14, 120–127. [Google Scholar] [CrossRef]
- Pappas, G.; Siegel, J.; Vogiatzakis, I.N.; Politopoulos, K. Gamification and the Internet of Things in Education. In Handbook on Intelligent Techniques in the Educational Process: Vol 1 Recent Advances and Case Studies; Springer: Berlin/Heidelberg, Germany, 2022; pp. 317–339. [Google Scholar]
- McRae, L.; Ellis, K.; Kent, M. Internet of Things (IoT): Education and Technology: The Relationship between Education and Technology for Students with Disabilities; National Centre for Student Equity in Higher Education, Curtin University: Perth, Australia, 2018. [Google Scholar]
- Song, J.; Meng, H. Research and Teaching Practice on Experiment Course of STM32-Embedded Microcontroller. In Proceedings of the 2019 3rd International Conference on Education, Economics and Management Research (ICEEMR 2019), Singapore, 29–30 November 2019; pp. 342–345. [Google Scholar]
- Nikolayev, N. The internet of things in transport technology improvement and project learning. IOP Conf. Ser. Mater. Sci. Eng. 2021, 1083, 012068. [Google Scholar] [CrossRef]
- Benitez, V.; Symonds, R.; Elguezabal, D. Design of an Affordable IoT Open-Source Robot Arm for Online Teaching of Robotics Courses during the Pandemic Contingency; Elsevier: Amsterdam, The Netherlands, 2020. [Google Scholar]
- Peters, A.; Vargas, F.; Garrido, C.; Andrade, C.; Villenas, F. Pl-toon: A low-cost experimental platform for teaching and research on decentralized cooperative control. Sensors 2021, 21, 2072. [Google Scholar] [CrossRef] [PubMed]
- Cvjetkovic, V. Pocket Labs Supported IoT Teaching. Int. J. Eng. Pedagog. 2018, 8, 32–48. [Google Scholar] [CrossRef] [Green Version]
- Dhivvya, J.; Bharath, M.; Suresh, A. Effective teaching using a real-time water quality monitoring prototype. Procedia Comput. Sci. 2020, 172, 43–48. [Google Scholar]
- Guo, H.; Magid, E.; Hsia, K.-H.; Su, K.-L. Development of IoT module with AI function using STM32 chip. J. Robot. Netw. Artif. Life 2021, 7, 253–257. [Google Scholar] [CrossRef]
- Kotsifakos, D.; Makropoulos, G.; Douligeris, C. Teaching internet of things (IoT) in the electronics specialty of vocational education and training. In Proceedings of the 2019 4th South-East Europe Design Automation, Computer Engineering, Computer Networks and Social Media Conference (SEEDA-CECNSM), Piraeus, Greece, 20–22 September 2019. [Google Scholar]
- Luis Bustamante, A.; Patricio, M.A.; Molina, J.M. Thinger.io: An Open Source Platform for Deploying Data Fusion Applications in IoT Environments. Sensors 2019, 19, 1044. [Google Scholar] [CrossRef] [Green Version]
- Carlos-Mancilla, M.A.; Luque-Vega, L.F.; Guerrero-Osuna, H.A.; Ornelas-Vargas, G.; Aguilar-Molina, Y.; González-Jiménez, L.E. Educational Mechatronics and Internet of Things: A Case Study on Dynamic Systems Using MEIoT Weather Station. Sensors 2021, 21, 181. [Google Scholar] [CrossRef]
- Setiawan, M.; Suwastika, N.; Prabowo, S. IoT-Based Kobela Teaching Aid for Mathematics Learning Multiplication and Division Materials for Grade II Elementary School Students. J. Media Inform. Budidarma 2021, 5, 1142. [Google Scholar] [CrossRef]
- Kleinschmidt, J. Teaching internet of things for engineering courses: A Project-based cooperative approach. Int. J. Electr. Eng. Educ. 2021, 58, 858–873. [Google Scholar] [CrossRef]
- Valencia de Almeida, F.; Hayashi, V.T.; Arakaki, R.; Midorikawa, E.; Canovas, S.D.M.; Cugnasca, P.S.; Corrêa, P.L.P. Teaching Digital Electronics during the COVID-19 Pandemic via a Remote Lab. Sensors 2022, 22, 6944. [Google Scholar] [CrossRef]
- Espressif Systems. ESP32. Available online: https://www.espressif.com/en/products/socs/esp32 (accessed on 19 June 2023).
- Digilent. Analog Discovery 2 Reference Manual. Available online: https://digilent.com/reference/test-and-measurement/analog-discovery-2/start (accessed on 19 June 2023).
- Seeed Technology Co., Ltd. Available online: https://www.seeedstudio.com/ (accessed on 19 June 2023).
- Adafruit Industries. Available online: https://www.adafruit.com/ (accessed on 19 June 2023).
- SparkFun Electronics. Available online: https://www.sparkfun.com/ (accessed on 19 June 2023).
Pin | Digital | Analog | I2C | UART |
---|---|---|---|---|
1 | D0 (Primary input/output) | A0 (Primary input) | SCL (I2C Clock) | RX (UART Receive) |
2 | D1 (Secondary input/output) | A1 (Secondary input) | SDA (I2C Data) | TX (UART Transmit) |
3 | VCC (Power for Grove Module, 5 V/3.3 V) | |||
4 | GND (Ground) |
Pin | I2C |
---|---|
1 | SCL (I2C Clock) |
2 | SDA (I2C Data) |
3 | V+ (Power for STEMMA QT/Qwiic modules 5 V/3.3 V) |
4 | GND (Ground) |
Library Group | Libraries |
---|---|
Wi-Fi | WiFiManager, ESPAsyncWiFiManager, WiFiEsp, WiFiNINA |
MQTT | PubSubClient, Adafruit MQTT Library, MQTT-TLS, MQTT-SN |
Display | Adafruit SSD1306, Adafruit GFX, TFT_eSPI, U8g2, ILI9341 |
Sensors | Adafruit BME280, DHT sensor library, Adafruit MCP23017, BH1750 |
Web Server | ESPAsyncWebServer, AsyncTCP, ESP8266WebServer, ESP8266HTTPClient |
JSON | ArduinoJson, ArduinoJson5, ESPJson, JsonStreamingParser |
LED Control | Adafruit NeoPixel, FastLED, WS2812FX |
Bluetooth | BLEPeripheral, BLEScan, ESP32 BLE Arduino, ESP32 Bluetooth |
SD Card | SD, SPIFFS, SdFat, ESP32_SD_Card, SD_MMC |
MQTT-based IoT | Blynk, Adafruit IO, Cayenne, Ubidots, Losant |
Motor Control | AccelStepper, ESP32Servo, DRV8825, Adafruit Motor Shield |
Real-Time Clock | DS3231, NTPClient, Time, Timezone |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Hercog, D.; Lerher, T.; Truntič, M.; Težak, O. Design and Implementation of ESP32-Based IoT Devices. Sensors 2023, 23, 6739. https://doi.org/10.3390/s23156739
Hercog D, Lerher T, Truntič M, Težak O. Design and Implementation of ESP32-Based IoT Devices. Sensors. 2023; 23(15):6739. https://doi.org/10.3390/s23156739
Chicago/Turabian StyleHercog, Darko, Tone Lerher, Mitja Truntič, and Oto Težak. 2023. "Design and Implementation of ESP32-Based IoT Devices" Sensors 23, no. 15: 6739. https://doi.org/10.3390/s23156739
APA StyleHercog, D., Lerher, T., Truntič, M., & Težak, O. (2023). Design and Implementation of ESP32-Based IoT Devices. Sensors, 23(15), 6739. https://doi.org/10.3390/s23156739