Remember the old TV Pong game? This is one of the early video games where you played a simulated version of ping-pong on a video screen.
Screen shot
Image may be NSFW.
Clik here to view.![[IMG]](//www.rssing.com/inc2/img/tinyinf.webp)
Video Game Demo
We built this on a breadboard for the fun of it when I was in grad school. Why would I want to do this again? Because it is doable, educational and fun.
Doing this on a microcontroller with a video screen is easy. How difficult would it be to replicate with common digital ICs on a breadboard? Well, not that difficult as it turns out. I will show you how.
What do we need? The objects on the screen are simple enough. All we need are two paddles and a ball.
Let's get hacking.
Video Basics
Firstly, we need a video screen. An old video monitor that accepts a composite video signal or a VGA monitor will do.
Next, we need to learn how to generate the video signal. This consists of three signals:
You may want to go to this link and read up about Video Basics. This is a very useful tutorial on video formats (thanks to bertus for sharing this link).
NTSC vs PAL
There are different video formats depending on your country and what screen you have. Which country do you live in? Check this link to find out if you need to design for NTSC or PAL. I will be using NTSC in this demonstration. For a different format all you need to do is to modify the numbers given below to suit your situation.
Old fashioned VGA monitor (640 X 480) expects the following (all numbers are approximations):
Horizontal scan frequency = 31.5kHz
Horizontal sync pulse width = 3.8μs
Vertical scan frequency = 60Hz
Vertical sync pulse = 64μs
NTSC format
Number of lines = 525 lines
Horizontal scan frequency = 15.75kHz
Frame frequency = 30Hz
PAL format
Number of lines = 625 lines
Horizontal scan frequency = 15.625kHz
Frame frequency = 25Hz
You need to pay attention to these numbers because your hardware design needs to confirm with a specific format that your display device can accept. Fortunately, video monitors are very tolerant and the horizontal and vertical scan frequencies do not have to be exact.
Here is a graphic of how the signals might appear:
Image may be NSFW.
Clik here to view.![[IMG]](//www.rssing.com/inc2/img/tinyinf.webp)
The horizontal scan lines displayed on analog TV screens are interlaced. That is, half the total number of lines are displayed on one vertical scan. The second half are displayed on the next vertical scan with the lines being positioned in between the lines of the first scan, i.e. interlaced. Because the entire frame is displayed at 30Hz (NTSC) or 25Hz (PAL), non-interlaced TV would present an annoying flicker. Interlacing the fields at 60Hz or 50Hz helps to reduce flicker.
For our simple DIY Pong project, we will ignore interlacing and display a complete frame at 60Hz. In order to do this we need to generate 525/2 = 262.5 horizontal scan lines every 16.667 ms. As mentioned before, video monitors are very accommodating. We will bend the rules somewhat and design for the following:
Number of horizontal lines = 260
Vertical scan frequency = 60Hz
Horizontal scan frequency = 260 x 60 = 15600Hz
If you are designing for PAL, choose something like:
Number of horizontal lines = 320
Vertical scan frequency = 50Hz
Horizontal scan frequency = 320 x 50 = 16000Hz
TV Composite Signal
Here is a sample of where the video information sits on top of a horizontal line scan.
Image may be NSFW.
Clik here to view.![[IMG]]()
Sync Generator
At the heart of any video system is the Sync Generator circuit.
Image may be NSFW.
Clik here to view.
We will set the 555-timer circuit to generate a fixed 4μs low pulse at a frequency of about 15600Hz. A trim pot is used to adjust this Horizontal scan frequency. A 12-stage ripple counter is used to count 260 cycles. This number has been selected because it is a simple matter to detect when the 256 + 4 count occurs. Two bits from the 12-stage counter are ANDed and the output used to reset the counter. For setup, we monitor the vertical sync on an oscilloscope which has been set to trigger on AC line frequency. Then we adjust the 555-timer frequency until the vertical sync matches AC line frequency (60Hz for NTSC).
Sync Generator Circuit
Image may be NSFW.
Clik here to view.
Composite Output Circuit
Image may be NSFW.
Clik here to view.
The HSYNC and VSYNC digital signals are combined in an XOR gate and then fed to the base of NPN transistor Q1. This is a simple emitter follower circuit with a 50Ω load resistor.
The Video input signal which will be described next is also added to the base of Q1
Here is a photo of the monitor with what we have so far. The intensity has been adjusted high so that you can see the scan lines. When the intensity is reduced the background will be black.
Image may be NSFW.
Clik here to view.
Component List at this stage:
TLC555 - timer
CD4040 - 12-stage counter
CD4538 - Dual mono-stable multivibrator
74HC08 - Quad 2-input AND gate
74HC86 - Quad 2-input XOR gate
2N3904 - NPN transistor
Breadboard Circuit
The blue trimpot adjusts the horizontal scan frequency.
The large shiny pot adjusts the position of our experimental paddle or ball.
Image may be NSFW.
Clik here to view.
The Paddle
The two paddles (or bats) are identical. The paddle is dead simple and is described in the next blog to come.
The Ball
(to come in future blog)
Finally, we come to the tricky part, the ping-pong ball itself. In order to simulate the motion of the ball as it bounces about the screen we will make use of two triangular wave generators, one for the horizontal motion and the second for the vertical motion.
The horizontal rebound of the ball will be affected by the players' paddles as well as by the walls of the play area.
The vertical rebound of the ball is affected by the walls only. Hence this is the easier of the two. Let us tackle this one first.
Vertical Movement
(to come in future blog)
Horizontal Movement
(to come in future blog)
Embellishments
The only items left to complete the full TV Pong game is the score-board and the sound effects.
The sound effect is dead easy to implement. As for the score-board. Well, I think that's enough for one DIY project. Don't you think?
Edit: I failed to initially consider four additional embellishments:
Happy Hacking!
Project started 2017.01.13
Project completed 2017.01.23
Screen shot
Image may be NSFW.
Clik here to view.
![[IMG]](http://forum.allaboutcircuits.com/proxy.php?image=http%3A%2F%2Fplayerschoicegames.com%2Fwp-content%2Fuploads%2F2011%2F05%2Fpong.jpg&hash=a1c996add20655e853620bff45c111b6)
Video Game Demo
We built this on a breadboard for the fun of it when I was in grad school. Why would I want to do this again? Because it is doable, educational and fun.
Doing this on a microcontroller with a video screen is easy. How difficult would it be to replicate with common digital ICs on a breadboard? Well, not that difficult as it turns out. I will show you how.
What do we need? The objects on the screen are simple enough. All we need are two paddles and a ball.
Let's get hacking.
Video Basics
Firstly, we need a video screen. An old video monitor that accepts a composite video signal or a VGA monitor will do.
Next, we need to learn how to generate the video signal. This consists of three signals:
- Horizontal sync
- Vertical sync
- Video content
You may want to go to this link and read up about Video Basics. This is a very useful tutorial on video formats (thanks to bertus for sharing this link).
NTSC vs PAL
There are different video formats depending on your country and what screen you have. Which country do you live in? Check this link to find out if you need to design for NTSC or PAL. I will be using NTSC in this demonstration. For a different format all you need to do is to modify the numbers given below to suit your situation.
Old fashioned VGA monitor (640 X 480) expects the following (all numbers are approximations):
Horizontal scan frequency = 31.5kHz
Horizontal sync pulse width = 3.8μs
Vertical scan frequency = 60Hz
Vertical sync pulse = 64μs
NTSC format
Number of lines = 525 lines
Horizontal scan frequency = 15.75kHz
Frame frequency = 30Hz
PAL format
Number of lines = 625 lines
Horizontal scan frequency = 15.625kHz
Frame frequency = 25Hz
You need to pay attention to these numbers because your hardware design needs to confirm with a specific format that your display device can accept. Fortunately, video monitors are very tolerant and the horizontal and vertical scan frequencies do not have to be exact.
Here is a graphic of how the signals might appear:
Image may be NSFW.
Clik here to view.
![[IMG]](http://forum.allaboutcircuits.com/proxy.php?image=http%3A%2F%2Fwww.ue.eti.pg.gda.pl%2Ffpgalab%2Fzadania.spartan3%2Fzad_vga_przebiegi.gif&hash=1e820355cf663d81ea345c157e66d64c)
The horizontal scan lines displayed on analog TV screens are interlaced. That is, half the total number of lines are displayed on one vertical scan. The second half are displayed on the next vertical scan with the lines being positioned in between the lines of the first scan, i.e. interlaced. Because the entire frame is displayed at 30Hz (NTSC) or 25Hz (PAL), non-interlaced TV would present an annoying flicker. Interlacing the fields at 60Hz or 50Hz helps to reduce flicker.
For our simple DIY Pong project, we will ignore interlacing and display a complete frame at 60Hz. In order to do this we need to generate 525/2 = 262.5 horizontal scan lines every 16.667 ms. As mentioned before, video monitors are very accommodating. We will bend the rules somewhat and design for the following:
Number of horizontal lines = 260
Vertical scan frequency = 60Hz
Horizontal scan frequency = 260 x 60 = 15600Hz
If you are designing for PAL, choose something like:
Number of horizontal lines = 320
Vertical scan frequency = 50Hz
Horizontal scan frequency = 320 x 50 = 16000Hz
TV Composite Signal
Here is a sample of where the video information sits on top of a horizontal line scan.
Image may be NSFW.
Clik here to view.
![[IMG]](http://forum.allaboutcircuits.com/proxy.php?image=http%3A%2F%2Fwww-inst.eecs.berkeley.edu%2F%7Ecs150%2Fsp99%2Fsp99%2Fproject%2Fhsync.gif&hash=a2bcc326ad356f5e20f6194e8afb920f)
Sync Generator
At the heart of any video system is the Sync Generator circuit.
Image may be NSFW.
Clik here to view.

We will set the 555-timer circuit to generate a fixed 4μs low pulse at a frequency of about 15600Hz. A trim pot is used to adjust this Horizontal scan frequency. A 12-stage ripple counter is used to count 260 cycles. This number has been selected because it is a simple matter to detect when the 256 + 4 count occurs. Two bits from the 12-stage counter are ANDed and the output used to reset the counter. For setup, we monitor the vertical sync on an oscilloscope which has been set to trigger on AC line frequency. Then we adjust the 555-timer frequency until the vertical sync matches AC line frequency (60Hz for NTSC).
Sync Generator Circuit
Image may be NSFW.
Clik here to view.

Composite Output Circuit
Image may be NSFW.
Clik here to view.

The HSYNC and VSYNC digital signals are combined in an XOR gate and then fed to the base of NPN transistor Q1. This is a simple emitter follower circuit with a 50Ω load resistor.
The Video input signal which will be described next is also added to the base of Q1
Here is a photo of the monitor with what we have so far. The intensity has been adjusted high so that you can see the scan lines. When the intensity is reduced the background will be black.
Image may be NSFW.
Clik here to view.

Component List at this stage:
TLC555 - timer
CD4040 - 12-stage counter
CD4538 - Dual mono-stable multivibrator
74HC08 - Quad 2-input AND gate
74HC86 - Quad 2-input XOR gate
2N3904 - NPN transistor
Breadboard Circuit
The blue trimpot adjusts the horizontal scan frequency.
The large shiny pot adjusts the position of our experimental paddle or ball.
Image may be NSFW.
Clik here to view.

The Paddle
The two paddles (or bats) are identical. The paddle is dead simple and is described in the next blog to come.
The Ball
(to come in future blog)
Finally, we come to the tricky part, the ping-pong ball itself. In order to simulate the motion of the ball as it bounces about the screen we will make use of two triangular wave generators, one for the horizontal motion and the second for the vertical motion.
The horizontal rebound of the ball will be affected by the players' paddles as well as by the walls of the play area.
The vertical rebound of the ball is affected by the walls only. Hence this is the easier of the two. Let us tackle this one first.
Vertical Movement
(to come in future blog)
Horizontal Movement
(to come in future blog)
Embellishments
The only items left to complete the full TV Pong game is the score-board and the sound effects.
The sound effect is dead easy to implement. As for the score-board. Well, I think that's enough for one DIY project. Don't you think?
Edit: I failed to initially consider four additional embellishments:
- How to apply "english"? That is how to make the ball rebound off the paddle at a different angle?
- How to make the ball rebound at a different speed?
- How to make the ball begin a new serve from the middle of the screen?
- How to change the direction of the serve depending on who won the previous point?
Happy Hacking!
Project started 2017.01.13
Project completed 2017.01.23