Using Adafruit HUZZAH ESP8266 to add WiFi to mbed LPC1768

/media/uploads/ausdong/chip.png

Adafruit HUZZAH ESP8266

The ESP8266 is an inexpensive and complete Wi-Fi chip. Adafruit’s HUZZAH ESP8266 breakout is breadboard friendly with some extra features such as shielding against RF emissions. It currently costs $9.95 directly from Adafruit. This document first shows how to wire up the HUZZAH ESP8266 with an mbed LPC1768, and then shows software info and some demo programs. The first demo is a configuration program that allows specifying SSID and password and then just prints out some info while looping. The second demo program uses the wifi chip to create a TCP server that allows simple mbed control and displays some information. In the end, there is a video showing the mbed control program working.

/media/uploads/ausdong/schematic.png

Wiring

For our purposes, we just need to hook up power, ground, and the two serial pins. No reset pin.

Warning!

1. This chip draws too much current (5V 500mA) to use mbed’s USB power supply and will need an external 5V power source.

2. There are two GND pins on the Wi-Fi board.

Huzzahmbed LPC1768External 5V DC supply >=500MA
gndgndgnd
TXRX-p27
RXTX-p28
V+5VDC

/media/uploads/ausdong/wiring.png

Code Demos

The HUZZAH chip uses NodeMCU firmware, which runs the Lua scripting language. There is documentation available for NodeMCU, and you can find NodeMCU-specific commands here.

For these demos, you should have a terminal program (Tera Term, putty, etc) running on your PC at 9600 baud. When the HUZZAH chip receives a restart command, it'll send out a line of garbage at a different baud rate before setting to 9600 baud. You will need to have access to a wireless network for the chip to connect to. A good program for creating a wireless access point with a Windows PC is Virtual Router.

Note: Wireless Frequencies

The ESP8266 chip only supports 2.4 GHz access points.

The first program configures the HUZZAH chip and connects to a wireless access point. There are "SSID" and "password" fields that need to be changed to connect to your access point. After configuring and connecting, the program just repeatedly prints out detected access points and the IP & MAC addresses.

Import programHUZZAH-ESP8266-configuration-LPC1768

Setup and test the Adafruit HUZZAH ESP8266 Wi Fi SOC. Sets SSID and PASSWORD and prints status messages. For use on mbed LPC1768. See https://developer.mbed.org/users/ausdong/notebook/using-the-adafruit-huzzah-esp8266-to-add-wi-fi-to-/

After your setup can successfully connect, you can try the second program below. It creates a web server that shows some info from the mbed and allows you to control the onboard LEDs. You will need to use a terminal application to find the server's IP address, which can then be used in a web browser to access the webpage that communicates with the mbed.

Upon starting the program, in your terminal application you should see the mbed send a bunch of commands to ESP8266. After several seconds, the terminal application will show " ++++++++++ Ready ++++++++++" followed by the IP address, as shown below:

/media/uploads/ausdong/terminal.png

Enter the IP address in a web browser. At the web page, you can see the hit count and time of last hit (not accurate; only based on mbed RTC). The web page also displays two analog pin values, which will fluctuate because of noise. To control the mbed LEDs, check a box and click 'send-refresh'. The corresponding LED will turn on/off.

Import programHUZZAHESP8266-web-control-LPC1768

For Adafruit HUZZAH ESP8266 Wi Fi chip on the mbed LPC1768. Sets up a web page server that can control a mbed onboard LEDs. Need to configure Wi Fi SSID and PASSWORD first with another program (one time only). See https://developer.mbed.org/users/ausdong/notebook/using-the-adafruit-huzzah-esp8266-to-add-wi-fi-to-/ .

/media/uploads/ausdong/webpage.png


4 comments on Using Adafruit HUZZAH ESP8266 to add WiFi to mbed LPC1768:

11 Apr 2016

This is perfect!

27 Apr 2016

Is there a way that I can call a website from the mbed, for example: "google.com"?

28 Apr 2016

Why does adding the "rtos.h" library stop your program from working?

30 Mar 2017

kushagra brahmbhatt wrote:

Is there a way that I can call a website from the mbed, for example: "google.com"?

sure, that is possible.

Please log in to post comments.