5 x 7 matrix binary clock

need help in creating a binary clock with a free 5 x 7 matrix.
I have an arduino uno (just bought it as a kit, (w/projects) a few months ago) and recently got a DS1307 too....link is not working...here's what my time-pcb looks like

can't even get the link to work properly....ugh

my problem is that I don't know how to setup the LED to show the time in binary,
requesting help, similar to reddits "explain this like im 5" section, b/c I'm learning all of it at once.

any help is appreciated, as I may not even know the right questions to ask.

Got a spec on your 5x7 matrix? Are you planning on scrolling all the info across the 1 device?

I'd like it to be static, so no scrolling.
it would leave one column left (on either side depending on how i adjust the code) for either seconds or days.

the sideprint is
DMGW2358...................................RI (or R1 maybe)
SY-C22..........................................738
on the bottom, through the semi transparent plastic this is printed
M23058A/B............... WLG.. Unp

my searches bring up many similar ones, but not the exact one..it may be old, I don't even know if it's anode or cathode

mine has 14 pins (7 per side) but different than the one at ebay linked below, the traces inside the box are running opposite directions (longways) and they're the wide type traces...with only a few skinny ones., but the casing appears to be identical, as it has the larger cutouts and looks like mine would mate up with this one.

However, I would buy another one if necessary.

.found on ebayy (which this link doesn't work either...bug?
here's the similar LED Matrix that i can find..but can't find my exact one...

http://www.ebay.com/itm/CSC-CSM57221E-5x7-DOT-MATRIX-ORANGE-2-INCH-DISPLAYS-8-PCS/221245517723?_trksid=p2045573.c100033.m2042&_trkparms=aid%3D111001%26algo%3DREC.SEED%26ao%3D1%26asc%3D33890%26meid%3D19e7afefbafb4a5e9f7717498f75a214%26pid%3D100033%26rk%3D1%26rkt%3D4%26mehot%3Dag%26sd%3D221245517723

CrossRoads:
Are you planning on scrolling all the info across the 1 device?

I think he means "binary clock".

Goodness knows why!

Paul__B:
Goodness knows why!

They are "trendy" in geek circles! Only the geeks can tell the time using them, so they feel a little superior to everyone else.

Falkor, does your matrix have 5 common anodes and 7 common cathodes, or the other way around?

PaulRB:
Falkor, does your matrix have 5 common anodes and 7 common cathodes, or the other way around?

In any case, a MAX7219 would be a good start.

yes Paul...
like the pic you posted...
I plan to use the extra column to be days...1-7

I learned the basics of binary last week and want to become fluent in it...so, a simple reminder on my desk would be nice...

Geek*!* :grinning:

Falkor:
I learned the basics of binary last week and want to become fluent in it

But why? We have computers for that!

Anyway, you did not answer my question about common cathodes and anodes.

We can suggest how you can wire up your matrix. You will need extra components, you cannot just connect it directly to the Arduino.

Paul__B’s suggestion of max7219 chip is probably easiest and best. But if you do not have/want to buy one of those, do you have any transistors or a ULN2003 or ULN2803 chip or anything else like that? Note that 74xx595 will not help much (tpic6x595 would help).

What people call “binary clocks” are, more often than not, merely BCD clocks 8)

PaulRB:
But why? We have computers for that!

Anyway, you did not answer my question about common cathodes and anodes.

We can suggest how you can wire up your matrix. You will need extra components, you cannot just connect it directly to the Arduino.

Paul__B’s suggestion of max7219 chip is probably easiest and best. But if you do not have/want to buy one of those, do you have any transistors or a ULN2003 or ULN2803 chip or anything else like that? Note that 74xx595 will not help much (tpic6x595 would help).

the matrix i have has 7 pins per side…and I don’t know which one it is yet.

parts in the mail are:
atmega328p-pu (w/bootloader)
atmel-attiny84-20pu
74hc164 shift registers
I can probably get transistors and the rest from an old modem.
I can also get lots of old LEDs too,

I will post a picture of the matrix when I get home

Paul__B:
In any case, a MAX7219 would be a good start.

Straight binary, or binary-coded decimal?

I'd like to accomplish binary coded decimal first.
liek this photo from Paul

You might want to consider using a matrix board:
Adafruit has some:

And then there are some low cost max7219 boards out there:
http://www.electrodragon.com/product/dot-matrix-chain-display-kit-max7219-v2/

There are ready to go libraries for both of them.
This will allow you to get up and going a bit quicker.

Adafruit has a 16x8 module which can be used for things like simple games.

The max7219 boards can be strung together to create much larger displays that can be used for messages including scrolling messages.

