GithubHelp home page GithubHelp logo

peekpt / esp8266button Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garthvh/esp8266button

0.0 2.0 0.0 20 KB

An IoT Button using an Adafruit Huzzah or SparkFun Thing, push button and IFTTT

License: MIT License

Arduino 100.00%

esp8266button's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.