1408 doomsday clock

Greetings travellers,

I'm currently working on this arduino-uno based doomsday clock, like in the movie 1408.
i am currently thinking of using the DS1307 I2C RTC clock module for tracking time, but is the rest of the project feasible?

I'm a newbie at arduino code, but i have some friends who can help me code, i hope.

I wanted to ask advice where i should start, getting a 4 digit 7 segment display? Some IC's for multiplexing?

Best solution would be if there is already an another project like this somewhere :slight_smile:

Thanks for reading, cheers!

the clock:

A single clock display can be this: Red 7-segment clock display - 1.2 digit height : ID 1264 : $7.50 : Adafruit Industries, Unique & fun DIY electronics and kits
You can use transistors or a chip that can drive the leds directly.
It depends on the size of the clock and how much current the leds need.

Look here for the section "Seven segment displays":
http://playground.arduino.cc/Main/InterfacingWithHardware#Output

Caltoa:
A single clock display can be this: Red 7-segment clock display - 1.2 digit height : ID 1264 : $7.50 : Adafruit Industries, Unique & fun DIY electronics and kits
You can use transistors or a chip that can drive the leds directly.

Adafruit also do a backpack version that uses just 4 wires. Nice looking and decent sized display. I have a green one that will hopefully soon become part of an alarm clock.

Take a look on these Nick Gammon Alarm clock from Atmega328 and 7-segment display

Hi Blastsniper,

There are many ways to drive displays like these. If you can narrow it down to a small choice of displays you like first, we can advise on which to choose & how to drive them.

Options, off the top of my head, could include max7219 or saa1064 led driver chips, more general purpose drivers like 74hc595 + ULN2803 or TIPC6B595. Or keep it minimal and drive directly with the Arduino plus a few transistors. You could even charlieplex like this.

Paul

ok so i have my display up and running with the 1307.

problem is the countdown function, i have it like this now.
And it wont start counting down from 59:59. It doesnt do anything, so apperently its not a matter of replacing the +'s , with -'s. Retarded i know, but i cant find anything on this matter.

I want a simple timer that counts down from 59:59, with the 4 digits as seperate outputs for the sevseg lib.

the problem is that it counts down to 59:50, before tripping.

unsigned long currentmillis = 0;

unsigned long previousmillis = 0;

unsigned long interval = 10000;



byte ones_seconds = 9;
byte prior_seconds = 0;

byte tens_seconds = 5;

byte ones_minutes = 9;

byte tens_minutes = 5;

byte tenths = 0;

byte hundredths= 0;

int countdownsec = ones_seconds;
int countdownsectenth  = tens_seconds;
int countdownmin = ones_minutes;
int countdownmintenth = tens_minutes;

int sec = (countdownsec,countdownsectenth);
int minu = (countdownmin,countdownmintenth);

void setup()

{



Serial.begin(57600);

}

void loop()

{

  currentmillis = micros(); // read the time.

  while (currentmillis - previousmillis >= interval) // 10 milliseconds have gone by

  {

    hundredths = hundredths -1;

    if (hundredths == 10){

      hundredths = 0;

      tenths = tenths -1;

    }

    if (tenths == 10){

      tenths = 0;

      ones_seconds = ones_seconds -1;

    }

    if (ones_seconds == 10){

      ones_seconds = 0;

      tens_seconds = tens_seconds -1;

    }

    if (tens_seconds == 6){

      tens_seconds = 0;

      ones_minutes = ones_minutes -1;

    }

    if (ones_minutes == 10){

      ones_minutes = 0;

      tens_minutes = tens_minutes -1;

    }

    if (tens_minutes == 6){

      tens_minutes = 0;

    }

    previousmillis = previousmillis + interval; // save the time for the next comparison

  }

  // counters are all updated now,

if (prior_seconds != ones_seconds){

  Serial.print (tens_minutes, DEC);

  Serial.print (" ");

  Serial.print (ones_minutes, DEC);

  Serial.print (" : ");

  Serial.print (tens_seconds, DEC);

  Serial.print (" ");

  Serial.println (ones_seconds, DEC);
prior_seconds = ones_seconds;
}

} // end void loop

