Pong Clock With Case

by oliverb in Circuits > Arduino

10915 Views, 118 Favorites, 0 Comments

Pong Clock With Case

Pong_game_Anim750.gif
Pong_Anim550.gif
Pong_Clock850a.jpg

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.

This is MrNick1234567 Pong Clock design and this Instructable shows how to fit it into a case and how to add a few extras including a DS3231 AT24C32 I2C Precision Real Time Clock Module, Master Clock Synchronisation PIR activation and IR remote control.

The case is a simple white jewellery box with a glass front. View it on Ebay here. A black display mask printed on inkjet slide film is added behind the glass over the display.

The standard clock has lots of different display modes to choose from:

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 Options-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.

Modifications to Nick's clock
I have made the following changes to Nick's code/design.

I have removed one of the modes, Time and date with seconds with jumbled character effect to save space on the Arduino.

I have used a modified remote control instead of the push buttons to set/control the clock.

Added remote controlled quick brightness control without going through the menus.

Instead of the DS1307 RTC I have used a DS3231 AT24C32 I2C Precision Real Time Clock Module.

A PIR is used to turn off the clock display when no one is in the room.

I have also added synchronisation to my Master Clock system so the clock always changes in time to my master clock ticks and stays in sync with the Master Clock chimes. The master Clock is synchronised to the "Atomic" DCF77 Clock in Germany.

Parts Required

Main parts required

For full parts details see individual sections.

Clock case

This is a WHITE WOODEN JEWELLERY & TRINKET BOX DISPLAY CASE GLASS LID and is available on Ebay. The case has a white painted motto on the glass that is easily removed.

Arduino

I have used a custom built Arduino Uno on vero board but a standard Uno will of course work just as well.

Display

2 off Sure 2416 LED display from Sure Electronics. I have used the 3mm Green for this case size.

Remote Control

Four-way 4-channel IR 12V Remote. This is modified to work on 5volts and has the relays removed.

DS3231 AT24C32 I2C Precision Real Time Clock Module

I have used a DS3231 Real Time Clock instead of a DS1307 Real Time Clock . The DS3231 is much more accurate and in module form it is very cheap. The module is modified to take a non rechargeable battery for safety reasons.

PIR Module

A PIR module is used to turn the displays on when someone enters the room.

Case Modifications

750animation.gif
Case04 copy.jpg
Case01 copy.jpg
Case02 copy.jpg
Case03 copy.jpg
Case05mask copy.jpg
Case05 copy.jpg
Case06 copy.jpg

fig.2/3 First scrape off the white lettering from the glass lid using your finger nail or a hard piece of plastic.

fig. 4 Then carefully pull out the glued in wooden dividers making sure you do not split the case sides.

fig. 4 Remove the felt ring holders and fit a new base board on top of the existing to hide the glued down lining.

fig. 4 The new base board is painted black

fig. 5 A display mask is printed out on clear ink jet film

fig. 6 The mask is attached behind the glass with 3 screwed on metal clips

fig. 7 Completed case ready for circuit boards.

animation fig. 1 Shows the wooden mounting blocks, the main Arduino vero board, Sure Displays, LED board. IR remote board and RTC module. The PIR is mounted remote from the case on top of a display cabinet.

fig.8 Is the full size template file. I print this onto clear inkjet film at high resolution to make sure the blacks are opaque. The white lettering comes out clear on the inkjet film so I mount a narrow aluminium bar behind the mask lettering to enable it to be read. The small square is left clear as this is where the IR receiver sits.

Downloads

Circuit Boards

vero_main_old.jpg
vero_rear copy.jpg
vero_led.jpg
vero_LED_rear.jpg

There are 2 boards to construct from vero board. You should be able to make the boards from the enclosed layouts and schematic included with this Instructable. The are also details on my web site for this clockhere.

The first board is the Arduino Uno board. A standard Uno board can also be used if you don't want to make up one of the Vero boards.

The second board is the LED board containing the 1 second LED, the 30 seconds LED and the sync LED.

The 1 second LED lights every other 1 second pulse while the 30 second LED lights on receipt of the 30 second pulse from my Master Clock.

The sync LED lights when the clock has been synchronised to the 30 second pulse on the half minute.

DS3231 AT24C32 Real Time Clock Modification

DS321 copy.jpg
DS321_modified copy.jpg

The RTC module has built in temperature compensation and an I2C interface and requires no code changes to work.

As supplied the module is designed to charge a LiR2032 Rechargeable Coin Cell Battery. There are many articles on the internet about the design of the charging circuit for these modules and possible fire risk to the battery.

I decided to play safe and cut out the charging circuit by removing R5 and then fit a standard battery. The battery should last many years.

fig.1 shows the module and location of R5 while fig.2 shows R5 removed.

Modification of Infrared Module

infra-red-board_relay.jpg
infra-red-board copy.jpg
remote_ctrl copy.jpg
remote_ctrl.jpg

I have used a modified remote controlled relay board to control/setup the clock.

The relay inputs are used to switch the Arduino. The module toggles so a button has to be pressed twice on each selection, once to operate and again to release. An LED will light if the switch is left operated. The code could be modified to trigger on each state if you find pressing a button twice annoying.

