Trybotics Logo

Arduino 24h Binary Clock with Seconds (17 LEDs) © GPL3+

DESCRIPTION

This clock does not (yet) synchronise with any time server and does not use a real time clock module to stay exactly on time (yet).

It just runs a basic seconds count with a 1000 millisecond delay in the sketch. LEDs are connected to PWM 3 to 19 with a resistor each.

Note that: PWM pins 14 to 19 are the Analog pins 0 to 5.

I will be adding Internet time synchronisation soon. Stay tuned and hit Follow! ;)

Enjoy and greetings,

Peter Lunk

24h Binary Clock with Seconds - Demo Video

Description:

A000066 iso both
Arduino UNO & Genuino UNO
×1
09590 01
LED (generic)
I used 10 red, 6 green and 1 Orange LED.
×17
Mfr 25frf52 100r sml
Resistor 100 ohm
1 Resistor for every LED
×17

Description:

This clock does not (yet) synchronise with any time server and does not use a real time clock module to stay exactly on time (yet).

It just runs a basic seconds count with a 1000 millisecond delay in the sketch. LEDs are connected to PWM 3 to 19 with a resistor each.

Note that: PWM pins 14 to 19 are the Analog pins 0 to 5.

I will be adding Internet time synchronisation soon. Stay tuned and hit Follow! ;)

Enjoy and greetings,

Peter Lunk

24h Binary Clock with Seconds - Demo Video

Description:

Arduino 24h Binary Clock with Seconds Sketch / codeArduino
// Arduino 24h Binary Clock with Seconds. (17 LEDs total)
// You can find a demonstration video of this project
// here on Youtube: https://www.youtube.com/watch?v=R1rWMhTKyh0
// Full project on Hackter.io : https://www.hackster.io/peter-lunk/arduino-24h-binary-clock-with-seconds-17-leds-total-2c2374
// Greetings, MrLunk

// pins 2 - 13 are the regular digital pwm pins.
int ledPinsSec[] = {2, 3, 4, 5, 6, 7};
int ledPinsMin[] = {8, 9, 10, 11, 12, 13};

// pins 14 - 20 are the analog pins 0 - 5 used as digital pwm pins  
int ledPinsHr[] = {14, 15, 16, 17, 18, 19};

// set Start time here
int countS = 0;   // Seconds
int countM = 13;  // Minutes
int countH = 23;  // Hours

byte countSec;
byte countMin;
byte countHr;
#define nBitsSec sizeof(ledPinsSec)/sizeof(ledPinsSec[0])
#define nBitsMin sizeof(ledPinsMin)/sizeof(ledPinsMin[0])
#define nBitsHr sizeof(ledPinsHr)/sizeof(ledPinsHr[0])

void setup(void)
{
  for (byte i = 0; i < nBitsSec; i++) {
    pinMode(ledPinsSec[i], OUTPUT);
  }

  for (byte i = 0; i < nBitsMin; i++) {
    pinMode(ledPinsMin[i], OUTPUT);
  }

  for (byte i = 0; i < nBitsHr; i++) {
    pinMode(ledPinsHr[i], OUTPUT);
  }
}

// ----- Main Routine -------------------------------------------------

void loop(void)
{
  countS = (countS + 1);
  if (countS > 59)
  {
    countS = 0;
    countM = (countM + 1);
    if (countM > 59)
    {
      countM = 0;
      countH = (countH + 1);
      if (countH > 23)
      {
        countH = 0;
        countM = 0;
        countS = 0;
      }
    }
  }

  dispBinarySec(countS);
  dispBinaryMin(countM);
  dispBinaryHr(countH);

  delay(1000);   // 1000 milliseconds = approx. 1 second delay
  // ADJUST for fast or slow running clock here, in milliseconds.
}

// ----- Subroutines ---------------------------------------------------

void dispBinarySec(byte nSec)
{
  for (byte i = 0; i < nBitsSec; i++) {
    digitalWrite(ledPinsSec[i], nSec & 1);
    nSec /= 2;
  }
}

void dispBinaryMin(byte nMin)
{
  for (byte i = 0; i < nBitsMin; i++) {
    digitalWrite(ledPinsMin[i], nMin & 1);
    nMin /= 2;
  }
}

void dispBinaryHr(byte nHr)
{
  for (byte i = 0; i < nBitsHr; i++) {
    digitalWrite(ledPinsHr[i], nHr & 1);
    nHr /= 2;
  }
}

Description:

Arduino 24h Binary Clock with Seconds Schematics
24h binary clock with seconds arduino 8izwvkeez6


YOU MIGHT ALSO LIKE