Why would you even want to make a flame-shooting, talking, internet controlled pumpkin?
For the past couple of years several IoT hackers in my area would show off our coolest halloween projects at conferences and meetups. These projects are perfect for learning since its a fun way to learn new technologies and put them into a finished product rapidly, and if it fails who cares it's just halloween props. This year was a combination and continuation of my previous two years projects using a single microcontroller since I wanted to learn more about the esp8266 and Elasticsearch.
What gave you the idea?
Two years ago I made a flame shooting pumpkin with an arduino that used a Kinect to shoot a flame as people came by. (A safe distance away)
The next year I created a "Pumkin King" which was an android app running on an udoo dual and a bluetooth speaker / mic combo that used google now and a siri like webservice to talk to passers by:
With those two projects under my belt I felt like I needed to combine the two in some way. A flame-shooting talking pumpkin sounded cool anyway right?
How does it work?
There are several parts to this setup: the hardware, ESP8266 firmware, a mobile web-app, a local python script, an Amazon Dash Button, and a cloud service.
For the hardware I chose an ESP8266 Huzzah from Adafruit. I chose that flavor of ESP because having played around with ESP for awhile this one came with a power regulator and nice breadboard breakouts something lacking on a lot of ESP modules alone. I used a common transistor circuit to connect the ESP to a Glade auto-sprayer, and an ISD1820 for playing back a pre-recorded message. Instead of integrating the grill igniter from the first flaming pumpkin I chose to use a candle for a constant and silent source of ignition (the grill ignitor was cool but had to be strapped to the pumpkin and made a really loud sound before the flame. I wanted to be able to pass this one off as a regular pumpkin.
The basis for the firmware I used came from Adafruit. They already had a sample firmware that connected to an endpoint and pulled the data into a string all I had to do was add a bit of parsing to it to get a boolean value from a json result set. The sample firmware from Adafruit can be found here:
For the mobile web-app I just needed something to make a post request to Elasticsearch in order to store whether or not the pumpkin should fire. This was a simple jQuery Ajax request to the elasticsearch endpoint. This allowed the firmware to poll elasticsearch to get the last recorded document and parse whether it should fire or not.
Pumpkin Mobile Web-App. When on the pumpkin showed a flame
The python script and Amazon Dash button go together A full writeup and video on how to hack the Amazon Dash Button to do your bidding is located here:
I used this as a basis and just had it make a post request to the Elasticsearch endpoint to turn on the pumpkin, wait for 5 seconds and send another to post an off message.
The cloud service I mention is actually Amazon Elasticsearch Service. It allows you to bring up an instance of Elasticsearch and Kabana at the push of a button and manages clustering for you. You simply tell it how many nodes you want and it will set them up. Then you just need to setup an index and document type. After that you have an endpoint you can hit and just send data... easy peasy.
So to recap the ESP8266 polls an Amazon hosted Elasticsearch endpoint and parses a boolean from it whether to turn on or stay off. The Elasticsearch endpoint can be triggered in many ways such as a mobile web-app, the Amazon Dash Button, another ESP8266 with a motion sensor, etc. Once the endpoint is triggered (by setting the document value to 1) the next poll of the ESP8266 will fire the glade auto-sprayer and start the ISD1820 playing back a pre-recorded message. Take a look at the video below for an explanation: