4. The Arduino Uno can be
programmed using the Arduino
software platform, which simplifies
the process of writing code for
controlling sensors, motors, lights,
and other electronic components.
The Arduino Uno is a popular
microcontroller board based on the
ATmega328P microcontroller
Arduino UNO
http://image
4
5. Features of Arduino UNO
The operating voltage is 5V
The recommended input voltage will range from 7v to 12V
The input voltage ranges from 6v to 20V
Digital input/output pins are 14
Analog i/p pins are 6
DC Current for each input/output pin is 40 mA
DC Current for 3.3V Pin is 50 mA
Flash Memory is 32 KB
SRAM is 2 KB
EEPROM is 1 KB
CLK Speed is 16 MHz
5
6. OTHER APPLICATIONS OF ARDUINO
Traffic Light Count Down Timer
Parking Lot Counter
Home Automation
Weighing Machines
Medical Instrument
Washing Machine
Microwave Over
Security Systems
CCTV Switchers
Advantages
No additional programmer/burner hardware is
required for the programming board
Portable
Low power consumption
6
7. The ESP01 WiFi module is
The ESP01 is a compact and power-efficient WIFI module that
seamlessly integrates with microcontrollers. It enables wireless
connectivity for a wide range of IoT and smart home applications.
http://image 7
8. 8
Feature of ESP01
Compact size: Small footprint
GPIO Pins: GPIO pins for interfacing with sensors and peripherals.
power supply: 3.3 volts (V)
Serial communication: Utilizes UART for communication with
microcontrollers.
AT command support: Communicates with microcontroller via AT
commands
Cost-effective: Inexpensive
11. Connection Description
VCC
Connect to a 3.3V
output from Arduino
GND
Connect to
Arduino's ground
TX
Connect Arduino's
TX pin to ESP-01's
RX pin
RX
Connect Arduino's
RX pin to ESP-01's
TX pin
11
ESP-01 Arduino Interfacing connection
Software Setup:
Install the Arduino IDE if you
haven't already.
Install the ESP8266 library in
Arduino IDE: Go to "Sketch" ->
"Include Library" -> "Manage
Libraries", then search for
"ESP8266" and install it.
Programming ESP-01
Communication with Arduino
Hardware Setup:
Note:
Remember to use a voltage divider or
level shifter
12. Code
#include<SoftwareSerial.h>
#include <Wire.h>
#include <DFRobot_DHT11.h>
SoftwareSerial comm(2, 3); //setting Tx and Rx pins
DFRobot_DHT11 DHT;
#define DHT11_PIN 11
String server = ""; //variable for sending data to webpage
boolean No_IP = false; //variable to check for ip Address
String IP = ""; //variable to store ip Address
char temp1 = '0';
int a = 0;
int b = 0;
String str1 = "<p>I am Arduino</p>"; //String to display on webpage
String str2 = "<p>Data Received Successfully.....</p>"; //another
string to
display on webpage
12
14. sendDataToServer(temperature, humidity);
delay(10000);
}
void findIp(int time1) //check for the availability of IP Address
{
int time2 = millis();
while (time2 + time1 > millis())
{
while (comm.available() > 0)
{
if (comm.find("IP has been read"))
{
No_IP = true;
}
}
}
}
void showIP()//Display the IP Address
{ 14
15. IP = "";
char ch = 0;
while (1)
{
comm.println("AT+CIFSR");
while (comm.available() > 0)
{
if (comm.find("STAIP,"))
{
delay(1000);
Serial.print("IP Address:");
while (comm.available() > 0)
{
ch = comm.read();
if (ch == '+')
break;
IP += ch;
15
16. }
}
if (ch == '+')
break;
}
if (ch == '+')
break;
delay(1000);
}
Serial.print(IP);
Serial.print("Port:");
Serial.println(80);
}
void establishConnection(String command, int timeOut) //Define the
process for
sending AT commands to module
{
int q = 0;
while (1) 16
20. unsigned int l = server1.length();
Serial.print("AT+CIPSEND=0,");
comm.print("AT+CIPSEND=0,");
Serial.println(l + 2);
comm.println(l + 2);
delay(100);
Serial.println(server1);
comm.println(server1);
while (comm.available())
{
//Serial.print(Serial.read());
if (comm.find("OK"))
{
20
21. p = 11;
break;
}
}
if (p == 11)
break;
delay(100);
}
}
void sendToServer()//send data to webpage
{
server = "<h1>Welcome to Data Receiving from Arduino</h1>";
sendData(server);
server = str1;
server += str2;
sendData(server);
delay(5000);
comm.println("AT+CIPCLOSE=0");
21
23. Explanation
1. Libraries: The code includes libraries like SoftwareSerial for
communication, Wire for I2C communication, and DFRobot_DHT11 for
interacting with the DHT11 sensor.
2. Global Variables: Variables like server, No_IP, IP, temp1, a, b,
str1, and str2 are declared for various purposes including storing
server information, IP address, and strings for webpage display.
3. setup() Function: Initializes serial communication, initializes the
WiFi module, and prints a message to indicate system readiness.
4. loop() Function: Continuously reads temperature and humidity from
the DHT11 sensor, sends the data to the server, and then delays for 10
seconds before repeating.
23
24. 5. findIp() Function: Checks for the availability of an IP address.
6. showIP() Function: Retrieves and displays the IP address.
7. establishConnection() Function: Sends AT commands to the WiFi
module and waits for the response.
8. wifi_init() Function: Initializes the WiFi module by sending a
series of AT commands, connecting to the WiFi network if an IP address
is available, and configuring the module for server communication.
9. sendData() Function: Sends data to the server using
the AT command AT+CIPSEND.
10. sendToServer() Function: Constructs and sends HTML-formatted data
to the server.
11. sendDataToServer() Function: Formats and sends temperature and
humidity data to the server.
24
26. 9. References
1. https://www.arduino.cc/
2. https://www.electronicwings.com/nodemcu
3.https://www.instructables.com/Connect-Arduino-Uno-With-ESP8266/
4. https://docs.arduino.cc/retired/boards/arduino-uno-wifi
Conclusion
The ESP-01 WiFi module's integration with the Arduino Uno provides an
easy and practical way to integrate wireless connectivity into
electronic projects. This improves these projects' usefulness and
adaptability and creates new opportunities for IoT, home automation,
and industrial control, among other industries. This integration has
the potential to completely change how electronic devices communicate
and interact with one another with the right setup and programming.
26