Pong Clock

March 2014 Update!

Version 5.1 of the firmware is out. It contains bug fixes and some sweet lower case font action. NOTE: If you upgrade, please replace all 4 libraries as well as the main code.

BTW, if anyone fancies designing a case for this let me know!


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 £60 / $100. All the parts are easily available on eBay and the software code is free to download. Features of firmware 5.1 include:

  • Pong Clock
  • Large Digits
  • Time written in words, e.g. “Ten Past Twelve”
  • Time and date with seconds
  • Time and date with seconds and a slide effect
  • Time and date with seconds and a jumbled character effect
  • Date display with printed retro flashing cursor effect
  • 12/24 hour option
  • Brightness option
  • Random clock mode option (changes the display mode every few hours)
  • Daylight saving option to add an extra hour
  • Push button driven menus for setup & display selection.

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

Parts List

  • 2 x Sure Electronics 2416 LED Matrix (24×16 pixels) in Red or Green (Make sure you get the version based on the HT1632C and not the HT1632 – more detail below).
  • 1 x Arduino Duemilanove / Uno with ATmega 328 CPU
  • 1 x DS1307 real time clock chip and IC socket
  • 1 x Crystal oscillator for the DS1307
  • 1 x 3.3v coin cell battery and battery holder for the DS1307
  • 1 x Arduino prototyping shield
  • 1 x Breadboard and jumper wire for testing or if you don’t want to solder (optional)
  • 1 x 16 Pin IDC Socket for the display connection
  • 2 x Push to make buttons
  • 1 x USB Lead
  • 1 x Mains to USB power adapter

Plus wire, solder, tools, time, sweat, tears, etc.

Parts in Detail

2 x Sure 2416 LED Matrix You can get these from eBay for around $20 each You can buy either the red or green display, and with 3mm or 5mm LEDs. My clock in the video is made with the 3mm green displays. Make sure you get the newer version of the display which is based on the Holtek HT1632C chip. You can tell the newer displays as they have the controller chip and DIP switches on the back. The front is relatively empty of components as you can see:

Sure 2416 LED Matrix with HT1632C.

1 x Arduino Uno / Duemilanove / Dicecimila with ATmega 328 CPU. The Arduino is the brains of the clock. It has a microprocessor that runs the clock software, plus inputs and outputs we connect to the displays, buttons and clock chip. Ensure you get an Arduino with the ATmega 328 CPU. The Uno is the latest version and has one as standard. Some Duemilanove / Dicecimila boards come with the ATmega 168 CPU with doesn’t  have enough RAM for the clock code. You can get Arduino’s for about $30. Try Sparkfun Electronics or eBay.

Arduino ‘Diecimila’ with ATmega 328 CPU.

1 x Arduino Prototyping Shield and Header pins. The prototyping board or ‘shield’ plugs onto the top of  the Arduino making it easy to add other components. It brings the Arduino’s input and output pins onto a circuit board that you can solder things 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. (You can see this area on the bottom left of the board in the picture below.)

Again places like Sparkfun or eBay are good sources for them. You should be able to pick one up for $15 – $20. Check you get the black header pins too as some boards are sold without them. These are the pins that you solder to the edges of the board that plug into the rows of sockets each side of the Arduino.

If you don’t like the idea of soldering, you could get a breadboard and jumper wire to build the circuit on temporarily instead. This is a good idea anyway to test it’s all working.

Prototyping Shield

1 x DS1307 Real Time Clock (RTC) chip, Crystal, 3.3v Coin Cell Battery & Holder. The clock chip keeps time, regulated by the crystal. The battery powers the chip if the clock is unplugged, so it remembers the time when you turn it back on. I found all these bits on eBay bundled as a kit for $10.

1x 16 Pin IDC Socket. The display panels come with ribbon cable that needs to connect to a socket like this. We’ll solder it to the shield 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.

16 pin IDC socket

x ‘Push to Make’ Buttons. These are used to set the time / change the display mode. You can get a pack on eBay for a dollar or two.


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

A to B type USB Lead

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.

USB Power supply

Circuit diagram

This is how it’s all connected…. not too difficult.

Circuit Diagram

Pong Clock Schematic


Due to my crappy skils at diagrams the schematic above is a bit off.

  1. The 2 push buttons are not shown in the above diagram. You will need to connect one button between Arduino digital pin 2 and GND. The other button needs to go between Arduino digital pin 3 and GND.
  2. The pin layout on the DS1307 is not exact. Pin 8 should really be top right opposite pin 1. All the pin numbers are correct in terms of what they connect to however, so follow the pin numbering and you should be fine.

Connecting it up!

LED Displays

The displays use a serial protocol called SPI to receive data. There are only 4 wires needed between the Arduino and the first LED display. Two more wires are required for power.

You’ll notice each display has 2 connectors on the back. These are for daisy chaining multiple units together as we are doing, and it’s what the little ribbon cable in the box is for. Connect the displays together using the ribbon cable. You can use either connector on the back as they are the same.

Use one of the free connectors on either display to connect to the Arduino. Again it doesn’t matter which one. For testing purposes I poked jumper wires from the Arduino into the ribbon cable connector. When I was happy things were working, I soldered the IDC socket to the prototype shield, meaning I could plug the ribbon cable in.

As on the wiring diagram, Pins 4 and 5 on the Arduino need to connect to pins 1 and 2 on the display connector respectively. These are used for something called Cable Select or ‘CS’. Cable Select determines which display listens when the Arduino is sending data out. The displays have small DIP switches to set their cable select address – essentially giving them different identities. Set one display’s switch to have CS1 on , and the other to have CS2 on .

Pin 10 on the Arduino is used to send the actual display data, and connects to pin 7 on the display. Pin 11  on the Arduino sends a clock signal. Connect this to pin 5 on the display.

Finally connect pin 12 on the display connector to positive and pin 11 to GND.  Alternatively if you prefer you can use the screw terminals on the back of the display for power.

A display with dip switch set as number 1.

Clock Chip

The DS1307 clock chip keeps the time. It uses something called the I2C protocol and only needs 2 wires to send time data to the Arduino. Connect pins 5 and 6  from the DS1307 to Arduino pins A4 and A5.

Connect the crystal  between pins  and 2  on the DS1307. The crystal regulates the clock and can be connected either way round.

Finally the coin cell battery’s positive terminal connects to pin 3 on the DS1307 and the negative terminal connects to GND . The battery runs the clock chip if the power is turned off meaning you don’t have to reset the time. It should last for many years.

Push Buttons

Connect one push button between Arduino digital input pin 2 and GND, the other between Arduino digital input pin 3 and GND.


We’ll supply power in using the USB port on the Arduino and then connect everything to the Arduino’s 5v and GND pins. Connect the 5v pin from the Arduino to the 5v pins on the display and DS1307. Then connect the GND pin from the Arduino to GND pins on the display and DS1307.


Don’t use a higher voltage supply into the Arduino’s round power jack. The Arduino’s onboard regulator may not be able to cope with the power demand. If you try you’ll notice the Arduino will get very hot very quickly and probably not last too long!

Be very careful if you are powering the Arduino from a computer’s USB port. You could easily damage the port if you have a connection wrong or if the computer can’t supply enough juice. I powered my setup with my Macbook for testing and all was well, but be warned!

Prototyping shield

The prototyping shield plugs into the Arduino making it easy to add components. On a standard prototyping board you should have room to solder the DS1307 clock, crystal, battery, buttons and the IDC socket for the display ribbon cable.

I can’t really give instructions for what to solder where, as prototyping boards vary quite a bit depending on what you buy, but you should be able to figure it out based on the circuit diagram.

When things are soldered it should look something like mine in the picture. You can see the IDC plug on the left for the display cable, in the middle is the DS1307 clock chip. The tiny silver capsule below the chip is the crystal. On the right is the coin cell. Below that are the 2 push buttons for setting the mode and time. The red button is a reset button which came in the pack with the shield. It’s useful as the shield covers up the reset button on the Arduino itself.Shield populated

Below you see everything connected together. The 2 displays plug into the prototyping board which sits on top of the Arduino. Nearly done!


Uploading the Clock Code

The last job is to upload the clock code to the Arduino. First you’ll need to download the Arduino programming software called the Arduino IDE. The current clock code was tested with IDE version 1.0.5. You can download the IDE from Arduino’s site here: http://arduino.cc/en/Main/Software

Once the IDE is installed, download the clock code here.

Unzip the clock code zip file. Inside you will see the main clock sketch called pongclock5_1.ino and 4 library folders called ‘Button’, ‘RTClib’, ‘Font’ and ‘ht1632c’. These libraries are extra bits of code needed by the main clock sketch.

Next install the libraries. When you installed the Arduino software it should have created a folder somewhere for your sketches (projects) to go in. Find that folder and see if there is a folder called libraries inside. If there isn’t, create one. Then copy the 4 library folders from the zip file into the libraries folder. After you have done that quit and restart the Arduino IDE to make it pick up the new libraries.

After restarting, go to the Sketch -> Import Library menu. If the libraries are in the right place you should see their 4 names listed in this menu.

Now go to the File menu and open the main pongclock sketch – the file ending in .ino. You should see the code appear in the main window. Next pick your Arduino Board Type in the Tools -> Board menu. Then hit the Verify (check mark) icon. This tests the code and should compete without errors. If you do get errors here, you’ve most likely not got the 4 libraries in the right place.

OK, time to upload the code to your Arduino! Unplug the Arduino from the clock prototyping shield and plug it into your computer with the USB cable. Click upload and wait for the code to be uploaded. Watch the TX and RX LED’s on the Arduino flash for signs of data transfer.

Finally unplug the Arduino from the computer and plug it back into the prototyping shield and displays. Then plug the USB lead from the Arduino into the mains to USB adapter.

All being well the display’s should spring to life. Well done! Use the buttons to set the time and then sit back and admire your handiwork!

And if you really, really like the project, here’s my bitcoin address!



Normal mode




Words mode


Startup Screen


Pong mode


Starting Pong Game


I get an error compiling:

  • Check the libraries are installed in the correct folder and appear in the menu
  • Make sure you have restarted the Arduino IDE after adding the libraries.
  • Check you are using Arduino software version 1.0.5.

I get an error uploading to the Arduino:

  • Check your board type and serial settings are correct in the Tools menu.
  • Check your Arduino has 32K RAM or more.

The clock doesn’t change:

  • Normally a wiring issue. Check the LED on Pin 13 of the Arduino flashes. If not then the clock chip is not being read. Check your connections to the DS1307.
  • Connect the clock to a computer running the Arduino IDE. Click the serial console button and set it to 57600 baud. You should see the time being printed to the console if the clock is being read. Check the wiring as above if it’s not.
  • You must have the coin cell battery connected for the clock to work.

The displays don’t light up

  • Check your wiring to the ribbon cables and check the display is getting enough power.
  • Try another power supply.
  • Remove one display and see if you get half the screen. If you do, then most likely not enough power is being supplied.

The 2 displays show the same half of the clock

  • Check the DIP switch settings on the displays are as per the instructions.

The text display is garbled after upgrading to 5.1

  • Make sure you have replaced the font.h library file with the new one in the 5.1 download.

If you have the older Sure LED Displays

The older LED displays from Sure use a different type of LED driver chip called the Holtek HT1632. You can tell these displays as they have the chips on the front of the LED board. If you have these, you need to replace the ht1632c.h library file in the normal clock code download with this file. Quit and relaunch the Arduino IDE to pick up the new file, then load up the main pong clock .ino sketch file. Next look for this line near the top of the code:

#include <ht1632c.h>

and change it to…

#include <ht1632.h>

Then verify and upload the code as in the instructions.


Thanks to everyone who contributed, including WestFW on the Arduino forum for providing the initial LED driver code, SuperTech-IT over at Instructibles, Alexandre Suter for help with the conversion to Arduino 1.0, Richard Shipman for the lower case font & Kirby Heintzelman for all the testing!

