Retro Pac-Man Clock

81,438

690

235

Introduction: Retro Pac-Man Clock

About: Crazy about technology and the possibilities it can bring. I love the challenge of building unique things. My goal is to make technology fun, relevant to everyday life and help people succeed in building cool …

Build an interactive Pac-Man bedside clock, with a touch screen, and animated Pac-Man figures.

This cool project is surprisingly simple to make and is a great gift for those nostalgic Pac-Man addicts.

As well as being able to interact with the Pac-Man game, you can record a sound of your choice for the alarm.

*** V10 code released with original Pacman Gameplay now included with Dots ***

Step 1: Gather the Materials

The Retro Pac-Man Clock is made from 5 key modules along with a case that is laser cut from MDF wood.

  1. Arduino Board - Arduino Mega 2560 (Items 1, 2 and 3 can be purchased as one bundled order)
  2. Touch Screen Arduino Shield - 3.2 inch Mega Touch L CD
  3. Expansion Board Shield Touch Screen - 3.2" TFT LCD Display + Touch Screen for Arduino's Mega 2560 (*Note: Avoid Sainsmart see section 4 below)
  4. Real Time Clock module - DS3231 RTC
  5. Voice Recorder Module - ISD1820 Voice Recorder

Enclosed in the instructable is the necessary Arduino code, links to libraries and any special graphics files you will need to build the project.

In the list above there are links to suppliers of parts that are similar to the items used in the prototype. You are free to source the parts from wherever you see fit to ensure costs are minimized.

In addition to these modules, you will require the following components

  1. Panel Pins x 4 for fastening front case to body
  2. Two Part Epoxy Resin for gluing case together
  3. Sandpaper sheets - 4 sheets each of fine and medium grade for sanding wood
  4. Electric Drill with 3mm diameter wood drill bit.
  5. USB Cable 1m length
  6. USB charger (used for the power supply for the clock)
  7. 150mm x 30mm x 3mm MDF or Styrene to build a bracket to hold circuit in place within case
  8. Hot glue gun

Optional Auto Back Light Dimming Components only required if a Bedside Clock

  1. Resistor 270k Ohm
  2. Zener Diode 3.3v 0.5 watt
  3. Resistor 47 Ohm
  4. Light Dependent Resistor (LDR)

Step 2: Build the Case

The case is made from 9mm and 3mm MDF wood which has been laser cut to shape. Below are files with the dimensions and number of parts required that you can send to a local laser cutter company to do this for you.

1. Front Panel

The front panel is sandwiched between two side rings and glued into place with 5-minute two-part epoxy glue. Be careful not to overdo the glue as it will show if it oozes out the sides.

In addition to this, a small piece of material is glued over the front cover grill to provide a nice effect and also allow the alarm speaker sound to carry out the front of the clock.

Four Panel Pins have been inserted into the corners of the inside of the front panel and glued into place with approx 10mm protruding back into the case. This will be inserted into the back panel so that it can be removed during testing.

2. Back Panel

The back panel consists of five side rings followed by the back case which is sandwiched by the final side ring. Once again and glued into place with 5-minute two-part epoxy glue. Be careful not to overdo the glue as it will show if it oozes out the sides.

Using the hole positions from the front panel pins carefully mark and drill 3mm holes and check the front and back units connect together.

3. Sand and Paint Components
Once you have the front and back units assembled you can choose to paint any colour or just sand lightly by hand and cover with a clear lacquer spray. I chose the latter because I quite liked the stressed wood effect that the laser cutter left after a light sanding. I had to put 3 to 4 coats of clear lacquer spray on the wood to get it sealed as the wood is very porous.

4. Alternative 3D Case
Two makers have kindly published a 3D template for this Retro Pacman Clock

These can be found here

Pac man case by feconinc

Pac man clock case remix by TronicGr

Step 3: Assemble the Electronic Modules

The overall circuit contains a Real Time Clock, Arduino Mega, Sound Module, Touch Screen and a Screen Sheild.

1. Real Time Clock

Mount the Realtime clock on the back of the Arduino Mega as in the picture provided. I used a hot glue gun and packing foam to ensure they are not touching and there is some cushioning to absorb movement. In my case, I soldered 2 of the RTC legs directly to the Arduino and used hookup wire to connect 5v and GND to the Arduino.

2. Sound Recording Module

These are really cool and easy to use. In a similar fashion as above, use foam and hot glue to position the module and the speaker on the back of the Arduino taking care to ensure they are insulated from touching. The Sound Module is triggered by D8 on the Arduino, so this and the power supply need connecting as per the circuit diagram provided.

3. Auto Backlight Dimmer (Optional)
If you intend on using as a bedside clock, then you will likely want to automatically dim the backlight at night so it doesn't affect your sleep. (If not then you can skip this step!)

Unfortunately, the backlight in the TFT screen is hard wired into +3.3v and cannot be adjusted with the Arduino. This means we have to disconnect it and reconnect to a PWM pin on the Arduino to control the Backlight brightness. I wanted to do this with minimal damage to pins or tracks on the components so took the following approach.

Follow the steps below carefully

(a) To achieve this a Light Dependent Resistor (LDR) is positioned at the back of the unit to detect the light. Drill two 3mm holes in the case and push the LDR legs through the holes. Use hot glue on the inside of the cabinet to hold the legs in place. Solder two wires on the inside of the case and connect them as per the circuit diagram. Add a 270k Ohm Resistor to A7 of the Arduino as per the circuit diagram.

(b) Remove the TFT Display, and place it on a firm surface. Identify pin 19 (LED_A) and carefully remove a few millimeters of the plastic at the base of the pin. Bend the pin flat and away from the connector as per the picture above. Check that the TFT Sheild can plug in snugly and that the bent pin does not obstruct the plug or socket.

(c) Solder a 47 Ohm register to the bent over the pin and connect a wire from the resistor to D9 of the Arduino Mega. The Arduino D9 pin can sink up to 40mA so the resistor limits this to less than this. Attach a 3.3v Zener Diode to the same pin (LED_A) and connect this to earth as per the diagram. The purpose of this is to protect the backlight from overvoltage as it will regulate the voltage to 3.3v.

4. TFT Screen and Arduino Shield
Carefully push the 3.2' TFT Touch Screen connectors into the TFT Arduino Shield. Then carefully connect to the top of the Arduino as per the picture provided. The RTC has a battery so will retain the correct time even if power has been removed. The Alarm time is stored in Eeprom on the Arduino which means it will be retained if there is a powercut.

Step 4: Upload the Code and Test the Clock

The Project will require the following files and libraries to be loaded before it will compile and run. The code is unique and built around the capability of the libraries, the hardware, some custom graphics and other projects that I've borrowed from.

Please Note: Development of the code for this project has used IDE v1.06 and some of the required libraries are dated. This means some people are having issues with the new IDE version 1.6 and above when loading code. Therefore in the interests of simplicity, I recommend people use IDE v1.06 and have included the correct version library files in zip files at the bottom of step 4 of the instructable.


1. Arduino IDE

I have been using an earlier version of the Arduino IDE, therefore in the interests of simplicity, I recommend that you download Arduino IDE version 1.06 on your desktop machine before you install the code. You can get his version from here.

2. Libraries

These need to be downloaded and added to the IDE (Integrated Development Environment) that runs on your computer, used to write and upload computer code to the physical board.

  • UTFT.h and URtouch.h located in zip file below
  • Time.h located in zip file below
  • DS1307RTC.h located in zip file below
  • Wire.h and EEPROM.h are already included in IDE V1.06

Credit for UTFT.h and URtouch.h goes to Rinky-Dink Electronics I've included these zip files as it appears the source Website is down.

4. TFT Screen Variations

The vagueries of TFT screens and manufacturers have led to these notes.

(a) Sainsmart - People who have purchased a 3.2' TFT screen that is branded Sainsmart on the back of the TFT device have found they have to modify libraries to resolve display issues. My advice is to avoid these and purchase the same type as displayed in the instructable parts list. If you have purchased a Sainsmart TFT Display already there is a fix below

