Wifi with ESP8266 - Part 1
The latest craze in Wifi cheap circuit is the Expressif ESP8266 which can be found on a quite a few breakout boards.
ESP-201
With so much choice and without having taken the time to think much about it, I went to the ESP-201. This one as a "normal spacing" (1/10th inch) pinout and is dead h: US$ 3.70 including postage.
As noted by numerous people, the 4-pin header is not breadboard friendly at all and pins need to be either resoldered on top or bent a bit.
The details of all the pins of the board is available on this blog entry.
Wiring
Re-using Jeelab's USB FTDI board and an aditional 5V to 3.3V voltage converter, I connected the board the following way:
- 3.3V & GND
- TX <-> RX
- RX <-> TX
- (GP)IO15 <-> GND
- CHIP_EN <-> 3.3V
- (GP)IO0 <-> GND when flashing (left unconnected otherwise)
USB Connection
with minicom for starters @115200 bit/s (but it really depends on the firmware apparently usually 9600 or 57600).
Some tests
- On the console:
AT+CWMODE=1
OK
AT+RST
OK
ets Jan 8 2013,rst cause:4, boot mode:(3,5)
wdt reset
load 0x40100000, len 212, room 16
tail 4
chksum 0x5e
load 0x3ffe8000, len 788, room 4
tail 0
chksum 0x1c
load 0x3ffe8314, len 72, room 8
tail 0
chksum 0x55
csum 0x55
jump to user1
ready
AT+GMR
00170901
OK
AT+CWLAP
+CWLAP:(0,"",0,e0:5e:ff:3f:00:00,0)
+CWLAP:(2,"SSID-01",-83,14:0c:76:fa:70:6c,1)
+CWLAP:(0,"FreeWifi",-88,14:0c:76:fa:70:6d,1)
+CWLAP:(2,"FREEBOX_NAIMA_SO",-92,0e:76:6b:29:10:48,1)
+CWLAP:(0,"freephonie",-92,0e:76:6b:29:10:4a,1)
+CWLAP:(0,"FreeWifi_secure",-85,14:0c:76:fa:70:6e,1)
+CWLAP:(3,"SSID-03",-81,f0:82:61:d0:52:ac,11)
+CWLAP:(0,"FreeWifi_secure",-95,f4:ca:e5:c9:1c:82,11)
+CWLAP:(2,"freebox_Jeannot",-90,f4:ca:e5:c9:1c:80,11)
+CWLAP:(2,"FREEBOX_TONY_55",-86,68:a3:78:01:be:46,5)
+CWLAP:(0,"FreeWifi",-89,68:a3:78:01:be:47,5)
+CWLAP:(0,"FreeWifi_secure",-88,68:a3:78:01:be:48,5)
+CWLAP:(4,"Bbox-8735B701",-84,d0:84:b0:0e:be:a0,11)
+CWLAP:(0,"SFR WiFi Mobile",-87,d2:25:15:dd:b6:2f,6)
+CWLAP:(2,"SFR_B628",-78,00:25:15:dd:b6:2c,6)
+CWLAP:(2,"freebox_SWWNDE",-74,ee:de:4f:b8:6b:94,6)
+CWLAP:(0,"FreeWifi",-75,ee:de:4f:b8:6b:96,6)
+CWLAP:(0,"FreeWifi_secure",-75,ee:de:4f:b8:6b:97,6)
+CWLAP:(0,"SFR WiFi Mobile",-90,9a:a1:d7:ec:85:af,6)
+CWLAP:(2,"SFR_85A8",-88,e0:a1:d7:ec:85:ac,6)
+CWLAP:(0,"SFR WiFi FON",-90,9a:a1:d7:ec:85:ad,6)
+CWLAP:(3,"SSID-02",-93,20:e5:2a:0f:f1:70,6)
+CWLAP:(0,"FreeWifi",-87,52:f2:79:19:0b:7a,7)
+CWLAP:(0,"FreeWifi_secure",-89,52:f2:79:19:0b:7b,7)
+CWLAP:(4,"Livebox-4dac",-87,00:19:70:44:cf:25,11)
+CWLAP:(0,"FreeWifi",-92,f4:ca:e5:c9:1c:81,11)
+CWLAP:(0,"FreeWifi_secure",-91,f4:ca:e5:bd:41:fa,12)
+CWLAP:(0,"FreeWifi",-89,f4:ca:e5:bd:41:f9,12)
OK
AT+CWJAP="MYSSID","MYPASSWD"
OK
AT+CWJAP?
+CWJAP:"MYSSID"
OK
AT+CIFSR
192.168.1.20
- On the computer:
nc -l 5000
- Connecting to the computer from the module using TCP:
AT+CIPSTART="TCP","192.168.1.16",5000
OK
Linked
AT+CIPSTATUS
STATUS:3
+CIPSTATUS:0,"TCP","192.168.1.16",5000,0
OK
AT+CIPSEND=6
> Hello!
busy s...
SEND OK
AT+CIPCLOSE
OK
Unlink
- On the computer:
nc -l -u 5000
- Connecting to the computer from the module using UDP:
AT+CIPSTART="UDP","192.168.1.16",5000
OK
AT+CIPSEND=7
> Bonjour
SEND OK
- Typing "Au revoir" on the computer...
+IPD,10:Au revoir
OK
- Switching the module to server mode:
AT+CIPMUX=1
OK
AT+CIPSERVER=1,5555
OK
- Connectiong to the module from the computer:
nc 192.168.1.20 5555
- Result:
Link
+IPD,0,13:Testtesttest
OK
AT+CIPSERVER=0
we must restart
NB: The server stays active! and seems to crash too...
Fatal exception (0):
Fatal exception (0):
Fatal exception (0):
Fatal exception (0):
- Trying to update directly.
AT+CIUPDATE
+CIPUPDATE:1
+CIPUPDATE:2
+CIPUPDATE:3
+CIPUPDATE:4
ERROR
Antenna business
Adding a 31mm (1/4 wavelength for 2.4Ghz) bare metal wire at the end of the antenna cable seems to have improved much the signal:
AT+CWLAP
+CWLAP:(0,"",0,20:5b:ff:3f:00:00,0)
+CWLAP:(0,"FreeWifi_secure",-81,14:0c:76:fa:70:6e,1)
+CWLAP:(2,"SSID-01",-79,14:0c:76:fa:70:6c,1)
+CWLAP:(0,"FreeWifi",-81,14:0c:76:fa:70:6d,1)
+CWLAP:(3,"SSID-02",-82,20:e5:2a:0f:f1:70,1)
+CWLAP:(4,"Bbox-8735B701",-82,d0:84:b0:0e:be:a0,11)
+CWLAP:(4,"Livebox-0A9C",-81,18:1e:78:3c:0a:9c,11)
+CWLAP:(4,"Livebox-4dac",-81,00:19:70:44:cf:25,11)
+CWLAP:(2,"FREEBOX_TONY_55",-84,68:a3:78:01:be:46,5)
+CWLAP:(0,"FreeWifi",-82,68:a3:78:01:be:47,5)
+CWLAP:(0,"FreeWifi_secure",-83,68:a3:78:01:be:48,5)
+CWLAP:(4,"Bbox-CE49A0",-76,00:19:70:ae:fe:87,6)
+CWLAP:(0,"SFR WiFi Mobile",-76,d2:25:15:dd:b6:2f,6)
+CWLAP:(2,"SFR_B628",-77,00:25:15:dd:b6:2c,6)
+CWLAP:(0,"SFR WiFi FON",-78,d2:25:15:dd:b6:2d,6)
+CWLAP:(2,"freebox_SWWNDE",-69,ee:de:4f:b8:6b:94,6)
+CWLAP:(0,"FreeWifi",-71,ee:de:4f:b8:6b:96,6)
+CWLAP:(0,"FreeWifi_secure",-71,ee:de:4f:b8:6b:97,6)
+CWLAP:(3,"SSID-03",-65,f0:82:61:d0:52:ac,11)
+CWLAP:(2,"freebox_Jeannot",-91,f4:ca:e5:c9:1c:80,11)
+CWLAP:(0,"FreeWifi_secure",-92,f4:ca:e5:c9:1c:82,11)
Gain of +11dB and ping packet loss now <5%... not bad at all.
Trying alternative firmwares
Since the loaded firmware wasn't the latest, why not try alternative ones...
Well, this might be more an adventure than previously thought... TBC