Here, I will explain step by step (Manually) how you can send data to the server using ESP01 Wi-Fi Module. (Not using any Program)
Recommended Internet of Things (IOT) Courses:
- Udemy: Complete Guide to Build IOT Things from Scratch to Market
- LinkedIn: IoT Foundations: Fundamentals
- edX: Introduction to the Internet of Things (IoT)
- edureka: IoT Certification Training on Azure
- Coursera: An Introduction to Programming the Internet of Things (IOT) Specialization
- Eduonix: Internet Of Things (IOT) Bundle
Basic knowledge of communication layers is as follows:
Communication Layers:
Application Layer : Generate Msg Signal (Eg. Serial Monitor)
Network Layer : Assign Source and Destination IP Address to Msg
Data Link Layer : Data packet will be framed bit by bit
Physical Layer : Transmitted / Received via medium.
Follow these steps:
- Connect ESP01 Module in configuration mode
PIN Diagram of ESP01: (This module works on 3.3v) (NOT 5v)Connections for configuration: - Open Arduino Serial Monitor and Set Baud Rate = 115200 and select "Both NL and CR" Option
- Type following AT commands in given Sequence
This will open a prompt like ">". Then you can send the data using GET command in that prompt as shown below:
you can check: "/HTTP/1.0\r\n\r\n" This string contains 18 character.
If we mention fewer bytes in the previous command then send more no. of byte then the server will accept only mentioned no. of byte and ignore remaining bytes.
Instead of "/HTTP/1.0\r\n\r\n", you can call APIs to send the data to the server and make the graph or do the analysis and post work.
If your ESP01 module isn't working as expected and you need to reset it to default, you can use the following command:
To understand better Watch the demonstration video below.
Demonstration:
Click here to see more codes for Arduino Mega (ATMega 2560) and similar Family.
Feel free to ask doubts in the comment section. I will try my best to solve it.
If you find this helpful by any mean like, comment and share the post.
This is the simplest way to encourage me to keep doing such work.
Thanks and Regards,
-Akshay P. Daga
it says espcomm failed
ReplyDeleteThat is really nice to hear. thank you for the update and good luck. Unique wifi names
ReplyDeleteHello.. oke it works..but can you give me simple sketch to turn on a led from android apps?
ReplyDeleteThank you for this fascinating post, I am happy I observed this website on Google. Not just content, in fact, the whole site is fantastic. IP Address
ReplyDeleteHi... Could you help me please.
ReplyDeletewich is the rigth string about "AT+CIPSEND" for this GET to my site:
www.abbici.org
/cgi-bin/auto_robot_arduino?fu=gianfry&fp=4rdu1n0&ro=1&val=0
you can test it free
change val=1 or 0
Thank you
@}-,-'----
Gianfranco
I have solved:
ReplyDelete#include "SoftwareSerial.h"
SoftwareSerial esp(19, 18);// RX, TX 19, 18 with MEGA
int conta = 0;
String strtmp;
String strcopy;
void setup()
{
esp.begin(115200); // Arduino to ESP01 Communication
}
void loop()
{
esp.println("AT+CIPMUX=0"); // To Set MUX = 0
delay(2000); // Wait for 2 sec
// TCP connection
String cmd = "AT+CIPSTART=\"TCP\",\"www.abbici.org\",80";
esp.println(cmd); // Send above command to Rx1, Tx1
delay(2000); // Wait for 20 Sec
// prepare GET string
strtmp = String(conta % 2);
String getStr = "GET /cgi-bin/auto_robot_arduino?fu=gianfry&fp=4rdu1n0&ro=1&val=" + strtmp;
getStr += " HTTP/1.1";
getStr += "\r\n";
getStr += "Host: www.abbici.org";
getStr += "\r\n";
getStr += "Connection: close";
getStr += "\r\n";
getStr += "\r\n";
getStr += "\r\n";
cmd = "AT+CIPSEND="; // send data length
cmd += String(getStr.length());
esp.println(cmd); // Send Data length command to Tx1, Rx1
delay(200);
esp.print(getStr); // Send Data length command to Tx1, Rx1
delay(2000);
esp.println("AT+CIPCLOSE\r\n"); // Send Close Connection command to Rx1, Tx1
delay(5000); // wait for 5sec
conta++;
}
I forgot: This is a simple example... conta changes value to send my site
ReplyDelete