Instructables

March 2014 Update! Version 5.1 of the code is out with bug fixes and a nice lower case font. Get it while it's hot! The link is on the last page of this instructable!


This clock uses the classic video game Pong to tell the time. The 2 players automatically win and lose so their scores show the hours and minutes. It's not too hard to build and should cost less than $100. All the parts are easily available on eBay and the software code is free to download!

The clock can also show the time written in words such as "Ten Past Twelve", with large or small digits and with a slide or jumble effect. The date pops up every now and again too, printed out with a retro flashing cursor effect. A menu screen lets you choose the display mode, or you can have the clock pick a random mode every few hours.

The project uses 2 bright LED matrix panels from Sure Electronics. You can buy them in red or green with either 3mm or 5mm LEDs. An Arduino runs the main code and a DS1307 clock chip keeps time, even when the power is off.

 
Remove these adsRemove these ads by Signing Up

Step 1: Parts List & Cost

Picture of Parts List & Cost
arduino.jpg
ds1307.jpg
shield.jpeg
idc16way.jpeg
push to make.jpg
usb-a-b-cable.jpg
mainsusb.jpg

So here's what you need...

2 x Model 2416 Red or Green LED Matrix Displays from Sure Electronics

You can get these from Sure's eBay store for $15 each: http://www.sure-electronics.net/ Make sure you get the new version of the display which is based on the Holtek HT1632C chip. You can tell the new displays as they have the controller chip and DIP switches on the back. (See pic). My clock is made with the 3mm LED display, but they also make a larger 5mm one.

1 x Arduino Uno / Duemilanove with ATmega 328 CPU

Th Arduino is the brains of the clock. It has a microprocessor that runs the main clock software, plus inputs and outputs we connect to the displays and other components. Ensure you get an Arduino with the ATmega 328 CPU. (Some older boards come with the ATmega 168 with doesn't have enough RAM). You can get Arduino's for about $30. Try Sparkfun Electronics or eBay.

1 x DS1307 Real Time Clock chip (RTC) and IC socket.
1 x Crystal Oscillator for the DS1307
1x 3.3v Coin Cell and holder - battery backup for the DS1307

I found all these bits on eBay bundled as a kit for $10.

1x Arduino Prototyping Shield

The prototyping board or ‘shield’ plugs onto the top of the Arduino making it easy to add components. It brings all the Arduino's input and output pins onto a circuit board that you can solder components to. Get a board which is designed for a chip to go on, i.e. one that brings each pin of the IC out to a solder pad you can connect wires to (see pic). Again places like Sparkfun or eBay are good sources for them. You should be able to pick one up for $15 - $20. If you don't like the idea of soldering, you could get a breadboard and jumper wire to build the circuit on temporarily instead.

1x 16 Pin IDC Socket
We solder this socket to the prototype board so we can plug the display ribbon cable in. They are a couple of dollars on eBay. If you aren't planning to solder, you don't need this.

2x ‘Push to Make’ Buttons.
These are used to set the time / change the display mode. You can get them for a few dollars.

1x USB Lead - Type "A to B"
This is needed to to program the Arduino, and then as a power lead for the clock.

1x Mains to USB Power Adapter
This is used to power the clock and you can pick them up for less than $10. Look for one with an output of 150mA or above.


1-40 of 93Next »
Djandco2 years ago
Hi,

First off thanks for the idea and the ible ;-)

I built one and I have a little question if you don't mind;
The clock works perfectly but it freezes up. If you do the IT repair (power off, power on) it works perfectly again.
Any ideas?

Oh, one more thing, for some reason the Uno is only pumping 3.4V DC from the 5V output, I found that I had to use the 5V supply to power the clock chip otherwise I got random code on the display and if your tried to change the clock time the number goes up and you can not select anything.
Put the 5V on and bob is your next door neighbour!

Thanks

Darren
mrnick1234567 (author)  Djandco2 years ago
Hi Darren,

Someone else had the same with the time freezing, he fixed it by replacing the DS1307, but it could be the power if your board is only outputting 3.4v. You might also have a bad connection to the clock chip. The LED on the arduino pin 13 should flash every second to let you know the clock chip is being read and ticking.

Make sure you are not powering the Uno from the round power jack and check the voltage from the 5v pin without anything plugged into the Uno. If it still reads low, maybe there is something up with your Arduino or power supply. If not maybe you have a short somewhere. Good luck!

Nick

Best bet is to run the 5V to the displays, and then run a 5V line to the 5V of the Arduino - so basically the Arduino is powered from the displays. That was how I fixed the problem.