fig.1 shows the original module.

fig.2 shows the relays and screw terminals removed and solder pins inserted into the old relay inputs. The infrared sensor is then extended out and hot melt glued into place under the clear window in the display mask.

The 5v regulator is no longer required so the input and output pins are shorted out and the board is then fed from the same supply as the Arduino.


The IR remote fig.3 is then re-labled as fig.4.

Mode selects the 5 display modes, Slide, Pong, Digits, Words & Normal and then Setup

Date display the date

Sync resets the seconds to 30 ready for initial sync (the clock will only sync if the seconds are between 24 and 36 when the 30 second sync pulse is received from the Master Clock). When real time seconds are in this range press the sync button to set the clock seconds to 30. The clock will wait until the 30 seconds sync pulse is received at 0 seconds and then on the next 30 seconds sync pulse the clock will sync. The clock will then sync on the half minute every minute.

Brightness cycles the display through 5 brightness levels without having to go through the setup menu.

Schematic

schematicv6_8v7_2.jpg

The Schematic is very simple and is can be built onto vero board in less than an hour.

The circuit is a DIY Arduino Uno with a CP2102 (with DTR for auto reset) to enable programming. You can buy kits from Ebay with the Atmega 328 I/C, quartz crystal and capacitors included. Get them pre programed with the Uno bootloader unless you want to program your own.

I use the same CP2102 module on most of my clocks and just plug it into the circuit board as required.

You can use an off the shelf Arduino Uno and it may work on other Arduino boards as well.

Display Mask

masklarge.png
mask-back02.jpg
mask-back01.jpg
mask-back03.jpg

The display Mask is used to hide away all the internal components/wiring and give a finishing touch to the case.

fig 1 The mask is printed out on a sheet of inkjet transparency paper. Make sure your print settings are high so the print is dense.

fig 2 remove the top of the glass case and flip it over so the recess for the glass is visible

fig 3 cut the printed out mask to fit in this recess

fig 4 cut some length of bar to hold the mask in place. You can add some double sided foam tape (only remove stick it to the bars not the mask by leaving one side of the backing tape on) to the bars to get a fit to the mask.

Mounting the Boards/assembling the Clock

750animation.gif
case-top06.jpg
case-top05.jpg
case-top04.jpg
case-top03.jpg
case-top02.jpg
case-top01.jpg

fig 1 shows the assembly animation.

fig 2 start by mounting to blocks of wood in the box. Screw these in from the back of the box using small wood screws. I always screw rather than glue as it makes it easier to remove the clock assembly at a later date.

The wooden blocks are cut so they space the main display boards up almost touching the glass/display mask. This will take a bit of trial and error and you may need some spacers under the blocks to get the correct height.

fig 3 screw the main circuit board in place to the base of the box.

fig 4 the RTC module is then fixed to the top wooden mounting block.

fig 5 before mounting the Sure Display boards join the boards together with a short metal or plastic bar and nuts and bolts on the bottom right corner of left display and the bottom left corner of the right display. If using a metal bar do not short out any metal parts of the PCB. This bar can not be seen on the picture as it is fixed under the display boards.

Now is a good time to connect all the ribbon cables and other connectors to the main Arduino board.

Mount the Sure displays on the wooden blocks. The displays are screwed directly to the top block and via short metal or plastic bars the the lower wooden block.

fig 6 The IR board and LED board are then mounted on the lower block making sure the IR receiver fixed to the IR board is aligned with the blank in the display mask. The LEDs on the LED board should also align with the LED labels on the display mask.

PIR Detection Module

infrared.jpg
PIR copy.jpg

PIR

Pyroelectric IR Infrared PIR Motion Sensor Detector Module The clock has infrared motion detection and this is detected off a remote sensor fig 1. that is used for a number of clocks in the room.

The PIR is mounted high up on a wall in a face plate and the output goes to all the clocks in the room with a PIR input see fig 2.

The modules has a single output that goes high when motion is detected. The sensitivity and length of trigger can be adjusted on the module to suit.

Display Modes

Pong_Anim550.gif
Pong_game_Anim750.gif
Pong_AnimWords672_415.gif
Pong_AnimDigits672_415.gif
Pong_AnimNormal672_415.gif

Note the pictures above are animations I had made the real clock is much smoother in operation.

There are 5 display modes on the clock.

1 Rotating digits. Time and date are displayed on an animated display. The digits roll down as they change.

2 Pong. The game of Pong is played and the ball is missed on each minute. The score is then updated to keep time.

3 Word. The time is spelt out.

4 Digits. The time is displayed using large digits.

5 Normal. Time and date is displayed with no effects.

Code

You can download a copy of my modified code here

You can add and removed features as required. Don't forget if you don't use the Master Clock sync disable it in code or tie the input so you don't get random 30 second syncs. The same goes with the PIR input.

There are many modified versions of Nick's clock out there all so if my version is not quite what you are looking for you shoud be able to add features from other clocks.

I have zipped up some of the libraries including Nick Hall's modified LED driver