[Dragonfly DIY] Arduino experiments with the ESP8266 WiFi module

First post to start exploring the ESP8266 WiFi module

Back in late 2014, Chinese chip maker Expressif burst onto the western market with the ESP8266 chip, a very (VERY!) inexpensive chip that implements a pretty complete 802.11 2.4GHz WiFi interface. The first modules available were the one on the left in this photo, with an 8 pin header which provided a simple SPI interface to processors such as the Arduino using a slow but useable AT command set.

Very quickly, makers noticed that the chip incorporated a 32 bit ARM core and that there should be a LOT more I/O available if only it were brought out to pins on the board. They started asking the company if this was possible. The company basically said "Sure, we just want to sell chips, here's the source code and the API!" and people went to town and the company is selling these chips by the bucketload now (take note, chip makers. Opening your API = more sales).

The chip is available in a bunch of configurations now. The one in the center of the photos is designed to be easy to work with on a breadboard or development kit. The one on the right is designed for compactness. All three include an antenna for WiFi connectivity. The middle one (and others that are available) also include a coax connector for attaching an external antenna.

To begin experimenting, I bought this development board for a total of $15 with the above module on it.

You can program directly for the chip, and there are also a few languages and environments that have been ported to it, but I'm going to stay with Arduino for this article.

Here is a good page with a ton of good information on this chip, including a schematic.
Here's the schematic itself, again, borrowed from the above page. Click to embiggen.

To get started, here's a page with the Arduino environment setup for this device.

I just followed the instructions on "Installing with boards manager" from the page above.

This page on github has a bunch of useful info on the Arduino port to the 8266.

I wrote a bit of code which is horrendously bad, but it does show using all of the stuff available on this development board and should be enough to get you going. I pulled in the DHT11 library from here:

Go to your Arduino installation, below Libraries create a directory called "DHT11", it's likely it will be here: C:\Program Files (x86)\Arduino\libraries\DHT11. Put Dht11.h and Dht11.cpp from the above page into that directory.

Here's the code I wrote.

Before uploading, change the ssid and pass to match your WiFi network. Set the dip switches with 1 through 6 on, 7 and 8 off. Also, to put the 8266 in bootloader mode, you must hold down S2 on the dev board when you turn it on. Then you can compile and upload the sketch.

Here's the video showing uploading the code and what it does, plus some rambling.