Pong In Hardware… Virtually

We are big fans of the Falstad circuit simulator. Sure, it isn’t perfect, but there’s nothing else like it when you want to whip up a simple circuit. But we were blown away when we saw a more or less complete hardware implementation of Pong in Falstad. No kidding. Starting with the original schematics, there are multiple pages that show each sub-circuit and even a playable subset that you can play the game in your browser.

But wait… you probably noticed there’s no CRT display in the simulator’s component menu. That’s true, there isn’t. However, you can write JavaScript to interact with a running simulation, so the display is a simple bit of JavaScript that samples signals at predetermined points and does the appropriate drawings. There’s even audio output for the sound effects, although that is built into the simulator.

As an example of how the display works, look at this snippet:

// called every timestep, which is 6 nanoseconds of game time.
// we do as little work in here as possible.
function didStep(sim) {
   var c = clk.getVoltage();
   if (c == lastclk)
   if (c>2.5) {
// positive clock transition, increase x
   if (x == 375) {
   x = -80;
   if (sim.getNodeVoltage("VBLANK") > 2.5) {
// if we're in vertical blank, set y to 0
   y = 0;
   clearedY = -1;
   sim.setExtVoltage("PADTRIGGER1", 5);
   sim.setExtVoltage("PADTRIGGER2", 5);

You can see the whole thing by simply viewing the page source in your favorite browser.

Not only is this very educational if you ever wanted to know how something like this works, but it is also a great illustration of what you can do with the Falstad simulator and some Web page work. It gives us a lot of ideas. If you are interested in the Pong circuit itself, we really enjoyed how each page broke down a part of the circuit and explained it along with the relevant simulation.

Don’t forget you can try Arduino programs out in Falstad. You can even build a simple analog computer.

5 thoughts on “Pong In Hardware… Virtually

  1. I’d like to point out that there are a bunch of fun and interesting things on Falstad besides his circuit simulator. You can click on the animated Falstad logo on the bottom-left of any of his webpages to get a list of every applet he has made. There are loads of them and many of them are very fascinating. I find the ripple tank and 2D Electrodynamics applets the most interesting.

    Also, Falstad isn’t the only great online and free circuit simulator. There’s also EveryCircuit, although you do need to pay money to unlock the ability to post circuits to the EC community or make them available by link and it is much more limited than Falstad in many ways (fewer components, less options for things like switches, etc.) but I find it to be one of the best simulators out there especially for quickly putting something together. With Falstad you have a bunch of right-click menus that can be slow to navigate and things like wiring are difficult to manage neatly and quickly but with EveryCircuit all components are drag-n-drop and the wires are self-routing (although sometimes I wish I could manually route certain wires) so it’s a lot easier and quicker to make a simple and neat circuit. I also just generally find it a lot easier to use than Falstad, and if you have a paid account (one time $15 payment for a lifetime premium account) you can save circuits so that they’re publicly available (even without paying you can still save them privately if you make a free account). I have personally made hundreds of circuits, including such things as audio amplifiers, RF amplifiers, discrete OP-amps, AM and FM transmitters and receivers, power supplies, and even various logic circuits such as binary adders. Unfortunately, the simulation has a limited workspace and no sub-circuit support and the developers have basically abandoned the project, but maybe if it receives more publicity that’ll change.

    If anyone’s interested, you can access my circuits by going to the EveryCircuit web app or mobile app and putting “@jason9” in the search bar (without the quotes of course).

  2. There was a Space Wars in Popular Electronics in the mid-seventies. As I recall, cmos. The original pong had to be with discrete ICs. But itwas big news when you could get an IC that did it.

    People rushing out and spending good money on those early games, and soon losing interest because of the repetition.

    Microprocessors made it all more flexible, and a steady stream of new games.

    1. Yep, I built one of those PopTronics Space Pong games in the ’70s. As I recall, for variety it had a switch that introduced ‘gravity’ to the pong balls that caused them to move in arcs across the pong field instead of straight across. Lots of fun at Saturday night parties in those days!

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.