Project in progress
RGB Large Digital Clock

RGB Large Digital Clock © MIT

Not your typical wall clock that tells time, it also becomes your wall light panels that lit up your scifi-like bedroom.

  • 23,618 views
  • 12 comments
  • 54 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)
09507 01
Soldering iron (generic)

Apps and online services

About this project

I wanted to customize how to my room apartment looks like. I love RGB LED strips and how much you can do to it. So, I decided to build my own digital clock that is large enough to make some mood while working or gaming.

Let's jump right to the 3d printing. Unfortunately, I was not able to logged the 3d design process. I use TPLA filament to my Ender 3 printer. It took 4 days to print the parts including the diffuser for LED strips.

Then, I painted to main parts with black to increase the contrast of illuminated parts for better readability.

After that, I installed the RGB strips inside the main part. The LED density is 60 pcs/meter and each segment has 5 RGB LEDs. For every digit, the total WS2812b LED is 35.

Each digit must be tested first before connecting them to each other.

We do the programming with Arduino to control the digital clock's LED. An RTC module was used for accurate clock timing. Adafruit's Neopixel library was utilized to achieve quick light effects and pattern. For now, only rainbow light effect was implemented. Arduino Pro Mini is the microcontroller used of this project. In addition, the WS2812b LED strips is running on 5V just like our microcontroller. Thus, 5V/2A power USB adapter is also used.

Finally, after series of testing and experiments, I was able to achieve the desired output from this project. Using double-sided foam tape, the 3D printed digital clock was installed on my wall.

Code

Arduino CodeC/C++
#include <Adafruit_NeoPixel.h>
#include <EEPROM.h>
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 RTC;

#define PIN  2
#define BTN  3

uint8_t NUM_DIGIT = 4;
const uint8_t LEDS_PER_DIGIT = 35;
uint16_t NUM_LEDS = LEDS_PER_DIGIT * NUM_DIGIT;

uint8_t time_h = 0;
uint8_t time_m = 0;
int num = 0;

float ambiant_light = 1.0;

bool mask_digit[10][35] =
{
  { //0
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1
  },
  { //1
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1
  },
  { //2
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0
  },
  { //3
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1
  },
  { //4
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1
  },
  { //5
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1
  },
  { //6
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1
  },
  { //7
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1
  },
  { //8
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1
  },
  {
    0, 0, 0, 0, 0,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1,
    1, 1, 1, 1, 1
  },
};
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
byte colors[3][3] = { {0xff, 0, 0},
  {0xff, 0xff, 0xff},
  {0   , 0   , 0xff}
};

void setup()
{
  Serial.begin(9600);
  Wire.begin();
  RTC.begin();
  if (! RTC.isrunning())
  {
    Serial.println("RTC is NOT running!");
    // Following line sets the RTC to the date & time this sketch was compiled
//     RTC.adjust(DateTime(__DATE__, __TIME__));
  }
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
  pinMode(BTN, INPUT);
}

void loop()
{
  DateTime now = RTC.now();
  time_h = now.hour();
  time_m = now.minute();
  int digit_4 = time_h / 10; //10 states, 0-9
  int digit_3 = time_h % 10; //10 states, 0-9
  int digit_2 = time_m / 10; //10 states, 0-9
  int digit_1 = time_m % 10; //10 states, 0-9
  //  Serial.println(digit_4);
  //  Serial.println(digit_3);
  //  Serial.println(digit_2);
  //  Serial.println(digit_1);

  //  rainbowCycle(10, digit_4, digit_3, digit_2, digit_1, ambiant_light);

  byte *c;
  bool map_num[NUM_LEDS] = {};
  for (int i = 0; i < LEDS_PER_DIGIT; i++)
  {
    map_num[i] = mask_digit[digit_4][i];
  }
  for (int i = LEDS_PER_DIGIT; i < 2 * LEDS_PER_DIGIT; i++)
  {
    map_num[i] = mask_digit[digit_3][i - LEDS_PER_DIGIT];
  }
  for (int i = 2 * LEDS_PER_DIGIT; i < 3 * LEDS_PER_DIGIT; i++)
  {
    map_num[i] = mask_digit[digit_2][i - 2 * LEDS_PER_DIGIT];
  }
  for (int i = 3 * LEDS_PER_DIGIT; i < 4 * LEDS_PER_DIGIT; i++)
  {
    map_num[i] = mask_digit[digit_1][i - 3 * LEDS_PER_DIGIT];
  }

  for (uint16_t j = 256; j > 0; j--) { // 5 cycles of all colors on wheel
    for (uint16_t i = 0; i < NUM_LEDS; i++) {
//      c = Wheel(((i * 256 / (NUM_LEDS/4)) + j) & 255); //each digit is rainbow
      c = Wheel(((i * 256 / (NUM_LEDS*8)) + j) & 255); //slow transition
      if (map_num[i] == 1)
      {
        uint8_t R = *c * ambiant_light;
        uint8_t G = *(c + 1) * ambiant_light;
        uint8_t B = *(c + 2) * ambiant_light;
        setPixel(i, R, G, B);
      }
      else
        setPixel(i, 0, 0, 0);
    }
    showStrip();
    delay(20);
  }
}


