Introduction: ESP8266 & IFTTT Autobot Notification System

One day I was walking around town and I came across this brilliant looking, LED backlit Autobot logo. I thought instantly "I want to hack this" and eventually I decided that I wanted it to be a notification system for all sorts of things. I recently got my hands on some ESP8266 development boards loaded with the nodeMCU firmware. Among other things, this board can connect to or host a WiFi network and allows you to create and run lua scripts to control it's functionality.

Lets get making!

Step 1: Gather Your Supplies

For this instructable, you will need (included are Amazon links though you may do better on Aliexpress):

You will also need the following:

  • Screwdriver
  • Soldering Iron
  • Wire stripper/snips
  • Dupont cables/several lengths of wire for connections

Step 2: Disassemble the Light

First you'll need to disassemble the light. There are 6 small Philips screws holding the back plate onto the unit. Remove these carefully and set aside for later. The two sides can then be separated. Inside you will find the power connector at the bottom, with the centre positive supply connected to the switch at the top, and finally three white LEDs.

The LEDs can be removed by snipping the cables coming from the power socket and the switch, and then carefully using a blade to push them off of their plastic pillars. Save the LEDs for another project - they sure are bright!

Step 3: Add Your Circuit

I've opted for simplicity at the moment and have arranged the NeoPixel stick vertically in the centre. The three connections are GND, VCC and DIN. These should be connected to GND and 3.3V on the development board, while DIN should be connected to the D6 pin.

I've taken power from the existing cables by stripping the lead, tinning it, and then connecting the dupont cable. The cable at the power socket connects to GND, while the switch should connect to the VIN pin on the development board (do not connect to 3.3V as this will blow the ESP chip)!

Step 4: Write the Code!

I've used the Esplorer development environment for this project. I've attached some example code to get you going.

The web server on the development board will respond to any request received on port 8080 (this port can be configured in the code). I've got a static IP and have set up port forwarding on my router to forwarded the request from IFTTT to the device's IP.

To set up integration with IFTTT, create a new recipe with whatever you'd like as the trigger. For the action, use the Maker channel, and enter your home IP address as the destination, with port 8080 at the end.

Step 5: Test It Out

Once we have the code working, you can easily test the device by going to http://yourhomeipaddress:8080

Now that it's working correctly, you'll want to create a new file called init.lua to run the notification script on reboot. Otherwise you'd have to keep opening it up!

The file can be nice and simple, such as the following:

dofile("NotificationSystem.lua")

I prefer to use a timer to load the file, just in case it gets caught in a loop (I don't want to have to keep flashing the firmware):

tmr.alarm(0, 100, 0, function() dofile("NotificationSystem.lua") end)

This will give the device 100 micro seconds to pause execution of the script. Just enough time for it to pause and overwrite the init file, for example!

Save the line of code above into a new file on the device called init.lua and reboot. It should go straight into the program

Step 6: Thinking of the Future

Obviously there are several improvements that can be made. Here's my list for the future:

  • Move everything onto a PCB at the bottom
  • Use a raw ESP module so I can get my development board back
  • Add in new light modes and a button or sensor to change between them
  • Add different forms of notification flash, with triggers based on the URL called or JSON in the request
  • Add a piezo speaker to produce sound along with the notifications
  • Write another lua file to bootstrap the notification program and download any changes I make remotely

Comments

author
damavox. (author)2016-03-04

I am currently looking for a way to control these: " http://www.amazon.com/Luma-Candles-Flameless-Remot... " IR Led flameless candles and make them flash a different color depending on the event I.E. raining outside they flash blue, New email = red...

Maybe IR hat and tasker app?

What are your thoughts?

author
DanielF24 (author)2016-02-26

Planning to make a similar project based on this design (but without the Autobot)! I'm pretty new to electronics projects--is this still powered by a USB plug? Did you just expose the USB port on the controller, or are you still using the plug from the original lamp?

author
seamster (author)2015-08-20

Very cool! What kind of notifications will you use this for?

author
Pjtheman (author)seamster2015-08-25

At the moment I'm using it with a filter for emails I consider to be urgent, though I want to add some more "effects" to signal different things. I'll tie it all together with a bunch of other devices once I move to signal things like the doorbell ringing and so on (at which point it'll be in the garage/office rather than the house).