Test esp8266 by AT command

in #utopian-io6 years ago (edited)

Before reading:

I write it on my PC typora ,but the passage may go wrong when I copy the passage to Utopian post editor.So I upload to the Github. If the article layout make you dazzled please read on the below url.Thanks.

The more readable version


1.Necessary hardware

  • ESP8266 -01 module

    图片.png
    图片.png

  • USB -TTL transfer tool

    图片.png

  • 3.3V power


2.Necessary software

  • Network debug assistant "Netassist.com"

    图片.png

  • Serial port debug tool "sscom42.com"

    图片.png


3.Connection

  • ESP8266 PIN instrution

图片.png

  • Connect ESP8266 to USB-TLL tool

    ESP8266-01USB-TTL tool
    UTXDRX
    URXDTX
    3.3V3.3V
    CH_PD3.3V
    GNDGND
  • Computer properties setting

    Right click "My computer" then click "properties" ,choose "hardware" tab ,and find " Device manager",select "COM and LPT" and you will see the number of USB-To-Serial Comm Port. Remember it!(Like the picture below,My port is COM6)图片.png

  • Debug

    • run the serial port debug tool "sscom42.com".Set the rate(波特率) as 115200 (New version of ESP8266 may be selected as 9600 )as well as the port as COM6.And remember click to select "send new line"(发送新行).Do as the picture marked below.

      图片.png

    • Then click "OPEN the buffer"(打开串口),and you will see some messy code,which is about the company information.You also can ignore it by click "Clearing"(清除).

      图片.png

    • Send AT commands to debug the ESP8266

      Frequently-used AT commands are listed below

      AT commandExplain
      AT+RSTrestart module
      AT+CWMODE=3set the mode
      AT+CWJAP="SSID Name","Password"connect to the WIFI SSID
      AT+CIFSRcheck up IP
      AT+CIPSTART="TCP","192.168.1.100",8080connect to TCP server
      AT+CIPSEND=4set the length of message

      AT command :

      ​ restart the module.

      AT+RST

      Receive :

      OK
      
      ets Jan  8 2013,rst cause:4, boot mode3,6)
      
      wdt reset
      load 0x40100000, len 816, room 16
      tail 0
      chksum 0x8d
      load 0x3ffe8000, len 788, room 8
      tail 12
      chksum 0xcf
      ho 0 tail 12 room 4
      load 0x3ffe8314, len 288, room 12
      tail 4
      chksum 0xcf
      csum 0xcf
      
      2nd boot version : 1.2
        SPI Speed      : 40MHz
        SPI Mode       : QIO
        SPI Flash Size : 4Mbit
      jump to run user1
      
      Ai-ThinkerTechnology Co. Ltd.
      
      Invalid
      

      AT command:

      ​ set the mode of ESP8266 as "softAP + station",which can let ESP8266 generate the AP and at the same time connect to WIFI Station.

      ​ The picture below shows the AP which ESP8266 has generated.

      图片.png

      AT+CWMODE=3

    Receive:

    AT+CWMODE=3
    OK
    

    AT command:

    ​ While ESP8266 is on "Station" mode,you can send the AT command below to connect to the existing WIFI .(My wifi name is 'Laoli',and the password is 'lrh13888'. so I modify the AT command as below)

    AT+CWJAP="Laoli","lrh13888"

    Receive:

    AT+CWJAP="Laoli","lrh13888"
    OK
    


    AT command:

    ​ After conected to the WIFI , sending this AT command can get the IP.

    AT+CIFSR

    Receive:

    AT+CIFSR
    +CIFSR:APIP,"192.168.4.1"
    +CIFSR:APMAC,"1a:fe:34:fa:b8:25"
    +CIFSR:STAIP,"192.168.1.107"
    +CIFSR:STAMAC,"18:fe:34:fa:b8:25"
    
    OK
    

    AT command:

    ​ Firtstly set up the TCP server by using network debug assistant "Netassist.com"

    图片.png

    After the TCP server successfully setting , sending this AT command can connect to the server.Remember to input the correct IP and port.

    AT+CIPSTART="TCP","192.168.1.100",8080

    Receive:

    AT+CIPSTART="TCP","192.168.1.100",8080
    CONNECT
    OK
    

    AT command:

    ​ Sending message to TCP server which we have connected to.

    ​ Firstly ,set the length of the following message.

    AT+CIPSEND=4

    ​ and we will receive:

    AT+CIPSEND=4
    OK
    > 
    

    ​ When we see the mark ">",it means we can send the message body .

    ​ Then I send "ABCD" four letters

    Receive:

    图片.png

    ​ What we send will be seen in the monitor of "Netassist.com"

    【Receive from 192.168.1.107 :20618】:03 08 41 42 41 42 43 44 41 42 43 44
    

图片.png


4.Summary

Generally ,we use ESP8266 and Arduino for network communications with server or client.Just taking advantages of the AT commands I list above can easily meet the normal requirements.

But this is only the basics of network communications .More funny functions are waiting to be achieved.

**Next time I will share some of complex projects about the ESP8266 and Arduino **.

Please look forward to it


Thanks for reading patiently.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

thanks so much

Hey @cha0s0000 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Suggestions

  • Contribute more often to get higher and higher rewards. I wish to see you often!
  • Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck!

Get Noticed!

  • Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.30
TRX 0.11
JST 0.033
BTC 64106.00
ETH 3129.71
USDT 1.00
SBD 4.16