Edit the file "initlcd.h" and modify the following line from

LCD_Write_COM_DATA(0x01,0x2B3F);

to

LCD_Write_COM_DATA(0x01,0x3B3F);

You will need to restart the IDE and then reload the code to the Arduino.

(b.) TFT Controller Chipset - People who have purchased a 3.2" TFT screen may find they could also have one of two different chipsets "SSD1289" or "ILI9341"

The annoying thing is that it's not easy to distinguish the difference online. The good news is that its easy to fix. If you get a blank screen after loading the code then it's probably because it's an ILI9341 controller. To fix you need to make the following changes to the code.

Edit the code and modify the following line of code from

UTFT myGLCD(SSD1289,38,39,40,41); //Parameters should be adjusted to your Display/Schield model

to

UTFT myGLCD(ILI9341_16,38,39,40,41); //Parameters should be adjusted to your Display/Schield model

Now try reloading the code to the Arduino.

5. Graphics Files

There are a group of bitmap files that I have included below that need to sit in the same subdirectory as the Arduino code when you begin to load into the Arduino. Therefore download the 17 files below and use the IDE to load.

6. Setup the Clock

Once the code has loaded successfully press the center of the screen and this should bring up the setup screen.

Use the menu to set the time and the alarm in 24-hour format.

Press the SAVE button to store the setting.

The RTC has a battery so will retain the correct time even if power has been removed. The Alarm time is stored in EEPROM which means it will be retained if there is a powercut.

7. Testing the Alarm

The Sound module is used to provide the Alarm. The ISD1820 is controlled by the Arduino D8 pin. Sound can be easily added by playing sound into the microphone while simultaneously pushing the record button on the ISD1820. In my case, I recorded the original Pac-Man introduction music from an audio file played through another device.

Once the sound is recorded the recording can be tested by pushing the PLAY-E button which should play the sound through the speaker.

Use the setup menu to set the clock time and the alarm time a few minutes apart. Be sure to "SET" the alarm and push the "SAVE" menu buttons. Once back to the main screen the Alarm should sound when the time occurs.

Turning off the Alarm can be done by pressing the center of the touch screen panel resulting in the Setup Screen.

8. Interacting with the game

V10 of the game has been designed to roughly emulate the original rules. The rules are as follows

  • Pac-man can be changed to Ms Pac-man by tapping the Pac-man icon in the setup menu
  • If Pac-Man eats a fruit the Ghost turns blue and can be eaten to score points
  • If Ghost is red and touches Pac-Man then Ghost gets points
  • The user can interact with Pac-Man by touching the LHS, RHS, Top Middle or Bottom Middle of the touch screen to issue commands. Pac-Man will only respond to a direction to go in the opposite direction to the way of travel. i.e if going left can be told to go right. If there is enough interest in the project I can add all directions later.
  • The game scores resets when either Pac-man or the Ghost scores more than 95.

When left alone the characters battle out the scores by randomly wandering through the maze. It's fun to watch and interact.

9. Touch Screen Calibration
Some makers have found that the Buttons on the Setup Screen do not align with the TFT touch controls.

In these cases the Touch Screen needs calibration. This can be easily done by using the Touch Screen Calibration code and instructions provided in the URtouch library. Follow these instructions if you observe this issue.

Step 5: Putting It All Together!

1. Adding External Power

The final step is to add the external power. Using a drill bit, add a hole in the back of the cabinet. Thread the USB cable through the back panel and then attach the USB cable VCC, GND, D+ and D- wires to the base of the Arduino USB Connector as per the circuit diagram. This has two advantages, firstly the USB input to Arduino Mega Boards has over current protection, and secondly you can use the USB cable to upload code changes without having to dismantle the box.

Hot glue the power cable insulation to the back of the Arduino to provide protection from cable tension when assembling front and back panels.

