Shelf Led Clock (with Snake)

A 21x5 led clock on which one can play Snake using any browser. Also adjust brightness based on surrounding brightness.
In the contest Timekeepers
34
64
0
1185
updated May 25, 2021

Description

PDF

Introduction

A 21x5 led matrix clock that shows the time normally, but can be controlled remotely using any browser/a web app.

EDIT: Videos on snake, rainbow effect as well as when the time changes (fading effect) can be found here.

When in clock mode, the colors of the leds changes during the day in a random pattern on every minute change. Each change is not noticeable, but over time the colors have changed completely. The brightness of the leds also adjust with the surrounding light, so on sunny days the leds are on high brightness, while on evenings and nights they are lower.

By using a browser, one can control the clock to enable a “Rainbow” mode where the full led matrix show an nice running rainbow effect. One can also enable Snake mode which lets you play Snake on the clock using the same web page. Commands are sent over a websocket to reduce latency.

Print instructions

The print consists of several parts.

  • Grid left/right: Print two, layer height 0.15.
  • Grid center: print one, layer height 0.15.
  • Window 9: print two, layer height 0.15.
  • Window 3: print one, layer height 0.15.
  • Backside 10: print one, layer height 0.2.
  • Backside 11: print one, layer height 0.2.
  • Clamp: Print 4-8 of them, or enough to keep your led box together, layer height 0.2.
  • Optionally print the esp box. See assembly.

I printed the backside and Grid in Prusament PETG Jet Black. Dark colors for the Grid work well to not get leakage of light between led cells. One could use brighter colors on the backside to utilize on the reflection from the windows, but unsure if how much that would improve anything.
Windows are printed in Prusament PETG Clear.

All parts printed flat on print bed.

Electronics

  • For this design, you need a led strip with 60 leds per meter. Most led strip will do here, but I used a WS2812B strip from banggood. Before printing all of the components, print a small test piece of the grid and make sure it aligns with your led strip led spacing.
  • Any microcontroller will do as you only need one pin for the leds (if you use a WS2812B led strip or similar), and one pin for the brightness sensor/LDR. You also need one with WiFi obviously to be able to play snake on it remotely (as well as for the time sync). I'm using a D1 mini ESP8266.
  • a LDR.
  • Power supply to power the ESP as well as the led strip. As the led strip I'm using is 5V, I can power both the ESP and the led strip using the supplied power adapter that came with the led strip.

Assembly

  1. Place on a table and connect them.
  2. Cut the led strip into length to match the Grid. That is, 21 leds per strip.
  3. Place the led strips to the data flow (marked with arrows) starts from the bottom left and ends at the top right in a zig-zag pattern (see photos).
  4. Verify that the leds are in correct alignment by temporary placing the Grid in top of the leds. Then either glue the led strips or use the tape to attach them to the backside.
  5. Solder three wires to the bottom left of the led strip (+, GND and data) and guide the wires out of the hole of the bottom of the backside.
  6. Then continue to connect the led strips at each end. Verify that the data direction is correct.
  7. Then place the Grid on top of the led strips. (Left + center + Right)
  8. Add the windows on top of the grids (9 + 3 + 9)
  9. Use the clamps to hold everything together.

For the ESP, see the attached schematic on how to connect data and the LDR. You can then just hide the ESP behind led box, or print the box. The box is not optimal, but it works. In future designs the esp might be integrated into the led box.

Software

For Arduino using Visual Studio Code and the Arduino plugin can be found here.

Supports/Features:

  • Clock mode: Colors changes during the day and where brightness adjust based on ambient brightness. Auto adjust based on NTP server.
  • Snake mode: Play snake using any web browser. Single player only, no speed up as apples are aten. Show score at end (but no high score).
  • Rainbow mode: just random “rainbow” colors.
  • Brightness mode: Brightness calibration mode.
  • MQTT integration where rainbow mode can be enabled. This is used to integrate it into Home Assistant to be able to automate when the rainbow effect should be enabled.
  • Direct remote control via web for snake, enabling rainbow, clock mode etc. Also same support via Telnet.

Suggest to use it as inspiration only! Plenty of things going on in that code with MQTT, different modes like Snake, brightness calibration modes, websockets and such. Pick your parts. Snake itself is implemented just how I remembered that the Snake game worked back when I played it on Nokia 3310 (so they might be bugs). Dependencies are listed in the top of the led_clock.ino file.

Tags



Model origin

The author marked this model as their own original creation.

License