Introduction: Bar Graph Clock IOT (ESP8266 + 3D Printed Case)

About: Innovation engineer. Electronic and DIY enthusiast, with personal interests in retro tech, board games and old cars.

Hi,

On this Instructables I will explain you how to build an IOT 256 LED Bar Graph Clock.

This clock is not very difficult to make, not very expensive yet you'll need be patient to tell the time ^^ but it's pleasant to make and full of teaching.

To make this clock, the main steps will be to :

  • Make a Clip-on Box
  • Find the exact time with WiFi and NTP protocole
  • Program a 8x32 LED Matrix witch represent 256 LED

Supplies

  • Led Matrix WS2812B 8x32 11€ on Aliexpress
    • The 8x32 WS2812B LED Matrix is also called NeoMatrix by Adafruit company.
  • A Nodemcu ESP8266 board 3 to 4€ on Aliexpress (Nodemcu is finer than Wemos)
  • Some 3D-printer filament (≈ 120g)
  • 2 screws or nails
  • A USB cable (USB Type A to Micro USB Type B)
  • A USB wall adapter

Required tools

  • A 3D printer, mine is a Creality CR-10
  • A pliers
  • A solder iron

Optional tools

Step 1: How to Tell the Time ?

Picture 1 and the "Explanation_Clock.pdf" file will explain you how to read this clock. Basically, you need to count the dots in each RGB column (red = hours / green = minutes / blue = seconds).

For example, the clock displays 17h50m44s on picture 2.

Step 2: Designing the 3D Printed Clipsable Enclosure Using Fusion 360

I wanted this box to be a fully clip-on box so I designed it in a way that I would not need to use glue.

Clip-on are inspired by this two tutorials (side clip)(mid clip)

Matrix dimensions :

300mm height x 80mm length x 2mm width

Box dimensions :

323mm height x 85mm length x 9.2mm width

Printing key figures :

  • 180g of filament
  • 16h30 (printing time)

Below, there are 4 files :

  • Box_Bottom_ws (with support)
  • Box_Top_ws (with support)
  • Cover_Bottom_Matrix
  • Cover Top_Matrix

You will need these 4 pieces to make the complete case.

Files are also available on Thingiverse, here is the link : https://www.thingiverse.com/thing:4292876

Step 3: Assemble 3D Printed Case + ESP8266

After printing the 4 pieces, follow these steps :

  1. Desolder all wires from the Matrix except the 5V, GND, and DIN
  2. Solder the 3 remaining wires to the ESP8266 board (See schematic)
  3. Assemble "Box_Bottom_ws" and "Box_Top_ws"
  4. Insert the USB cable through "Box_Bottom_ws"
  5. Fix the ESP8266 with double-sided tape or hot glue
  6. Plug the USB cable to the ESP8266
  7. Slide the LED matrix through "Cover_Bottom_Matrix"
  8. Clip "Cover_Bottom_Matrix" on "Box_Bottom_ws"
  9. Redo step 7 and 8 with "Cover_Top_Matrix"
  10. Start programing

Step 4: Programming Using Arduino IDE

This program has three main functions :

Prerequisites :

For the Board Manager :

For the Library :

To drive the matrix, use:

  • "Adafruit GFX Library" made by Adafuit
  • "Adafuit NeoMatrix" made by Adafruit
  • "Adafuit NeoPixel" made by Adafruit

To connect to Wifi, use :

  • Build-In "WiFi" made by Arduino
  • Build-In "ESP8266WiFi" available by adding the board

Download the code, change the WiFi ssid and password (lines 54 and 55) and upload it on your ESP8266 board.

Optional:

  • Change the colors (line 52) (You can use this tool : Color to RGB code)
  • Change the time zone (line 59)
  • Change the brightness for every LED (line 92)
  • Change the way to display the second (line 101 to 104)(I let you try)
  • Code your own way to display ^^.

/!\ The matrix is powered by the USB interface board, so the power consumption has to be limited to 500mA (sources). To stay below 500mA, keep the luminosity variable between 0 and 10 (Check with your USB tester if you have one).

If you want more details about :

  • how NTP works look this video made by Andreas Spiess.
  • how NeoMatrix works look at this video again done by Andreas Spiess.
  • how Adafuit Library works see this tutorial

Step 5: Hang It, Look at It and Start Counting - Be Patient

I'm happy with the result, the clip-on box is cool and easy to assemble and the clock works like a charm.

I admit that it is not the fastest way to tell the time but it's a pretty funny way.

Have a nice day !