November 2, 2014
I connected the ESP8266 module to a computer using standard PL2303 USB to RS-232 module, and for power supply I have used USBAsp module set to 3.3V. Pin CH_PD needs to be connected to Vcc for ESP8266 to function.
ESP8266 is a great new WiFi to RS-232 module. The great thing about it is that it cost only 5$, and it provides the abillity to connect your MCU to a network using only RS-232 port. Also, it has built-in TCP/IP stack so it should be simple enough to setup your MCU to talk to other devices in network or servers on the Internet. Processor on this module is Tensilica Xtensa LX3 32bit, clocked at 80 MHz. This is my first try of using this module.
This is the pinout of ESP8266.
I have wired everything on a breadboard.
When the module is powered it will send some boot information. The baud rate setting of the module is 115200,N,8,1.
ets Jan 8 2013,rst cause:4, boot mode:(3,7) wdt reset load 0x40100000, len 24236, room 16 tail 12 chksum 0xb7 ho 0 tail 12 room 4 load 0x3ffe8000, len 3008, room 12 tail 4 chksum 0x2c load 0x3ffe8bc0, len 4816, room 4 tail 12 chksum 0x46 csum 0x46 ready
Giving the command AT+CWLAP will make the module list all AP that it can hear.
AT+CWLAP AT+CWLAP +CWLAP:(0,"",0) +CWLAP:(4,"spanic",-39) +CWLAP:(4,"H1 Telekom_F676",-96) +CWLAP:(3,"Zdenka",-81) OK
Command AT+CWJAP makes the module join the given AP. The module will answer with OK.
AT+CWJAP="spanic","password" AT+CWJAP="spanic","password" OKCommand AT+CIFSR makes the module display its IP address that it got assigned from a routers DHCP server.
AT+CIFSR AT+CIFSR 192.168.1.24These two commands makes the module start listening for a TCP connection on a given port, in this case 80, a default HTTP port.
AT+CIPMUX=1 AT+CIPMUX=1 OK AT+CIPSERVER=1,80 OK
When the module start listening on port 80, if you enter the modules IP address into a browser...
... ESP8266 will receive the HTTP GET request from a browser.
Link +IPD,0,279:GET / HTTP/1.1 Host: 192.168.1.24 User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:33.0) Gecko/20100101 Firefox/33.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive OK
If you respond with a HTTP response...
AT+CIPSEND=0,97 > HTTP/1.1 200 OK Content-Type: text/plain Content-Length: 13 Connection: close hello world SEND OK Unlink
... browser will show the sent HTML page, in this case only a text "hello world".
My next step will be to interface the module with an ATmega8 MCU and implement a simple HTTP server.
Thank You for reading.
Tags: ESP8266 network