ESP8266 WiFi Module Experimentation

ESP8266I received two WiFi modules today from ElectroDragon.com.  These are the newly found and very cheap boards discussed on HackaDay.io. I thought they might work better than the NRF24L01+ modules I’ve been testing for my IoT RaspiBadger side project.  Here’s my initial notes to get started:

I’m using the Arduino UNO with this module.  The 3.3v/Gnd/Rx/Tx pins of the WiFi Module are directly attached to the same pins on the UNO.  I believe I have the Revision 1 (using cmd AT+GMR gives 01000800), the Rev 2 has additional IO pins as well as a reset and ?Enable? pin.  Rev 2 will likely not work the way I will describe below for the Rev 1.  I tried connecting the WiFi to a pair of AAA batteries at 2.95V and I didn’t get consistent results.  I’ll have to explore this further as my end goal is to run this off batteries.

Serial_Monitor_SettingsWith an empty sketch on the UNO, I am communicating with the WiFi via the Arduino IDE Serial Monitor.  I found the settings in the bottom right drop-down boxes had to be “Carriage Return” and “57600 baud” in order to do anything.  When I power up the WiFi module by reconnecting the power, I receive scrambled text followed by “ready”.  Changing the connection speed did not decrypt this text.

GÄZ?Q@@HdI?wÌQ;k#P@æoÔWZ5?F?DTVi`\ dH`HP@%mhL `FèWe!?@GñZcHTQUw_H7¢Duc
`\Âm`HP@%mhKhFèWe!@GñZcI¢Dg¦k`\Yo`@cIèWe!ÙDuc
`\ÂmtSP@%mlIP@æodHÄZcJTQUw_H=]TQ¦k`\Yñ
ready

I tried the AT+RST command to reset the module and I began receiving garbled output that keeps repeating.  I couldn’t enter any commands at this point.  I changed the settings to 115,200 baud to view it.  Keep in mind you have to change it back to interact with the module.

Garbled Text that was repeating:

@·?gC))h$
¤?ßµ!??9«l&Â?¤)!ÀçB(?B)© 9(-¨ Î??Â?Æ?1Ç÷CyëÃ??ÄÕ!)© ä¤B$øo)'?Æ?D£äÿøö¡bÃ)ùìÃB(Õ#ëÄÄ9k*$ùÃ)'?cí£æÿC¸ö ÿ?¦þ
ready

Here is that same section after changing settings to 115,200 baud:  Notice that the last line is the garbled version of “ready” I presume.

wdt reset
load 0x40100000, len 28400, room 16
tail 0
chksum 0x33
load 0x3ffe8000, len 2516, room 8
tail 12
chksum 0x5e
ho 0 tail 12 room 4
load 0x3ffe89e0, len 3120, room 12
tail 4
chksum 0x6e
csum 0x6e
æ???fxx?f???

I’m not sure what all that actually means, another user had similar results but different room #’s etc.

Alright, so unplug the power and get back on with it.  Power back on, scramble message appears then “ready”, AT gives OK.

AT+CWLAP (List access points) gives:

AT+CWLAP

+CWLAP:(0,"",0)
+CWLAP:(3,"TheBogueRat",-51)
+CWLAP:(3,"PantherPride",-90)

OK

AT+CWJAP (Join Access Point) gives:

AT+CWJAP="TheBogueRat","meSmileyFace"  (not my actual info, btw)

OK

Now I check the IP address assigned to the module

AT+CIFSR
192.168.1.33

I checked my router and I can see the DHCP Discovery process but not the IP in the list of connected devices.

Sep 10 21:48:06 dnsmasq-dhcp[304]: DHCPDISCOVER(br0) 18:fe:34:97:c6:6d
Sep 10 21:48:06 dnsmasq-dhcp[304]: DHCPOFFER(br0) 192.168.1.33 18:fe:34:97:c6:6d
Sep 10 21:48:06 dnsmasq-dhcp[304]: DHCPREQUEST(br0) 192.168.1.33 18:fe:34:97:c6:6d
Sep 10 21:48:06 dnsmasq-dhcp[304]: DHCPACK(br0) 192.168.1.33 18:fe:34:97:c6:6d

The DHCP Lease shows the WiFi Module as having a * for the Hostname.

Hostname IP Address   MAC Address       Expires
*        192.168.1.33 18:fe:34:97:c6:6d 23:45:16

Then I can disconnect and reconnect with pretty much the same results.

I can successfully ping the module via the Router’s Network Tools but not from the Win7 cmd prompt.

TCP Server Mode

I was looking around at the existing Arduino WiFi libraries and found an example of establishing a TCP server and connecting via PuTTy.  My attempt to reproduce the procedure is outlined below.

As described above, connect to your AP.  The Command, AT+CIPSERVER=1,4000 will establish a socket for communications.  1 is open, 0 is close socket; 4000 is the Port, (default is 333).  With PuTTy, login to the Host Name (IP address of WiFi Chip), Port 4000, Connection type: RAW.

PuTTY

I typed Hello and it appeared.  I typed….whoops, the connection closed down.  I reconnected with PuTTy and tried again.  Faster this time and got more text accross before it closed down again.

AT+CIPSERVER=1,4000
OK

+IPD,5:Hello  
OK
+IPD,2:
OK
(Lost connection, reopened PuTTy and tried again...)
+IPD,13:Hello, Again!
OK

+IPD,2:
OK

+IPD,15:Then it crashes
OK

+IPD,2:
OK

+IPD,9:Possibly,
OK

+IPD,2:
(Lost connection again.)

 

Back on the Serial Monitor, AT gives OK.  A third attempt to connect with PuTTy repeatedly timed out. I tried establishing the server again but it returns “no change”.  I tried to close the socket server with AT+CIPSERVER=0,4000 and it returns “ERROR”.  I tried to close the connection with “AT+CIPCLOSE” and it returns “we must restart”.

AT+CIPSTATUS gives the following:

AT+CIPSTATUS
 
STATUS:2
+CIPSTATUS:0,"TCP","0.0.0.0",4000

No IP listed, possibly my problem lies somewhere in that.  Will come back to this on another day.

 


 

Keep an eye on the Hackaday.io page as they’ll be much more active on this than I will.  In fact, I’ll probably just parrot much of what they have discovered.

This is a long way from where I would like to be but a good start with new hardware.

My desired end state is to be able to send data from the arduino to MySQL via .php.  Or more simply, to send an HTTP request at a minimum and parse the reply if possible.