Add a cord grip to the cable by placing a cable tie tightly around the cable on the inside of the case on the power cable 6-8 cm from the Arduino connection. The cable tie should avoid tension on the joints when the USB cable is pulled by butting up against the inside of the case.

2. Mounting the Electronics in the case

Using 3mm thick Styrene or MDF cut out two brackets that are 105mm width x 12mm height. Cut a section out 95mm x 6 mm as per picture above.

Place the Circuit on top of the front panel and power on the circuit so you can see the front panel screen, Carefully position the brackets and screen in position and glue into place with Hot Glue.

Carefully do one bracket corner at a time and check the orientation and position of the screen. Let each glue joint cool before moving onto the next.

The outcome is a snug fit with a straight screen which is centered in the cutout hole.

3. Final Assembly

Gently push the Front Panel onto the Back Panel taking care to align the panel pins with each hole and gently pulling the USB power cord to take up the slack in the back panel. The cord grip is useful here and should protect any damage to wiring.

Plug into the USB charger and you're good to go. Enjoy!!

Step 6: DK and Other Themes

The Retro Pac-Man Clock code can be modified to provide other themes. The USB cable means there is potential for other Makers to develop their own unique themes.

Included is an initial version of Donkey Kong. The clock functions as usual and touch screen control is in place to control Mario.

*** Production Version 3 now released in this Instructable ***

Up, Down, Left and Right controls can be used to change the direction of Mario only by touching the top, Bottom, Left and Right of the screen.

To jump when traveling left or right touch the top of the screen. To activate the setup menu press the centre of the screen.

I hope this provides some inspiration for others to develop further!!

Microcontroller Contest 2017

First Prize in the
Microcontroller Contest 2017

Sensors Contest 2017

Participated in the
Sensors Contest 2017

Woodworking Contest 2017

Participated in the
Woodworking Contest 2017

15 People Made This Project!

Recommendations

  • The 1000th Contest

    The 1000th Contest
  • Battery Powered Contest

    Battery Powered Contest
  • Hand Tools Only Challenge

    Hand Tools Only Challenge

235 Discussions

0
covkid50
covkid50

Question 4 months ago

I finally added the LDR with its associated components, and the dimming works well, but when the clock is in a completely darkened bedroom the display flickers.While this isn't a problem for the occupant of the bedroom, because they should be asleep, I wondered if it could have a negative effect on the backlight of the display. I want this clock to last a long time. Any thoughts on this, or on how to prevent the flicker, would be welcomed.
Thanks,
Colin

0
Sorcerer_34
Sorcerer_34

Answer 4 months ago

Hello ...
To resolve this issue, you must add this three lines :
"
if (dimscreen < 0){
dimscreen = 0;
}
"
just after this three other lines:
"
if (dimscreen >= 255){
dimscreen = 255;
}
"
to obtain this :
"
dimscreen = (LDR/4)+5;

if (dimscreen >= 255){
dimscreen = 255;
}
if (dimscreen < 0){
dimscreen = 0;
}"
Regards
Serge

0
covkid50
covkid50

Reply 3 months ago

Serge, that worked. Thanks again!

0
covkid50
covkid50

Reply 4 months ago

Serge, many thanks for your reply. I will give this a try. Have a great weekend.
Colin

0
Lacybad
Lacybad

Question 6 months ago

Are you planning to recreate it with ESP8266/32? :)

0
Sorcerer_34
Sorcerer_34

Tip 7 months ago

Hello ...
For Europeans guys who wish to have the display in 24H mode, it is enough to replace the routine; "void UpdateDisp ()" by this one and it's all good.
........... Edit ......
Sorry for the bad news but the routine posted yesterday only works
until 19:59. From 20:00 the display requests a larger space in width (because of the 2 which replaces the 1) and the space available on the display is simply insufficient.
We should use a smaller font, but drawing a new font is beyond my skills.
Still sorry for giving false joys

Friendships.
Serge
0
Sorcerer_34
Sorcerer_34

7 months ago

