Close
0%
0%

Simple, Scrolling, RTC Clock

Amuse-myself-for-a-couple-of-hours-Scrolling-Clock with an Arduino Uno, generic, 8x8 led matrices, and a RTC.

Similar projects worth following
1.3k views
I have been playing around with clocks as of late. And in the process of amusing myself one evening, I came up with this simple clock. Which in the near future will get more complicated with buttons for an alarm and time setting.

Simple, Scrolling, RTC clock

The other night I was puttering around, looking in my box of goodies to see what I brought to play with. I usually grab a few items and then see what inspires me along the way. Tonight it is two 8x8 led matrices, i2c, ok that looks like fun. The goal started out being able to move something across the screen. The 8x8's are from Keyestudio, are I2C, and use the HT16K33 controller. It is also found on the Adafruit panels.  

The mystery box

A little more digging around and I had the choice between:

 It seems, in my general searches, that most all of the 8x8 panels use the Max7219, or another chip in the family. Information was a little scare for the HT16K33, but between some searching and wandering through some user forums I was able to get the information I needed. Adafruit provided the libraries and the function that got me started. A thank to them and their great work! Note to self: Take this project and port it over to my IstyBitsy M4 just 'cause I want to. 

As I was getting started, it came to me that just moving some random text across the screen wasn't very much fun. A quick stepping stone, but it needs to do something. Shazaam! Another clock. 

What board to choose?

  • Arduino Uno, generic
  • Adafruit ItsyBitsy M4
  • Adafruit Metro 328
  • Arduino Nano generic, generic
  • NodeMCU ESP8266-12E, Amica

I wound up picking up the Uno. For this is was just the easiest to get to and put to work. The DS3231 RTC I have is one that I picked up for a Raspberry Pi, but hey, it will work just as well here. 

Rest of the parts, the BOM

So before I go any further here is the Bill of Material (BOM) for my project

  • 1x 1/2 sizeBreadboard
  • 1x Arduino Uno
  • 2 x KeyStudio I2C HK16K33 8x8 LED matrix
  • 1 x RTC DS3213
  • Jumper wires
  • 1 x micro USB data cable

Putting it together

I started with the usual ritual of plugging the screens and checking on the I2C addresses.  You can find a sketch in the Arduino IDE that will scan the bus and return the addresses it finds. I was short of some jumper wires, so I pulled out the creative hat; here is my tip. A short piece of ethernet cable and the project is back on track. I already have the address of the DS3231 Real Time Clock (RTC) from an earlier project. Screen A is 0x70 and screen B is 0x72, the clock is 0x68. If you look close in the picture you will see that one of the address pads is soldered. See the screen on the left hand side, and in its' upper right-hand area. They are labeled A2, A1, and A0. I solder bridged A2 so that the address will be different than the first. 

Getting all wired up with my makeshift jumpers

The wiring is simple as everything is using I2C for communication; just daisy chain them SCL to SCL, SDA to SDA. Only four Uno pins are required, 2 for I2C and 2 for power and ground. It is important to make sure that all of the addresses are different. 

  • SCL --> Uno Pin 5
  • SDA --> Uno Pin 4
  • 5v -->  5v
  • Gnd --> Gnd 

The base code I found on one of the Adafruit forums. It was pertaining to scrolling text. I copied it and started to play around with it. I do need a clock in the living room. Clock are few and far between in my house and not sure why. This will help change that. 

I took the code from one of my earlier clocks and used it with the scrolling function. I won't go to in-depth right now. You can check out the code over on my GitHub. I have tried to comment it as to explain what is going on and why. 

The clock is done. Not bad for a nights work. Being back home I am looking around my workshop for a project box or something to use for an enclosure. By time I had the code tweaked it was getting late and...

Read more »

  • 1 × Arduino Uno, generic
  • 2 × 8x8 LED matrix HK16K33 backpack
  • 1 × DS3231 RTC

  • PIR Senor Play

    Peter09/05/2019 at 21:09 0 comments

    At night the clock can get kind of bright and during the day it is just the dog watching the clock. I wanted a clean way to display the time without having to push a button. 

    Well, I have a HC-SR501 PIR Sensor laying around. So tonight (I don't have the clock with me) and going to play around some. I want to get the skeleton code to add to the clock when I get home. I added a 8x8 matrix display, it makes it a little more like the project that it will integrate into. 

    // Libraries required
    #include <Adafruit_LEDBackpack.h>
    #include <Adafruit_GFX.h>
    #include <gfxfont.h>
    
    // Definitions and variables
    #define pirPin 2
    int calibrationTime = 30;
    long unsigned int lowIn;
    long unsigned int pause = 5000;
    boolean lockLow = true;
    boolean takeLowTime;
    int PIRValue = 0;
    
    // Setup the 8x8 matrix
    Adafruit_8x8matrix matrix = Adafruit_8x8matrix();
    
    void setup() {
       Serial.begin(9600);
       pinMode(pirPin, INPUT);
       matrix.begin(0x74);
    }
    
    void loop() {
    
       // Calling the sensor function 
       PIRSensor();
    }
    
    void PIRSensor() {
       // If there is motion, put something on the scree
       if(digitalRead(pirPin) == HIGH) {
          if(lockLow) {
             PIRValue = 1;
             lockLow = false;
             Serial.println("Motion detected.");
             matrix.clear();
             matrix.setCursor(2,1);
             matrix.print("B");
             matrix.writeDisplay();
             delay(50);
          }
          takeLowTime = true;
       }
       // No more motion, clear the screen
       if(digitalRead(pirPin) == LOW) {
          if(takeLowTime){
             lowIn = millis();takeLowTime = false;
          }
          if(!lockLow && millis() - lowIn > pause) {
             PIRValue = 0;
             lockLow = true;
             Serial.println("Motion ended.");
             matrix.clear();
             matrix.writeDisplay();
             delay(50);
          }
       }
    }

  • Some things to work on

    Peter08/30/2019 at 21:12 0 comments

    Now that the puttering is over and I have put a little more thought into this project; I am going to extend it a bit. I also dug up 2 additional 8x8's last night so I can expand the screen up or sideways. 

    I am going to try and keep myself honest and put up my TO DO list for this project. It seems a bit too simple and needs are little something, something to kick it up a notch. And not a fancy case. 

    - 3 buttons. Mode, Up, and Down

    - Alarm, start with single

    - Time set function

    - Numbers scroll up and down off the screen

    - replicate on ARM M4 with circuit python

    - PCB?

View all 2 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates