Requirements:
1. Arduino UNO
2. ESP8266 Wifi Module
Connecting the Arduino UNO to ESP8266 :
1. Connect the Arduino'ss 3.3V PIN output to the red line on a breadboard.
2. The ESP8266 works with 3.3V and not 5V, so this is necessary.
3. Connect Arduino's GND (ground) to the blue line on bread board.
4. Connect the RES or RESET pin of Arduino to the blue line.
When you ground the reset pin, the Arduino works as USB to serial connector, required for talking to the ESP8266.
(When you ground the Reset PIN, you wont be able to load your binary to Arduino, so if you want to load any of your code to arduino make sure the reset pin is not grounded)
5. Connect the RXD pin of the Arduino to the RX pin of the ESP8266.
6. Connect the TXD pin of the Arduino to the TX pin of the ESP8266.
Usually, when we want two things to talk to each other over serial, we connect the TX pin of one to the RX of the other (send goes to receive and receive goes to send).
Here Arduino is not talking to ESP8266, it only powers the ESP8266 module & gives us a interface to send connection commands from our computer to the ESP.
7. Connect the GND pin of the ESP to the blue line on breadboard.
8. Connect the VCC of ESP to the red line on breadboard.
9. At last CH_PD goes to the red line. (CH_PD - Chip Power Down) Used to enable / disable the Wifi module.
A good feature to save power when wifi is not in use.
Sending Comands to ESP8266 Wifi Module from PC:
1. We will not be uploading any binary to the ESP8266.
2. Open Arduino IDE → Tools Menu → Serial Monitor.
3. Set baud rate to 115200 [the default ESP8266 firmware uses]
4. Set line endings to 'Both NL & CR'.
5. Now type AT & click Send, this will send an AT command to ESP8266 module, & ESP will respons back with OK acknowledge.
You should see output as below:
ESP8266 AT Commands :
Commands
|
Description
|
Set/Execute
|
Parameters
|
AT+RST
|
restart the module
|
–
|
–
|
AT+CWMODE
|
wifi mode
|
AT+CWMODE=<mode>
|
1= Sta, 2= AP, 3=both
|
AT+CWJAP
|
join the AP
|
AT+ CWJAP =<ssid>,< pwd
>
|
ssid = ssid, pwd = wifi password
|
AT+CWLAP
|
list the AP
|
AT+CWLAP
|
|
AT+CWQAP
|
quit the AP
|
AT+CWQAP
|
|
AT+ CWSAP
|
set the parameters of AP
|
AT+ CWSAP=
<ssid>,<pwd>,<chl>, <ecn>
|
ssid, pwd, chl = channel, ecn =
encryption
|
AT+ CIPSTATUS
|
get the connection status
|
AT+ CIPSTATUS
|
|
AT+CIPSTART
|
set up TCP or UDP connection
|
1)single connection (+CIPMUX=0)
AT+CIPSTART= <type>,<addr>,<port>; 2) multiple connection
(+CIPMUX=1) AT+CIPSTART= <id><type>,<addr>, <port>
|
id = 0-4, type = TCP/UDP, addr =
IP address, port= port
|
AT+CIPSEND
|
send data
|
1)single connection(+CIPMUX=0)
AT+CIPSEND=<length>; 2) multiple connection (+CIPMUX=1) AT+CIPSEND=
<id>,<length>
|
|
AT+CIPCLOSE
|
close TCP or UDP connection
|
AT+CIPCLOSE=<id> or
AT+CIPCLOSE
|
|
AT+CIFSR
|
Get IP address
|
AT+CIFSR
|
|
AT+ CIPMUX
|
set mutiple connection
|
AT+ CIPMUX=<mode>
|
0 for single connection 1 for
mutiple connection
|
AT+ CIPSERVER
|
set as server
|
AT+ CIPSERVER=
<mode>[,<port> ]
|
mode 0 to close server mode, mode
1 to open; port = port
|
+IPD
|
received data
|
Video demo for AT Commands:
Sir I would like to upload the sensor data from Arduino to cloud using esp8266 will you please help me
ReplyDelete