Use "code" tags ( [ # ] icon), not "quote". Please fix it.

Did that, didnt know how you could paste the code correctly…

Anyway, i need to make my 4 digit segment screen countdown from 59:59, any easy way to do this? In my previous post i posted the code i was currently working on

A far simpler system may be to just count seconds and make the display code break it down into thousands, hundreds, tens and ones.

Yes, Riva beat me to that suggestion by seconds! Except, of course, its not thousands and hundreds, its tens of minutes, minutes, tens of seconds and seconds. I'm sure that's what Riva meant.

Hmmm, can i use my ds 1307 rtc with that?

This project should do 3 things, display time, spazz(random digits), and countdown from 59:59.

The problem is, i wanted to break down the code into 2 files, so if i wanted to switch from time to the random digits i should upload the other code.

The best thing would be if i could put those three functions into the same code, and then switch from function through the serial monitor. Is this doable? I mean, it shouldnt be that difficult? This is the first project im trying to do which hasnt been done yet. So its quite the challenge figuring this stuff out.

And how should i make the code so it displays the countdown? It shouldnt count up, but down.. im in a hassle here.
Thanks for the help and suggestions.

Yes, all 3 functions can be in the same sketch. You could select between them with serial, a button swich, or make it random.

I wouldn't use the rtc for the countdown. It won't count backwards anyway, so you would have to write some code to calculate the "remaining time to go" from the current time. Unless you want the countdown zero time to be at a particular time of day...

Paul

How does the serial command line work?

I’m this far with the countdown timer.

#include <SevSeg.h>


unsigned long currentmillis = 0;

unsigned long previousmillis = 0;

unsigned long interval = 10000;



byte ones_seconds = 9;
byte prior_seconds = 0;

byte tens_seconds = 5;

byte ones_minutes = 9;

byte tens_minutes = 5;

byte tenths = 0;

byte hundredths= 0;

int countdownsec = ones_seconds;
int countdownsectenth  = tens_seconds;
int countdownmin = ones_minutes;
int countdownmintenth = tens_minutes;

int sec = (countdownsec,countdownsectenth);
int minu = (countdownmin,countdownmintenth);
SevSeg sevseg;

void setup(){
//I am using a common anode display, with the digit pins connected
sevseg.Begin(1, 4, 3, 2, 1, 12, 11, 10 , 9, 8, 7, 6,5);

//Set the desired brightness (0 to 100);
sevseg.Brightness(70);




Serial.begin(57600);
}

void loop()

{

  currentmillis = micros(); // read the time.

  while (currentmillis - previousmillis >= interval) // 10 milliseconds have gone by

  {

    hundredths = hundredths -1;

    if (hundredths == 0){

      hundredths = 9;

      tenths = tenths -1;

    }

    if (tenths == 0){

      tenths = 6;

      ones_seconds = ones_seconds -1;

    }

    if (ones_seconds == 0){

      ones_seconds = 9;

      tens_seconds = tens_seconds -1;

    }

    if (tens_seconds == 0){

      tens_seconds = 6;

      ones_minutes = ones_minutes -1;

    }

    if (ones_minutes == 0){

      ones_minutes = 9;

      tens_minutes = tens_minutes -1;

    }

    if (tens_minutes == 0){

      tens_minutes = 9;

    }

    previousmillis = previousmillis + interval; // save the time for the next comparison

  }

  // counters are all updated now,

if (prior_seconds != ones_seconds){

  Serial.print (tens_minutes, DEC);

  Serial.print (" ");

  Serial.print (ones_minutes, DEC);

  Serial.print (" : ");

  Serial.print (tens_seconds, DEC);

  Serial.print (" ");

  Serial.println (ones_seconds, DEC);
prior_seconds = ones_seconds;
}
sevseg.PrintOutput();
sevseg.NewNum();

} // end void loop

And it seems to work slightly, i’m getting some correct output on the monitor. But it doesn’t want to print on the segment display.