This can happen if you are using a standard USB cable - they drop voltage like crazy. A beefier USB cable may solve this, OR you can use a power adapter. If you use a power adapter (don't go over 9V) and your regulator on the arduino is getting hot, see my instructable on beefing up your arduino. If the clock gets less than 3.4V the clock stops sending data, and the program freezes. This was the entire reason (and project) I made that instructable for.
CIMG1779.JPG
Thanks Nick,

In your ible you do state to use the USB to power it and not the round power socket, I had been told that you only had to worry about this on older ones where you had to select the power source? not sure about that but I had also been told that on the new model UNO it did not matter which way you power it.
Turns out it does :-)
I cut down a USB lead and powered the unit from that and so far we have no issues.

Should have done what you said in the first place!

Thanks for coming back to me on this.

Kind regards

Darren
2011-12-28_13.05.06.jpg
paulindallas7 months ago

Saw your project and just HAD to do it.

Got all the parts and downloaded the most recent code (Nov. 2013) to run
with the Arduino 1.05 software.

Loaded the four libraries and when I went to compile I get the following
error:

error: 'myfont' was not declared in this scope.

The Font library is in libraries so am kind of lost.

Running the Arduino with a PC.

Any help would be appreciated.

Thanks, Paul

I just got the same errors trying to verify the code. I opened the font library file and declared myfont, tinyfont and bigfont constant, by adding const between unsigned and int.

Hope I could help.

Ya, this was all written on IDE 0023, and other IDE updates after tended to kinda puke on it...lol...

Thanks... I went to the author's site and posted problems there. The solution that finally worked was to start with an empty "library" (rename the old library... old library or something) create a new "library" folder and import the 3 libraries that come with the program so that they are the only ones in there. After that it worked like a champ.

Glad you found another solution. I will keep that in mind for similar problems in the future.

XMAZDAX5 months ago

How to set up the clock. I only have the menus like Pong or Word and when i press the Pong setup it stands there GO or BACK

one of the menus is to set the clock

goldenshuttle6 months ago

Almost forgot ; guys be warned ...this game is addictive:)

goldenshuttle6 months ago

Great projects; many thanks.

I think you can add audio to this game ; something like a 2-transistor multivibrator with a resistor connected to one of Arduino outputs; this will give simple beep for each action. or you can add full audio effects by tweaking the code. what di yo think ?

kidos1007 months ago
Would it be possible for you to post a instructable using TVout?
kidos100 kidos1007 months ago
Sorry, let me clarify, could you post an instuctable using TVout to display the clock?
Kirkthepyro11 months ago
Awesome!
Hey, I currently just finished building my pong clock but didnt feel that the coin cell holder and battery for the RTC chip was necessary when I bought everything. Now im trying to set the time for my clock and it isnt working!! I looked back at the instructions to see if I really needed the cell holder and it doesnt look like I do but I realized the RTC chip wasnt hooked up to the ground or positive terminal. So how do I hook the chip up properly?
jashan5102 years ago
Instead of an arduino can we use a pic micro controller.. Because i wanna make this clock for someone but i really dont want to give away my arduino
mrnick1234567 (author)  jashan5102 years ago
Very hard to say.. depends on the PIC, what outputs / inputs / what code it runs etc etc...
im new to the microcontroller world dont know much about em...
if not pic then any microcontroller with which i dont have to use my arduino board
cz u get the microcontrollers for like 3-4 dollars but the arduino i have was quite expensive..
is there a way to use the arduino boot loader without the arduino board?

P.s thanks for replying man im in love with your clock best iv ever seen.
Just get an Atmega328 chip. Program the bootloader and firmware into the chip, then remove and breadboard it or make a PC Board for it and put your original atmega328 back into your arduino. Simply swap the chips any time you need to update it. Personally I have a USB to TTL Serial adapter which cost about 2 bucks on ebay. I put a 3 pin TTL Serial in on my clock board (GND, RX, TX) hooked to ground, and pins 2 and 3 on the atmega328. When I want to update the code, I choose the com port the adapter is on (COM2: for example) and as soon as I see the "Binary sketch size" message in the Arduino information window, I hit RESET on the clock. Sounds like a lot of work, but it updates really fast. Faster than using a 6 or 10 pin ICSP connector - but that's also an option. The problem I ran into there is Arduino ISP 0023 doesn't see my ATTiny as a programming option. I would like to offer some general advice here too. POWER THE DISPLAY, NOT THE ARDUINO. If you have a reliable 5V source, power the display, and the arduino or Atmega328 will draw it's power from the display, and you don't have to modify any connections.
mrnick1234567 (author)  jashan5102 years ago
I think using any other microcontroller or pic would need a lot of work and re-coding to get the clock going.

