Over a million developers have joined DZone.

Cheap and Simple WiFi with ESP8266 for the FRDM Board

· IoT Zone

Access the survey results 'State of Industrial Internet Application Development' to learn about latest challenges, trends and opportunities with Industrial IoT, brought to you in partnership with GE Digital.

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 :-)


The IoT Zone is brought to you in partnership with GE Digital.  Discover how IoT developers are using Predix to disrupt traditional industrial development models.

Topics:

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}