Building an interactive Jack-O’-Lantern with Bolt IoT

Mayank Joneja
Bolt IoT
Published in
4 min readOct 31, 2017

*Creaking doors and howling wolves* *somber voice*
Happy Halloween! ◞≼◉ื≽◟ ≼◉ื≽◟

Tweet #boltiot Jack looks #evil but has a kind soul

This Halloween, we, the hardware team at BoltIoT decided to build a project fitting the mood. We are celebrating with an interactive Jack-o’-Lantern to which users can tweet out a message containing #boltiot followed by a “hot” word like #evil, #peaceful, #loving or #harmless to set the color of our lantern.

One of the past live feeds of our Jack can be seen on (wait for a few seconds and you’ll see somebody making it “evil” :D )
https://youtu.be/NTs8v-jAxps?t=16402

(UPDATE 9/11/17: The stream is not LIVE any longer but you can see the past streams on YouTube by the same channel as the one above)

The main hardware used in this project (other than the lamp), includes:

1x Bolt module
1x Bolt USB Adapter (5V 1A)
1x 12V, 1A DC Adapter
4x 5V Relay modules
1x Christmas lights strip with Pink, White, Blue, Green LEDs.

Hardware Setup for Bolt IoT with relays and LEDs

We connected three LEDs in series and connected to each relay which was controlled by a GPIO pin on the Bolt module using the Bolt API.

The main “intelligence” of the system comes from a flow written in IBM Node-RED, an amazing graphical programming tool for IoT hardware which makes interfacing with other web services quite easy using RESTful APIs. It also supports common E-mail and Twitter triggers and actions natively.

Note: We assume you have already gone through the basic getting started flow for your Bolt device. If not, check it out at https://cloud.boltiot.com/docs in the Quick Start Guide.

TL;DR
1. Wire up the hardware as shown above.
2. Install node-red: https://nodered.org/docs/getting-started/
3. Clone Halloween flow: https://github.com/Inventrom/bolt-jack-o-lantern
4. Link Twitter account.
5. Modify Bolt Device ID in “Action” block.
6. Modify API key in “Bolt LED control” block.
7. Deploy on node-red (either locally, or on a cloud like Digital Ocean).
8. Tweet and shout “Trick or Treeeeat”!

Here are some more details of the process that was followed.

1. Wire up the hardware

The Bolt GPIO pins are connected to the input of each relay module as shown in the image. In this case, digital pins 1,2,3, and 4 are connected to the 5V relays.

The DC jack supplies power to the LEDs while the Bolt module is powered separately by a 5V,1A USB power supply.

2. Install and setup Node-RED

We used the Docker approach for our solution as explained on:
https://nodered.org/docs/platforms/docker

3. Download the flow

Once setup, on the local machine, you can open a browser and go to the Node-RED editor at:
http://localhost:1880

Each set of blocks is saved as a Node-RED “Flow”, essentially a JSON block object collection.
The flow used in the project can be found on:

Node-RED flow for Bolt JackOLantern

The flow functions in the following fashion:
a) User Tweets a public Tweet containing one of 5 words (evil, harmless, loving, peaceful, sleepy) with #boltiot.
b) Parse Tweet and if matches criteria, send out Bolt GET request to toggle LED.
c) Tweet back to succesfull tweet saying LED set, with live stream link (persist state for 50 seconds then switch off)

LED color key:
-Evil : Green
-Harmless : Blue
-Loving : Pink
-Peaceful : White
-Sleepy : All OFF

4. Link Twitter

Click on both the Twitter receive and send blocks to link them to your account (and send a tweet to @BoltKickstarter — https://twitter.com/BoltKickstarter — telling us you did :D).

5. Change Bolt Device ID
The Bolt device ID can be found on your Dashboard at https://cloud.boltiot.com/home/
Copy your device ID and replace inside the “Action” block.

Note: The public docs can be found at: https://cloud.boltiot.com/docs

6. Change Bolt API key in the GET Request
Copy your API key and replace inside the “Bolt LED Control” block. Have a look at the way the query is structured to simultaneously write states to all pins.

We use digitalMultiWrite for this purpose from the Bolt IoT API.

http://cloud.boltiot.com/remote/<YOUR_API_KEY_HERE>/digitalMultiWrite?pins={{pins}}&states={{states}}&deviceName={{deviceName}}

7. Deploy on Node-RED.

Hit the big red “Deploy” button in the top right corner. Also, ensure your flow is “enabled” by double clicking on the tab of the flow.

In case you want to deploy on Digital Ocean like we did, have a look at:
https://www.digitalocean.com/community/tutorials/how-to-connect-your-internet-of-things-with-node-red-on-ubuntu-16-04

8. Trick or Treat!

Enjoy the sweet sound of clicking relays as you tweet, laugh at the response in maddening bliss, share with your friends and family.
Happy Halloween!

PS: To know more about Bolt IoT platform, check out our website. To know what other interesting projects can be built on Bolt you can check out the Docs section on Bolt Cloud.

WE ARE LIVE NOW! Bolt is launching on 3rd of November 2017 (6:45 p.m. IST i.e. 8:15 a.m. CT) on Kickstarter.https://www.kickstarter.com/projects/boltiot/bolt

--

--