Skip to content
An IoT Button using an Adafruit Huzzah or SparkFun Thing, push button and IFTTT
Other
  1. Other 100.0%
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE Initial commit Jul 25, 2015
README.md
esp8266_iot_button.ino
esp8266_iot_button_thing.ino

README.md

esp8266 Dash Like IoT Button using IFTTT with Captive Portal WiFi Setup

first-timers-only

Enclosure Assembly Customized Project Enclosure - Thingiverse

An IoT Button using an Adafruit Huzzah or Sparkfun Thing, a push button and the IFTTT Maker Channel (or any other http endpoint). Posts JSON data to an IFTTT Maker Channel event when the button is pressed.

I soldered male pins on my Huzzah, and added female headers to my Sparkfun Thing. The thing did not come with any headers and male headers were included with the Huzzah.

I was able to program both with my FTDI Friend, you will need to cut the default RTS jumper on the back of the FTDI Friend (used by the Huzzah) and connect the DTR jumper to program the thing. Once cut it has been pretty easy to switch back and forth by soldering the jumpers as needed.

I still need to write some sleep code to be more efficient on battery use.

Enclosure Assembly

The built in battery and charging circuit on the ESP8266 Thing really makes it easy to work with. By cutting the DTR trace on the bottom of the board and installing pins for a jumper I am able to program the thing with the jumper installed, and debug over serial with it removed.

Enclosure Assembly

Since flashing the device each time to configure WiFi was a pain I added some code that creates an Access Point and allows the user to configure the wireless network via their mobile device. I created a slimmed down version of base css to style the pages served by the ESP8266.

I used an interesting hack I ran across, it serves the WiFi configuration page for any requests that result in a 404(Not Found) HTTP code creating a captive portal (like you seen in hotels or guest networks). By returning the configuration page for 404 requests it allows easy configuration no matter what page your mobile device OS requires. Once the device is connected a status page is available to check on your button and reset WiFi settings if necessary. This works perfectly on iOS devices and has been hit or miss on Android. On Android if the captive portal does not work automatically you can always hit the root IP of the access point to view the configuration page.

WiFi Setup

Setup

Requires an arduino ide version > 1.6.4

Set up your Arduino IDE board manager to support the Huzzah breakout board.

BOM

Adafruit Huzzah

Sparkfun Thing

Device Configuration

At the top of the esp8266_iot_button.ino file are the configuration options for the device. You will need to replace the placeholder values with your KEY and EVENT for IFTTT. You can create your own SSID name for configuration mode and you can optionally turn on a RGB LCD.

const char* AP_SSID = "ESP8266_IOT_BUTTON_SETUP";
////////////////////////
// Device Definitions //
////////////////////////
String DEVICE_TITLE = "IFTTT ESP8266 Dash Like Button";
const char* AP_SSID = "ESP8266_IOT_BUTTON_SETUP";
boolean POWER_SAVE = false;

///////////////////////
// IFTTT Definitions //
///////////////////////
const char* IFTTT_URL= "maker.ifttt.com";
const char* IFTTT_KEY= "YOUR IFTTT_KEY";
const char* IFTTT_EVENT = "YOUR_IFTTT_EVENT";
const char* IFTTT_NOTIFICATION_EVENT = "YOUR_IFTTT_NOTIFICATION_EVENT";

IFTTT Events

You will need to setup the IFTTT Maker Channel and two IFTTT recipes, one for the button event, and one for the notification that the webserver is up with WiFi SSID and IP address.

IFTTT Recipes

Enclosure

Using this awesome Parametric and Customizable Project Enclosure I made customized enclosures that fit the parts I was using for my buttons.

Customized  Project Enclosure

Customized Project Enclosure - Thingiverse

Requirements

You can’t perform that action at this time.