Electrodragon ESP8266 (Wi07C) Module Notes

I recently ordered up a few of those super-cheap ESP8266 wifi modules.  These have an 80211 b/g/n Wifi with WPA/WPA2 support, are super small and have a fairly powerful CPU on board (more powerful than that Arduino I am hooking it up to).  I ordered my modules from Electrodragon and they came super-fast (and even shipped from state-side).  For ~ $25.00 I got 4 pieces shipped to my door.  In hindsight I should have ordered a couple of the modules with all the GPIO pins exposed.  The first order of business is interfacing.  These modules utilize a 3.3V power supply and IOs.  I utilized my $17.00 Arduino Mega with 3.3v selector to be voltage compatible instead of setting up voltage dividers.

There are 5 critical pins needed to get this working:

  • GND – Connect to Arduino GND
  • VCC – Connect to Arduino 3.3V VDD
  • UTXD – Connect to Arduino Mega RX1
  • URXD – Connect to Arduino Mega TX1
  • CH_PD – Connect to Arduino 3.3V VDD

If you do not connect the CH_PD (Chip Power Down – active low) you will not be able to communicate with the module.  After the connections are made you need to load a simple sketch to test out your modules.  I wanted to enter in AT commands to initialize and connect via the serial monitor so I could play with the module in realtime.  This is what I came up with:

#define BAUDRATE 9600

void setup() {
  // Initialize both serial ports
  Serial.begin(BAUDRATE);
  Serial1.begin(BAUDRATE);

  Serial.print("UART TEST");
}

void loop() {
  // Read from port 1 and send to port 0
  if (Serial1.available()) {
     int inByte = Serial1.read();
     Serial.write(inByte);
  } 

  // Read from port 0 and send to port 1
  if (Serial.available()) {
     int inByte = Serial.read();
     Serial1.write(inByte);
  }
}

Some trial and error was required to determine what baud rate would work with this module. I started with 115200 then worked my way down until I found one where AT+RST would return the ready string. Turns out that the particular version of module I received had firmware 0.92 (as reported by the AT+GMR command). At this buadrate it may be possible to interface with a stock arduino using the software serial library in similar fashion so long as the IOs are properly protected. I started issuing commands and connecting to my network:

AT+RST

OK

<junk characters>
<junk characters>
[System Ready, Vendor: www.ai-thinker.com]

AT+CWMODE=3

OK
AT+CWLAP
+CWLAP:(3,"MYSSID",-67,"xxxxxx:,6)
+CWLAP:(1,"NEIGHBOR1",-82,"xxxxxx:,6)
+CWLAP:(4,"NEIGHBOR2",-86,"xxxxxx:,9)
+CWLAP:(0,"MYSSID2",-46,"xxxxxx:,11)

OK
AT+CWJAP="MYSSID","PASSWORD"

OK
AT+CIFSR
192.168.4.1
192.168.1.118

This accomplishes the following:

  • Reset the module
  • Setup the module as an access point and a station
  • List the available access points
  • Join the access point “MYSSID”
  • Return the IP addresses of
    • The access point
    • The address of the module on the home network

In many cases the module should simply be initialized as a station (mode 1).  In this case AT+CIFSR only returns one IP address, the IP of the module on the network it has joined.  This is the basic setup and communication.  If we you can get this far the possibilities are endless.  I’ll be doing more development on this platform and will continue to document  any issues I encounter and possible work-arounds.  The next step is to get a basic web-page GET/POST working along with utilizing the CH_PD to conserve power when not transmitting/receiving data.  That can be used to further control a remote platform, collect data and log it or to monitor overall network connectivity.  I think I also need to purchase an FTDI friend or similar so I can play with some custom firmware on one of these modules.