void rainbowCycle(uint8_t SpeedDelay, int d4, int d3, int d2, int d1, float ambiant_light)
{
  byte *c;
  uint16_t i, j;
  bool map_num[NUM_LEDS] = {};
  for (int i = 0; i < LEDS_PER_DIGIT; i++)
  {
    map_num[i] = mask_digit[d4][i];
  }
  for (int i = LEDS_PER_DIGIT; i < 2 * LEDS_PER_DIGIT; i++)
  {
    map_num[i] = mask_digit[d3][i - LEDS_PER_DIGIT];
  }
  for (int i = 2 * LEDS_PER_DIGIT; i < 3 * LEDS_PER_DIGIT; i++)
  {
    map_num[i] = mask_digit[d2][i - 2 * LEDS_PER_DIGIT];
  }
  for (int i = 3 * LEDS_PER_DIGIT; i < 4 * LEDS_PER_DIGIT; i++)
  {
    map_num[i] = mask_digit[d1][i - 3 * LEDS_PER_DIGIT];
  }

  for (j = 0; j < 256; j++) { // 5 cycles of all colors on wheel
    for (i = 0; i < NUM_LEDS; i++) {
      c = Wheel(((i * 256 / (NUM_LEDS)) + j) & 255);
      if (map_num[i] == 1)
      {
        uint8_t R = *c * ambiant_light;
        uint8_t G = *(c + 1) * ambiant_light;
        uint8_t B = *(c + 2) * ambiant_light;
        setPixel(i, R, G, B);
      }
      else
        setPixel(i, 0, 0, 0);
    }
    showStrip();
    delay(1);
  }
}

// *** REPLACE TO HERE ***

void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
  // NeoPixel
  strip.show();
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
  // FastLED
  FastLED.show();
#endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
  // NeoPixel
  strip.setPixelColor(Pixel, strip.Color(red, green, blue));
#endif
#ifndef ADAFRUIT_NEOPIXEL_H
  // FastLED
  leds[Pixel].r = red;
  leds[Pixel].g = green;
  leds[Pixel].b = blue;
#endif
}

void setAll(byte red, byte green, byte blue) {
  for (int i = 0; i < NUM_LEDS; i++ ) {
    setPixel(i, red, green, blue);
    delay(1);
  }
  showStrip();
}

byte * Wheel(byte WheelPos) {
  static byte c[3];

  if (WheelPos < 85) {
    c[0] = WheelPos * 3;
    c[1] = 255 - WheelPos * 3;
    c[2] = 0;
  } else if (WheelPos < 170) {
    WheelPos -= 85;
    c[0] = 255 - WheelPos * 3;
    c[1] = 0;
    c[2] = WheelPos * 3;
  } else {
    WheelPos -= 170;
    c[0] = 0;
    c[1] = WheelPos * 3;
    c[2] = 255 - WheelPos * 3;
  }

  return c;
}

Custom parts and enclosures

STL File
Just download and use slicer like Cura

The files include the main part and its diffuser for each digit.
Another 2 files are also uploaded to contain your microcontroller and RTC

Comments

Similar projects you might like

RGB HexMatrix | IoT Clock

Project tutorial by Mukesh Sankhla

  • 7,744 views
  • 14 comments
  • 38 respects

Tri-Mode Digital Clock with ATtiny85 and RTC

Project showcase by LAGSILVA

  • 14,241 views
  • 5 comments
  • 28 respects

Roman Numeral Clock

Project tutorial by John Bradnam

  • 958 views
  • 0 comments
  • 3 respects

Ternary Digital Clock with Arduino

Project showcase by LAGSILVA

  • 8,076 views
  • 6 comments
  • 19 respects

7-Segment Array Clock

Project tutorial by John Bradnam

  • 4,472 views
  • 6 comments
  • 14 respects

How to Make Analog Clock & Digital clock with Led Strip

Project tutorial by DKARDU

  • 4,969 views
  • 0 comments
  • 9 respects
Add projectSign up / Login