Hello ...
I am building this clock and so far everything has been going well. The Arduino, screen and RTC work well together.
I am trying to add the LDR but I have a little problem. Wiring, no problem but if I look at the value of the variable "dimscreen" it only varies between 100 and 110. While in my opinion we should sooner have between 0 and 255.
What are the extreme resistance values of the LDRs you use?
Thank you.
Friendships.
Serge

0
covkid50
covkid50

Question 7 months ago

Hi,
I finally got all of my parts, and wired everything together on the bench. To keep it simple I didn't add the LDR for dimming. I compiled the sketch using the recommended version of Arduino IDE, and uploaded to the Mega with no errors.
Unfortunately I got a blank, white screen, so I edited the program to use the other chipset. Recompiled, re-uploaded, but still a blank screen. Would you happen to have any suggestions as to a possible cause for this? Thanks in advance.
UPDATE: It turned out that the display was defective. Replacing it with another one solved the problem.

0
covkid50
covkid50

Question 8 months ago

I have a question. In paragraph 5 you mention 17 graphics images that need to be downloaded, but I don't see a link for them. Did I overlook the link, or is it not there any more?
TIA

0
shakil.sharif1
shakil.sharif1

Question 1 year ago

Hey there.
I just wanted to ask which file had the TFT LCD code change for?:
UTFT myGLCD(SSD1289,38,39,40,41); //Parameters should be adjusted to your Display/Schield model

Thank you

0
rporter47
rporter47

1 year ago

I have all of the components to make this. However, I'm a little confused as to how you were able to "mount" the clock and voice recorder modules to the Mega. Can you clarify on that more? When I place them where the pictures say, they move, and I don't want to damage anything. Thanks for your input and awesome project

0
TechKiwiGadgets
TechKiwiGadgets

Reply 1 year ago

Hey no probs. I used shipping foam that the TFT screen was shipped with and cut to the size of the boards. This has hot glue on both sides to ensure its kept in place. The important thing is to ensure that the PCB tracks are well insulated and do not touch the each other. Use plenty of hot glue. See this image and let me know if you need anymore help

mounting.jpg
0
rporter47
rporter47

Reply 1 year ago

Okay, I got some foam, but now I'm having trouble loading the file. This is what I get when I try to upload. Also, the DS1307RTC.h and Time.h files aren't highlighted on the main page.

1567435789234830364613267447691.jpg
0
TechKiwiGadgets
TechKiwiGadgets

Reply 1 year ago

Hi

I suspect it could be a newer version of the IDE and library files causing the issue.
Try loading an earlier version of the IDE outlined in the instructable. I will do a test on latest IDE this week to see if I can resolve.

0
AshrafU1
AshrafU1

1 year ago

add Lipo Battery, Lipo Charger & XL6009 DC-DC Booster module for power backup

DSC_1994.JPG
0
AshrafU1
AshrafU1

1 year ago

hey i am new here i made this project successfully but a little problem raised clock time dose not updating it stays on set time can you help?

0
AshrafU1
AshrafU1

Reply 1 year ago

never mind my RTC Module was faulty

0
rporter47
rporter47

Question 1 year ago

I have some clarification questions. The first picture in step 3 shows where everything is connected together. What I'm confused about are the resistors and zener diodes. Are they soldered together to the Arduino, or are they put into the same lead on the Arduino? Also, could you elaborate a little more on where the USB cable connections go on the board? I'm in love with this post and want to make one myself, but just needed some clarification on a few things. Can't wait to hear back from you. Thanks

0
TechKiwiGadgets
TechKiwiGadgets

Answer 1 year ago

Hey no problems.

1. Dimmer Circuit:
In step 3 the very last image has a comment attached to it. The zener diode and resistor are soldered directly to pin 19 of the screen as shown in the previous two pictures.

The joints are insulated with heat shrink and connected via hookup wire to the Arduino, Earth and the Vcc line.

2. USB power cable connections:
I soldered the USB cable to the back of the Arduino Mega Board directly under the USB connector solder side of the board.

On the circuit diagram, you will see a diagram showing the orientation of the wiring for the USB connections to the Arduino Board.

Let me know if you need further assistance.