Anyway, just some alternatives.

--- bill

Falkor:
the matrix i have has 7 pins per side...and I don't know which one it is yet.

If there isn't a part number stamped on one of its sides (which you could then do a web search) then get a multimeter with a diode test function and use that to "pin it out".

thanks guys..
Runaway: I did 30-45minutes of searches for the part numbers, which is why I believe mine to be very old... or from another country, and I will look into how to tell what matrix I have (don't really know yet..but I do have a diode, and a multimeter.

berryfap: thanks too... those look really cool, and good for future projects. I currently have a few parts (in the mail) to set this up...

74hc164 hi speed si-gate cmos logic ic,
8 parallel serial shift registers
attiny74-20pu ic
and an atmega328p-pu
a bunch of resistors and some pib dipsockets so i can set this as a stand alone device.

I guess this hasn't been done before (with an arduino), as I presumed it would've been old news by now...

forgive me for any (mis)spellings and/or puns.

again, all suggestions are appreciated and I will update this post as I complete (or destroy) the project.

// for turning a number into lights
// which lights to turn on?

// variable for the number you want to turn into lights
byte number = 15;

// variables that show, for each light,
// whether that light should be on or off
// true means on; false means off
boolean forty, twenty, ten, eight, four, two, one;

int leftover = number;

boolean forty  = (leftover >= 40);
if     (forty)    leftover -= 40;

boolean twenty = (leftover >= 20);
if     (twenty)   leftover -= 20;

boolean ten    = (leftover >= 10);
if     (ten)      leftover -= 10;

boolean eight  = (leftover >=  8);
if     (eight)    leftover -=  8;

boolean four   = (leftover >=  4);
if     (four)     leftover -=  4;

boolean two    = (leftover >=  2);
if     (two)      leftover -=  2;

boolean one    = (leftover >=  1);
if     (one)      leftover -=  1;

I know that this code could be made "cleaner", but I wrote it this way to make it easier for a newbie to read.

And here is a worked example to help you understand:

// WORKED EXAMPLE


byte number = 15;
// OK, for this example, the number is 15
// and these variables will hold the results
boolean forty, twenty, ten, eight, four, two, one;


int leftover = number;
// this makes a copy of our number
// now we can change the copy without changing the original number
// so now, leftover is 15


boolean forty  = (leftover >= 40);
// 15 is less than 40, therefore, (15 >= 40) is false
// so this boolean gets set to false

if     (forty)    leftover -= 40;
// since the boolean is false, nothing happens here


// now on to the next boolean
boolean twenty = (leftover >= 20);
// 15 is less than 20, therefore, (15 >= 20) is false
// so this boolean gets set to false, too

if     (twenty)   leftover -= 20;
// again a false boolean, so again, nothing happens


// and now for the next boolean
boolean ten    = (leftover >= 10);
// 15 is greater than 10, therefore, (15 >= 10) is true
// so this boolean gets set to true

if     (ten)      leftover -= 10;
// since the boolean is true, we follow the instruction
// the instruction says to decrease the value of leftover by 10
// leftover was 15, 15 minus 10 leaves 5, so leftover becomes 5


// remember, leftover is 5 now
boolean eight  = (leftover >=  8);
// 5 is less than 8, therefore, (5 >= 8) is false
// so this boolean gets set to false

if     (eight)    leftover -=  8;
// the boolean is false, so here, nothing happens


boolean four   = (leftover >=  4);
// 5 is greater than 4, therefore, (5 >= 4) is true
// so this boolean gets set to true

if     (four)     leftover -=  4;
// the boolean is true, so we follow the instruction
// the most recent value for leftover was 5
// 5 minus 4 leaves 1, so leftover becomes 1 


// keep in mind that leftover is now 1
boolean two    = (leftover >=  2);
// 1 is less than 2, therefore, (1 >= 2) is false
// so this boolean gets set to false

if     (two)      leftover -=  2;
// the boolean is false, so nothing happens here

// leftover is still 1


boolean one    = (leftover >=  1);
// 1 is equal to 1, therefore (1 >= 1) is true
// so this boolean gets set to true
if     (one)      leftover -=  1;
// the boolean is true, so we follow the instruction
// 1 minus 1 leaves 0, so leftover becomes 0

Falkor:
I guess this hasn't been done before (with an arduino),...

I doubt that very much.

You are not understanding that determining what to do depends on what you have -- what sort your "5x7" matrix is, its specifics.
There simply is not a "5x7 matrix industry standard" pin layout. OK?

So, you need to use your multimeter's diode tester to find out what is what:
Place the + lead on a pin and the - to all the others, one at a time, and see if any lights up (dimly). Then place the + lead on the next pin, taking notes of what results a light each time (e.g. pin 3 +, pin8 - : Col 2, Row 4 On) and just keep going at it, process of elimination.

That will give you a hobby.

Falkor:
74hc164 hi speed si-gate cmos logic ic,
8 parallel serial shift registers
attiny74-20pu ic
and an atmega328p-pu
a bunch of resistors and some pib dipsockets so i can set this as a stand alone device.

I guess this hasn't been done before (with an arduino), as I presumed it would've been old news by now...

Using shift registers to drive LEDs or a LED matrix has been done before, many times.
When using a LED matrix and the shift registers you have selected, you may have to have some additional h/w to drive the leds like transistors (depending on the LEDs and how bright you want them), but you will also have to use/write some s/w to rapidly control the shift registers to light up the LEDs since you can't just turn on/off individual LEDs within the matrix. You have to scan across the columns/rows to turn on the LEDs within each single row/column in succession. i.e. at any given instance of time you can't turn on/off the leds in more than a single row/column.

In fact, if you google Arduino shift register LED matrix, you can find many links to various videos, tutorials and projects that show how to do this.
Most will be using 595s but it is essentially the same for a 164.

To do this and other things at the same time like reading the time from an RTC requires coming up with a way to do "multi-tasking". Updating the shift registers in your main idle loop is not difficult and works, but then as soon as you start to do something else like look at buttons (to set the time) or talk to i2c to get the time you add overhead which delays the updates to your LED output scanning. This added overhead will likely cause the leds on your display to flicker.
To keep the display looking nice you can use an interrupt routine to update the shift registers in the background.
While also not difficult, it is a different style of programming and debugging code used at interrupt level is difficult using the primitive Arduino IDE debugging capabilities.

Another thing to consider is physical wiring. When wiring up the matrix without a PCB there are many wires and that can make it a difficult project particularly when trying to fit it in a space limited case.

I'm not trying to say don't go down this path but simply that this is much more complicated as an initial project than using a chip that does the all LED matrix scanning for you like the max7219 or the HT16K33 that were on the boards I linked to.
Using those chips dramatically reduces the s/w complexity in that the sketch can simply tell the chip which leds to turn on and then the chip will do all the needed scanning for you while the sketch is free to be off doing other things.
And using a kit that contains a PCB allows everything to be very compact and dramatically limits the wires.
On the adafruit boards, since they use i2c you would be using the same 2 Arduino pins to read/set the RTC clock as to control the LED matrix.

--- bill

bperrybap:
Using shift registers to drive LEDs or a LED matrix has been done before, many times.
When using a LED matrix and the shift registers you have selected, you may have to have some additional h/w to drive the leds like transistors (depending on the LEDs and how bright you want them), but you will also have to use/write some s/w to rapidly control the shift registers to light up the LEDs since you can't just turn on/off individual LEDs within the matrix. You have to scan across the columns/rows to turn on the LEDs within each single row/column in succession. i.e. at any given instance of time you can't turn on/off the leds in more than a single row/column.

In fact, if you google Arduino shift register LED matrix, you can find many links to various videos, tutorials and projects that show how to do this.
Most will be using 595s but it is essentially the same for a 164.

To do this and other things at the same time like reading the time from an RTC requires coming up with a way to do "multi-tasking". Updating the shift registers in your main idle loop is not difficult and works, but then as soon as you start to do something else like look at buttons (to set the time) or talk to i2c to get the time you add overhead which delays the updates to your LED output scanning. This added overhead will likely cause the leds on your display to flicker.
To keep the display looking nice you can use an interrupt routine to update the shift registers in the background.
While also not difficult, it is a different style of programming and debugging code used at interrupt level is difficult using the primitive Arduino IDE debugging capabilities.

Another thing to consider is physical wiring. When wiring up the matrix without a PCB there are many wires and that can make it a difficult project particularly when trying to fit it in a space limited case.

I'm not trying to say don't go down this path but simply that this is much more complicated as an initial project than using a chip that does the all LED matrix scanning for you like the max7219 or the HT16K33 that were on the boards I linked to.
Using those chips dramatically reduces the s/w complexity in that the sketch can simply tell the chip which leds to turn on and then the chip will do all the needed scanning for you while the sketch is free to be off doing other things.
And using a kit that contains a PCB allows everything to be very compact and dramatically limits the wires.
On the adafruit boards, since they use i2c you would be using the same 2 Arduino pins to read/set the RTC clock as to control the LED matrix.

--- bill

tl;dr: Maybe less work just to buy twenty loose LEDs (and, of course, twenty resistors) and wire them up.