Thursday, December 25, 2014

XBee-fy the ESP8266 WiFi module

With the new ESP8266 module, adding WiFi to any Arduino project became a lot cheaper.
This module has a serial interface; therefore it only requires connecting 4 pins: Tx, Rx, 3V3 and Ground, as shown in this image.

A few peculiar facts about ESP8266:
  • default serial baud rate is 57600; since this rate is too high for SoftwareSerial library, a hardware port should be used;
  • requires 3V3 for power and level shifting for Rx signal (5V to 3V3);
  • physical interface is a 2x4 pin male header;
  • firmware can be upgraded to a version that allows 9600 baud rate;
  • can be used either as client or server.
The first two characteristics makes it a perfect candidate for a module with an XBee footprint, as is WiFly, for example.

It took me about half an hour to do it, following these steps.
  1. cut a piece of 2-mm perfboard to the XBee dimensions;
  2. solder two 10-pin the 2-mm-spaced male headers on the sides;
  3. desolder (using wick) the 2x4 header;
  4. mechanically attach the header-less ESP8266 module to the XBee perfbord, by soldering 4 pins into the corner holes, aligned with holes in the perfboard;
  5. wire the pins 1, 2, 3 and 10 of the Xbee-type module to pins Vcc, Tx, Rx and Gnd of the ESP8266 module respectively.

And now a few photos. Start with these (XBee shown for comparison purpose):


to make this:



Then plug it any Xbee socket, like one on Wise Clock 4:


or Adafruit XBee adapter:


Hopefully now more people can try adding new WiFi features to their Wise Clocks without breaking the bank (paying $35 for WiFly).

8 comments:

  1. What firmware do you use on ESP8266? I tried with AT and Nodemcu, but without any results - my esp8266 not respond to Arduino script for Xbee module

    ReplyDelete
  2. Version 0.9.6, as described here:
    http://timewitharduino.blogspot.ca/2015/03/wifichron-with-software-support-for.html

    ReplyDelete
  3. Hi just got an esp8266 wee wifi module, the question I have, is it just a case of plugging it in and add my wifi details to the sd card, or is there some code I have to change, as it doesn't seem to be working

    ReplyDelete
    Replies
    1. It's not plug and play, unfortunately.
      You will have to re-compile the code after you un-comment this line in UserConf.h:

      //#define WANT_ESP8266

      Delete
  4. Already done that but for some reason its not connecting to my wifi, dose it matter what firmware is on the esp8266?

    ReplyDelete
    Replies
    1. Did you specify the network ID and the password (in message.txt on the SD card) as described here?
      http://timewitharduino.blogspot.ca/2016/02/new-wise-clock-4-software-release.html

      Delete
    2. It also matters what firmware is installed. The module should be (it is by default) set up on a baud rate 38400. The current software (as far as I remember) will try 9600 in case 38400 does not work.
      The logic is in file ESP8266.cpp (it includes the commands sent to the module, which you can try to send manually, in case you want to make sure the module works as expected).

      Delete
    3. Thanks for the help, have got it working and updating the time, just have to figure out how to adjust for the 4 seconds difference

      Delete