Introduction: ESP-12F: ESP8266 Module - Connection Test
This instructable will show you the first steps in order to use and test an ESP8266 ESP-12F module.
I put here just the thinks to know... mainly also to rembember myself what I did.
This will show only how to do a first connexion and to test the module with a serial USB connected to a computer and use of Arduino IDE Serial Monitor.
Step 1: Parts Needed
The parts needed are:
- ESP-12F Module from ebay for example around 2.31USD
- An USB to serial TTL UART Module (like CP2102 from ebay for exemple): 1.24USD
- A 3.3V Power supply like MB102 from ebay: two for 1.67USD
- An optional ESP-12 adapter like this one from ebay: 3 for 1.20USD
Step 2: Setup the Power Supply
The ESP8266 is a 3.3V device. So setup all the pins of the power supply to 3.3V (on bot sides) and use only the green marked pins in the pictures. Do not use the 2 pins markend in red (5V).
Step 3: Solder the ESP-12F on the Adapter
It is now time to solder the ESP-12F on the adapter. The 2mm pitch of the ESP-12F is big enough to solder with a solering iron.
Start by soldering the ESP on the adapter.
Then solder the pins.
Please notice that this adapter has already:
- a 10k resistor pull-up for EN (CH_PD) pin
- a 10k pull down-resistor for GPIO15
Step 4: The ESP-12F
ESP- 12F WiFi module is developed by Ai - thinker Team. It contains a ESP8266 and 4MB external SPI flash.
I have found here the datasheet of the module. This datasheet describes all the pins but also the PIN Mode.
Modes are:
- UART (for programming): GPIO0 - low, GPIO2 - high, GPIO15 - low
Flasg boot (for running the flashed software): GPIO0 - high, GPIO2 - high, GPIO15 - low
Another PIN not to forget is EN (also named CH_PD on other devices). This need to be pulled high in order the device to work.
Step 5: Wire
Wire as follow:
- Power GND / CP2102 GND / ESP-12F GND / ESP-12F GPIO15
- Power 3.3V / ESP-12F VCC / ESP-12F GPIO0 / ESP-12F GPIO2 / ESP-12F EN
- CP2102 RX / ESP-12F TX
- CP2102 TX / ESP-12F RX
Some connections done here to VCC should not be done directly but with a pull-up resistor.
See my next Instructable.
Step 6: Start and Test With Putty
Connect CP2102 to computer and identity COM port.
Start putty and connect to the COM port with speed 74880 bauds.
Power un the power supply.
Some data will be displayed. This data is from the ESP8266 startup itself.
The data looks like :
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 1856, room 16
tail 0
chksum 0x63
load 0x3ffe8000, len 776, room 8
Now switch the baud rate to 115200. Restart ESP-12F
This time the data displayed comes from the embeded AT commands software. Data looks like:
Garbage caracters
Ai-Thinker Technology Co. Ltd.
ready
You can start type AT commands.
After each ENTER press also Control-J
Example AT
You will get:
AT+GMR
AT version:1.2.0.0(Jul 1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
Ai-Thinker Technology Co. Ltd. Dec 2 2016 14:21:16
OK
Step 7: Arduino IDE
Close putty if not done already.
Start Arduino IDE, choose COM port (Tools>Port) and run Serial Monitor (Tools>Serial Monitor)
With Arduino IDE Serial Monitor set speed 74880 and restart ESP.
You will get output looking like:
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x40100000, len 1856, room 16 tail 0 chksum 0x63 load 0x3ffe8000, len 776, room 8 tail 0 chksum 0x02 load 0x3ffe8310, len 552, room 8 tail 0 chksum 0x79 csum 0x79
2nd boot version : 1.5 SPI Speed : 40MHz SPI Mode : DIO SPI Flash Size & Map: 32Mbit(512KB+512KB) jump to run user1 @ 1000
rf cal sector: 1017 rf[112] : 00 rf[113] : 00 rf[114] : 01
SDK ver: 1.5.4.1(39cb9a32) compiled @ Jul 1 2016 20:04:35 phy ver: 972, pp ver: 10.1
With Arduino IDE Serial Monitor set speed 115200 and "Both NL & CR" at bottom right of the screen.
You will se also garbage then:
Ai-Thinker Technology Co. Ltd.
ready
Now you are ready for last step.
Step 8: AT Commands
The full reference ot AT commands is on expressif website or a short reference here.
Here is a short list:
- AT
- returns OK
- AT+GMR
- returns version
- example:
- AT version:1.2.0.0(Jul 1 2016 20:04:45)
- SDK version:1.5.4.1(39cb9a32)
- Ai-Thinker Technology Co. Ltd. Dec 2 2016 14:21:16 OK
- AT+CWMODE?
- displays current Acces point mode
- AT+CWMODE=
- sets acces point mode.
- 1 : station mode
- 2 : softAP mode
- 3 : softAP + station mode
- sets acces point mode.
Here is an example:
Set Dual Mode
AT+CWMODE=3 OK
List acces points
AT+CWLAP +CWLAP:(4,"TOTO-500D00A0",-00,"40:65:03:40:03:30",1,10,0) +CWLAP:(4,"TOTO-1300",-00,"04:A0:00:dA:50:50",1,13,0) +CWLAP:(0,"TOTO1",-54,"36:00:03:61:00:50",3,-4,0) +CWLAP:(0,"TOTO_sA0urA",-54,"36:00:03:61:00:50",3,-4,0) +CWLAP:(4,"TOTO-A006",-50,"00:30:06:30:A0:06",6,-11,0) +CWLAP:(0,"TOTO2",-50,"1A:30:06:30:A0:06",6,-11,0) +CWLAP:(4,"TOTO-A506",-00,"60:0A:05:03:05:06",6,-10,0) +CWLAP:(0,"TOTO",-06,"4A:0A:05:03:05:06",6,-10,0) +CWLAP:(4,"TOTO-305A",-01,"00:00:61:d0:30:5A",6,3,0) +CWLAP:(0,"TOTO3",-00,"00:00:61:05:04:00",6,-0,0) +CWLAP:(3,"TOTO 34556",-00,"50:00:01:d3:10:46",6,10,0) +CWLAP:(4,"TOTO-04A0",-00,"00:00:61:05:04:00",6,-0,0) +CWLAP:(4,"TOTO4",-50,"64:00:34:10:10:00",0,-10,0) +CWLAP:(3,"TOTO-0C00",-00,"00:00:00:06:00:00",11,06,0) +CWLAP:(0,"TOTO_011",-05,"00:30:00:05:00:11",11,-10,0) +CWLAP:(4,"TOTO-D3000030",-00,"64:00:34:00:A0:04",11,-10,0)
Connect
AT+CWJAP="TOTO","password" WIFI CONNECTED WIFI GOT IP OK
List IP adresses
AT+CIFSR +CIFSR:APIP,"192.168.56.1" +CIFSR:APMAC,"aa:aa:aa:aa:cd:ef" +CIFSR:STAIP,"192.168.23.17" +CIFSR:STAMAC,"cd:01:23:45:ef:cd" OK
Make a http request
1st connect
AT+CIPSTART="TCP","www.google.fr",80 CONNECT OK
Make the request
AT+CIPSEND=20 OK GET / HTTP/1.0 > Recv 20 bytes SEND OK
And the response is
+IPD,471:HTTP/1.0 302 Found Cache-Control: private Content-Type: text/html; charset=UTF-8 Location: <a href="http://www.google.fr/?gfe_rd=cr&ei=MR6WWPuYDIvu8weQxKbwCw" rel="nofollow"> http://www.google.fr/?gfe_rd=cr&ei=MR6WWPuYDIvu8w...</a> Content-Length: 258 Date: Sat, 04 Feb 2017 18:32:17 GMT <HTML>Some html here</HTML> CLOSED
Step 9: Ressources
Please find attached some ressource files: the ESP-12f datashet and my Fritzing schematics.