ESP8266 Samples

"How warm is it now? How about now? And now?"

On this page

A simple test program

This test won't use any other components besides the ESP8266 chip, and assumes you have your Arduino environment set up & ready to go as described on the previous page.

This little program will connect to your wifi and then try to read the contents of http://www.homeautomationforgeeks.com/esp8266test.html.

To upload this to the ESP8266, you need to first make it ready to receive data. To do this, keep the reset button down on the HUZZAH ESP8266 and press the GPIO button. Then release both. The red LED should stay dimly lit. Now you can upload the program (which can take a while). Once it's done, you have a few seconds to open the Serial Monitor and see the output. If you missed it, just press reset on the ESP8266 and it will re-run the program.

The output of the test program
The output of the test program

A webserver to tell us how warm it is

This example shows you how to turn your ESP8266 into a simple web server that can return data from a connected DHT sensor on request. This simple setup is all you need to include a wireless sensor in your Home Automation network!

The wiring is very simple: connect power & ground as usual, and connect the data leg to pin 5 on the ESP8266. Just like in this picture:

Adafruit HUZZAH ESP8266 + DHT22 sensor
The ESP8266 on breadboard, making friends with a DHT22 sensor.

When the upload to the ESP8266 is done, you can now browse to its IP address, and you should see something like this:

A simple ESP8266 web server
A simple ESP8266 web server

Go to any of the sensor readings you defined in the code to see its output:

Temperature output on the ESP8266
It was pretty warm when I tested this

Powering this with the USB cable isn't very practical if you want to put this in another room, away from your computer. If you have a breadboard power supply, you can wire it like this:

Adafruit HUZZAH ESP8266 + DHT22 sensor + power
The same setup as before, but with a breadboard power supply added.

Go Back

Guides