ESP8266 Quick-Start Guide

From ElectroDragon
(Redirected from ESP8266 Basic)
Jump to: navigation, search

Module Pin Description ESP-01

  • Normal mode: Normal boot from flash, normal working mode
  • Flash mode: Firmware flash mode
Pin Working Mode Flash Mode Description
VCC, GND* power supply, better use a standalone, and share ground with uart port
TXD, RXD** uart interface
RST Restart on low TTL
CH_PD 1 1 Chip select enable, constant High TTL always
GPIO 15 0 0 Low TTL on boot , N/A for ESP-01
GPIO0 1 0 Switch working / flash mode
GPIO 2 1 1 High TTL on boot
Red LEDs (cancelled on latest) constants on to show the power status
Blue LEDs blink when data come through

Module wiring

  • Use FT232RL can supply enough power, must be genius IC of course
  • Swap the uart pins if no data show up on the monitor
  • There are two leds on the board, one is power led (RED), another one is status LED(BLUE), when power up, pwr led keeps on and status led will blink once.
  • baud rate may work at 9600 (seems the latest correct one), 115200 or 57600

Setup Check list

Check list Description
Check default wifi status if your devices (e.g. your phone) can find a wifi spot named like "ESP_98529F", "AI-...." or similar, the later number part is the mac ID, if you can see this wifi spot, it means your module boot up successfully
check LED status and wiring blue led will blink once on boot up, serial data output "ESP Ready", Tick "new line" option on USB-TTL serial port monitor tool, Try baudrate 9600 or 115200 default firmware use these two
Check power supply use shared GND will standalone power supply
Check IO15 status connect GPIO15 to GND on boot if you are using the SMD model
  • Use power source that can provide sufficient current, better not using power from USB-TTL module
  • Module will automatically disconnect "unlink" TCP/UDP when no data go through
  • Wifi password length must be more than 8 bytes

Use Guide of AT Commands

At Commands Header text Header text
Reset AT+RST restart the module, received some strange data, and "ready"
Set Work Mode AP+STA AT+CWMODE=3 change the working mode to 3, AP+STA, only use the most versatile mode 3, AT+RST may be necessary when this is done
Join Network AT+CWLAP search available wifi spot
Join Network AT+CWJAP=you ssid, password join my mercury router spot, e.g. AT+CWJAP=“TP-LINK_4226”,“1234567890”, password length must be correct, remove all the empty space in the command
Join Network AT+CWJAP? check if connected successfully, or use AT+CWJAP=?, or use AT+CIFSR to find your ip address
Cloud Update AT+GMR check current version, output AT+GMR AT version:0.30.0.0(Jul 3 2015 19:35:49) / SDK version:1.2.0 / Ai-Thinker Technology Co.,Ltd. / Build:1.2.0.A Aug 7 2015 17:21:44 / OK
Cloud Update AT+CIUPDATE get reply +CIPUPDATE:1, +CIPUPDATE:2, +CIPUPDATE:3, +CIPUPDATE:4, OK
TCP Client AT+CIPMUX=1 turn on multiple connection
TCP Client AT+CIPSTART=4,"TCP","192,168.1.104",9999 connect to remote TCP server 192.168.1.104 (the PC)
TCP Client AT+CIPMODE=1 optionally enter into data transmission mode
TCP Client AT+CIPSEND=4,5 send data via channel 4, 5 bytes length (see socket test result below, only "elect" received), link will be "unlink" when no data go through
TCP Server AT+CIPSERVER=1,9999 setup TCP server, on port 9999, 1 means enable
TCP Server AT+CIFSR check module IP address
  • Test, PC as a TCP client connect to module using socket test, send data
  • Socket test running result, In the sockettest, do not tick the "secure" in TCP client, it causes unstable

Note

  • Avoid to use GPIO4 (D2) and GPIO5 (D1) in nodemcu, it seems switched: GPIO5 =D2 and GPIO4=D1