garysat
Published © GPL3+

Minimal parts simple word clock

Simple word clock using 2812b leds.

BeginnerFull instructions provided3,363
Minimal parts simple word clock

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Real Time Clock (RTC)
Real Time Clock (RTC)
DS 1307
×1
2812b addressable rgb Leds
×22
Breadboard (generic)
Breadboard (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Card stock, glue, misc supplies
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

WORDCLOCK2812

Code

wordclock2812.ino

Arduino
#include <Wire.h>
#include "RTClib.h"
#include <FastLED.h>
#define NUM_LEDS 22
#define DATA_PIN 7
CRGB leds[NUM_LEDS];

RTC_DS1307 rtc;


void setup () {
 
  

  Serial.begin(9600);
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
    
  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    
  }

{

FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
}

}
void loop () {
    DateTime now = rtc.now();
   int h;
   
    Serial.print(now.hour(), DEC);
       h=(now.hour());
     if (now.minute()>34){
      h=h+1; 
     }
      
   
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    leds[0] = CRGB::Yellow;
    leds[20] = CRGB::Yellow;
     FastLED.show();
    if (now.minute() <=4){
      Serial.print ("nothing");
      
        leds[1] = CRGB::Black;
        leds[2] = CRGB::Black;
        leds[3] = CRGB::Black;
        leds[4] = CRGB::Black;
        leds[5] = CRGB::Black;
        leds[6] = CRGB::Black;
        leds[7] = CRGB::Black;
         
          FastLED.show();
      }
      else if (now.minute() <=9){
      Serial.print ("five minutes past");
        leds[5] = CRGB::Red;
        leds[6] = CRGB::Red;
        leds[10] = CRGB::Red;
          FastLED.show();
      }
      else if (now.minute() <=14){
      Serial.print ("ten minutes past");
        leds[5] = CRGB::Black;
        leds[2] = CRGB::Red;
        leds[6] = CRGB::Red;
        leds[10] = CRGB::Red;
          FastLED.show();
      }
      else if (now.minute() <=19){
      Serial.print ("quarter past");
        leds[2] = CRGB::Black;
        leds[4] = CRGB::Red;
        leds[6] = CRGB::Black;
        leds[10] = CRGB::Red; 
          FastLED.show();
      }
      else if (now.minute() <=24){
      Serial.print ("twenty minutes past");
        leds[4] = CRGB::Black;
        leds[3] = CRGB::Red;
        leds[6] = CRGB::Red;
        leds[10] = CRGB::Red;
           FastLED.show(); 
      }
      else if (now.minute() <=29){
      Serial.print ("twenty-five minutes past");
      
        leds[3] = CRGB::Red;
        leds[5] = CRGB::Red;
        leds[6] = CRGB::Red;
        leds[10] = CRGB::Red; 
          FastLED.show();  
      
      
      }
      else if (now.minute() <=34){
      Serial.print ("half past");
        leds[3] = CRGB::Black;
        leds[5] = CRGB::Black;
        leds[1] = CRGB::Red;
        leds[6] = CRGB::Black;
        leds[10] = CRGB::Red; 
          FastLED.show();  
          
       
      }
      else if (now.minute() <=39){
      Serial.print ("twenty-five minutes to");
        leds[1] = CRGB::Black;
        leds[10] = CRGB::Black;
        leds[3] = CRGB::Red;
        leds[5] = CRGB::Red;
        leds[6] = CRGB::Red;
        leds[7] = CRGB::Red; 
          FastLED.show();  
      
      }
      else if (now.minute() <=44){
      Serial.print ("twenty minutes to");
        leds[4] = CRGB::Black;
        leds[5] = CRGB::Black;
        leds[3] = CRGB::Red;
        leds[6] = CRGB::Red;
        leds[7] = CRGB::Red;
           FastLED.show(); 
      }
      else if (now.minute() <=49){
      Serial.print ("quarter to");
        leds[3] = CRGB::Black;
        leds[4] = CRGB::Red;
        leds[6] = CRGB::Black;
        leds[7] = CRGB::Red; 
          FastLED.show();
      
      }
      else if (now.minute() <=54){
      Serial.print ("ten minutes to"); 
        leds[4] = CRGB::Black;
        leds[2] = CRGB::Red;
        leds[6] = CRGB::Red;
        leds[7] = CRGB::Red;
          FastLED.show();
      
        
      }
      else if (now.minute() <=59){
      Serial.print ("five minutes to"); 
        leds[2] = CRGB::Black;
        leds[5] = CRGB::Red;
        leds[6] = CRGB::Red;
        leds[7] = CRGB::Red;
          FastLED.show(); 
      }
    
 
    
    if (h==1){
      leds[21] = CRGB::Black;
      leds[9] = CRGB::Blue;
      FastLED.show();
    }
    if (h==2){
      leds[9] = CRGB::Black;
      leds[11] = CRGB::Blue;
     FastLED.show(); 
    } 
    if (h==3){
      leds[11] = CRGB::Black;
      leds[8] = CRGB::Blue;
      FastLED.show();
    } 
    if (h==4){
      leds[8] = CRGB::Black;
      leds[12] = CRGB::Red; 
      FastLED.show();
    }
      if (h==5){
      leds[12] = CRGB::Black;
      leds[13] = CRGB::Red;
      FastLED.show();
      }
    if (h==6){
      leds[13] = CRGB::Black;
      leds[16] = CRGB::Red;
     FastLED.show(); 
    }
    if (h==7){
      leds[16] = CRGB::Black;
      leds[15] = CRGB::Blue;
      FastLED.show();
    } 
    if (h==8){
      leds[15] = CRGB::Black;
      leds[14] = CRGB::Blue; 
      FastLED.show();
    }
     if (h==9){
      leds[14] = CRGB::Black;
      leds[17] = CRGB::Blue;
      FastLED.show();
      }
    if (h==10){
      leds[17] = CRGB::Black;
      leds[18] = CRGB::Blue;
     FastLED.show(); 
    }
    if (h==11){
      leds[18] = CRGB::Black;
      leds[19] = CRGB::Blue;
      FastLED.show();
    } 
    if (h==12){
      leds[19] = CRGB::Black;
      leds[21] = CRGB::Green;
     FastLED.show(); 
    } 
      
     if (h==13){
      leds[21] = CRGB::Black;
      leds[9] = CRGB::Green;
      FastLED.show();
    }
    if (h==14){
      leds[9] = CRGB::Black;
      leds[11] = CRGB::Green;
     FastLED.show(); 
    } 
    if (h==15){
      leds[11] = CRGB::Black;
      leds[8] = CRGB::Green;
      FastLED.show();
    } 
    if (h==16){
      leds[8] = CRGB::Black;
      leds[12] = CRGB::Green; 
      FastLED.show();
    }
      if (h==17){
      leds[12] = CRGB::Black;
      leds[13] = CRGB::Green;
      FastLED.show();
      }
    if (h==18){
      leds[13] = CRGB::Black;
      leds[16] = CRGB::Green;
     FastLED.show(); 
    }
    if (h==19){
      leds[16] = CRGB::Black;
      leds[15] = CRGB::Green;
      FastLED.show();
    } 
    if (h==20){
      leds[15] = CRGB::Black;
      leds[14] = CRGB::Green; 
      FastLED.show();
    }
     if (h==21){
      leds[14] = CRGB::Black;
      leds[17] = CRGB::Green;
      FastLED.show();
      }
    if (h==22){
      leds[17] = CRGB::Black;
      leds[18] = CRGB::Green;
     FastLED.show(); 
    }
    if (h==23){
      leds[18] = CRGB::Black;
      leds[19] = CRGB::Green;
      FastLED.show();
    } 
    if (h==0){
      leds[19] = CRGB::Black;
      leds[21] = CRGB::Red;
     FastLED.show(); 
    }   
      
    
      
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    
   
    
    Serial.println();
    delay(3000);
}

Credits

garysat

garysat

4 projects • 35 followers

Comments