Programming an ESP8266 as an Arduino to send data to dweet.io

This article will describe how to program the ESP8266 IoT board to make HTTP Post requests to http://dweet.io.

Parts List

Breakout Board $0.22

ESP8266 Chip $2.59

USB FTDI Programmer $1.99

Total price: $4.80 and if you already have a USB FTDI board it’s only $2.81.

I’ll let that sink in for a moment.  For $2.89 you can connect to your Wifi and communicate to a server on the internet.  The ESP8266 that I bought from TaydaElectronics has 8 GPIO pins available for interacting with the physical world.  In this example we will not be using the GPIO.  Instead we will periodically send a message to dweet.io that the device is alive.  Below you will see images of all the parts.

ESP8266 ESP-12 Buy it here.

ESP8266 Breakout Board Buy here.

USB FTDI Adapter Buy here.

Connecting the ESP8266 to the FTDI adapter for programming.

After you have soldered the ESP8266 to the breakout board and installed the pin headers you are ready to program the micro controller.

connect_ftdi_to_esp8266

Solder a female jumper wire to the 3V3 point on the FTDI connector.  Connect this to the VCC pin on the breakout board (lower left pin).
Solder a female jumper wire to the RTS point on the FTDI connector.  Connect this to the REST pin on the breakout board (top left pin).

Next, connect the rest of the pins from the FTDI header to the ESP8266.

DTR from the FTDI connects to GPI00.
GND connects to GND.
RXD on the FTDI connects to TXD on the Breakout Board (BB).
TXD on the FTDI connects to RXD on the BB.

This configuration is called the Programming Configuration.  When in this configuration your device will be detected by the Arduino IDE and can be programmed.

screen-shot-2016-12-21-at-9-00-30-pm

In the Arduino IDE select the ESP8266 board from the Tools | Board menu.  Also, after you connect the USB FTDI adapter to your computer you should then have a port named /dev/cu.SLAB_USBtoUART select that port.  If you do not have the ESP8266 board please go to the Board Manager in the Arduino IDE and download the board definition.

Open the Ardunio IDE INO file below or cut and paste the following code into the IDE.

dweet-from-esp8266-example-ino

Be sure to change the your-ssid, and your-password with the appropriate values for your wifi network.  Also, the your-thing-name will be the device name that you are posting data to on dweet.io.

When you compile and upload this to your device you can then unhook the REST and GPI00 pins then power cycle your ESP8266 by removing the GND and reattaching it.  Within about four seconds the dweet.io url for your device should start showing data: https://dweet.io/follow/your-thing-name

 

Leave a Reply

Your email address will not be published. Required fields are marked *