Cheap and Simple WiFi with ESP8266 for the FRDM Board

How cool would it be to add WiFi support to any projects or IoT? Why not using WiFi with a microcontroller which has only few KBytes of RAM and FLASH. For less than US$5? Dreams came true, and intrigued by an article at Hack-A-Day, I searched a supplier for that ESP8266 module. And this evening I have found the four ESP8266 modules I have ordered for $4.50 each from ElectroDragon in my mailbox. Of course I did not want to wait for the week-end, so I hooked it up to my FRDM-KL25Z board.

ESP8266 Module

ESP8266 Module for US$ 4.50

I already love a very similar module, the nRF24L01+ (see “Tutorial: Nordic Semiconductor nRF24L01+ with the Freescale FRDM-K64F Board“). The ESP8266 looks is similar from the size and connection header, but instead of SPI it uses UART mode with AT commands. So it is much more like one of the HC-06 Bluetooth modules (see “Getting Bluetooth Working with JY-MCU BT_BOARD V1.06“).

Main features of the module (from http://www.electrodragon.com/w/Wi07c):

  • 2.4 GHz WiFi 802.11 b, g and n
  • Supports WPA/WPA2 security mode
  • 14 mm x  24 mm module size
  • AP (Access Point), STA (standalone) and AP+STA modes
  • Simple AT commands to join router, run TCP client and TCP server
  • Built-in TCP/IP Protocol stack
  • PCB antenna

There are only a few pins needed for connecting it to a microcontroller, and by default the module features a serial UART interface:

ESP8266 Pinout

ESP8266 Pinout

The module is all using 3.3V logic levels.

  1. Vcc: 3.3V, up to 300 mA
  2. GND: Ground
  3. Tx: UART Tx of the module, to be connected to the microcontroller Rx of the microcontroller
  4. Rx: UART Rx of the module, to be connected to the microcontroller Tx of the microcontroller
  5. RST: Reset/Restart, pull to GND to restart
  6. CH_PD: Chip enable, used for flash boot and updating the module
  7. GPIO0: pulled low for update mode
  8. GPIO2: not sure yet???

The processor on the board is a Tensilica Xtensa LX3 32bit, clocked at 80 MHz, and it has an SPI flash on the module/board. There is now even a gcc port/environment for it (see http://www.esp8266.com/viewtopic.php?f=9&t=224), so if I want, I can write and update code for that module :-). So with this, I can run the module standalone, and even do not need another microcontroller. Very neat!

But to get a first response from the module, there were several problems to solve:

  1. Data sheet is in Chinese. Luckily, there are already some Google Translation version in the community (see links below)
  2. Many posts and articles mention a baud rate of 57600. But the issue is that newer modules use 115200, and of course mine was using 115200 🙂
  3. The module is rather power-hungry, some articles talk about 80 mA or even up to 260 mA (!!!!). To protect my FRDM board, I’m using a 3.3V DC-DC converter.
  4. Some posts indicate that only Vcc (3.3V), GND, Tx and RX need to be connected. Until I found a post indicating that all the other pins need to be pulled up at Vcc too.
First Setup for ESP8266

First Setup for ESP8266

And finally, the module responded to my AT command: I send “AT\r\n”, and it responds with “AT\r\n\r\nOK\r\n”, hurray! 🙂

ESP8266 Response to AT Command

ESP8266 Response to AT Command

So I’m not communicating with the world yet. But at least the microcontroller can talk to the module. To be continued…..

Links:

  1. Hack-A-Day article: http://hackaday.com/2014/08/26/new-chip-alert-the-esp8266-wifi-module-its-5/
  2. Hack-A-Day project: http://hackaday.io/project/2879-ESP8266-WiFi-Module-Library
  3. ESP8266 Forum: http://www.esp8266.com/
  4. AT command overview: http://www.electrodragon.com/w/Wi07c
  5. NURDs page on ESP8266: https://nurdspace.nl/ESP8266
  6. First impressions on the ESP8266 module: http://rayshobby.net/?p=9734
  7. Using the ESP8266 module: http://www.instructables.com/id/Using-the-ESP8266-module/?ALLSTEPS
  8. GCC for ESP8266: http://hackaday.com/2014/10/02/gcc-for-the-esp8266-wifi-module/
  9. Module at iteadstudio: http://imall.iteadstudio.com/im140905002.html

Happy WiFi’ng 🙂

10 thoughts on “Cheap and Simple WiFi with ESP8266 for the FRDM Board

  1. Great find Erich. Was starting to look for a solution for a school project I put together and have to manage, this one is going to grow. Thanks for the post and the fact it will work.

    Like

    • Yes, this ESP8266 seems to get viral all over the place. It perfectly hits a common need, and compared to other solutions it costs only a fraction of it. Yes, I will not be usable to host a complex and very fast web server. But it is a cheap and simple way how to implement small sensor gateway to the internet.

      Like

  2. Got one of these too, managed to get as far as getting an IP address from AP using AT commands, whenever i tried to open a port as either client or server got some errors :(.
    Have now built the tool chain, and using that built the IoT example code, ready and waiting to flash it, but the module is out in my garage and I’m off to bed now, a bit of fun for tomorrow evening.

    Like

  3. Pingback: Tutorial: Web Server with the ESP8266 WiFi Module | MCU on Eclipse

  4. Pingback: Apresentando o módulo ESP8266 - Embarcados - Sua fonte de informações sobre Sistemas Embarcados

  5. Pingback: Apresentando o Módulo ESP8266 | André Curvello

  6. Pingback: ESP8266 - podłączenie i aktualizacja firmware Ostatnio na blog... | Sputnik

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.