Team Sidney Enterprises

Hacking & Snacking since 2018

Home Our projects Blog About us

Blinky - The Cloud-Controlled LED Light Display

Blinky GIF Blinky hardware

Blinky is a cloud-controlled, programmable home light display based on the amazing Feather HUZZAH32 developer board and DotStar LED strips, both from Adafruit.

Hardware

For this project, you will need:

We have found this setup works fine using 3.3V signals from the Feather to the DotStar (although technically the DotStar requires 5V).

Software design

This project relies heavily on Google Firebase to synchronize the Feathers and the web interface. Indeed, with this setup you do not need to run a web server of your own – the Feathers fetch their configuration directly from the Firebase cloud servers. The web interface can be hosted anywhere that serves up static web pages – such as GitHub Pages – since it does not store any state on the web server itself, nor does it require server-side scripting.

The web interface has JavaScript code to write the configuration for each Feather board to a Firebase database. Each Feather board periodically reads its configuration from Firebase using the Firebase REST API, and uses this information to animate a pattern on the LED strip.

In this setup, write access to the Firebase database is limited to certain users (which can be configured in the Firebase console), so only certain authenticated users can change the device configs. However, read access is global, so that the Feather devices need not use auth credentials. (It is likely possible to achieve this using OAuth, but I am being lazy.)

Firmware

The device firmware is an Arduino sketch (Blinky.ino) that uses the Adadfruit DotStar library as well as the Feather HUZZAH32 built-in WiFi and HTTP client libraries.

To run the code on your own devices, you need to configure several things in the code:

After editing these lines in Blinky.ino you can program the Feather and connect the DotStar strip. When the device powers on, it will sweep through red, green, and blue patterns on the LED strip to test that the hardware is working. It will then periodically (every 10 seconds) call into Firebase to fetch the config it should be using. If no config is available, the LED strip will turn off.

The sketch writes a lot of useful debug information to the serial port, so use the serial monitor if things do not seem to be working.

Web interface

Blinky web interface

The web interface uses the Firebase JS API to read and write data to Firebase. To use this with your own project, you need to edit the code (found here) to change the name of the Firebase project and authentication token in the code. You will first need to set up Firebase (the basic tier is free) and configure the authorized users for your Firebase project in the Firebase console.

The web interface first presents a login button which triggers the Firebase authentication flow. Once the user is logged in, it registers to receive updates from the Firebase database for several data types:

Ediing the config for the strip writes a corresponding record to the strips database, which the Feather will periodically poll and receive.

The local IP address is currently unused, but in the future we may add the ability to synchronize over the local LAN (e.g., to make immediate changes to the strip config without waiting for the next polling interval).