If you look at in terms of how much time you would spend on trying to get it working, and how much you value your time, it's probably a cheaper option of you just bite the bullet and get another arduino. They are a bit cheaper on eBay if you search.
Yes u probably right man itll take a lot to rewrite the codes and redesign everything..
The way to go is definitely as mischka says - use an ATMeag-328 and program it in your Arduino but then pull out the chip and put it into a socket on a piece of perf-board made up as indicated in the bread-board arduino tutorial. You need almost none of the gubbins on an Arduino board to make the chip run - that's mostly for development. Once you have it running you only need the chip, crystal and a few capacitors. You don't really even need a reset switch unless you are wanting to re-program it in place. With this project you are only using a few pins so it would be very easy to make up a '328 board. The '328 chips themselves only contribute about £3-£4 to the cost of the project.
You could buy the ATMEGA preprogrammed with the arduino bootloader, program it with your arduino board and wire it like this: http://www.instructables.com/id/Standalone-Arduino-ATMega-chip-on-breadboard/

I have modified the code to:
1) Allow switching from 24 hour to 12 hour time
2) Returns to whatever mode it was running before you change the time
3) I preferred a solid line down the middle of the pong "court".
4) sped up the ball a bit.
I have now added a brightness function too.
sarahline1 year ago
(removed by author or community request)
mrnick1234567 (author)  sarahline1 year ago
Hey, so I use a 5 volt Mains to USB power supply to supply the Arduino - i.e plugged into the USB port on the Arduino. Then I use the 5v pin on the Arduino as an output of 5v, this is split to go to the RTC and the first display. (The second display gets it's power through the ribbon cable from the first so nothing else is needed there.)

I split the power using the proto shield, but you could also do the same with a breadboard for testing - this lets you plug things like the RTC chip and wires in. They are really simple to use and cost only a few pounds / dollars from eBay.

Hope this helps.
Nick
If you use an RTC module, see my instructable on making your RTC into a mini shield eliminating wires. This assumes you have a pre-made RTC board.
I power mine off A2 and A3, so the tiny board plugs directly onto the arduino from A2 to A5.
Thanks for the reply! I got the board working eventually, For some reason trying multiple sketches, this was the only demo code I could get running! I have edited your code to create my self a library, Luckily you included a plot point, which was precisely what I was looking for, I have done all kinds of stuff! My main project so far was to create a graph generator! I also attempted to make a sin/cos and also a tan graph! Thank you ever so much for your code. http://gyazo.com/4f4ac264ef1829e4828f1415e2598408
If you include math.h and know how to use sin and cos, you shouldn't have any problems plotting a circle.
By the way, this isn't my code - I think the author may have moved to bigger and better things ages ago. I got my Arduino about 6 weeks ago I guess, and got my book on C language on the 24th of last month. I'm a pretty quick study though, and I will probably port many arduino projects to the Commodore VIC-20 or C64. It's funny how people are just starting to do stuff with these microcontrollers that I was doing back in the 80's...LOL. I may take some of the stuff I used to do on the Commodore computers and port it to the Arduino too.
I am having a little problem, uploading the sketch, I can see nothing on my board :/
I would need more information to know what you mean.
1) by "board" do you mean the LED panels, or do you mean the arduino isn't receiving data?
2) What version of the IDE are you running? (You need to be running the older 0023)
3) are you uploading using the Arduino, or by an ICSP (ISP) programmer board?
See my instructable on "Beefing Up Your Arduino Power".
http://www.instructables.com/contest/fixit2013/ (please VOTE if you can)
http://www.instructables.com/id/Beef-up-your-Arduino-power/ (direct link)
Also see my Instructable on eliminating the wires from your clock module
(this is the project I use it with)

http://www.instructables.com/id/Turn-your-Real-Time-Clock-module-into-a-mini-shiel/
sarahline1 year ago
If I wanted to rework the code a bit to where on the "jumble" section it changes to words instead of the time, how would I do that? I'm having a hard time seeing which code is drawing from the clock and which is creating the jumble. Thanks for your help.
mrnick1234567 (author)  sarahline1 year ago
In the Jumble function, remove the code from under the bit that says

//set final characters

all they way up until the bit that says:

byte x = 0;
byte y = 0;

//until all counters are 0

Then replace it with lines that set the endchar array to the letters you wanted. E.g. if you did

endchar[1] = 'H';
endchar[2] = 'E';
endchar[3] = 'L';
endchar[4] = 'L';
endchar[5] = 'O';
endchar[6] = '!';
endchar[7] = '!';
endchar[8] = '!';

You should see the top line say "HELLO!!!" You can set the bottom line by setting endchar[9] to [15]

Hope this helps.
Nick
mrnick1234567 (author)  mrnick12345671 year ago
Sorry that should be:

endchar[0] = 'H';
endchar[1] = 'E';
endchar[2] = 'L';
endchar[3] = 'L';
endchar[4] = 'O';
endchar[5] = '!';
endchar[6] = '!';
endchar[7] = '!';
ddpdpdp2 years ago
Sorry again, here is the image of the chip.Please help!
1-40 of 93Next »