« Build ideas: IoT #Christmas lights
With Christmas around the corner, I decided to get in the holiday spirit by decking the halls. Well, I didn’t deck the halls, but I did deck my desk. Using a Raspberry Pi and a blink(1) dongle I created a little Christmas light to bring some holiday cheer to my workspace. The Pi polls Twitter for all “#Christmas” tweets and alternates the color of the blink(1) between green and red for each tweet in the data stream.
Expert: 10 minutes
Beginner: 30 minutes (set up Twitter credentials, download blocks, set up service)
Why would you use nio create this project?
nio is the perfect IoT tool for this project. The concept of “everything is a signal” allows for a streaming API to control a piece of hardware using the nio System Designer’s streamlined logic. Simply get the tweets and use those signals to drive the hardware control. Three blocks are all you need to get it working!
Service level view
Instance level view
The blocks used are: one that generates signals, one that inspects signals, and one that controls hardware based on those signals.
The service begins with the Twitter Block. This block polls Twitter, using API credentials you set up, for any tweets matching the configured query parameters. Using my Twitter credentials, I simply set the block to query tweets that include “#Christmas”.
The second block will inspect the signals (tweets) returned from the Twitter Block. This is the Counter Block which appends a count of the number of signals passed through it. The Counter Block will append “count” for the number of signals passed through it at one time, and “cumulative_count” for the total number of signals that it has ever received. The cumulative_count field will be useful for the next step!
The final part of the service will take the signals passed down to this point and control a piece of hardware based on the content of the signals. This is the Blink1 Block which controls the color of a blink(1) dongle. This block allows us to set the color using an RGB color code. The cumulative_count from the Counter Block will be used to alternate the color between green and red depending on if the count is even or odd.
blink1 block configuration
Any advice you would want to give a customer when recreating this project?
I encourage anyone who wants to recreate this to think outside the box. Streaming data like tweets could be used for any kind of innovation. This example is a really fun start, but could be expanded in so many ways!
Take the Christmas theme further and connect Twitter to the lights on your Christmas tree or outside your house!
Scaling nio to an enterprise-level adoption:
Social media has become a growing method for customers to request support from companies online. nio can be implemented as a way to automate responses for people tweeting to you. This reduces the need to have around the clock support at the ready for social media and provides quick resolution times for your customers. nio could respond to all tweets appropriately or escalate support requests to the appropriate people creating a more efficient customer support experience.