Real-time Colors on CheerLights

CheerLights now supports the MQTT protocol. This means that devices and apps can receive real-time updates to changes in the CheerLights color without polling for the latest color.

How to use MQTT

Connect your device to mqtt.cheerlights.com:1883 and subscribe to the “cheerlights” topic. When the CheerLights color changes, the color name will be streamed to your device. You no longer have to poll for the latest CheerLights color on the ThingSpeak API.

Here are the valid color names:

  • red (#FF0000)
  • green (#008000)
  • blue (#0000FF)
  • cyan (#00FFFF)
  • white (#FFFFFF)
  • oldlace / warmwhite (#FDF5E6)
  • purple (#800080)
  • magenta (#FF00FF)
  • yellow (#FFFF00)
  • orange (#FFA500)
  • pink (#FFC0CB)

Check out the CheerLights API documentation for more detail.

Star Wars R2D2 Lamp on Twitch

This news is just in time for an R2D2 Lamp live streaming on Twitch.

(My) History of the Internet of Things

Back in 2007, Jason Winters and I started working on what would become ioBridge, RealTime.io, and ThingSpeak. The phrase “Internet of Things” got added to the discussion when Richard MacManus resurrected it from the RFID days in the late 90s and applied it to companies like ourselves in a 2009 article in the New York Times. Jason and I had experience with projects going viral such as a remote-controlled tractor with a webcam and an aquarium with real-time controls and monitoring. “Jason’s Fishcam” had sensors reporting temperature on a webpage and an interactive gator inside the aquarium. People used to watch the fish and control the gator mouth.

Jason’s Fishcam (January 2006)

The “Slashdot Effect” used to crush our homespun servers and render our projects useless for a period of time. Jason had the idea of moving the “control” part of our projects to the web. If all commands routed to and from a web server instead of going directly to a device, then we could control which commands went through, secure the connections using SSL, create access lists, and change things on the fly. This idea became our obsession for over a decade with several patents, licenses, open source projects, and customers from all over the world to show for the effort. We still work on large-scale IoT, Internet of Things for short, projects and have helped companies of all sizes reduce costs, predict equipment failures, and bring about connected products that serve a purpose.

“Twitter for Things” Demo App

When I first heard about Twitter back in 2006, I thought this is a perfect idea for things. Why would a human want to post short statues? Devices have a lot to say. “The HVAC system just turned on.” “The conveyor is drawing 3.1 amps.” “SYSTEM FAILURE: Code 87643.” If a web application could capture these messages, then the messages could be used for analysis. Jason and I started ioBridge in July of 2008 and built a scalable out-of-the-box solution plus a hardware dev kit. The only issue is that we only knew 30 people that were interested in the aquarium project. We sent an email to all 30 people and one person named Pete purchased a dev kit. He built a monitoring system for large aquariums in the Baltimore area. The next wave of users and customers didn’t come until Stephen Myers created an interactive pet treat dispenser for his dog. Stephen didn’t have an aquarium, but he did have a dog. Everything is a remix. Stephen blogged about his project on December 3, 2008, and his project got picked up by “The Unofficial Apple Weblog” since he used the iPhone as the controller.

iPhone Controlled Pet Treat Dispenser (December 2008)

To demonstrate the idea for a “Twitter for Things” to investors, I created @MyToaster – a Tweeting Toaster that used our system to send status updates about whether or not it was toasting. I followed Stephen’s idea and blogged about the toaster with my article, “Social Networking for My Toaster” on December 8, 2008, and described in detail how to build your own connected appliance. A few days later, Priya Ganapati picked up the story of MyToaster and wrote an article for Wired Magazine. This project and our company… took off.

First MyToaster Article in Wired Magazine (December 2008)

The toaster allowed me to start conversations with product manufacturers and designers that had ideas for new products. I worked on a number of consumer products and industrial systems that all use the same technology that Jason and I created. The Amazon Echo wouldn’t be possible if the Echo device had to understand all aspects of speech and user intents locally. The web allows Echo to tap into a huge data set that enhances its functionality. ThingSpeak is still going strong. You can still sign up today for a free, non-commercial account and join a community of over 350,000 developers around the world that are all learning about IoT and building new IoT applications.

ThingSpeak System Diagram (December 2010)

Fast forward 10 years, and we are still working on the same thing, but the things are now factories, agricultural systems, windmills, and space probes. I was really happy when Katie Blackley from Pittsburgh’s NPR New Station asked me for an interview and an update regarding the MyToaster that started my journey. It has been 10 years and the toaster still works. It is now outfitted with a Particle Photon and uses the ThingSpeak web service to update its thousands of followers. I am glad she reached out to me as it caused me to reflect a bit about the journey and prompted me to share my history of the Internet of Things.

Appendix: MyToaster

MyToaster has been popular on its own for a long time. I have gotten requests to talk about the toaster on news stations, interviews for magazines, and to have the toaster brought to IoT conferences. Every trade show we did had MyToaster on display. The “touring toaster” was a stand-in and took a lot of abuse over the years.

Another significant event for MyToaster is when the Washington Post posted an infographic on “The Marriage of Appliance and Internet“.

They listed that MyToaster from 2008 was a significant event that shaped “Connected Appliances” and “Consumer Internet of Things Products”.

2008 – @mytoaster joins Twitter. It’s a toaster that Tweets. Hans Scharler rigged up his toaster to his Twitter so the appliance Tweets one of two things: Toasting or Done Toasting.

Time Logo

A man in Pittsburgh, Pennsylvania has rigged his toaster to tweet “Toasting” or “Done Toasting” with each use, and — despite the account’s lack of variety — has gained more than 2,000 followers.

In order to further connect us with our possessions, Scharler and his friend Jason Winters created a platform for developers called ThingSpeak— a sort of Twitter for things — that lets objects send messages, broadcast their location, graph their temperature, and more.

 / Time

Wired Logo

“Tweeting appliances speaks to this whole ‘internet of things’ idea,” says Hans Scharler, a tech consultant who also writes comedy material. “If your appliances were outputting information, it can always go to a database. But we love to share information. So why not find a way to do that?” Scharler found online fame for his twittering toaster, whose tweets alternate between “toasting” and “toast is done.” @mytoaster has about 200 twitter followers.

Priya Ganapati / Wired

Control IFTTT Webhooks with MATLAB

Yesterday, I was building an integration with IFTTT and my Philips Hue lights in my office. I wanted the Philips Hue lights to change to the latest CheerLights color. IFTTT offers a webhook as a trigger, so I decided to use MATLAB to trigger the webhook. MATLAB will get the latest CheerLights color, then send it to IFTTT and IFTTT sends the color to Philips Hue.

When I created the IFTTT webhook, IFTTT presented a CURL example:

curl -X POST -H “Content-Type: application/json” -d ‘{“value1″:”green”}’ https://maker.ifttt.com/trigger/mwOffice/with/key/xxxyyyzzz

Here’s how to turn the CURL request into a MATLAB command:

webwrite(‘https://maker.ifttt.com/trigger/mwOffice/with/key/xxxyyyzzz’,’value1′,’green’);

Check out the IFTTT documentation for more information.

ThingSpeak at the Boston TechJam

I recently got the change to give a ThingSpeak IoT demo at Boston TechJam. MathWorks is one of the sponsors so we got to participate with other tech companies and over 8,000 students and entrepreneurs from Boston. My demo used MATLAB to detect multiple faces from a live stream of video. The MATLAB analysis code sends the count to a ThingSpeak channel. I used the new ThingSpeak gauge widget to show how many people stopped and participated in the demo.

To learn how to build a ThingSpeak People Counter with MATLAB, check out File Exchange. To learn about the new ThingSpeak gauge widgets, check out the MathWorks Documentation for ThingSpeak or the MathWorks IoT Blog. Thanks for stopping by!

Use the New MQTT Service from ThingSpeak for Real-time CheerLights Updates

It’s that time again. That time when people all across the world synchronize their lights together with CheerLights! People have built amazing CheerLights displays. I have seen everything from color-changing shoes to snowmen… and trees.

 

CheerLights Introduction

Here’s a quick introduction to the CheerLights project for those who are new to the project. Imagine 1000’s of multicolored lights all around the world synchronized to one color. When one of the lights turns red, they all turn red. To control CheerLights, send a tweet to @cheerlights or include “cheerlights” somewhere in your message with the name of a color. This will cause a chain reaction and all of the CheerLights displays and apps will change their color to red.

 

ThingSpeak MQTT Service

CheersLights is powered by ThingSpeak IoT. And, this year, I am happy to introduce real-time CheerLights updates using ThingSpeak’s new MQTT service. Using the MQTT service by ThingSpeak, your CheerLights change instantly. ThingSpeak has posted an example that gets a Particle Photon connected to CheerLights using MQTT. The Subscribe to Channel Updates Using Particle Photon Client example shows you how to use a Particle Photon Wi-Fi board to subscribe to channel updates from the CheerLights channel. The program displays the color read from the channel on the built-in LED on the Photon board. You can subscribe to the channel feed or directly to the color field on the CheerLights channel.

Once you learn how to use the MQTT service from ThingSpeak, you can easily adapt it to your IoT project. This is a great way to have real-time control of a device or real-time monitoring of sensors.

If you want to follow the project and see what others are building, visit CheerLights.com or follow on Twitter.

Use AWS DeepLens to Determine If Hotdog or Not Hotdog

While at re:Invent, I got to take a deep learning workshop to learn about the new capabilities of AWS such as SageMaker and Greengrass. We used a new device created by AWS and Intel called DeepLens to build an image classification model, deploy it to the device, and use the model to predict image labels. In reference to the TV show Silicon Valley, we trained a neural network to determine if the image from the video camera contained a “Hotdog or Not hotdog.” My machine learning model performed better when the hot dog had mustard on it.

Fun aside, the DeepLens device is a really powerful way to learn image and video-based machine learning and artificial intelligence. Once you get ahold of the device, you can follow the workshop by downloading the materials and code from GitHub.

How to Reset the Arduino MKR1000

I am working on a project that uses the Arduino MKR1000 with ThingSpeak. While working on my code, I uploaded a bad sketch to the MKR1000. Every time that the board powers up, it starts running my bad code over and over and appears to be stuck in an infinite loop. I tried pressing the reset button, unplugging the USB cable, reboot my computer, reinstalling drivers, and unplugging the USB cable (for good measure). Nothing made the board responsive again. I found a forum post talking about the bootloader. The user mentioned that quickly pressing the reset button twice put the device into a good state by loading the bootloader. Success!

CheerLights Robot for Your Nursery

I shared my latest project over on my Nursery Hacks website. It combines some of my favorite things… IoT, CheerLights, ThingSpeak, Particle, and building things for my soon-to-be-here son’s nursery.  I didn’t want a bright light in the nursery, but I did want to build a little CheerLights display for something in the background.

I found a Robot Nightlight on Amazon and purchased it. This little robot is a great night-light and you can change the color using the included infrared remote control. To connect this light to CheerLights, I built an IR controller that is internet-connected using the Particle Photon. The Photon subscribes to the latest CheerLights color on ThingSpeak and transmits the IR code as if the button was pressed on the remote control.

To build your own CheerLights Robot, visit Nursery Hacks for the parts and code.

Measure Wi-Fi Signal Levels with the ESP8266 and ThingSpeak

Oh, my. I am sure you have been hearing about the Internet of Things… The IoT! You might be wondering how to get started with i(o)t. There are many places to start. You might be interested in the data that devices collect and analyzing it or you might be interested in how to deploy thousands of sensors around a factory floor to better understand how efficient things are. You might just want to tinker. Be the cool person at the party talking about Arduino, Raspberry Pi, and Maroon 5. If you want to try out a “thing” – a small, connected device – that can measure data, I will help you get started with a quick tutorial using the ESP8266 “thing”.

Parts

First, you need to go by a thing on Amazon. I recommend for this project an ESP8266 compatible device like the NodeMCU. Don’t be scared. Add it to your Amazon shopping list or ask Alexa to buy you one. It’s $8.

ESP8266 NodeMCU

Other parts that you will need:

  • Laptop
  • Micro USB cable

ThingSpeak

While you are waiting for your Amazon stuff to arrive, you can learn about ThingSpeak.

ThingSpeak IoT Platform

ThingSpeak is where we are going to store the data collected by our thing and where we can see the data that we collected. Visit ThingSpeak.com and Sign Up for an account. This will just take a minute and user accounts are free. Once you have a user account, you need to create a channel. ThingSpeak channels are where data gets stored. Create a new channel by selecting Channels, My Channels, and then New Channel. Name the channel, “ESP8266 Signal Strength” and name Field 1, “RSSI”. Click “Save Channel” at the bottom to finish the process.

Channel_Settings

Arduino Setup

Once the ESP8266 comes in the mail in a couple of days you need to gather a few more things to be able to program this thing. You will need a laptop and a micro USB cable (like the one that you charge a phone with). On the laptop, we need to install some software to be able to program the ESP8266. Visit Arduino.cc and install the Arduino IDE.

Arduino IDE

Once the Arduino IDE is installed, open the program so we can do a couple of setup steps to get it ready to program ESP8266 devices. Under File, Preferences, and Additional Boards Manager URLs, add this link: http://arduino.esp8266.com/stable/package_esp8266com_index.json – this will allow the Arduino IDE to manage ESP8266-compatible boards.

Arduino Preferences for ESP8266 programming

Close and reopen Arduino. Click on Tools, Board, and Boards Manager…. to open the board manager. The Arduino IDE will load the Additional Boards URL that you entered in the preferences.

ThingSpeak Library

Arduino needs to have a library installed in order for your thing to know how to send data to ThingSpeak. In the Arduino IDE, choose Sketch, Include Library, and Manage Libraries. Search for “thingspeak” and click Install.

The thing that you bought from Amazon uses the CP2102 USB driver. You might have to install a USB driver from Silicon Labs for this to work with your computer. Connect the ESP8266 to your laptop with the micro USB cable.

USB Driver for the ESP8266 CP2102

Back on the Arduino IDE, under tools, configure the following settings:

Arduino Board Settings for NodeMCU

Whew. We got through the setup. Now we can program this device or any ESP8266 compatible device and shouldn’t have to do that again.

Programming

The code that the Arduino IDE uses is called a “sketch” – this is just a short program that the device runs over and over. In our project, we are going to have the code measure the signal strength of the Wi-Fi connection and upload the data to ThingSpeak, wait, and repeat. Over time we can see the signal strength of our Wi-Fi connection. Copy the example code to your Arduino IDE and change some of the defaults to match your Wi-Fi network and ThingSpeak settings.

Once everything is set, click Sketch and then Upload. This will take the code and program the ESP8266 with it. It takes a minute so be patient. If anything goes wrong, make sure that you have the right board settings and that your “Port” matches what your laptop thinks the port is.

Back on ThingSpeak, you should see data start to come in. You are looking for the Private View of your channel and a chart that is updating. As new dsata comes in, the chart shows the latest value. If you carry the ESP8266 around the house, you might notice the signal strength changing.

ThingSpeak_Channel

Next Steps

To take the project further, you can use MATLAB on ThingSpeak to do some data analysis. I will post about IoT data analytics on another day. The ESP8266 source code for sending data to ThingSpeak is available on GitHub.

Welcome to the Internet of Things. Let me know if you try this out and let me know if you take this project further and build something cool.

Learn How to Use MQTT.fx with ThingSpeak

ThingSpeak just announced that they added MQTT as a way to send data to a ThingSpeak channel. This is great news since a lot of devices support MQTT. If you don’t have a device, but want to try out the MQTT protocol with ThingSpeak, you can use a desktop application called MQTT.fx. In this example, I am going to explain how to use MQTT.fx to send data to a ThingSpeak channel.

ThingSpeak MQTT Broker

Setup ThingSpeak

  • Sign up for ThingSpeak (or log in if you have an account)
  • Create a new channel
  • Note the Channel ID and Write API Key

Setup MQTT.fx

  • Download and install MQTT.fx.
  • Configure the connection profile for the desktop MQTT client.
    • Broker Address: mqtt.thingspeak.com
    • Broker Port: 1883

MQTT.fx Screenshot

  • Click Connect to connect to the ThingSpeak MQTT broker.

mqttdesktop02

  • Enter the topic channels/<channelID>/publish/<apikey> to publish data to a channel feed. Replace <channelID> with the channel ID and <apikey> with the write API key of the channel. Enter the message to publish to the channel feed. This PUBLISH message publishes a value of 45 to field 1 and 60 to field 2 of the specified channel, along with a status message MQTTPUBLISH.

mqttdesktop03

  • Alternatively, you can enter the topic channels/<channelID>/publish/fields/field<fieldnumber>/<apikey> to publish to a channel field. Replace <channelID> with the channel ID, <fieldnumber> with field number that want to update, and <apikey> with the write API key of the channel. Enter the message to publish to the channel field. This PUBLISH message publishes a value of 45 to field 1 of the specified channel.

mqttdesktop04

Additional Resources

  • MQTT Basics – Learn about the publish/subscribe architecture for connecting bandwidth and power-constrained devices over wireless networks
  • MQTT Client Configuration – Learn how to set up an MQTT client to communicate with the ThingSpeak MQTT broker
  • Choose Between REST and MQTT – Learn when to use REST and MQTT to update a channel