ESP-01-based IoT systems generally use AT commands to be able to perform actions in a network. These AT commands are known to be many. In addition, the combination of commands is difficult to understand for a beginner. Therefore, this project was created to improve the convenience of the ESP-01-based IoT system. In this case, the author used the UART protocol on the development board side. This project has been implemented and took approximately 2 weeks. Two types of development boards were used. Arduino Uno R3 is used to retrieve soil moisture data from the sensor which is then sent to ESP-01 via UART communication: Serial Software. Meanwhile, ESP-01 is used to receive data from Arduino Uno via UART communication: Hardware Serial and then send the data to Ubidots via HTTP protocol.
Part | Description |
---|---|
Development Board | • Arduino Uno R3 • ESP-01 |
Code Editor | Arduino IDE |
Programmer Tools | CH340-ESP01 USB |
Driver | CH340 USB Driver |
IoT Platform | Ubidots |
Communications Protocol | • Hypertext Transfer Protocol (HTTP) • Universal Asynchronous Receiver-Transmitter (UART) |
IoT Architecture | 3 Layer |
Programming Language | C/C++ |
Arduino Library | • SoftwareSerial (default) • Ubidots-ESP8266 |
Sensor | Capacitive Soil Moisture Sensor (x1) |
Other Components | • USB type B cable - USB type A (x1) • Jumper cable (1 set) • ESP-01 Adapter (x1) |
-
Arduino IDE
https://bit.ly/ArduinoIDE_Installer
-
CH340 USB Driver
https://bit.ly/CH340_USB_Driver
Block Diagram | Infrastructure |
---|---|
Pictorial Diagram | Wiring |
---|---|
• Serial Communication
Basically, a device can be communicated with other devices either wirelessly or by cable. Communication between commonly used hardware is Serial Communication
. It can be known that there are three types of Serial Communication
, which include: UART (Universal Asynchronous Receiver-Transmitter)
, SPI (Serial Peripheral Interface)
, and I2C (Inter Integrated Circuit)
. Serial UART communication
allows each device to act as a master
or slave
in a limited way. Master
is the primary device that has full authority over the control of the Slave, while the Slave
is the secondary device that is under the authority of the Master device. There are two kinds of UART Serial Communication
, namely Hardware Serial
and Software Serial
. Hardware serial communication
can be done by connecting the TX
and RX
pins crosswise
on each development board, for example: RX-TX
, then TX-RX
. The TX
pin is for sending data
, while the RX
pin is for receiving data
. Serial Software Communication
is more or less the same as Serial Hardware Communication
in terms of cabling, but there are differences in terms of coding. By using this Serial Software
you can overcome the constraints of the limitations of RX
and TX
pins on the development board. To communicate with this Serial Software
is quite easy, namely by using certain Digital Pins
as a substitute for TX pins and RX pins
.
• Internet of Things
Internet of Things (IoT)
is a concept where things connected to a network can perform one or more actions in achieving a goal. These actions include data collection, data transmission, data reception, or data processing. Every IoT project requires devices that can connect to WiFi such as ESP. ESP consists of 2 types, namely ESP8266
and ESP32
. This is on the market very diverse models, for that you need to readjust to the needs in the project so as not to cause disappointment.
-
Open the
Arduino IDE
first, then open the project by clickingFile
->Open
:•
Master.ino
•
Slave.ino
-
Fill in the
Additional Board Manager URLs
in Arduino IDEClick
File
->Preferences
-> enter theBoards Manager Url
by copying the following link :http://arduino.esp8266.com/stable/package_esp8266com_index.json
-
Board Setup
in Arduino IDEi
How to setup the
Arduino Uno
boardClick
Tools
->Board
->Arduino AVR Boards
->Arduino Uno
ii
How to setup the
ESP-01
board• Click
Tools
section ->Board
->Boards Manager
-> Installesp8266
.• Then click
Tools
->Board
->ESP8266 Boards
->Generic ESP8266 Module
.
-
Change the Board Speed
in Arduino IDEi
How to change the speed of
Arduino Uno
boardClick
Tools
->Upload Speed
->9600
ii
How to change the speed of
ESP-01
boardClick
Tools
->Upload Speed
->9600
-
Install Library
in Arduino IDEDownload all the library zip files. Then paste it in the:
C:\Users\Computer_Username\Documents\Arduino\libraries
-
Port Setup
in Arduino IDEClick
Port
-> Choose according to your device port(you can see in device manager)
-
Change the
WiFi Name
,WiFi Password
, and so on according to what you are currently using. -
Before uploading the program please click:
Verify
. -
If there is no error in the program code, the next step is to use the
ESP-01
programming tool according to the procedure. Then click:Upload
. WhileArduino Uno
can be done directly without using programming tools. -
If there is still a problem when uploading the program, then try checking the
driver
/port
/programmer tool
/others
section.
-
Programming Mode
:• Attach the
ESP-01
to theCH340-ESP01 USB
.• Press and hold the button on the
CH340-ESP01 USB
, and plug it into computer/laptop.• Release the button when the device is recognized by the computer/laptop.
• Please
upload
the program. -
Operating Mode
:• Release the
CH340-ESP01 USB
from the computer/laptop.• The program code that has been embedded in this
ESP-01 board
is ready for operation (no more programming activities).• Release the
ESP-01
from theCH340-ESP01 USB
. Do the wiring as shown in the pictorial diagram.
Notes :
• To upload the program, besides using the • Based on experience, I admit that using the |
-
Getting started with Ubidots :
• Please Log in to access the
Ubidots
service.• If you don't have a
Ubidots
account yet, please create one.
-
Creating devices :
• After logging into the account -> click
Devices
.• Click
+ (Create a device)
-> then selectBlank Device
.•
Device name
customize according to your needs.•
Device label
customize what was on Ubidots when it successfully sent the data the first time, in which case it will usually be an ID.• Select
✅ Checklist
to save.
-
Creating dashboards :
• Click
Data
-> then selectDashboards
.• Click
Add new Dashboard
.•
Name
,Tags
,Default time range
-> customize it to your needs.•
Dynamic Dashboard
-> change it toDynamic (Single Device)
.•
Default Device
-> select the device you want to display.• Leave the other settings alone -> then click
SAVE
.
-
Creating widget :
• Make sure you are in the
Dashboards
menu.• Click
+ Add new widget
.• Please choose according to your needs. In this project, the author uses
Line chart
for data visualization.• Please set the variables that you want to display on the widget by clicking
+ Add Variables
, then click✅ Checklist
to save.• If you want to change the content of the widget, please click the
pencil
symbol -> if so, then click✅ Checklist
to save.
-
Firmware configuration :
• Click the
User
section in the top right corner -> then selectAPI Credentials
.• Copy the
Default token
-> paste it into the firmware code. An example is as follows:const String token = "BBUS-aRZvtYRMM7IWbrKFcICR30YYP7dh5Q"; // define ubidots token
-
Download and extract this repository.
-
Make sure you have the necessary electronic components.
-
Make sure your components are designed according to the diagram.
-
Configure your device according to the settings above.
-
Please enjoy [Done].
Hardware | Serial Monitor & IoT Platform: Ubidots |
---|---|
If this work is useful to you, then support this work as a form of appreciation to the author by clicking the ⭐Star
button at the top of the repository.
This application is my own work and is not the result of plagiarism from other people's research or work, except those related to third party services which include: libraries, frameworks, and so on.
MIT License - Copyright © 2024 - Devan C. M. Wijaya, S.Kom
Permission is hereby granted without charge to any person obtaining a copy of this software and the software-related documentation files to deal in them without restriction, including without limitation the right to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons receiving the Software to be furnished therewith on the following terms:
The above copyright notice and this permission notice must accompany all copies or substantial portions of the Software.
IN ANY EVENT, THE AUTHOR OR COPYRIGHT HOLDER HEREIN RETAINS FULL OWNERSHIP RIGHTS. THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, THEREFORE IF ANY DAMAGE, LOSS, OR OTHERWISE ARISES FROM THE USE OR OTHER DEALINGS IN THE SOFTWARE, THE AUTHOR OR COPYRIGHT HOLDER SHALL NOT BE LIABLE, AS THE USE OF THE SOFTWARE IS NOT COMPELLED AT ALL, SO THE RISK IS YOUR OWN.