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.
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.
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.
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.
- Sign up for ThingSpeak (or log in if you have an account)
- Create a new channel
- Note the Channel ID and Write API Key
- Download and install MQTT.fx.
- Configure the connection profile for the desktop MQTT client.
- Broker Address: mqtt.thingspeak.com
- Broker Port: 1883
- Click Connect to connect to the ThingSpeak MQTT broker.
- 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.
- 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.
- 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
I am preparing for my IoT talk today and researching the popularity of common IoT protocols.
I discovered that MQTT as a Google search term has taken off!