Clock project - what to buy

Hi

I'm pretty new to Arduino and I would need some info so I know what to buy to start my project. Just to make sure that I don't buy the wrong parts :slight_smile:

Goal
Program my own clock using seperate leds to display the time and making sure you don't need to enter the time again every time you cut the electricity.

I/O

  • 30 outputs min
  • 5 inputs min

Requirements

  • The board needs to be as small as possible
  • Needs to have a backup battery to ensure that there is no reset of time every time you disconnect the power
  • Time needs to be correct - no deviation of a few secs/day

Questions

  • What board would be best to buy
  • Is there a need of an extra board to be able to use 30 outputs?
  • Is there an expander board for battery backup purposes?
  • Is there an extra chip needed for RTC?

As this is my first real project, I need to buy all hardware so I would love to get some guidance on what to buy exactly and if possible I would like to use as much many default libraries as possible.

Thanks!

To keep accurate time, consider using a 60KHz time signal receiver module, and maybe not bother with the RTC.

Do you really need 30 outputs? You could save pins my mutiplexing the LEDs, or by using an external 7-segment display driver chip.

30 outputs?
That seems like a lot. Why so many?
Do you really need that many?
What about voltage on the i/o pins?
Do you need 5v or can it work with 3v?
What about the current on the i/o pins?

I think you need to provide more details on the
rest of the design to get good options.

The teensy boards ( Teensy USB Development Board )
are very compact and Teensy 3 even has
realtime clock support built in but if you can't use 3v i/o pins
then this is not an option.

Teensy ++ could be used. It would require a RTC
I'd recommend a ds1307 i2c rtc module. They are about $2.50 USD on ebay.
(search for "i2c rtc" on ebay and you will see them)
There are arduino time libraries for the 1307.

That said, I'm betting that there are some alternatives to the design you are thinking
that could reduce the pin requirements.
i.e. using multiplexing to drive the display leds.

--- bill

Something like this clock chip (and battery) will give you the time:

You can get port-expander chips, or even just 74HC595 shift registers, as described here:

That turned on 32 LEDs using only three pins (plus power and ground) from the processor. On a Uno or similar Arduino board that still gives you most of the 20 pins for other uses. Well, you would lose two of them for the clock chip. Still, that easily gives you more than 5 inputs.

There's a board called the Centipede which has 64 output ports. Pictured on this page:

Time needs to be correct - no deviation of a few secs/day

Most clock chips will have some sort of drift. There are more expensive ones with less drift. If you want no drift you will probably need a GPS which gets its time from the satellites.

Example: Adafruit Ultimate GPS Breakout - 66 channel w/10 Hz updates [PA1616S] : ID 746 : $29.95 : Adafruit Industries, Unique & fun DIY electronics and kits

You could use the GPS to "correct" the clock, so you still know the time even if you lose GPS signal from time to time.

If space is at a premium I would look on the site here for some of the smaller boards like the Pro Mini.

Thanks for the reply both.

Well I need to be able to enable/disable 30 leds one by one to make combinations to show the time. Every minute will show a different combination of leds. The setup is to enable a led on a certain location which will show the correct time by combining the information of all enabled leds. So yes, I would need 30 but maybe I can use a system to enable leds via a matrix or so? That way I would need less outputs? (I did some programming in the past but never did the electronics part myself)

I don't know anything at all about leds, they need to be bright and I was planning to run down to a local shop tomorrow to get the info. Can you choose or are there requirements depending on power source maybe?

Thanks!

Thanks Nick, I'll have a look at that too! This is great input to see what I should buy :slight_smile: The drift you are talking about is no issue at all, GPS will be overkill. Is it straightforward/easy to connect a clock chip and use it while programming an arduino or is this a tricky part?

They are easy to use. Connect up 4 wires (SDA, SCL, power, gnd) and use one of the libraries.

Have you got some sort of custom display you have in mind, or are you trying to show digits? In any case there are multiplexing chips that will do that with a small number of outputs from the processor.

For example, as shown here: http://www.gammon.com.au/forum/?id=11516

That turns on and off 64 LEDs by multiplexing. It only requires 3 processor pins, plus power and ground.

Stijn:
Thanks for the reply both.

Well I need to be able to enable/disable 30 leds one by one to make combinations to show the time. Every minute will show a different combination of leds. The setup is to enable a led on a certain location which will show the correct time by combining the information of all enabled leds. So yes, I would need 30 ...

I was assuming that is what you had in mind.

You can take advantage of the way the human eye works to save MANY pins.
You can take advantage of the human eye's persistence of vision.
You know how when a picture is taken you see the flash for some time after?

Using that to your advantage,
you can multiplex the LEDs such that you only light certain needed segments at a time
but if you do it fast enough, the eye will see them all lit.

Not lighting all the LED segments at once will also save power.

The s/w to do it is more complicated than simply assigning an output pin to each led segment.

-- bill

Hi

Apologies as my setup might not have been very clear, I'll try to rephrase it:

I have a glass panel where several words and numbers are transparent and all other parts are not. The goals it to enable a led behind a transparent part so that you can โ€œreadโ€ the time from the glass panel as a full sentence by just looking at the parts where a led is burning.

So I canโ€™t use a display and I would need to be able to enable/disable 30 separate leds. Using a matrix is still an option as I would be able to control more leds than I use I/Os.

The first goal of the project is to do a very simple setup, not harder than using a clock chip, battery backup if this is not too advanced, using a few buttons to set the time and control the leds 1 by 1 to control the leds. If this succeeds I can make a 2nd revision and already understand more of what you guys are telling :slight_smile:

At the moment I understood that I should buy

  • An Arduino nano
  • A clock chip
  • 5 buttons/30 leds

What am I missing in this picture?

Thanks!

A multiplexing chip like the MAX7219. For example, in this photo:

The LEDs are actually being lit in sequence, very quickly. And there are 64 of them. You would need to wire your LEDs in a suitable way for multiplexing.

Alternatively, 4 x 74HC595 shift registers. Here I had them wired up to 32 LEDs:

Notice in the above photo that most of the Arduino pins are still free.

Nick

I might be really stupid here but I'll take my chances to have to change my name afterwards :wink:

In this project the first one wouldn't be an option as the leds will be far away from each other (10 cm every time) but a shift register might be an option. So my list continues:

  • Arduino board
  • Clock chip (some type?)
  • 4 x 74HC595 shift registers
  • 30 leds
  • 5 buttons
  • Some resistors for the leds

Open questions:

  • Wouldn't it be more interesting to buy a Teensy board because it already has the RTC support? Does it support the same libs or are they always behind a bit?
  • What about a battery backup so I don't need to set the time every time? Or is it difficult to implement?

Thanks!

The clock board I mentioned here has a lithium battery backup:

I'm a bit troubled about this 3 meter cable run you are contemplating. It might pick up quite a bit of noise which would be fed back into the shift registers. Maybe some decoupling capacitors might fix that. Perhaps someone else here has had experience with such a project?

Ah.... I'm guessing a word clock.
There are several instructable articles about this.
You can find many pages by googling around.
Here are a few links of what I think you are talking about:
http://www.highonsolder.com/blog/2011/1/8/arduino-word-clock.html

Whether it is individual LEDs in word clock or segments inside 7 segment LEDs
it doesn't matter. The techniques for driving multiple LEDs with fewer pins
will be the same.
Using a technique called charlieplexing it is possible to drive 120 LEDs with a Arduino board
without having to resort to shift registers or other external chips.
The key is that not all of them are on at once.

The problem with trying to have a pin to drive each individual LED is that
even if you did by say using a Teensy++ the AVR cannot drive all the LEDs at once.
That is too much current. So you can't run them all at the same time even if you
wire up that way.

In the word clocks I've seen, the words need more than a single LED
to light up the full word. It often takes an led per letter
Words like "Minutes" will need 7 Leds. If the LED has much brightness to it,
which it will need to see in the daylight, the 7 leds will draw more current than
than the AVR pin can handle and you still need to light up a few other words
to show the full time.

So that means you have to use some sort of external circuitry and as well as multiplexing
to get the job done.

A lot of the word clocks only use 24 or so "words"
There are many techniques that could be used.
You could use shift registers or a matrix driven directly by pins.
But both of those will potentially require using transistors to actually drive the LEDs
especially if the the LEDS are not time multiplexed.

With that many LEDs, unfortunately, I think you are going to have
to jump into the deep end and start swimming.

The hc595 can drive 25ma per output but it can't do that on all 8
pins at once as the total package can only support 750mw which is about
18ma per pin if all are on.
You can limit the current to make that work, but it may not be as bright as you
want/need.

Take a glance at some of the other projects to get some ideas as to what they have done.
They have schematics and even code.

Me, I'd do it with a matrix and a few transistors and time multiplex it.
It keeps the external components down to just resistors and transistors
which are pretty cheap.

For a clock "chip", you could go that route but then you would need more components.
I'd get an i2c clock module that is ready to go. Just pop in the battery and hook it up.
You can get it from Adafruit or if you have time, you can order a similar module
from China off ebay for less.

--- bill

The 74hc595 is notorious for noise. Even when the wires are short like inches (6 cm) you can have problems
with clocking. Caps help alot but it will be tricky to chain 4 of these together to ensure that the
bits carry over correctly.
Google around and you will see lots of people running into issues particularly when chaining together.
The big issue is if clocking when the outputs are enabled because all the output stages are transitioning
while the latches are being loaded and clocked. It creates a tremendous amount of noise and can create
ground bounce.
I chased an issue with this a while back when I was building LCD backpack circuit using a single
595. My wires were only a few inches long and the load on the outputs were quite minimal.
Careful wiring and some additional caps solved the issue.

---bill

Stijn,
Here is a video that talks about multiplexing and using persistence of vision.

It uses a simple matrix and time multiplexes through it.
This technique requires no external components as you just turn on the individual LEDs
based on column & row address.

Not sure that you can use his code but you can get an idea about the technique.

--- bill

Here is a full project. It uses some external components to be able to drive the LEDs
but it can do some interesting effects.

--- bill

Am I seeing this too simple when I would say that I would connect all 30 leds one side to the Arduino/shift register/... and the other end to an external power source to ensure they have enough power? That way I don't need to worry about this? Or is this "not done" for some reason?

Stijn:
Am I seeing this too simple when I would say that I would connect all 30 leds one side to the Arduino/shift register/... and the other end to an external power source to ensure they have enough power? That way I don't need to worry about this? Or is this "not done" for some reason?

Go back and read my post (reply #25)
There are power issues depending on how much current the LEDs draw and how
many are on at any given time.

It doesn't matter if the other side of the LED goes to a separate power source.
The pin driving the LED must source or sink the current going into the LED.
And while any given output pin might be able to supply a certain amount of current,
all the pins on a chip cannot simultaneously supply the maximum amount of current
that an individual output pin can supply.
i.e. there is a limit per output pin and a limit per chip and the limit per chip is less
than the limit per output pin times the number of pins on the chip.

--- bill

Hi Bill

thanks, my post was exactly a question after reading yours :slight_smile: this shows how "much" I know about all this, my apologies!

I will make a calculation of how many and which leds I will need and come back! This will be better to help understand the project! Thanks again!

Bill and others,

my apologies, I took the time to review all posts and check all links and this was exactly what I was hoping to create. I will take some more time to dive into all links and come back to this if I have better questions :slight_smile: Thanks for the info and help!!