Pure binary clock

I originally posted this in the General Discussion group, but realised that was the wrong place, so apologies to anyone who may have seen this already.

I was given an Arduino starter kit for Christmas and have had a lot of fun messing about with the various projects the kit provides for. However, I thought I'd do a bit of prototyping myself and elected to make a binary clock.

I've seen versions that use a binary system to represent each of the 4 digits of a conventional clock display, but I wanted to go pure binary. Having come up with a design and an Arduino program to run it, I decided to go the whole hog and have my own bespoke PCBs made to make assembly of the finished product a lot easier.

These are the parts used for the clock :

And this is the finished article, displaying a time of 11:10 am (Counts from the bottom up, blue leds showing minutes and yellow for hours. The red led lights up to show pm)

1 Like

Sorry to burst your bubble, but that clock is BCD, binary coded decimal, not "binary" which would be a row of LEDs either on or off for each binary digit.

Paul

Paul_KD7HB:
Sorry to burst your bubble, but that clock is BCD, binary coded decimal, not "binary" which would be a row of LEDs either on or off for each binary digit.

It's not BCD. His original idea of each of the 4 digits would have been BCD.

This is maybe binary coded base-60 if you want to be pedantic.

Not bad.
I've put a few clocks together, but never used a custom PCB for anything. Maybe I should.

A few questions:

  • Is that a crystal you have there? If it is, is that what you are using for the timekeeping?
  • It looks like you are using an ATMega328 and one other chip. What is the other chip?
  • May we see the source code for this clock?

The clock looks to show 0-F for hours (0-15 possible), and 0-3F (0-63 possible) for minutes. Looks like binary to me.

0-F for hours, 0-7 for tens of minutes and 0-F for ones of minutes might be easier to look and interpret.

Single 16 MHz crystal driven '328P the resistors/LEDs would have been enough, even with 4 bits for hours, 3 bits for tens digits, and 4 bits for one minutes.

This code could be adapted easily to output in binary

unsigned long currentMicros;
unsigned long previousMicros;
unsigned long elapsedTime;


// Initial time to start, adjust as needed.


byte hundredths;
byte tenths;
byte oldTenths;
byte secondsOnes = 0;
byte oldSecondsOnes;
byte secondsTens = 0;
byte minutesOnes = 2;
byte minutesTens = 3;
byte hoursOnes = 4;
byte hoursTens = 0;


void setup() {


  Serial.begin(115200); // make serial monitor match
  Serial.println ("Setup Done");
}


void loop() {


  currentMicros = micros();


  // how long's it been?
  elapsedTime = currentMicros - previousMicros;
  if ( elapsedTime >= 10000UL) { // 0.01 second passed? Update the timers
    previousMicros  = previousMicros + 10000UL;


    hundredths = hundredths + 1; // increment
    if (hundredths >= 10) {
      hundredths = 0; // else rollover and increment next digit


      tenths = tenths + 1;
      if (tenths >= 10) {
        tenths = 0;
        secondsOnes = secondsOnes + 1;
        if (secondsOnes >= 10) {
          secondsOnes = 0;
          secondsTens = secondsTens + 1;
          if (secondsTens >= 6) {
            secondsTens = 0;
            minutesOnes = minutesOnes + 1;
            if (minutesOnes >= 10) {
              minutesOnes = 0;
              minutesTens = minutesTens + 1;
              if (minutesTens >= 6 ) {
                minutesTens = 0;
                hoursOnes = hoursOnes + 1;
                if ((hoursTens == 2) && (hoursOnes == 4)) {
                  hoursOnes = 0;
                  hoursTens = 0;
                }// hours total rollover check
                if (hoursOnes >= 10) {
                  hoursOnes = 0;
                  hoursTens = hoursTens  + 1;
                } // hoursOnes rollover check
              } // minutesTens rollover check
            } // minutesOnes rollover check
          } // secondsTens rollover check
        } // secondsOnes rollover check
      } // tenths rollover check
    } // hundredths rollover check
  }// hundredths passing check


  if (oldTenths != tenths) { // show the elapsed time
    oldTenths = tenths;
    Serial.print(hoursTens);
    Serial.print(hoursOnes);
    Serial.print(":");
    Serial.print(minutesTens);
    Serial.print(minutesOnes);
    Serial.print(":");
    Serial.print(secondsTens);
    Serial.print(secondsOnes);
    Serial.print(".");
    Serial.println (tenths);


  } // end one second check


} // end loop

CrossRoads:
The clock looks to show 0-F for hours (0-15 possible), and 0-3F (0-63 possible) for minutes. Looks like binary to me.

0-F for hours, 0-7 for tens of minutes and 0-F for ones of minutes might be easier to look and interpret.

That is pure binary for the hours and BCD for the minutes. For a 12-hour clock, that would display identically to pure BCD, except for the hours 10 through 12.

Scarebird:
I've seen versions that use a binary system to represent each of the 4 digits of a conventional clock display, but I wanted to go pure binary.

In other words, the OP was aware of BCD clocks, it's just that he (she?) decided not to make one.

Yet another possibility would be to use a 30+15+8+4+2+1 system. That way, you would have hours, quarter-hours, and minutes.

CrossRoads:
The clock looks to show 0-F for hours (0-15 possible), and 0-3F (0-63 possible) for minutes. Looks like binary to me.

0-F for hours, 0-7 for tens of minutes and 0-F for ones of minutes might be easier to look and interpret.

Single 16 MHz crystal driven '328P the resistors/LEDs would have been enough, even with 4 bits for hours, 3 bits for tens digits, and 4 bits for one minutes.

This code could be adapted easily to output in binary

  // (insert CrossRoads' beloved stopwatch sketch here)

If you want to go that route, see my two-button clock project, here:
https://forum.arduino.cc/index.php?topic=408565.0