SubscriberBoard - a Home Assistant-connected Oversized 7-segment Display

by CameronCoward in Workshop > Woodworking

1769 Views, 16 Favorites, 0 Comments

SubscriberBoard - a Home Assistant-connected Oversized 7-segment Display

SubscriberBoard - a Home Assistant-connected oversized 7-segment display
IMG-1302.jpg
IMG-1304.jpg

SubscriberBoard is a four-digit, seven-segment display scaled up to a size that makes it perfect for wall art! It connects to a Home Assistant home automation server and can show whatever four-digit numbers that server can send via MQTT. I have it set up to cycle between the time, the current temperature, and the number of subscribers on my YouTube channel (hence the name).

I decided to do this project after I saw that Instructables was having a woodworking contest. I used to own a fabrication business with a big workshop and my first thought was "I wish I still had that shop so I could participate in the contest!" But then I realized that this would be the perfect opportunity to demonstrate what you can achieve, even when you live in a tiny one-bedroom condo like I do.

I think SubscriberBoard looks awesome and it was built entirely indoors—no garage, yard, or workshop necessary!

Supplies

  • ESP32 dev board
  • WS2812B LEDs
  • Basswood sheets
  • Wood stain
  • Wood glue
  • M3 heat-set inserts and screws
  • 3D printer filament

Overview

There are a few different concepts at play here, so I'll give a brief overview of each. Then in the later steps, I'll provide more detail.

Woodworking

Most people hear "woodworking" and think of a big shop full of table saws and routers. I used to own a business with exactly that and I used the tools to build high-end furniture.

But the truth is that you can accomplish a lot without all of that space or messy tools.

In this case, I did everything indoors using a laser cutter, a 3D printer, some sandpaper, and some wood glue.

The laser cutter was integral to this project, because it let me cut the display board (which needed to be precise) without making a big mess. The 3D printer was necessary for parts like the LED diffusers.

LEDs

I wanted this to look like a seven-segment display, but to be much bigger and with greater flexibility.

So this isn't actually a seven-segment display at all. Instead, all of the segments are lit by WS2812B "NeoPixel" individually addressable RGB LEDs. Those are easy to set to any color or brightness, I just had to code an algorithm to illuminate the right groups in the right orders according to the incoming data.

Data

I recently built a home server called NASTIER. Its primary purpose is to act as a NAS (Network-Attached Storage) device. But it is a full server and I wanted to take advantage of that capability. So I installed Home Assistant and now I need a use for it. I figured it would be able to gather the data I wanted.

SubscriberBoard can display any four digits of data that Home Assistant can access. I chose the time, my local temperature, and the number of subscribers on my YouTube channel. I'm currently trying to build up my YouTube channel and I thought this might give me some motivation.

Home Assistant sends data via MQTT messages to the ESP32 that controls SubscriberBoard. That requires an MQTT broker, which runs on the same server as Home Assistant.

Design and Laser-Cutting

IMG-1286.jpg
Fusion360.png
IMG-1284.jpg

CAD

I did all of my design work in Autodesk Fusion 360. If you follow my work, you may know that I wrote a book on CAD modeling in Fusion 360 for beginners and this is still my go-to CAD software.

Fusion 360 is great for a project like this one, because it lets us do all of the CAD in one place. I modeled all of the parts I needed to fabricate, including the 3D-printed diffusers and spacers. I was then able to export the 3D-printed parts as STEP files for printing and the wood parts as DXF files for laser-cutting.

To export a DXF (which is a 2D drawing similar to a vector file), just start a new sketch on the face you want to export. In my case, that was the face of the wood board on front. Then project the entire face onto the sketch and finish the sketch. Now you can right-click on that sketch and Export as DXF.

Laser-cutting

I used a Creality Falcon 2 laser cutter for this project, but any laser cutter should work.

If your laser cutter is powerful enough, you can use whatever type of wood you like. But basswood is usually the easiest and fastest to cut, so that's what I used.

Because we have a DXF to work with, any laser cutter software will work. I used Lightburn. To get clean cuts, make sure your laser is focused properly, then cut at the maximum speed and minimum power you can get away with.

Finishing the wood

You don't have to give the wood a finish, but it can enhance the appearance and the durability.

I wanted the wood to be whitish to blend in with the unlit diffusers, so I chose a water-based whitewash stain.

To apply the stain, first lightly sand the wood with a medium-fine grit sandpaper (like 400). That helps to open up the wood's pores to accept the stain. Then use a brush to apply enough stain to saturate the wood. This is stain and not paint, so you aren't trying to lay down an opaque layer. Finally, use a paper towel to rub the stain in and remove any excess.

You can apply a clear protective coat if you like (urethane types are good), but that isn't necessary for something that will only be indoors like this.

3D-printing

There isn't anything special about the 3D-printed parts. But you want to use white for the diffusers and black for the shields that prevent light bleed.

LEDs and Diffusion

IMG-1292.jpg

All of the segments are lit by strings of WS2812B individually addressable RGB LEDs, which people often call "NeoPixels" based on the Adafruit brand name. But it wouldn't look good if you could see the dots of light coming from each LED, so diffusion is important.

There are many ways to diffuse LEDs, but the most effective method I've found is to simply put some distance between the LEDs and the diffuser. In this case, there is around 8-10mm space.

The diffusers themselves are 3D-printed in ASA material, but PLA should work too. There is only a single 0.16mm layer of material for the light to shine through and that keeps it bright. The distance between the diffusers and LEDs does all the heavy lifting.

To prevent light bleed between segments, there are black 3D-printed "shields" on the inside. Those create a cavity around each segment, so the light remains contained.

IoT, Home Assistant, and MQTT

HA_automation.png

This is an internet-connect display, so it needs some way to get data. I have Home Assistant (home automation software) running on a home server and chose it for this purpose. Home Assistant has access to all kinds of data and there are a lot of integrations you can add to make it work with other services and devices. For instance, I added the YouTube integration to get my subscriber count.

But you still need some way to get data (the four digits we want to display) from Home Assistant to the ESP32 that controls the LEDs. I selected MQTT, which is a network protocol built specifically for IoT applications.

MQTT basics

In any MQTT setup, a device sends messages over a local network. Those messages consist of a Topic and a Payload.

Other devices can then "subscribe" to specific Topics in order to listen for messages and read their Payloads.

In this case, for example, Home Assistant publishes an MQTT message once per minute with the Topic "time" and the Payload as the current time. The ESP32 subscribes to the "time" Topic and whenever it sees a message on the topic, it reads the Payload. It then updates the display with the data from the Payload.

All of this requires an MQTT broker, which takes a message published by one device and sends it out over the local network to all of the other devices that might want to read it.

There are many different options for MQTT brokers, but I chose to use Mosquitto running on the same home server as Home Assistant.

Home Assistant basics

Home Assistant (HA) is a very complex platform with tons of features, so I'm only going to talk about the important stuff for this project.

HA is all about automations: do X when Y happens.

In this case the trigger (Y) is a simple timer: once per minute at zero seconds, it triggers the time message. At 20 seconds, it triggers the temperature message. At 40 seconds, it triggers the YouTube subscriber count message.

The action (X) is to publish an MQTT message with the corresponding Topic and Payload.

That Payload is data that comes from a HA Sensor. HA assistant calls a lot of things sensors, even when they aren't actual physical sensor. A sensor is basically anything that updates with data.

So for the temperature, the sensor is actually weather data published by a local weather service. That sensor provides all kinds of information, like temperature and barometric pressure. We only need temperature, so the Payload only contains that attribute of the sensor.

If you aren't familiar with Home Assistant, you'll want to do research on all of these concepts as there is too much to cover in detail here.


ESP32 and Code

I chose an ESP32 development board (ACEIRMC D1 Mini NodeMCU on Amazon) to control SubscriberBoard, because it was cheap, powerful, and has a built-in WiFi adapter.

I programmed it in the Arduino IDE to take advantage of the FastLED and ArduinoHA libraries, and because I'm familiar with Arduino coding.

The code

I have thoroughly commented my code, so you'll want to look at that to get a good understanding of how everything works. But the basic concept is simple:

  • Connect to WiFi
  • Connect to the MQTT broker
  • Subscribe to the MQTT topics
  • Wait for MQTT messages
  • Process MQTT payload data to get four numerical digits
  • Turn on the LEDs corresponding to those digits

That last step was the hardest part of this project and the part I'm most proud of.

All of the LEDs are wired as a single string and we can only reference their position in the string. So how do you translate the number 9 in the second digit into "turn on LEDs 20 through 24, 32 through 36, 40 through 44" and so on?

I could have programmed that all explicitly with a huge tree of If-Then and Switch statements, but that would have been a mess. So I did everything mathematically, which I think was clever.

There is a simple two-dimensional array that defines a "map" of which segments should light up for each number (0-9) and F (for Fahrenheit). Because we know how many LEDs are in each segment, we can calculate the position of the first segment of a digit. From there, we can calculate which LEDs to illuminate and which to skip based on the "map" in the array.

I like my solution, because it only requires a handful of lines of code and runs very quickly.

And the best part is that this is scalable. If you build a bigger sign that has, say, 10 LEDs in each segment, this will adapt to that. The only thing you need to change is the "LEDS_PER_SEG" definition at the very top. It would also be easy to add additional digits, which I might do if I ever gain more than 9,999 subscribers on YouTube.

Wiring and Assembly

IMG-1288.jpg
IMG-1289.jpg
IMG-1290.jpg
IMG-1295.jpg
IMG-1297.jpg
IMG-1298.jpg
IMG-1299.jpg

LED wiring

As I already mentioned, all of the LEDs are wired as a single strip. That was the most laborious part of this project, because it meant soldering 30 small strips together (one for each segment, plus two for the dots).

That was a challenge, because the strips had to fit into the small amount of space available and were all 90 degrees relative to each other.

There are two tricks I used to speed this up:

  1. used pins from a header to solder together adjacent strips
  2. printed a template to scale to position the strips

The circuit

Power distribution is important for WS2812B LEDs. So I have power connected at the beginning and the end. I'm using a 10A 5V power supply, which is plenty for this number of LEDs—especially since they're set to a single color at a time at half-brightness. As recommended, I added a capacitor across the power wires to smooth out the power.

All of the wires and the headers for the ESP32 were soldered onto a prototyping board.

Gluing

Wood glue is your friend!

I used wood glue to secure all of the diffusers in place, as well as the black shields.

I used hot glue to secure the power jack and the prototyping board.

Right now, I have electrical tape holding the LEDs onto the black shields. That's temporary to ensure that everything works and I'll use hot glue to secure them once I'm satisfied that I don't need to make any changes.

Heat-set inserts and final assembly

I love heat-set inserts and used a bunch of them here. Both the front and back boards attached to the 3D-printed spacer frame pieces using M3 screws in M3 heat-set inserts.

I think those screws look nice and they will prevent the wood from warping.

Finally, I wrapped some steel wire around two of the screws on the back, so I could hang SubscriberBoard on the wall.

Enjoy!

IMG-1303.jpg

So that's it, folks! I hoped you liked this project.

I started this to prove that you can do woodworking indoors and I'm happy with the results. Laser cutters are great for those of us living in apartments and condos, because you can fabricate complex and precise wood parts without making a big mess.

If you enjoyed this project, consider subscribing to my YouTube channel so I can get that subscriber number up to something respectable!