392 thoughts on “Pong Clock

  1. Pingback: LED Pong clock - machine quotidienne

    • Hey Florin, your clocks look great.Did you cut your plastic enclosures yourself? I was thinking of trying some semi opaque plexiglass so you just see the diffused LEDs.

  2. Looked at it for approx. 30 secs, and decided I _MUST_ build one myself.
    Just Ebay’ed the sure-elec led panels.
    Happy days!

    • Hi,

      The Sure display based on the 1632 suffers from getting very dim when a lot of the LED’s are on, whereas their board based on the 1632C doesn’t have this problem. As far as I know it’s because the 1632 needs additional driver circuitry which Sure didn’t implement. The newer 1632C has it built in.


      • Thanks Nick

        Do you believe then that your code will work with the 1632 displays but the displays will perhaps exhibit just dimming issues?


      • Yes it will work, but you’ll need a different library for the 1632, and have to make a coupe of tweaks to the main code – I can email them to you if you are interested. (I had it working on the older 1632 boards before I upgraded them to the 1632C.)

  3. Nick

    Yes please send me the code to play with as I have accidentally ordered the 1632 based units and would like something to play with before I can afford the 1632C versions. I am templed by a couple of 32×16 dual colour units though with the 1632C controller.

    I assume that you have my email address.

  4. Hi,
    I’ve got mine up and running!
    Atmega328 on breadboard and rtc on a small pcb that I made years ago

    Looks awesome!

  5. Thanks for this project, took a couple of hours to assemble this afternoon – I used a RTC module on a board from bluesmokelabs.com It also took a little while to work out where to connect the switches, your description in the post doesn’t match the photos, but I guess that’s one of deliberate mistakes to keep us on our toes.
    It looks very nice alongside my nixie clocks, and I’ll have to build a case for it next week. Then on to try to program some more modes and maybe an alarm sounder…

    Thanks again

    • Hey great to hear you made one. What confused you about the switches (apart from them missing from the schematic)? Maybe I can make it clearer in the instructions.

      Love to see the case you come up with too.

      • Hi, I guess the confusion is in the connection of the switches.
        You say connect them between A2/A3 and +5V. This should have been between A2/A3 and GND instead.

        Clock is working great here. Etched a custom PCB for this. (so no arduino board needed)
        Like Richard, I also have to workout a case for it. (acrylic probably)

      • Whoops, sorry if that lead you astray – should have checked before I wrote it all up. I’ve changed that now. Thanks for pointing it out.

  6. Pingback: Wolf’s Spoor | Arduino Pong Clock

  7. Hi

    I was wondering if you heard of anyone getting this running using the 5mm version of the 2416 boards. I have been trying, following your instructions to the letter, and I get no where. I do have the 1632c.


    • Hi Todd, I had a quick look at the data sheet and they look the same. (If you load up the data sheet from sure for the 3mm and 5mm models they are the same doc!).

      So I’m not too sure why they aren’t working :(

      • BTW – You could ask on the Arduino forum if anyone has the same displays – there are a few threads about these displays.


  8. Thanks Nick

    I figured I would ask you first just in case and the Arduino forums were doing their migration.

    Thanks again for you time.

  9. Pingback: Pong clocks using LED matrix modules - Hack a Day

  10. Pingback: hackaholicballa - Pong clocks using LED matrix modules

  11. Nick, Many thanks for the clock design. After waiting for a couple of weeks for the LEDs to arrive from Hong Kong I now have a red version up and running. http://youtu.be/t0pA_k7Px80
    I did spot one thing on the circuit layout diagram which seems to differ from your photographs. The connections to the DS1307 seem to be the wrong way around. Using your numbering I have:
    pin 5 to +5V
    pin 6 unconnected
    pin 7 to Arduino A5
    pin 8 to Arduino A4

    Many thanks again.

    • Hey Andy,

      Really glad you liked the project and have built one. The red LED’s look great! I wish I had bought the dual colour displays now so I could have a menu option to switch colours.

      As for the DS1307. The pinout I have is 5 and 6 to Arduino, 7 is N/C and 8 goes to +5v. Pin 8 is bottom right on my photo.
      See the chip pinout here: http://www.datasheetdir.com/DS1307+Real-Time-Clocks-RTC.


      • Hi Nick
        Agree with the bi-colour LEDs they look great. I might just order one of those from sure and knock another clock together. :-)

        I have the same data sheet and that’s how I connected the RTC chip. Perhaps I didn’t explain very well… The diagram that you have showing the connections between components has the pins on the right hand side of the RTC running from bottom to top, when they should go top to bottom (so +5v is opposite pin 1 for the crystal).
        Hope that makes more sense.

      • Ah I get you, diagrams were never my strong point! When I get time I might try and redo it.

  12. Hi Nick,
    I’ve made a few updates to the Arduino sketch, and was going to upload it to the google code project (but couldn’t work out how).
    Have changed the normal_ clock to animate the digits, so when the time changes the changing digit scrolls down off the screen and the new digit scrolls in from above.
    Have also added a couple of Binary clock modes.
    If you’re interested then drop me a note and I’ll forward the updated sketch.

      • Hey Just had a look at your code. I like the new modes -although I’m not sure I’ll ever be able to figure out the time from the binary display!

      • Hi !

        I just saw you pong clock and I must say that it really looks great… I´m using also the 2416 displays but with the older 1632 chip on it. In earlier post I read that you have offered Mark Pepper to send him the code for the old display version. So I would like to ask you if you please can send me the code for the old 2416 displays…. Thank you very much !!!

    • Hey Andy,

      I have been running your modified code for a while.
      Have you seen the new version that Nick has posted?
      Any chance that you will incorporate your ideas into this?
      I did find an odd bug, when setting up random mode. Sometimes the binary clock is off by ten hours after setting it that way, I can’t remember the exact sequence of vents right now, but I was able to repeat it several times.

      Great work though on your additions!

      I love seeing activity. It would be really cool if someone would add a seconds readout to the one mode that has time and date. That area of the panels looks like it has enough space for it, and the blank space looks out of balance somehow.



      • Hi Kirby,
        Good to hear that you have enjoyed my updates to the pong clock code. Unfortunately I managed to blow my matrices and dont currently have another set to work with, so I cant do any testing. I’ve got another set on the way from China so will take a look once they arrive.

      • Hey Kirby, I saw your post and yeah I see what you mean about the unused part of the display that could have seconds in it. I left them out initially as thought it might be too cluttered. Anyhow, I’ve put them in now. Will give you a shout when the new code is up.


      • Nick,

        That’s cool!

        I think think it will look good.

        Maybe Andy can add his special animation of the rolling digits to this “theme” too!

        Good stuff! This really is a very cool project. Wish I knew more so that I could contribute more.

        BTW, I will send you some pics of my proto board that plugs on the back, and if I can get motivated, the box I am putting the whole deal in.


  13. Hi,

    I was having problems understanding how you brought power to the display boards. When I connected the +5V and GND pins from the display boards to the (I’m assuming) the GND and 5V pins on the Arduino. But I do so, the power light on the Arduino goes off (I guess the Arduino board was drawing too much power). Any suggestions?

    • Hey, Yes I connect the +5v from the LED boards to the Arduino’s +5v pin, and GND from the boards to the Arduino’s GND pin. Sounds like you might have a short or maybe your power supply isn’t up to it.

      Make sure you use a good mains to USB power adapter and connect it to the USB port, or connect a 5v supply to the +5v and GND pins. Don’t use the round power jack on the Arduino.


      • Nick,

        After retrieving a mains to USB power supply (+5V) there was still no change. So connecting the +5V and GND pins from the display board to the POWER +5V and GND pins should work? Once the +5V pins are connected, the Arduino (Uno) board’s “ON” light cuts off.


      • Yes that should work unless you have a short. Both the LED boards and the arduino need 5 volts, so it’s just a case of connecting them together. Have you got a circuit tester – maybe test to see what happens to the voltage when you connect the LED’s.


  14. Hi i saw this thing and its awesome, now i want to build one my self, Can i connect 4 display modules to make the hole thing bigger? can i use the same code for that?
    I am new with programing, but i want to lern how to do.
    Sorry for my English, i am from Sweden.
    Best regards Axel

    • Hey, glad you like it. 4 displays would need quite a bit of changes to the code, but you could get the bigger 5mm LED versions of the displays, I have the 3mm ones which are smaller.

  15. Hi, great idea. Very classic and great for gamers! Im curious about turning your idea into a table. That way my coffee table would display the time and play pong as well. Would there be any changes necessary to make it work as effectively as it already does? Thanks

    • I guess it depends on what you wanted to do. You would maybe have to design new display boards so they could drive individual LED’s to mount in the table. That could be quite a bit of work.


  16. Hi there, been struggling for a while to get this running before i realised I’m using the ht1632 boards rather than the 1632c. Could you possibly email me the code for the older boards?


      • Cheers for that, got the code compiling fine and got the heartbeat on pin13 but no output to the matrix. I’m using the red ht1632 boards, any configuration tricks for them? had a few other demo’s working and I know my RTC works.


  17. Nick,

    Okay I figured out that some of the connections on my display board wasn’t set up correctly. I have the boards showing up now. Question, is there a way to actually have 2 players be able to play?

    • That would take some coding and figuring out how to attach 2 controllers to the analogue inputs, it’s possible with some research. There are probably some tutorials on the Arduino site that might help.

      Glad you got it up and running though

      • Nick,
        Do you think there is a way to be able to run the game independent of the clock? I don’t have the necessary parts for the clock. I’m doing research right now also trying to figure out how to possibly use 4 push buttons (2 for each player to move up and to move down).

      • It’s possible, but you would need to change the code significantly.


  18. How can I program four push buttons two for each paddle for a pong game. One being used to move the bat up and the other bat downward? Any ideas would really help!

    • You’d need to wire them up to 4 spare input pins, then re work the code so it moves the correct paddle up or down, plus you would need to change the scoring, and either strip out all the other clock stuff or add another ‘Game’ mode. I.e. it’s quite a bit of work!

  19. Ok I understand, now in terms of your project I have been able to get it up and running which is fantastic by the way. The only issue I am having is setting the clock. It keeps saying oo:00?

  20. Hi, wow!, what an amazing clock, superb code. I just built one myself. Built a simple but effective case using a perspex sandwich design similar to dotklok casing. Keep up the good work, I just love arduino.

  21. Hi Nick,

    You sent me a copy of the code for the older ht1632 controller. I made the changes to the Arduino PDE pong code as per your instructions and replaced the HT1632 file. After uploading to the Arduino and making sure the board was wired up correctly to the display, we had lift off. (Or not). Nothing displayed.

    There seems to be a number of versions of the HT1632 file floating around for the 2416 display on the WWW.

    Did you get this code working with the older 2416 Green displays. I know the displays are OK as I tried them with a Amicus18 board on another project. Any additional help would be appreciated.



    • Hi Kevin,

      Yes I had the older versions of the board initially and that was the code I used. I’ve also sent the email you have to a number of other people who have had success using the older displays.

      Hard to say what is wrong with your setup. Do you get the flashing LED on the arduino to show the clock is ticking?


    • Hmm. OK just to make sure – this is the LED that is connected to pin 13 on my Arduino. It should flash on when powered up, then stay off for the “Clock version x.xx” message, then start flashing every second when the clock goes in to pong mode.

      With the display not connected it will stay off (just tried it). Really difficult to say without looking at it. You might want to see if the demo code from westFW here (see reply 8) works. You may need to adapt the pin numbers. That’s the basics of the library. If not maybe the displays are wired wrong.


  22. Hi Nick,

    Yes we are talking about the LED that is connected to pin 13. It it comes on, flashes for a few seconds and then remains on. The same result is seen even with the display not connected.

    In terms of the demo file you refer toy, loaded this up and no problems. Worked are described. So either Windows 7 64bit is having a spooky effect on the compiler or my wiring is going wrong somewhere.

    Spent ages on the Arduino.cc forum for these displays, a lot of people have a lot of fun with the older 2416 Green units. A couple of the demos produced a mirror effect, seen this before withe Amicus18 , found a fix for the Amiucus and finally the Arduino.
    I shall do a bit more work on it later this week, just started working on Nixie Tubes. Even more fun and some interesting high voltages. Still all good fun.

    Will let you know if I have any luck, thanks for your help.

  23. Hi Nick !
    You helped me some weeks ago already and I am really happy with your clock. I used the more exactly working DS3231 real-time clock, and added a DS18B20 for showing the temperature…. So far so good. My question is hopefully without sounding to impudent :
    I have 4 of the old yellow Sure 0832 displays and I would like to use them instead of the two 2416 displays. Is there a chance that you can adapt your code for the 0832 displays ? ? Of course you wouldn´t do this for free !!



  24. Sven, if I may: you can also read the temperature from DS3231.
    As for the 0832 displays, there is also a mechanical challenge in making a bigger matrix. Would be nice to see how you solve that.

  25. Hi Florin ! Yes I know about the possibilty reading the clock from DS3231. But I am afraid that if it is built in a frame the temperature inside will give wrong values and I am not able to measure anywhere outside…. Why is it a mechanical challenge ? I would like to use 4 0832 instead of 2 2416 displays… so the height/dots is the same but it is more width/dots. Like this one here but with the pong clock :http://www.makehackvoid.com/member-projects/ht1632-avr-library-interface-ht1632-led-driver-ics-and-avr-micro-controllers

  26. You are right about the temperature inaccuracy, especially if it’s inside of an enclosure, the values are skewed.

    In the video you pointed to, there is a gap between the 2 0832 displays. That is because the displays have the PCB extended so they can be attached (with screws) to something. You would eventually need to cut those extensions, then somehow “glue” the 2 displays together. Not impossible, but challenging (and requires a bit of careful work).

  27. Hi Florin !
    I have already cut the extensions and attached the 4 displays together so that there is no gap :-) My problem is the rewriting of the code that splits the information to each of the 4 displays…. Therfore I need somebody :-)

    Regards Sven

  28. It’s nice to hear you managed to get rid of the gap. I would like to see your solution.

    From what I imagine, the change in the code consists in talking to 4 different HT1632 chips (each controlling a 0832 display) rather than just one (controlling the 2416 display). You will have one CS line to each of the 0832 displays (whose address also needs to be set, with the switches).
    A bit of work, but not “rocket science” as they say :)

  29. Hi Florin !
    It´s not that complicated… I had to rasp about 0.8 mm on one side of that v -cut point to get them a little closer. I used my small milling machine for that and it took about 5 minutes. Then I soldered a srew with its head down on that silver mounting holes and connected them with the peaces of v-cut material I broke away before (cut them into to the right lenght,drilling holes, and fixed them with a bolt). All together less than an our of work :-) Comming back to my question :-) and asking you directly : Are you able/willing to rewrite the code for me ?


    • Hey Sven,

      Thinking about this there are 3 steps needed to get the code working…

      1) Replace the current HT1632C driver library with the HT1632 driver – I have this already so not a problem,

      2) As Florin says, we will need to re-write the driver parts of the code to cope with 4 displays. I.e. if the main part of the code is trying to plot a pixel at y=9, then it needs to know to plot it as pixel 1 on the second display. I can try and do this for you – but it may be hard to test without 4 displays to hand.

      3)Tweak all the various clock routines so they are adapted to the new screen size as you are effectively adding 16 pixels width. – I don’t think I will be able to do this without having 4 displays, so I may have to leave it for you to play with.


  30. Hi Nick !

    Of course I understand that it may be hard to do this without having the displays !!
    I did step 1 already and currently using your code with slightly changes on the 2 2416 displays. It sounds great to me that you give it a try to do this !! …and of course I will and have to play with it !

    • Hi Sven,

      What version of the display do you have? I need to get the datasheet from Sure, but from a quick look they seem to list the HT1632C versions only. Do you have that version or the older HT1362 version?


  31. Sven, I uploaded this “draft” version for you:

    You will also need to download the font3.h file:

    I just compiled the code. I did not have the slightest chance to test it (I don’t even have an 0832 display around, plus it’s a Sunday :). You give it a try and let me/us know.

    Even if it works, the digitalWrite() functions will need to be replaced with their “optimized” version.

  32. Hi Florin !
    Thanks a lot !! You are more than fast :-) I just downloaded it and will try it this evening.
    Unfortunately I can´t try it now because I have to work ;-)
    I will let you know the result….


  33. Not bad, for a first, blind, try.
    It seems that displays 1 and 2 are accessed correctly.
    In function displayScrollingLine, you need to make some changes. I left the second param as 0, but it should have been really “y”, and its value, set at the top of the same function, should be between 0 (top of the screen) and 10 (let’s say).

    ht1632_putchar(-x+6, 0, ((crtPos+1 < strlen(msg)) ? msg[crtPos+1] : ' '));
    should be
    ht1632_putchar(-x+6, y, ((crtPos+1 < strlen(msg)) ? msg[crtPos+1] : ' '));

    etc (same for the rest of the line).
    I think you got the idea.

  34. Hi Florin !

    I changed the code to this here :

    void displayScrollingLine()
    // modify this value to display the text on the desired display row;
    int y = 4;

    // shift the whole screen 6 times, one column at a time;
    for (int x=0; x < 6; x++)
    ht1632_putchar(-x, 0, msg[crtPos]);
    ht1632_putchar(-x+6, y, ((crtPos+1 < strlen(msg)) ? msg[crtPos+1] : ' '));
    ht1632_putchar(-x+12, y, ((crtPos+2 < strlen(msg)) ? msg[crtPos+2] : ' '));
    ht1632_putchar(-x+18, y, ((crtPos+3 < strlen(msg)) ? msg[crtPos+3] : ' '));
    ht1632_putchar(-x+24, y, ((crtPos+4 < strlen(msg)) ? msg[crtPos+4] : ' '));
    ht1632_putchar(-x+30, y, ((crtPos+5 < strlen(msg)) ? msg[crtPos+5] : ' '));
    ht1632_putchar(-x+36, y, ((crtPos+6 = strlen(msg))
    crtPos = 0;

    Again a link what it looks like :

    I will put the displays back together again… it´s not nice this here :-)

    From wednesday till sunday I am not able to test because I do a little trip…

    But I will be online if there is any question !!

    THANKS !!!

  35. Sven,
    It look good to me. In principle, it works.
    Now, do the following 2 steps:
    1. insert these 2 lines somewhere in the file (close to the top):

    #define fWriteA(_pin_, _state_) ( _pin_ < 8 ? (_state_ ? PORTD |= 1 << _pin_ : \
    PORTD &= ~(1 << _pin_ )) : (_state_ ? PORTB |= 1 << (_pin_ -8) : PORTB &= ~(1 << (_pin_ -8) )))

    2. replace "digitalWrite" everywhere with "fWriteA" (arguments to the function will stay the same).
    This should speed things a bit.

  36. Hello! Thanks for posting your project. It was extraordinarily helpful.

    I got the clock working and even added a speaker and alarm mode to it-was a lot of fun.

    I decided to string four of the displays together for a new project. I thought it would be as easy as changing the max x and max y. I was wrong. When I write to the third or fourth display the first and second go besonkers.(any two displays work perfectly on their own)

    Any help would be hugely appreciated. I can post an image if you want to see exactly whats going wrong.

    Thanks a lot!

    • Hey Joel, Glad you liked the project and got something out of it. Yes the code wont’ work as it stands as the driver bits are only written for 2 displays.

      Each display needs it’s own Cable Select line, so first off you would need to wire up the other 2 CS lines from the displays (CS3 and 4) to the Arduino, say on pins 6 and 7. Set each diplay to 1, 2, 3 and 4, then change the code that defines the cs pins:

      static const byte ht1632_cs[4] = {4,5,6,7};

      also at the top you will want to set

      #define NUM_DISPLAYS 4

      and as you say change the max X and Y

      Then, in the ht1632_plot and get_shadowram functions, you would need to tell the code which display (variable d) to write to depending on the pixels you want to plot.

      E.g. if you had all the displays in a line, X would go up to 96. So plotting X=49 you would want that to be on display 2 (displays are numbered 0 – 3). So Just add 2 more if statments after the ones for x values 0-23 and 24-47. I.e. if the displays were in a line, add one for x=48-71 where d=2 and 72-96 where d=3. You also need to change the x=x-24 to x=x-48 and x=x-72

      …and youd need to do the same kind of thing in the function: get_snapshotram

      There might be some other bits I've missed but hopefully that will get you started! Also see the post from Florin, as he is kindly helping someone do the same but with 4 x 0832 displays… the principle there is the same.


  37. yes I had the CS lines and #displays. I had just missed the _plot and shadow ram functions. It works now. Thanks a lot for your speedy reply.
    I had read the exchange between Florin and the 0832 displays. I actually have 4 of the same displays. But mine are the newer ht1632c so I figured the code wouldn’t be applicable.

  38. So I attempted to string four of the 3208 in series. I modified all of the same code I did while stringing the four 2416′s together.

    This time.
    #define X_MAX 127
    #define Y_MAX 7

    if (x >= 0 && x =96 && x <=127) {
    d = 3;
    x = x-96;
    In all the right places. It works great except for the fact that it wont print the rightmost 8×8 block on every display. I know this is because the 2416 is 24 wide and something is still set to that width per display. I looked at the code by florinC but because it was for the ht1632 I didn't know how to adapt it.

    I know this line needs to be fixed. But I am too new to this to know how,
    ht1632_sendcmd(d, HT1632_CMD_COMS01); // NMOS Output 24 row x 24 Com mode

    Any advice for where to go would be great.

    Thanks a lot!

  39. Not sure if this helps, but I found this in function ht1632_setup() in my code:

    #ifdef _16x24_
    ht1632_sendcmd(HT1632_CMD_COMS11); // 16*32, PMOS drivers
    // (fc)
    ht1632_sendcmd(HT1632_CMD_COMS10); // 32×8, PMOS drivers

    Basically, you send the first command for the 16×24 display and the second for the 0832 display.

  40. I am using the 3208 32×8 not the 0832.
    I’m assuming other code in the shadow ram methods will have to be changed as well.

  41. Are you sure it’s the HT1632C? The data sheet I found on ebay doesn’t mention it for the newer displays:


    Look at page 12 – 3.3. Command Summary.

    Under Common options you will want to set xx in:


    to the default listed on the page. This command sets up the HT1632 output pins for the display. For the HT1632 version of the 0832 it’s 10 (as in the data sheet above). See if you can find the data sheet for your particular version on Sure’s site.

    Also in the code in all the HT1632 related functions where you see the value of 96, that is essentially
    96 x 8 bits = 768 bits (double the number of pixels on the display). I.e. half of the bits are used for actual display data, the other half for the snapshot. You should change this to double the num pixels on the 0832.

    See if that helps…

  42. Yes I had to change it to 00. I probably could have guessed that :/
    Now it plots the leftmost 8×8. However, it is only plotting all the even columns. Any idea how to fix this? I already changed the 96′s to 64′s.
    Thanks again for your help.

    • Hey, Really hard to say to be honest without having a look at your code.

      Sounds like you are going in the right direction though. Have you written a function where you can plot values and check where they appear on the display?


  43. I thought we/you rewrite the pong clock code for 4 0832 displays and the code you wrote is just to do the basic tests ?


  44. Sven,
    In Nick’s version of the code I have (which may not be the latest), I identified a few places with dependencies on the screen dimensions.
    Here they are (updated with the values for your 64×16 display):

    #define BAT1_X 1
    #define BAT2_X 62

    //very basic AI…
    // For each bat, First just tell the bat to move to the height of the ball when we get to a random location.
    //for bat1
    // (fc) dependent on screen size;
    if (ballpos_x == random(40,62)){// && ballvel_x 0) {
    bat2_target_y = ballpos_y;

    //when the ball is closer to the left bat, run the ball maths to find out where the ball will land
    // (fc) also dependent on screen size;
    if (ballpos_x == 15 && ballvel_x 0)

    Nick may have already modified his code to make use of 2 macros that define MAX_X and MAX_Y.

    Again, I did not test this code (don’t have the setup to do it). If you find a few things awkward, try to understand what the above numbers mean and play with them.

  45. Hi Florin !
    I´ve tried a little bit and it works with some little problems…. :-)
    I have a problem with the clear display function. If I use the pong code that has this definition here

    #define cls ht1632_clear

    I get the error

    void ht1632_clear(byte chipno)
    too few arguments to function ‘void ht1632_clear(byte)

    I deactivated the #define cls and all cls calls and the I was able to upload the first time – of course the display is not cleared then :-(

    Do you have a idea what to do to get the clear display function working ?
    I ´ve uploaded a video that shows the clock….

  46. Good job Sven.
    Now, insert this function:

    void ht1632_clear()
    for (int i=1; i<=4; i++)

    and leave the #define cls ht1632_clear in place, together will all calls to cls.
    Basically, we re-defined the old ht1632_clear (with no parameters) function.

    (As before, I did not test this.)

  47. Hi Florin !
    I changed it and now I get another error message:
    Pongclock_v2_28_0832_test.cpp: In function ‘void ht1632_setup()’:
    Pongclock_v2_28_0832_test:41: error: too many arguments to function ‘void ht1632_clear()’
    Pongclock_v2_28_0832_test:303: error: at this point in file
    Pongclock_v2_28_0832_test.cpp: In function ‘void ht1632_clear()’:
    Pongclock_v2_28_0832_test:564: error: too many arguments to function ‘void ht1632_clear()’
    Pongclock_v2_28_0832_test:567: error: at this point in file

    void setup is this here :
    void ht1632_setup()
    pinMode(HT1632_CS1, OUTPUT);
    pinMode(HT1632_CS2, OUTPUT);
    pinMode(HT1632_CS3, OUTPUT);
    pinMode(HT1632_CS4, OUTPUT);

    digitalWrite(HT1632_CS1, 1);
    digitalWrite(HT1632_CS2, 1);
    digitalWrite(HT1632_CS3, 1);
    digitalWrite(HT1632_CS4, 1);

    pinMode(HT1632_WRCLK, OUTPUT);
    pinMode(HT1632_DATA, OUTPUT);

    for (int j=1; j<5; j++)
    ht1632_sendcmd(j, HT1632_CMD_SYSDIS); // Disable system
    ht1632_sendcmd(j, HT1632_CMD_COMS10); // specific to 0832 display, PMOS drivers;
    ht1632_sendcmd(j, HT1632_CMD_MSTMD); // Master Mode
    ht1632_sendcmd(j, HT1632_CMD_SYSON); // System on
    ht1632_sendcmd(j, HT1632_CMD_LEDON); // LEDs on


    void clear is just copy and paste from your post before
    I don´t know if its important but the the arduino ide jumps (orange-highlighted) on the #define FADEDELAY 50 – doesn´t make sense to me…

    Thsnk you !!

  48. Hi there. Im looking for someone to help me create a custom LED project that would need to be very compact. I have a budget and would like to know if you may be interested.


    • Probably means you have something wrong in your setup… e.g. you need to copy the libraries from the download into your setup.

      Also make sure you aren’t using an old version of the Arduino IDE.


  49. Hello, I’ve been busy with some other things and just got back to trying to get the 32*8 ht1632C displays working. I left off having everything working except that it is doubling the X value of all the positions. So turning on all the values will actually light only the even columns and the zeroth column. I’m not sure where to go :/ It’s probably something with the bitshifting. Anyway, im happy to send you the code if you want. As a thanks I’m happy to send you one of the displays as well.
    Thanks :).

    • Hey Joel, Thanks for the kind offer of a display… I would love to but I just don’t have the time at the moment! If I get a chance I’ll let you know.

  50. This is a really awesome project! I am a site manager on Instructables.com. You should consider submitting this as an entry to our Clocks Challenge. We’re giving away an iPad along with other great prizes.

    You can check out the contest here: http://www.instructables.com/contest/clocks/

    I would be happy to feature it on our site if you decide to post the instructions there and help get it noticed among our 10 million visitors. Let me know if you have any questions!


    • Hey Carley, Wow, sounds cool! I like the Instructables site.

      Sadly it looks like your competition is only open to the US and Canada. I’m in London, UK, so looks like I’m excluded.

  51. hey nick,

    me and my buddy are making a pop shots basketball game we have a string of 18 leds to keep score, i saw this pong clock so i built one and it works great but for some reason it wont change time i think i messed my ds1307 up but, I was wondering is there any way to add a counter to the program to keep score for our game im pretty sure there is a way my programming sucks though any suggestions

    • Yeah it could well be the DS1307… check all the connections, if they are dodgy it wont read the time.

      I’m not too sure on your game but you could use some bits of my code and reprogram it to make a counter in some way. You would need to brush up on your coding though or get someone who knows a bit about it.

      Good luck!

      • Hi Nick
        Really great project indeed!!

        I have the same idea as “jarell” about building a score counter
        Basically I have a RF keyfob with 2 buttons (A and B) each of them giving points to Team A and Team B.
        So far everything works on the Arduino serial monitor but I am not capable of displaying the results on the led matrix.

        First :
        int scoreTmp =0;
        int score;
        My code detects the state of the buttons and adds 1 for each time the button is pressed:
        if (buttonState1 == HIGH) {
        switch (scoreTmp) {
        case 1:
        score1 = 100;
        case 2:
        score1= 150;
        case 3:
        score1 =200 ;

        In the arduino Serial monitor I would use.

        What should I do if I want to display it on the led matrix?
        void demo_chars ()
        ht1632_putchar(0, 0, ‘score1′, (GREEN));

        ht1632_putchar(0, 8, ‘S’, (GREEN));
        ht1632_putchar(6, 8, ‘c’, (GREEN));
        ht1632_putchar(14, 8, ‘o’, (ORANGE));
        ht1632_putchar(20, 8, ‘r’, (RED));
        ht1632_putchar(26, 8, ‘e’, (GREEN));

        Thanks for your help.

      • Hey Daniel,

        Really sorry it’s taken so long to respond. You can use the putchar function in the clock code…

        Set a message string like so:

        char message[8] = {“SCORE 0″};

        Then put it on the screen using…

        ht1632_putchar(x, y, message[i]);

        Where x and y are the pixel coordinates and i is the letter in the message. E.g.

        ht1632_putchar(5, 5, message[0]);

        would print an “S” 5 pixels to the right and 5 pixels down.

        You can also use the above method with

        ht1632_puttinychar for small characters

        ht1632_putbigchar for the big numbers (there are no letters defined in the font, just 0-9)

        Hope this helps…

  52. Hi, great project. I get ” ‘Button’ does not make a type ” when I compile in Arduino.
    What does that mean?
    I’m just about ready to build it. Any help would be greatly appreciated


  53. Oops sorry, I’m so dumb (and french!) When creating the libraries folder I spelt it wrong

    sorry to bother, carry on :)

  54. Hi, me again. Could not wait to build this, did it without the ds1307 chip!!

  55. Hey Nick,
    just wanted to thank you for this awesome project, i love it !!
    I’d just build one for myself and it looks splendid
    just because of you, i bought my 1st arduino board and now i cant get my hands of it :p
    thank you for that :)
    just a little tini tiny thing… for some reason, the clock freezes sometime and the only fix is to reset the arduino board…. (arduino UNO with SM chip)
    since my 1st attempt, ive switched to Richard Shipman s evolution of your sketch, and i havent run into the problem anymore… weird

    anyway, a BIG THANK YOU for introdcuing me to arduino through this project, and i really hope you ll carry one improving this project and writing some more exciting projects

    cheers ;)


  56. Since i really want to give you something back, i made a diagram of all the connection, like the one you have but it s in color (not too much tho…) and i ve included the little changes you talked about (pin number on the DS1307, added 2 buttons). Aswell, in case you are planning on going international, i can translate your instructable in french… tell me if you would fancy that

    cheers again


  57. hey nick,
    after few more tests, it appears that, even with Richards sketch(invaders), the clock freezes at a random time aswell…
    i m lost, i checked connections and all but cant find why thoses freezes happen…
    Have you heard of anybody having this problem or any ideas on how to fix it ?
    thx in advance

  58. Hey Poto. If you leave it in pong mode, does the time freeze or the ball too?

    If it’s the time, I woud check the wiring to the clock chip – power data etc.

    If it’s the whole thing check the wiring to the arduino and make sure you power supply is good, If it wavers it could cause things to lock up.


  59. Hey Nick,
    i just checked all that, powered the board through an UPS to really see if the problem was coming from the power… change location aswell, to double check…
    but after some investigations, i suspect the ds1307 to be faulty…
    i’ll order some new parts and i ll check again
    i ll keep you posted

    thx for the support ;)


  60. the ball and the time freezes, but sometime i get the time back rght after reseting, some other times, i don’t…
    must be the ds1307

  61. Hey Eric,
    no i havent try that….
    since i know very little about electronic yet, can you explain me why should i do that and what effect will it have on the board ??
    and what pin 5 and 6 are you reffering to ?? the ones on the arduino or the ones on the ds1307 ??

    thanks for your help ;)

  62. Hi Poto, the pins I’m referring to are of the clock chip DS1307. I’m not really sure about the resistor but they are in the datasheet diagram.
    Some kind of pull-ups for the chip to behave normally?
    If you try them, tell me if it helps.


  63. well, i ve tried, and it doesnt work at all…
    right now, it s 45:85 on my clock (when on pong mode), and i cant set it right…
    if i change the mode to something else (ex:numbers) the time switches every second 12:62, 45:85; 32:54 …

    Plus, if i am the only one with this problem, why those resistors are en issue with my clock and not the others ??
    i’ll get back to you guys once i ve received the 10x DS1307 i ve ordered…. out of all of them, 1 must work, right ?? :p

    thx for the help anyway

  64. The sketch is pretty much at the bottom of the page.
    Make sure to uncomment the line
    //RTC.adjust(DateTime(__DATE__, __TIME__));
    like so
    RTC.adjust(DateTime(__DATE__, __TIME__));

    I hope this helps

  65. Well, as i was suspecting, the chip and/or the crystal is faulty. I went to the electrolab, an hackerspace in Paris, and they helped me fix it. new ds1307, new crystal, now it works like a charm ;)

    thx for this awesome project, and someone mentioned that they wanted to play real pong on he clock; i love the idea so if i make it happen, you ll be the 1st to know ;)

    thx Nick, thx Eric

    • I don’t know as I’ve not got a Mega. I guess you would have to figure out which pins you could use on the mega (as it obviously has more), and change the code for it.

  66. Hi nick,
    i ve been making a homemade PCB for this project and so far everything works fluiently but a need an information that i cant find anywhere…

    how to change the pin connection between the arduino and the DS1307+ ??
    In your project pin 5 of the DS1307 is connected to A4 and pin 6 is connected to A5, i need to change that, where can i do it ??

    i ve checked the sketch, the libraries and all but no luck … can you enlightened me ??

    thx in advance ;)


  67. Hi, have you tried in setup:

    pinMode(x pin, OUTPUT);
    pinMode(x pin, OUTPUT);

    then in loop:

    digitalWrite(x pin, LOW);
    digitalWrite(x pin, HIGH);

    That is what I did in the RTC code as I needed to use Arduino pin 16 LOW (0v) and pin 17 HIGH (5V)

    just a thought! again I might be really off the track here!!



  68. Hey Nick

    I’m really keen on building a Pong Clock. I ordered also the parts already. Now I opened the code in the arduino program and added the libraries. Then I verified the code and there was a mistake and because I’m new into this I would like to ask you for some help.

    every time I push verify, i get this error:

    pongclock_v2_27.cpp:18:57: error: WProgram.h: No such file or directory
    In file included from pongclock_v2_27.cpp:20:
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:12:24: error: WConstants.h: No such file or directory
    In file included from pongclock_v2_27.cpp:20:
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:51: error: ‘boolean’ has not been declared
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:52: error: ‘boolean’ has not been declared
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:53: error: ‘boolean’ has not been declared
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:57: error: ‘byte’ has not been declared
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:58: error: ‘byte’ has not been declared
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:59: error: ‘byte’ does not name a type
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:60: error: ‘byte’ has not been declared
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/DS1307/DS1307.h:63: error: ‘byte’ does not name a type
    In file included from pongclock_v2_27.cpp:21:
    /Users/Flo/Desktop/Arduino.app/Contents/Resources/Java/libraries/Button/Button.h:34: error: ‘LOW’ was not declared in this scope

    what did I wrong?


    • Hey Flo,

      Glad you wanted to build the clock!

      Looks like the Arduino software has been updated and my code no longer compiles :(

      Download the older arduino IDE – version 0023 from the download page, it should work with that one.

      I’ll have a look at fixing it with the new IDE.


  69. Hi Nick,
    Great project! Would you have any example code to do just the ds1307/time display (no pong) on Sure’s DE-DP13112 32×8 display? I’ll have to build the bigger clock though (a friend saw it and fell in love ;), just have to buy the hardware …


    • Hi Don,

      Glad you like it. I don’t have any code to hand, your best bet would be to adapt the code that’s in the pongclock sketch itself. The display you mention looks to have the same controller chip, so it should work with the driver functions. You would need to obviously change where stuff was drawn on screen to fit the new display’s resolution of 32×8.

      If you just wanted a bigger clock, Sure do a bigger version of the 2416 boards that use 5mm LEDs. I know a few people have used those with this sketch.


  70. Hi Nick,
    Great project, I followed your instructions to the letter and had no problems. I was wondering if it was possible to incorporate an adjustable setting to turn the display off at night. I have a similar option on my Nixie clock.
    Thanks again for one of the best clock projects on the net.

    • Hey Kevin, glad you like it.

      It would be possible to dim the display if you were OK with a bit of coding. In the main clock loop you’d want something a bit like…

      If (hours > 11 || hours < 6 )

      The above is pseudo code – it won't work as I don't have the stuff in front of me to look at, but it's the kind of thing you'd need. You can also dim the display (I use it in the code to fade the display). You could set it at a very low brightness.

      Hope that points you in the right direction!


  71. Hi,

    I have tried to compile your script on arduino versions back to 21 but I keep getting the same errors. Any assistance would be appreciated:

    pongclock_v2_27.cpp:1:20: error: Button.h: No such file or directory
    pongclock_v2_27.cpp:2:20: error: DS1307.h: No such file or directory
    pongclock_v2_27.cpp:3:18: error: Font.h: No such file or directory
    pongclock_v2_27.cpp:4:21: error: ht1632c.h: No such file or directory
    pongclock_v2_27:49: error: ‘Button’ does not name a type
    pongclock_v2_27:50: error: ‘Button’ does not name a type
    pongclock_v2_27.cpp: In function ‘void gettime()’:
    pongclock_v2_27:112: error: ‘RTC’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_chipselect(byte)’:
    pongclock_v2_27:123: error: ‘DEBUGPRINT’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_chipfree(byte)’:
    pongclock_v2_27:129: error: ‘DEBUGPRINT’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_writebits(byte, byte)’:
    pongclock_v2_27:141: error: ‘DEBUGPRINT’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_sendcmd(byte, byte)’:
    pongclock_v2_27:165: error: ‘HT1632_ID_CMD’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_senddata(byte, byte, byte)’:
    pongclock_v2_27:184: error: ‘HT1632_ID_WR’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_setup()’:
    pongclock_v2_27:205: error: ‘HT1632_CMD_SYSON’ was not declared in this scope
    pongclock_v2_27:206: error: ‘HT1632_CMD_LEDON’ was not declared in this scope
    pongclock_v2_27:207: error: ‘HT1632_CMD_COMS01′ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_clear()’:
    pongclock_v2_27:345: error: ‘HT1632_ID_WR’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_putchar(byte, byte, char)’:
    pongclock_v2_27:386: error: ‘myfont’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_putbigchar(byte, byte, char)’:
    pongclock_v2_27:413: error: ‘mybigfont’ was not declared in this scope
    pongclock_v2_27:421: error: ‘mybigfont’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_puttinychar(byte, byte, char)’:
    pongclock_v2_27:460: error: ‘mytinyfont’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void normal_clock()’:
    pongclock_v2_27:490: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:494: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void display_date()’:
    pongclock_v2_27:577: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:577: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27:656: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:656: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void fade_down()’:
    pongclock_v2_27:710: error: ‘HT1632_CMD_PWM’ was not declared in this scope
    pongclock_v2_27:716: error: ‘HT1632_CMD_PWM’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void fade_up()’:
    pongclock_v2_27:728: error: ‘HT1632_CMD_PWM’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void button_delay(int)’:
    pongclock_v2_27:743: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:743: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void pong()’:
    pongclock_v2_27:800: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:804: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void word_clock()’:
    pongclock_v2_27:1199: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:1203: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void jumble()’:
    pongclock_v2_27:1323: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:1327: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27:1451: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void switch_mode()’:
    pongclock_v2_27:1478: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void set_time()’:
    pongclock_v2_27:1549: error: ‘RTC’ was not declared in this scope
    pongclock_v2_27:1550: error: ‘DS1307_SEC’ was not declared in this scope
    pongclock_v2_27:1551: error: ‘DS1307_MIN’ was not declared in this scope
    pongclock_v2_27:1552: error: ‘DS1307_HR’ was not declared in this scope
    pongclock_v2_27:1553: error: ‘DS1307_DOW’ was not declared in this scope
    pongclock_v2_27:1554: error: ‘DS1307_DATE’ was not declared in this scope
    pongclock_v2_27:1555: error: ‘DS1307_MTH’ was not declared in this scope
    pongclock_v2_27:1556: error: ‘DS1307_YR’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘byte set_value(byte, byte, byte, byte)’:
    pongclock_v2_27:1593: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:1595: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘byte set_value_dow(byte)’:
    pongclock_v2_27:1634: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27:1635: error: ‘buttonB’ was not declared in this scope

    • Looks like it can’t find the libraries. Make sure you have put the library folders in the arching libraries folder and restarted the arduino application.

  72. Hi Nick,

    Great project – you have inspired me to make one too :) your clock looks great, I have all the parts needed winging their way to me as well as some perspex to make a stand/case

  73. Hi Nick,
    I love this clock and have built a few for the family. The last one though seems to start up at random. If i turn off with pong running it doesn’t always start with pong when i turn it on although the time is correct.. Could this be a problem with the RTC?
    Have you considered incorporating a atomic clock receiver. I recently attached one to my Nixie Clock, the hardware is fairly simple but i am hopeless with code.
    Thank you again for a great project.

    • Hey Kevin,

      Glad you like the clock! That’s an interesting problem you have. It should start with pong (if I remember right!). I don’t think it would be to do with the RTC. Maybe the power supply could be doing something funny… but I would expect to see other issues if that were the case. Maybe try running it from another power source as a test.

      Not had a look at the atomic receiver … where do you get those from?

  74. Hi Nick,
    I will try a different PSU but to be honest I’m stumped with this one. I get my real time modules from Pete Virica at http://www.pvelectronics.co.uk/index.php Last time i looked they were priced from £6.95. There is also some references on the site to how they work. Would be a great addition to the Pong Clock

  75. Hi Nick,
    I finally found the problem with my last clock. I’ve now designed a pcb specifically for this project called the GURDuino it has a IDC header for the ribbon cable attachement and can be powered by a voltage regulator or +5v psu. I can now use my Duemilanove just for programming.

  76. Hi i saw this clock and have order all the stuff so i can build one myself, i was wondering if it is hard to add a thermometer mode to the clock ?
    I am new to programing but i want to learn becouse you can make so much fun stuff with the arduino.
    Regards Axel

    • Hey, glad you bought the bits. You could add a temperature sensor, but you would probably need a bit of experience coding it in to work with the clock.

      There are lots of guides on the net about reading temperature with an Arduno, I would have a look at what is out there as a first step.


    • Hey Lucian, the Pro Mini is based on the ATMega 168 which doesn’t have enough RAM for the sketch. You would have to spend time trying to slim down the code.

      • Hi again Nick,

        I went ahead and built the clock with the Pro Mini (the older ones were ATMega 168, the newer ones come in 328 flavor too)


        Works great, I made a few adjustments like powering everything from a 7805 voltage regulator and capacitor combo (bottom left of breadboard)

        May I ask a question, feel free to tell me to go and learn myself, how would I go about inserting a new mode, that just scrolls a piece of text (one of a choice of 4 say) with the cursor effect you have implemented. I’d like to trigger this every half hour?

        Making the casing at the moment, will upload some pics in due course. Many thanks for the work you put in :)

      • Hey, great to see you got it working.

        As for scrolling text, well. If you just have a short message that will fit on the screen you can adapt the display_date() function…

        Something like:

        void my_message()
        char message[9]={“Hello” };

        //call the flashing cursor effect for one blink at x,y pos 0,0, height 5, width 7, repeats 1

        //print the message
        int i = 0;
        ht1632_putchar(i*6 , 0, daynames[dow][i]);

        I havent tested the above (and had a few beers) so it may not work, but you get the idea. you will need to call the my_message() funtion from the main loop. If you want it every 30 mins you would need an if statment e.g.

        if (rtc[1] == 30){

        rtc[1] hold the minutes value.

        If you want to scroll text bigger than the display, you would need to write a new routine that used ht1632_putchar and updated the positions moving each character a pixel along. The format is

        ht1632_putchar(xpos, ypos, character);

        Hope this helps!


  77. Hi, i have now assembly my clock and have one problem, it dosen´t work, when i connect the usb cable to the board the power lamp goes on and one of the display is lit say clock but its missing some dots in the text, when i dissconnect power to the displays the orange lamp on arduino bord flashes every seconds so i beleve the clock function works but not the displays ?
    What can i have done wrong?

    • Hey,

      Hmm, sounds like you might have something shorting out or wired wrong. The flashing every second sounds like the clock chip is OK like you say.

      Try with just one display – you should get half the display working as normal.

      Make sure the displays are set to CS1 and CS2 with the switches.


    • now i have fix the problem,it was power problem but now when i try to set the clock it wont save it, it just says 00:00 what did i do wrong?

      • If it forgets when you turn the power off, it sounds like the battery is not connected right. check your connections to the DS1307 again.

        That could also be why the light doesn’t flash. It needs the clock chip working to flash.

      • Ok thanks i think its the clock chip thats broken, i shall replace it and see if it works

  78. Hello !

    I can not compile the program: (
    Shows such errors:

    pongclock_v2_27.cpp:18:57: error: WProgram.h: No such file or directory
    In file included from pongclock_v2_27.cpp:20:
    D:\arduino\libraries\Wire/DS1307.h:12:24: error: WConstants.h: No such file or directory
    In file included from pongclock_v2_27.cpp:20:
    D:\arduino\libraries\Wire/DS1307.h:51: error: ‘boolean’ has not been declared
    D:\arduino\libraries\Wire/DS1307.h:52: error: ‘boolean’ has not been declared
    D:\arduino\libraries\Wire/DS1307.h:53: error: ‘boolean’ has not been declared
    D:\arduino\libraries\Wire/DS1307.h:57: error: ‘byte’ has not been declared
    D:\arduino\libraries\Wire/DS1307.h:58: error: ‘byte’ has not been declared
    D:\arduino\libraries\Wire/DS1307.h:59: error: ‘byte’ does not name a type
    D:\arduino\libraries\Wire/DS1307.h:60: error: ‘byte’ has not been declared
    D:\arduino\libraries\Wire/DS1307.h:63: error: ‘byte’ does not name a type
    In file included from pongclock_v2_27.cpp:21:
    D:\arduino\libraries\Wire/Button.h:34: error: ‘LOW’ was not declared in this scope

  79. I installed the 0023 version. Now there are errors:

    pongclock_v2_27.cpp.o: In function `__static_initialization_and_destruction_0′:
    d:/pongclock_v2_27.cpp:72: undefined reference to `Button::Button(unsigned char, unsigned char)’
    d:/pongclock_v2_27.cpp:73: undefined reference to `Button::Button(unsigned char, unsigned char)’
    pongclock_v2_27.cpp.o: In function `set_value_dow(unsigned char)’:
    d:/pongclock_v2_27.cpp:1658: undefined reference to `Button::isPressed()’
    d:/pongclock_v2_27.cpp:1657: undefined reference to `Button::uniquePress()’
    pongclock_v2_27.cpp.o: In function `set_value(unsigned char, unsigned char, unsigned char, unsigned char)’:
    d:/pongclock_v2_27.cpp:1618: undefined reference to `Button::isPressed()’
    d:/pongclock_v2_27.cpp:1616: undefined reference to `Button::uniquePress()’
    pongclock_v2_27.cpp.o: In function `switch_mode()’:
    d:/pongclock_v2_27.cpp:1501: undefined reference to `Button::uniquePress()’
    pongclock_v2_27.cpp.o: In function `display_date()’:
    d:/pongclock_v2_27.cpp:600: undefined reference to `Button::uniquePress()’
    d:/pongclock_v2_27.cpp:600: undefined reference to `Button::uniquePress()’
    d:/pongclock_v2_27.cpp:679: undefined reference to `Button::uniquePress()’
    pongclock_v2_27.cpp.o:d:/pongclock_v2_27.cpp:679: more undefined references to `Button::uniquePress()’ follow

      • Hmm. Sounds like maybe there is something up with your install, or you have accidentally typed something in the code.

        I’d be tempted to remove the arduino IDE (1.0 and 0023), then the libraries folder as this can hold libraries for 0023 and 1.0 and can get confused. THen try re downloading the code from google.

        Hard to say without looking at it :(

  80. What a great looking project. I have ordered the display’s and wired it up and I can get the left part of the display working on both halves of the display by changing the switches but can’t get the whole display to work. I did see it operate once but the R an L was switched around. I turned it OFF then ON again and since I have just had a one sided display. I am thinking maybe a reset pulse but thought maybe you have saw this before.

    • Hey, glad you like it – really cool you bought the bits. If the displays only work as left, sounds like one of the CS lines maybe isn’t working.

      Check all your connections and make sure there are no loose wires / dry solder joints etc.

      You should have one display with only CS1 on and the other with only CS2 on.

      If they are the wrong way round, just change the switches round. I.e make the one that had CS1 on have CS2 on, and vice versa.


  81. Problem solved. I was running the project on a dual voltage output supply. I switched the displays and arduino stand-alone board to one supply and it works great. Must have been a difference in supply grounds or the project not resetting correctly.

  82. Nick, this is entirely awesome – and that is not a word I overuse! I have my first Arduino board on order and am planning to make one of these as my first project. I’m tempted to try the 32×16 Bi-colour display from Sure, here:


    This is also based on the HT1632C – so should it be relatively doable to adapt the code to the slightly smaller display? Or am I missing something? MTIA :)

    • Hey Matthew,

      Yeah unfortunately it would be quite a lot of work to adapt the code – e.g.

      - rewrite the driver code to address 1 display not two, and to write in the correct format for that bi-colour display
      - rewrite the clock modes to support the reduced 32 pixel width (the 2 displays I use give 48 pixels)
      - redesign the fonts to fit 32 width – i don’t think the big numbers will fit.
      - add in any customisations you wanted to make it bi colour.

      It’s di-able (apart from word mode which might not fit on 32 pixels) but quite a big re write.


      • Nick, many thanks for the reply. I haven’t got my arduino board yet, but I downloaded and looked through your code – although I’m new to the hardware side of things, I’m a developer by day. Looks very good, commented and easy to follow – so I think doing it with a different display is doable too! Adapting it is probably a good way to learn some stuff about the Arduino too. In the unlikely event my end result is presentable, I’ll send it back to you ;)

      • Hey sounds great, you can correct all my dodgy coding! Be cool to see what you come up with.

  83. Hi again Nick,

    Loving my clock, it really is a nice looking bit of furnature and a good talking point. I am finding writing useful code for it a massive challenge though. I have gone from being an Arduino noob to building your clock and have missed a load of steps learning wise ;) Any pointers on where to begin with these panels? I’ve found a few threads and posts by westfw which might be helpful but any pointers welcome

    • Yeah the problem with the panels is you need to be a bit of a brainbox like WestFW. He looked at the schematics from Sure and worked out what needed to be set to get them going. You can have a look as a start and see what codes the driver chip accepts – various modes etc etc.

      Then I just ended up playing around to learn – think of an effect you might want to do, and see how far you get!

  84. Also, I am seeing some flickering of unlit LEDs, but only ones under blocks of several LEDs (large characters other modes are fine), my wiring seems good…


    • Hey, looks like you have added to the code to get the numbers animating (nice!), it could be a result of redrawing the display a lot.

      I don’t see it on mine, but then I’m not drawing the screen as much, or with big block of pixels so much.

      Tricky one. If you look in the arduin forums there is an alternative method to drive the display (a post I think by WestFW) that may be better… I’ve not tried it myself though.

      • It looks like interference or my shoddy soldering :( I uploaded your sketch and it is still visible (under the Pong paddles for example). Then I fired up your sketch with my Uno on breadboard and it is not visible

        Oh well, back to the drawing board!

  85. Been working on dimming the clock (the highest intensity is far too bright for night time :D) with help from the Arduino forums. I’ve got two levels sorted (15 and 0) and been able to switch between them on button presses by cannibalizing code. Still working on getting the dimming function to trigger after a certain time though. Would you have any pointers?

  86. Awesome, thank you Kevin. I had a quick look at his code, it uses a pretty different method to what I’ve started doing… As tempting as it would be to copy him I am going to figure out what I need to do on my own! :)

  87. Hi, I saw this project and I wanted to have one! Just ordered the parts in China via american and british ebay, have them delivered to Germany within 4 weeks, and built the thing. Great! Everything works fine, but…
    When I looked inside the code, I found at least two recursions, which are a NoGo in embedded programming:
    Function normal_clock() calls itself in line 487, function pong() calls itself in line 797.
    I have not analyzed further, but maybe you will get a stack-overflow when you press the button continously.
    void normal_clock(){ …

    Do I see this correct? Or is there something special in C for Arduino, which I did not understand?

    • Hey, glad you bought the bits. I’ve not had a look at the code in a long while but it could well be doing things that aren’t recommended. (I’m still quite new to programming on the Arduino.)

      Feel free to amend and glaring errors and let me know. I can post the update on the google code page.


  88. Hi Nick,

    Still haven’t finished my clock and it’s been MONTHS lol. Have been adding to the code bit by bit though and have learned a lot. Thank you for the push I needed to get into Arduino :) Here is a short clip of my clock. Maybe I’ll finish it before the RTC battery runs out?!

    Here it was gone 1 am so it was in dimmed mode and the RGB back light LEDs are on

  89. I fired it up just to test it all without the switches. I thought it might work without them I just wouldn’t be able to set them. I fired it up and got clock v 2.27 and then it went blank. Any ideas on where it went wrong?

  90. Also I don’t have the battery rigged up. I am running it straight to the wall cause I was thinking you didn’t need it if you had a continuous source. I also didn’t use any of the resistors that came with the kit because you didn’t show them in your schematic. I did use the 8 pin chip and have it all plugged into a board just using wires – no solder.

    • Should be fine without the switches, not sure about without the battery, that could well be the problem as after the startup screen it looks to the clock chip to get the time. Another hint will be if the led on pin 13 of the arduino flashes once a second. If not the clock isn’t ticking.

      Not sure about resistors, I don’t know which kit they came with – if it was with the arduino shield they are usually for power LEDs. If that’s the case it shouldn’t make a difference if you use them or not.


  91. Hi Patrick,
    I’ve used the same RTC and it works fine once all the components are connected up. The clock will work without the switches for test purposes.

  92. Awesome! I got it working. I soldered up the chip and got everything wired up. I set the time through the computer so I didn’t really need switches to change anything. I’m buying parts for the cubes now about to start on the led cube 8x8x8. Have y’all seen prices on the all inclusive kit. It’s stupid ridiculous expensive!

  93. Nick,
    Im new to this arduino stuff..just trying to compile the code and its not properly working. I keep getting a code error saying that the button does not name a type. Im not sure if ive correctly saved the library folders but could you give me step by step instructions on how to do that? because i tried following the ones provided and everytime i reboot arduino it seems as if it hasnt recognized the library folder.
    thanks very much,

    • Hi Luke,

      Glad you decided to have a go making the clock. What version of the Arduino software are you using? You need the older version 0023. If you can see the libraries under Sketch -> Import library after you restart the software then they are in the right place.


      • I got the older one and I got everything connected and its working now. Thanks. But its really glitchy..not really sure why though..could it be the code? or is something off about the displays?

      • Hey, probably not the code as it works for myself and others. I would check all your connections, especially the 4 data lines to the displays and the power to the displays.

        Also make sure you have a powerful enough USB supply. If it can’t provide enough juice, you may get unexpected results like glitches on the display. Maybe test it with just with one display plugged in, that would reduce the power consumption.

      • Hi Nick,
        Neat clock. I have ordered all of the parts. Decided to load an verify the code, but I get tons of errors on my Macbook Pro. Yes, I am using a 1.0.x version of the.

        I decided to try it on Win7, on my fusion VM, with 023, and it does verify.

        I am curious, are you planning on updating the code for version 1.x.x anytime soon?

        I once had to roll back to 1.0.1 fro some other example. It gets real messy, I hate using more than one version, especially since there is no support form the Arduino team for anything other than most current IDE.

        I certainly do not have your programming skills.

        Has anyone else updated your work that you know of?

        Thanks for your efforts!

      • Hey Kirby, Glad you decided to make the clock. I had a quick look at updating the code a while back but I must admit I didn’t get very far. If someone was willing to go through and update it I’d be happy to add it to my google code page. I know it’s a pain working with different versions of the IDE.


  94. Hi! This is perhaps the best creation in the Arduino. I would like to do the same clocks, but I have only HT1632 matrix. : ((
    I’m so confused with libraries and code programs that are here in the comments …
    Could you send me an e-mail the necessary libraries and program code for matrix HT1632… Please!

    • Hey, glad you like the clock. Sorry but I don’t have time to re write it all for the displays you have. Buy the new ones, they aren’t that expensive!

  95. I see no resistors? I’m a grade 12 working on a prject so im not good at this stuff, are the resistors built in to the led matrix, if not where are they?

      • Hey any kind of wire you get at the hobby store / radioshack will do. Like stuff used in battery powered toys or whatever. You don’t need to add any resistors.

  96. I bought a few of them a while back from an eBay seller called offtherails2000, they have since gone up to £3.99 + P&P but it looks like a better kit. I got an older ATMega328p rather than the newer 328P-PU, different LEDs and one tactile button. This guy is really helpful, we’ve swapped a dozen or so Arduino related emails over the last few months, great guy



  97. Hello Nick!

    Great project, i really like to rebuild this!

    Can you by chance email or share the code for the old “non-C” Holtek HT1632 ?

    I happen to have two of these display lying around and want to use them :)

    Thank you for sharing this nice thing!

    Regards Markus

    • Hi Markus, I’ve just uploaded the driver for the older style displays to my google code page. There are a few tweaks you need to do to the code that i’ve put in the description notes.


  98. I finished building today and downloaded the code.

    It uploade to the Arduino with no error messages, but nothing is showing on my board.

    I left all for code unmodified, but I am only using one board right now. Is that why nothing is showing? My second one is on the way, so if I plug in that will this work?

    Or did I do something else wrong? Should something still be showing with one board?

    • Yes you should see half the clock with just one board. Changing the dip switch will choose which half.

      Check the dip switches and check all the connections and that you have everything wired to the correct pins. Also check the clock is ticking, the arduino pin 13 LED should flash once a second.

      Also check you have the new version of the display board with the chips on the back.

  99. Hello.

    I try to uploas your program in my atmega and in arduino software i have this errors:

    pongclock_v2_27.pde:-1: error: ‘Button’ does not name a type
    pongclock_v2_27.pde:-1: error: ‘Button’ does not name a type
    pongclock_v2_27.cpp: In function ‘void gettime()’:
    pongclock_v2_27.pde:-1: error: ‘RTC’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_chipselect(byte)’:
    pongclock_v2_27.pde:-1: error: ‘DEBUGPRINT’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_chipfree(byte)’:
    pongclock_v2_27.pde:-1: error: ‘DEBUGPRINT’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_writebits(byte, byte)’:
    pongclock_v2_27.pde:-1: error: ‘DEBUGPRINT’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_sendcmd(byte, byte)’:
    pongclock_v2_27.pde:-1: error: ‘HT1632_ID_CMD’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_senddata(byte, byte, byte)’:
    pongclock_v2_27.pde:-1: error: ‘HT1632_ID_WR’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_setup()’:
    pongclock_v2_27.pde:-1: error: ‘HT1632_CMD_SYSON’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘HT1632_CMD_LEDON’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘HT1632_CMD_COMS01′ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_clear()’:
    pongclock_v2_27.pde:-1: error: ‘HT1632_ID_WR’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_putchar(byte, byte, char)’:
    pongclock_v2_27.pde:-1: error: ‘myfont’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_putbigchar(byte, byte, char)’:
    pongclock_v2_27.pde:-1: error: ‘mybigfont’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘mybigfont’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void ht1632_puttinychar(byte, byte, char)’:
    pongclock_v2_27.pde:-1: error: ‘mytinyfont’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void normal_clock()’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void display_date()’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void fade_down()’:
    pongclock_v2_27.pde:-1: error: ‘HT1632_CMD_PWM’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘HT1632_CMD_PWM’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void fade_up()’:
    pongclock_v2_27.pde:-1: error: ‘HT1632_CMD_PWM’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void button_delay(int)’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void pong()’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void word_clock()’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void jumble()’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void switch_mode()’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘void set_time()’:
    pongclock_v2_27.pde:-1: error: ‘RTC’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘DS1307_SEC’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘DS1307_MIN’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘DS1307_HR’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘DS1307_DOW’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘DS1307_DATE’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘DS1307_MTH’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘DS1307_YR’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘byte set_value(byte, byte, byte, byte)’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope
    pongclock_v2_27.cpp: In function ‘byte set_value_dow(byte)’:
    pongclock_v2_27.pde:-1: error: ‘buttonA’ was not declared in this scope
    pongclock_v2_27.pde:-1: error: ‘buttonB’ was not declared in this scope

    What shoul i do?

  100. Hi,

    I am trying to compile your code using my macbook but I get the following errors. Can you point me in the right direction? I am using Arduino 0023 as suggested in your instructions:

    pongclock_v2_27/Button.cpp.o: In function `Button::pulldown()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/Button.cpp:48: multiple definition of `Button::pulldown()’
    Button.cpp.o:Button.cpp:48: first defined here
    pongclock_v2_27/Button.cpp.o: In function `Button::wasPressed()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/Button.cpp:73: multiple definition of `Button::wasPressed()’
    Button.cpp.o:Button.cpp:73: first defined here
    pongclock_v2_27/Button.cpp.o: In function `Button::stateChanged()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/Button.cpp:84: multiple definition of `Button::stateChanged()’
    Button.cpp.o:Button.cpp:84: first defined here
    pongclock_v2_27/Button.cpp.o: In function `Button::isPressed()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/Button.cpp:55: multiple definition of `Button::isPressed()’
    Button.cpp.o:Button.cpp:55: first defined here
    pongclock_v2_27/Button.cpp.o: In function `Button::uniquePress()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/Button.cpp:91: multiple definition of `Button::uniquePress()’
    Button.cpp.o:Button.cpp:91: first defined here
    pongclock_v2_27/Button.cpp.o: In function `Button::pullup()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/Button.cpp:39: multiple definition of `Button::pullup()’
    Button.cpp.o:Button.cpp:39: first defined here
    pongclock_v2_27/Button.cpp.o: In function `Button’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/Button.cpp:28: multiple definition of `Button::Button(unsigned char, unsigned char)’
    Button.cpp.o:Button.cpp:28: first defined here
    pongclock_v2_27/Button.cpp.o: In function `Button’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/Button.cpp:28: multiple definition of `Button::Button(unsigned char, unsigned char)’
    Button.cpp.o:Button.cpp:28: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::set_sram_byte(unsigned char, int)’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:209: multiple definition of `DS1307::set_sram_byte(unsigned char, int)’
    DS1307.cpp.o:DS1307.cpp:209: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::set_sram_data(unsigned char*)’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:186: multiple definition of `DS1307::set_sram_data(unsigned char*)’
    DS1307.cpp.o:DS1307.cpp:186: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::save_rtc()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:42: multiple definition of `DS1307::save_rtc()’
    DS1307.cpp.o:DS1307.cpp:42: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::start()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:164: multiple definition of `DS1307::start()’
    DS1307.cpp.o:DS1307.cpp:164: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::stop()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:156: multiple definition of `DS1307::stop()’
    DS1307.cpp.o:DS1307.cpp:156: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::set(int, int)’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:95: multiple definition of `DS1307::set(int, int)’
    DS1307.cpp.o:DS1307.cpp:95: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::get_sram_byte(int)’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:199: multiple definition of `DS1307::get_sram_byte(int)’
    DS1307.cpp.o:DS1307.cpp:199: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::get_sram_data(unsigned char*)’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:172: multiple definition of `DS1307::get_sram_data(unsigned char*)’
    DS1307.cpp.o:DS1307.cpp:172: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::read_rtc()’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:24: multiple definition of `DS1307::read_rtc()’
    DS1307.cpp.o:DS1307.cpp:24: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::get(int, unsigned char)’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:64: multiple definition of `DS1307::get(int, unsigned char)’
    DS1307.cpp.o:DS1307.cpp:64: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::min_of_day(unsigned char)’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:148: multiple definition of `DS1307::min_of_day(unsigned char)’
    DS1307.cpp.o:DS1307.cpp:148: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307::get(int*, unsigned char)’:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:55: multiple definition of `DS1307::get(int*, unsigned char)’
    DS1307.cpp.o:DS1307.cpp:55: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307′:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:15: multiple definition of `DS1307::DS1307()’
    DS1307.cpp.o:DS1307.cpp:15: first defined here
    pongclock_v2_27/DS1307.cpp.o: In function `DS1307′:
    /Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:15: multiple definition of `DS1307::DS1307()’
    DS1307.cpp.o:DS1307.cpp:15: first defined here
    pongclock_v2_27/DS1307.cpp.o:/Users/user/Documents/Arduino/libraries/pongclock_v2_27/DS1307.cpp:209: multiple definition of `RTC’
    DS1307.cpp.o:DS1307.cpp:209: first defined here

  101. Hi,

    when I try to verify the coe, I receive this error:

    ‘myfont’ was not declared in this scope.

    How can I resolve this?

    Thanks, Andrea from Italy

    • Sounds like you don’t have the libraries in the right place. Make sure they appear in the menu like the instructions say.

    • Hey, looks great – love the case! Not sure why your RTC doesn’t set the year, it looks the same chip. Does it remember the time when it’s turned off?

      You can always cheat and set the year in the software code!

  102. Hi Nick,

    Finally got all my parts, and got the clock running. Had a bit of trounle becuase I followed your illustration for wiring the DS1307, even though I really do know how to count pins on a DIP!

    Clock still seems to work, though I did put a new on in to see if the Day and Year setting problem I am having went away. It did not. The clock says it is tuesday, even though it is Saturday! And when I go to try to set the time again, it says Tuesday, and the year is always 2010!

    I am perplexed by this. Sometimes the day name is correct when it goes through that cursor mode thing, but mostly it is wrong. I am curious to see what it does later in the week.

    Times seems ok, though I really wish there was a twelve hour number mode.

    Still really fun, but I would love to know why this anomaly is happening. Interesting to see that another fellow is having the 2010 year problem that I am.

    I assume that you are really supposed to see the current day and day name when you are in time setting mode?

    Best wishes.


    • Hi.

      I get the same problem.
      If i set 2013 in the year, the days (monday, tuesday…) displayed are wrong.
      So i set 2010 for the year, and the clock work fine.

      • Hey,

        Try setting the day individually, Its not clever enough to work it out from the date if I remember right.


    • Hey, not near the clock/code so I can’t check, but i think the clock will load up the time set in the main sketch when it goes onto set mode. It it will always be 2010 or whatever. You can change this in the code.

      If I remember right, you need up set the day name too as you go through those set screens, it’s not clever enough yet to figure the day out from the date yet.



      • Ahhhh, you know, that makes a great deal of sense.

        I got it set now, so it is near perfect. I think I was skipping through the day and year, trying to reset the seconds to get it close as possible. I am pretty sure I set every item the last time, and that is making sense with what you have said. The dayname and year does always seem to be as you said now that I think about it. Tuesday 2010!!

        The kit work marvelously now, thanks so much for sharing your work with all of us!

        I wish I understood the programming better, so that I could help you update it for the newer Arduino IDE versions.

        I would also love to add a few modes, I love to see seconds incrementing. Kind of like the Doomsday clock I see at Wiseduino, and Wyolum’s YouTube video.

        I am running the version that another user listed here, with the animated digits, and blinking colon. I am too slow witted to use the binary clocks! I can’t add it fast enough.

        Now I just need to fab a case.

        Thanks again! Really really cool kit!

  103. I’m having two problems which I believe to be related. The button folder will not unzip without errors and then I get errors when I compile about button nor being defined.

    • The Button folder should not need to be unzipped separately, if you unzip the main file you download then all the libraries will be ready, just drop them into the correct folder as per the instructions.

      • OK, I used win rar to unzip into the libraries folder but I still get an error message when I compile.

      • Hmm, what exactly is the error you are getting from winrar? maybe your download is corrupted somehow? Try re downloading it. Then all you should need to do is unzip that single file to see the 4 folders and code file.

  104. Hi Nick,

    I absolutely love what you have done/are doing here. I’m a web developer with a good knowledge of C# (always have been into electronics). I stumbled across your project and instantly said “Ive got myself a new hobby!”. I never heard of Arduino until i saw this post. ive been aware of electronic dev kits through college mates but didn’t think they would be capable of doing anything more than powering a buzzer connected to two LEDs. Or i have seen motion sensor robots etc.

    I’m leaving this post to show my appreciation for what you have done and to say i have ordered all of the components except the RTC. I was looking at this and wondering if it would work and if so which connector is the 5v? I know the Arduino analog pin 4 connects to SDA & the Arduino analog pin 5 connects to SCL.


    It will probably be a month or so by the time i get all the parts and all running. Ill hopefully post a video once things are running.

  105. Sorry, after a bit if goggling i found out that the 5v is the VCC. However my question still remains if this will work? i see it has two sides to it with P1 & P2 sets of connections. Also the fact that it comes added with an eeprom, resistors & diodes which i don’t quite understand their presence.

    I’m sorry but my expertise isn’t in the hardware department, i just know enough to get me by :).

    • Hey James. thanks for the post, really glad you’ve been inspired to get into this stuff!

      Yes Vcc is the 5v like you say. As for that particular RTC module, I can’t say for certain, but it looks like it should work. There’s no circuit diagram, but I’m guessing the RTC connects to one side of connectors, and the EEprom to the other (not sure which is which). My RTC also came with an EEprom so they are often sold together by the looks of things.

      I guess you’re gambling $2 here… so maybe not the end of the world if it doesn’t pan out! Let me know how you get on.


      • Yea if it doesn’t work attached to the board i can always separate the individual parts.

        I wonder if you could help me with another similar project. I have removed a 7×80 color LED matrix from a text scroller. I think there was something wrong with the board attached to it, it was used to show film times above a cinema screen.

        My question is: on the matrix it has a set of 10 2pin connectors in a row. It looks like your 16 pin IDC only without the plastic surround and with 20 pins. Is there any way to know or find out which pins are which. Like i said before im not a hardware person. But i would like to connect an Arduino to it and revive it as a text scroller, or maybe another clock. I know this is off topic from your clock but i would greatly appreciate your help as i cant seem to seem to find an answer online.

        Thank you,


      • No fraid not. It’s impossible to say unless you can find a wiring diagram or identify the ICs and trace the pins.


  106. Hey, Nick.
    I built the clock, and I’m having trouble getting the clock set.
    Once I set the time, the cursor flashes on screen for a few seconds, and then ”

    Is displayed and fades after a few seconds.
    And advice?…

    • Hey Alex,

      Weird one, does the time change if you leave the clock alone? If not I’d say it’s not reading the time from the clock chip, so check the connections to that.


      • Hey, I was able to figure out what the problem was. I wired it up exactly as it’s pictured in the schematic and didn’t read what you have right under the picture. Oops.

  107. Hmmmm….. sounds very familiar!
    Did the exact same thing myself a few weeks ago when I built mine!
    The RS1307 got pretty hot….. but it still worked after I corrected that problem.
    And as I mentioned earlier… I should have known better, I know how to count pins on DIP’s!!

  108. Woo Woo! After a month of waiting on the parts they all finally arrived (With the setback of customs holding and charging me €13 for the LED matrix, Sure Electronics declared them as bottles!). I had all built in a couple of hours and it worked first time, All down to your great instructions. Thanks again Nick! Have you tried powering the clock from a battery pack and if so how long did it last?(would the 9V provided from the battery constitute as too much power as per your warning?)

    • Hey, great news! Glad you made it! Annoying about the LED panels though.

      A 9v battery (rectangle one) Wont give enough power to run all those LEDs. You’d need a chunky battery to run it for any length of time – maybe a bunch of D cells with something to bring the voltage to 5v?


  109. I’ve read your tutorial…great. You explained this really well. I’m waiting for the LED matrix and i want to put two pot to play pong! I’ll let you know ;)

    Congratulation for your work.


  110. Hello,
    Thank you for this project.
    I have built one, using the 5mm displays. It seems to be working fine, however I am not getting any clock signal (time stays 00:00) I am using Grove RTC from seeed as I couldn’t get my hand on a DS1307 by itself.

    Do you think my problem is because I am using Grove RTC? If yes, can I tweak the code to get it working?

    The sample code project on Grove RTC doc seems to function correctly (I can see the correct time on the serial)

    Thanks again for the project and for your time.

    • Glad you built one. That grove RTC should be fine, it just looks like a DS1307 packaged on a circuit board. Just check you have it wired up correctly, the doc I found mentions something about a base shield that plugs into the Arduino. The arduino pin 13 LED should flash once a second when it’s connected right.


      • Hello again,
        I managed to get it to work, however there are some weird behaviors, here is how i got it to work:

        1- I got an actual DS1307 and the behavior was the same as with the grove RTC.

        2- The led on Arduino is always on (not flashing), however when i added a 220ohm resistor and a led on pin 13, it started flashing.

        3- The set clock function in the code never works, to get it working, I had to set the time first using a code sample i found online for the DS1307, I was able to confirm this because the sample code uses the same pins as the pong clock to communicate with the DS1307 so i am sure it’s not a connection error.

        When i set the clock with sample code, pong works perfectly, if i disconnect power and battery, pong shows 00:00 forever, setting the time does not work.

        4- Since, the code sample I have does not set the day of the week, the clock thinks it’s always Tuesday and never updates that even when a day passes.

        5- All other clock modes(apart form Pong) do not work properly:
        5.a- Words mode: always shows Twelve o clock for 1 sec, then the real time for 1 sec and so on.

        5.b- Jumble mode: keeps randomizing every second, using debug, the variable mins was not correct, either empty or has the wrong minute, so I changed the for loop to be “rtc[0] == 59″ instead of “mins != rtc[1]“, which seems to have fixed the problem, however the day of week was still garbage since it was not set, so i replaced the array with months, it works fine this way, however as soon as you go back to another mode, you find that the time has been stuck in the past and did not update, the only way to get it back to work is to set the time again using sample code.

        5.c- Normal mode: Displays the correct time for 1 sec then displays 00:00 forever

        5.d- Random mode: Seems to be okay, it’s just that most other modes do not work.

        5.e- Pong mode: Works perfect, I left it overnight and the time was right, disconnect/reconnect power and time was still good.

        5.f- Set clock: Only saves time, not the date/day.

        5.g- Display date: Sometimes shows: ET HOUR 0TH. and sometimes shows the correct date.

        Since I do not know very well Arduino nor C++ I cannot tell what/where is it going wrong, but while debugging, I can see that the rtc[] array in pong mode returns the time correctly, while in all other mode there is a parameter or two incorrect.

        Have you seen anything like that before?

        Thank you again for the project and for your support; And please excuse my very long post.


      • Hey,

        This is all very strange, I’ve never seen this behaviour. Everything should just work, you shouldn’t have to start changing odd things in the code per mode. If the time data is correct they should all be fine.

        It sounds like you have a bigger issue, maybe an unstable power supply? Does it work without the displays plugged in and some debug lines, or with just one plugged in? Try and reduce the power draw. Are you powering via USB?

        Do you another Arduino to test it with?


      • As per your advise, I tried to disconnect the second display, it seems to have worked, all modes work better now, except numbers mode, which now blinks the real time and 00:00 every second.

        My arduino is powered by USB (from PC when debugging and from a 2A USB adapter when not)

        My multimeter reads 470 to 480mA when both displays are connected and 500mA when only one is connected.

        I unfortunately have no other Arduino to test with.


      • Solved. Simply switching to a DC adapter fixed all the problems! I don’t really understand why, I have to admit, it’s my first arduino project and I am a bit confused by this behavior.

        Again, thank you for the great project and for your support.


      • Ah well done. It sounded like it might have been something funny with the power. Really glad it’s working!

  111. Hi, i build thi clock för about a year ago, now i have a problem, the clock hangs up and freeze the display, i have to disconect power to reset it. Why is this comming after a year ? And is there any sollution for it ?
    (sorry for my bad english)

  112. Thanks Nick for a fantastic project, I would like to see the 2 Binary modes from 2.28 incorporated into 4.02 !! I have had a play with the code but I’m not clever enough to know what I’m doing !! Anyone like to help me out ?

    • There’s a guy who has done some work on it on Instructables – he might be able to help. I don’t have time to code it all these days.


  113. Hi again Nick,
    Anxious to load your new update!

    12 hour mode is a great addition.

    I am currently running the modified version that has the two binary clocks, and animated digits. I hope that programmer will incorporate your changes. ( I did find a repeatable bug in that version hard to explain ).

    I have built two clocks now. One green with a shield on a Diavolino, and now a red one with no shield at all. While I was building my own single board proto board, which was getting a bit messy as far as the wires, I found a great product that I wanted to share with everyone.


    I am using this “kit” for my second clock, and it is working well.

    I have soldered a female 16 pin IDE conector on to the board, and I am plugging the whole board directly on to the LED matrix, eliminating one cable. Connector placement is critical, for the board to fit. If I knew how, I would design a complete board to do all of this. I know I saw some person’s project that did that very thing, but can’t find it now.

    This is a bit tricky I must admit. Had to cut a few traces carefully, and remove a few pins on the connector. The nice thing is that it cuts down on the number of jumper wires. There are some power considerations, but I hope others can work that out if they decide to try this neat Arduino clone.

    Thanks again for your work and generosity on this clock!


    • Hey that is a great idea having the connector directly on the board with the Arduino, saves a ribbon cable and makes it more compact. Send me a picture when you’re done!

      Someone was actually meant to be designing a dedicated PCB for it actually, but I’ve not heard anything back as yet.


  114. Hi Nick,

    Can’t wait to have a dig about your code to see how you achieved dimming. It took me a month of head banging and still isn’t quite bug free! Sometimes my clock bathes my room in glorious green LED light at 3am :p

    • Hey, the dimming mode was actually added by a chap over at Instructables, so I can’t claim the credit there!

  115. Whadda’ ’bout the12hr mode?
    That’s my fave ill’ improvement/feature?
    Hate military time!


  116. Hey!!
    I recently built a pong clock of my own and wired it up all right (So I think) and it seems to work but I cant set the time!!! Every time I try it always reads 00:00 or 12:00 depending if I have it on a 12 hour or 24 hour time, anyone have any ideas of what is going on?? I thought my RTC chip was broken or something so I used another one but still, the same problem. Its been happening for a few weeks now and I have no clue what to do so can anyone help me????

    • Are you absolutely sure that you have wired the RTC chip correctly? If the time is not changing at all, something is definitely wrong.
      I wired it first time so that it physically matched the drawing, but Nick pointed out clearly in the docs that the pin-outs on the chip in his drawing are not as they really are on the chip!
      The numbering goes counter clockwise from the top left most pin when you have the dimple or other pin one marking on the top. So 1 & 8 are opposite each other as are 2 & 7 etc.
      I was truly embarrassed, because I know how chips are numbered, but I blindly followed the drawing. Once I realized that, and corrected the wiring, all has been well, and now I have built two! One red, and one green, kinda’ like New Mexico Chiles.

      • Hey Kirby,
        I wanna thank you so much for replying!! Ive been having this problem since the start of the summer and I could not be able to understand why! I know that 1 and 8 are opposite each other and I am 99% positive I wired it up correctly. My chip looks exactly like the on in the photo except for the big circle in the bottom left corner. And I presume the leg next to the circle is leg number 1 which is left of the semi-circle on top and thats exactly how I wired it up. Also since Im kind of new at this I tried wiring it up all different kinds of ways, none of which worked. Do you have to somehow program your RTC before it works?? Any help would be appreciated!!!

  117. I’ve tried everything you’ve said and read other posts as well. but its not working. Could you please do a video tutorial on this. And also a way to test if the led matrix is working.

  118. Nick

    Just wanted to thank you for the clear explanations to build a great project! I love my pong clock and have learnt a lot making it.


  119. Nick,

    Thank you for a great site and tutorial.

    I have a weird problem. I was using TIny RTC as a replacement for DS1307 and clock was working fine. Than something happened (no idea what) but time no longer will save nor Arduino can retrieve time from the RTC. I thought since in your specs you specifically said to use DS1307 I ordered that and got it all setup on the breadboard. I can see that if I had wiring or some issues sketch wont work so I know that all my wires are connected correctly and clock is showing up on the display, the issue is same as with Tiny RTC , time wont come (get_time()) and nothing gets stored on DS1307. Clock always show 00:00 and Tuesday Jan 1 2000.

    I have also taken out all wiring , kept only the clock circuit and loaded TestRTC sketch. I can set the time and date and retrieve it too. It confirms that I can get time from the chip but the pong clock sketch is unable to retrieve. The amazing thing is that every thing worked for three or four days and than it all stopped.



    • Oh just to update, I did google on the pin configuration and got it working correctly. One of the way of knowing is that when you have wiring wrong on the chip you only get the pong clock version 4.0 and nothing moves further. Once you fix your wiring on the chip every thing works except time is not correct.

      • Hey, the tinyRTC module looks to have a 1307, so should be the same as a separate 1307 chip.

        Weird it works on the test script. Could it be a power thing? Maybe try another PSU.

        Or could you stick the testRTC script as a new function in the pong sketch, and use that for gettime() as a test.

        You can also add print statement to the clock code to print rtc[0] (secs) rtc[1] (mins) etc to see if those values change.

  120. Hi Nick, great project.

    I am having problems getting the components for this to work!

    I have purchased so much from Sure Electronics over the years, amplifiers and all sorts… It seems they no longer sell the displays… “2 x Model 2416 LED Matrix Displays from Sure Electronics.” I do know they used to sell them so its of more frustration!

    Do you or anyone know where:
    1) I could get the 2416 modules; or
    2) Any similar setup that can be achieved from the led matrix modules that are real cheap, with some controller IC or components to achieve something very similar?

    I tried ebay, amazon, alibaba/aliexpress and even Googled… but to no avail.

    Any help much appreciated! :)

  121. Another report of a successful clock build. I used the Tiny RTC which are available on ebay. The Tiny RTC contains a DS1307 chip. The pin-out is as follows

    SCL=Pin 6=Arduino A5
    SDA=Pin 5=Arduino A4

    The Tiny RTC also contains a temperature sensor which I would like to add temperature to the Pong Clock. Has anyone done this?

    It would also be nice to set the time with the atomic clock radio signal or using a GPS receiver

    • Hey great news Jim. Post a pic if you can!

      Temperature would be a good addition. You might be able to use some raw I2C commands to grab the temperature direct from the board without having to ditch the RTClib library I use. Maybe ask in the Arduino forums as I couldn’t see anything with a quick google. You’d want to stick the commands in the get_time() function. Then I guess you could tack another screen on the display_date() function to print the temp, or maybe another menu option for it.

      Alternatively if you can’t use raw i2c, looking here:

      They provide a library to read from a board which looks similar to yours:


      So you could adapt the pong code to use that library to get time and temp instead of RTClib – specifically these functions:

      get_time() – reads the time from the RTC
      set_time() – set the time on the RTC
      set_dst() – adjust the daylight saving option by setting the RTC
      setup() – you’d need to add whatever is needed for the new library
      plus change the ds1307 object at the top of the code.

      The new library looks pretty similar to what I used – ie. you create an object and use it to set / read the time – so it shouldn’t be too tricky.

  122. Hi Nick, I see you are looking to get a PCB designed ? I would give it a go, however I feel you would be better to design a PCB shield for the UNO. If you want a complete PCB so you can do away with the Uno, you will need to replicate what Arduino have done so fantasticlly and people would need to have the Atmel with the boot loader already burnt, and you would still need to provide a way of uploading the code. Let me know if you want me to have a crack at it.

    • Hey Gary,

      Thanks for the kind offer of giving this a go. I thought about making a shield to start with, but then I realised a lot of the stuff on the Arduino / Uno isn’t needed for the clock, plus one PCB would be smaller and more compact. Ideally with an IDE socket on it so it connects straight to the display (i.e. no ribbon cable).

      The ATmega doesn’t need much at all to support it – just one resisitor, 2 capacitors and a crystal. See: http://arduino.cc/en/Tutorial/ArduinoToBreadboard

      You can buy pre programmed ATmega chips from Ebay and I was thinking of having a header for an FTDI cable for people to program them with.

  123. Hi Nick,

    O.k I will give it a go, I forgot to ask if you still want the Pong clock to be powered by USB cable ?

    Give me a few weeks and I should have something ready.

    • Hey, great you’re having a crack at it!

      Good point on the USB. How about we
      just go with a 5v ‘wall wart’ and round jack. Might be cheaper.

      • I was also thinking of keeping it a single sided PCB, cheaper and easier to be made at home, but has some limitations i.e may need jumper wires, I will have a play around and see what works best.

        I was also going to include a reset switch, or at least a place to put a reset with if required.

      • Hey, good point on the single sided idea. I’ve never made a PCB so didn’t consider that idea. A reset switch would be good, maybe even a spot for the led on pin 13 that flashes seconds.

  124. Hi Nick,
    It’s been a while since I left you a comment here. Great to see so many pong clocks being built!

    I managed to blow my first set of panels with some dodgy soldering. I kept meaning to get another set sent over from China, but never quite got around to it. Then I found a 16×32 RGB matrix ( https://www.adafruit.com/products/420 ) that was easy to get hold of in the UK (http://www.phenoptix.com have them) , and re-wrote your code to work with it.


    I added a microphone, and gave it a spectrum analyser mode:


    and then added an ethernet shield to go pick up the weather forecast


    So, many thanks again for such a great project. It’s kept me busy for many hours. Everybody loves the clock when they see it.


    • Hey Andy, that looks awesome, you’ve really gone to town with it! Love the colours. I must admit I have a 32×32 one of those matrices currently languishing in a drawer as part of a half completed project. I was trying to hook it up to a raspberry Pi but I couldn’t get the bit rate fast enough. I should revisit it sometime.

      Glad you got inspired though!


    • Hi Andy,

      That’s a very cool mod you have going there!

      Do you by any chance plan on sharing the code and wiring with the world?

      Just curious. Always looking for another LED project.

      I am really enjoying Nick’s latest version, with the seconds, and rolling digits, not to mention 12 hr mode!



  125. Hi Nick,
    Saw your project and just HAD to do it.

    Got all the parts and downloaded the most recent code 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 folder as well as the other three libraries and were imported via the Arduino program as I normally do for other libraries on other projects..So I am kind of at a loss to understand what is wrong.

    I program my Arduino with a PC and not a MAC but as far as I know that should not be a problem

    Any help would be appreciated.



      • Yes they do. That is what I found strange too.

        I have seen a couple other comments posted with the same problem. The reason I mentioned that I was using a PC and not a MAC is that the zip file for the Pongclock5 seems to be set up for a MAC.

        Thanks for responding… Paul

      • Yes I made the zip file on my mac, but I think it should be compatible with PC.

        How do you know the zip was set up for mac by the way?

      • When I unzipped the files to my computer I come up with a directory called __MACOSX as well as the 4 library file directories, Pongclock 5 directory and a Readme.TXT file. The __MACOSX is the dead give away.

      • Hah, yea that is a bit of a giveaway isn’t it! I forgot how Windows will show the Mac’s hidden files.

        Can you confirm you have the include Font.h line at the top of the code under the //include libraries comment? I get the same message if I take that out.

        Maybe also check to see that you don’t have another Font library installed that’s conflicting. As a check you could rename your current libraries folder to something like libraries_old and then create a new one just with the pong libraries in.

      • Hey Nick,

        Your trick with creating a library file with just the PongClock5 libs worked like a charm. Have to remember that one in case of similar future problems. Thanks again so much for your help. It is much appreciated. Looking forward to getting this going later today. Still woking on a few “Honey DOs”


      • Hey, glad it worked – thanks so much for taking the time to build one! (Good luck with the chores too!)

  126. I have been working on a PCB layout, I should have something to post by the end of this week.

    Just need to get one made or for someone to have one made to confirm all works, for the present I left the pong clock powered by USB, as on my PCB there is no voltage regulator or no voltage protection, it would be far too easy to destroy the Atmega 328. I wouldn’t take much for me to change the PCB to a DC Jack, but then there is the issue of polarity.

    • Hey Gary, that’s great news. You might want to talk to Kirby on here as he was also having a go at a PCB and trying out voltage regulators. Can’t wait to see what you come up with.

      • Hi Nick I have a finished (revision 1) of the PCB, it has not been tested or made yet. what would be the best way of posting the pdf files ?

  127. Hey Nick,

    After your help getting it working and putting it together, I noticed a few things in the pong display and was wondering if you or anybody else has made these observations.

    1. The left paddle will occasionally miss the ball when it is not the minute mark, another ball appears and then the left paddle will miss again in a few seconds and the minute score will update,

    2. The right paddle will occasionally miss when it is not on the hour and another ball will appear and the game will continue with no change in “score”. When it is the hour mark the right paddle misses and the score updates.

    3. The left will occasionally NOT miss on the minute mark and the ball keeps bouncing back and forth until the next minute mark at which time the left paddle misses and the minute score updates by 2.

    I have seen all of these things happen often and was wondering if I have another problem or if these are “features” needing a tweak?

    • Hey Paul, I’ve seen 1 and 2, but not 3. You are correct there are erm ‘features’ at the moment. I can’t remember I coded it so long ago but I think I pick a random point on the balls journey toward the bat, then work out where it will land, and move the bat toward it. I suspect sometime the bat doesn’t make it in time, i.e. I’ve assumed the bat can always make it, but on some random picks the calculation is made too late or the ball is going too fast.

      When (if) I get time I’ll have to poke through it all, or feel free to investigate!

      • Thanks Nick…. Thought I was seeing things there for a while… ;)
        When and if I ever get my coding up to speed I might just try and see what I can do.

        Still a great project… glad you made it and am very happy with mine. If somebody else looks at it and mentions one of the features I’ll just say… “Hmmm, that’s funny are you sure?” Since they happen randomly, I might just get away with it…. LOL


  128. Hi Nick, just saw your message requesting an all in one PCB for your clock… funny tho that your clock was my very first project with arduino, PCB designing and making… so I have a version of your work that is all on 1 homemade PCB… if you are still interested, give me a shout

    • Hey Rob, glad you made the clock – love to see the all in one PCB you have. Gary – few comments up (down?) has also designed one thought not had anything made yet.

    • Hey again, I have been playing around with the new version of the code, I love it but I miss something … back in the days when I built that clock, I switch from your code to Wolf’s Spoor ( http://pcbo.dcs.aber.ac.uk/blog/projects/arduino-pong-clock/ ) because I really wanted to have the space invaders mode on my clock…. any chance that you try to incoprorate this mode into your code ?? I went back to Wolf’s to ask him aswell, but it doesnt seem to be active on this project anymore … could you try to insert it in your next version of the clock ?? (my programming skills arent good enough to do so .. I’ve tried, but I end up with bugs, glitches and all ^^)
      be carefull tho if you try, you need to use the font that’s included in the tar.gz otherwise it wont work

      Thanks in advance

      PS : check your actual code, line 1953, you put “bool” instead of “boolean” … it may be the reason why some ppl experienced glitches on the 31st of January … just my 2 cents ^^

      cheers ;)

  129. Hello.

    Today when i opened my eyes, my clock is again on Friday 31 January.

    What happen, what should i do? Have you already seen this problem?


    • Oh I’ve never seen that before. Are you running the latest firmware? If you upload that again it should reset everything.

      • You know what – mine is the same, only I didn’t notice as I had it in random mode. It’s an error in slide mode – the 3 from the 31sst doesn’t get cleared from the display for some reason so it appears as 32. If you change mode or change back to slide mode it goes. I’ll have to look into my dodgy programming some point and issue an update. Sorry about that! Nick

      • Ok.
        I push the button to display the day and when the program came back in slide mode, the number of the day is ok.

  130. Has anyone thought about creating a laser cut case for this? I was thinking about designing one once I had built my clock. I was thinking ABS plastic sides then clear perspex front?

    • Yes I was thinking of getting one made at one point. I wanted an opaque white diffuse plastic box – the kind that looks white until the LED lights up behind it. Be interested if you come up with something.

  131. I’m discovering this exciting project! Very thank you to you to share your work.

    I wonder if you know about the real power consumption. Of course it depends of how many leds are on at a certain moment but we can measure an average and a peak. According to the specs, I though about something like 50 mA for the Arduino and 100 mA for each led panel. But you talk about a power supply of 150 mA, is it really enough?

    My idea is to supply power with batteries.


    • Hey, thanks for the interest. I’ve never measured power consumption, I picked 150 mA as that was the USB PSU I had and it worked. I think you’d need quite a powerful battery to keep it running for any length of time. I don’t know of any LED clocks (even the 7 segment ones) that run of batteries for that reason.

      If you really needed batteries, maybe you could implement something in the code that only lit up the display when you pushed a button.

  132. Yes sure, but displaying Pong IS the funny goal. I calculated that even with optimistic consumption, big batteries won’t be alive for more than 10 days!
    I definitively will use a wired power supply.
    Thx a lot.

  133. j’ai fait aussi une horloge avec le méme type de matrice que toi sauf que j’aimerai afficher la température a la place des “ND” ou “TH” dans le mode normal , j’ai in capteur LM35 sauf que je n’arrive pas a faire afficher ma valeur de mon capteur , a chaque fois que j’essaye les matrice m’affiche rien pourtant le code et bon mais je ne sais pas comment on fait pour que ma valeur soit afficher sur la matrice , si tu a un conseil je le veut bien
    merci et en tous cas encore une superbe idée ton horloge c’est du bon boulots :)

    • I also did a clock with the same type of matrix as you except that I’d like to display the temperature instead of “ND” or “TH” in normal mode I in sensor LM35 except I don ‘happen to do not see my value of my sensor every time I try the matrix shows me nothing though the code and good but I do not know how it’s done for my value is displayed on the matrix, if you have advice I willing
      thank you and certainly still a great idea your clock is good jobs :)

      • Hey, really hard to say what’s wrong -especially when you say your code is correct. I’d try adapting one of the very simple functions like the one that shows the version when the clock starts up. See if you can get it to print the temperature digits there. If that works, you can transplant the code to the clock functions that are a bit more complex. Good luck with it

  134. Good morning,

    my name is Francesco.

    A year ago i bought a led panel “sure electronics P4 32X8 3208 red led
    dot matrix unit board spi like” and the “Arduino UNO” but i
    understand how to use the panel program.

    I would like to add some buttons and potentiometers to the system.
    For example: pressing the button “1″ display lights up with the
    name wich runs for 30 seconds at least. Pressing another button display
    lights up with another saved name wich also runs for 30 seconds at least
    and so on for the other buttons wich have to recall the saved words.
    I also would like to know how to add two potentiometers: on for slide
    speed control and one just for time control.

    I’m waiting for your answer and i thank you in advance.


    • Hey, I don’t see why not. I’m sure there are snippits of code you could use that check a light sensor. You’d just have to convert the range of numbers that it produces into the 0-15 range I use for brightness in the clock script.

      Then put a brightness check in so it gets called every so often. Maybe stick it in with the get_time() function.


  135. hey Nick
    my watch does not run in ver. 5.1 all text will are different, only the digits displayed correctly
    run perfectly with ver. 5.0?
    can you help?

  136. hello again
    it worked thanks for the help
    now I’m trying to change the clock to Danish. so now there is a copy in Denmark once again thank you. J

  137. Hi nick,
    Great job, as always ;)
    quick question : what about the All in one PCB… are you still working on this ??
    quick question # 2 : any chance to see the Invaders from Wolf’s clock (http://pcbo.dcs.aber.ac.uk/blog/projects/arduino-pong-clock/) any time in your version, since he doesn’t seem to be active on this project anymore and his version was based on your work? It would be awesome :)

    Anyway, thanks for this great project and for all the updates you ve done in the past couple of years to make it even better, everytime ;)


    • Hey, One of the guys on the comments here was working on a board, he was doing a few tweaks last I spoke to him.

      I did try and put invaders mode in, but I couldn’t get it to work. I’ll have to have another look at the code. The icons are in the new font in 5.1, just it used yet!

  138. hey nick
    I changed my watch to Danish but Danish has three letters more of the alphabet (æøå)
    these letters can i add them too the front.h labery ?
    and how?
    best regarts j

    • Hey, I’ll try and explain…

      The 5×7 characters are stored in font.h as hex in the myfont array – the first array listed. There are 5 hex values per letter, one hex value for each column of the character. If you convert a hex value to binary (e.g. using an online calculator) that gives you the pixels in the column. E.g. for the letter A the first hex value is 0x3F which converts to 00111111 which is the pixels for the left hand column of the A. (The right hand bit in the above being the top left pixel). As the letters are 5×7 and the hex values 8 bits, the first bit isn’t used and is always 0.

      So you’d need to design new letters, split them into columns of 1s and 0′s and convert to hex. Then add them to font.h at the end of the myfont array, and update the number of chars in the array at the top of the font.h file from 80 to 83.

      After that you need to alter the main code in the ht1632_putchar and slideanim functions. Add more “else if” lines for the new chars. E.g.

      else if (c == ‘æ’) {
      c = 80;
      else if (c == ‘ø’) {
      c = 81;

      Hope this makes sense!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s