← All projectsCTYJul to Aug 2023

Breadboard Game Console

CTY, summer 2023

A breadboard circuit with an LCD that ran several games, played with push buttons.

2 gamesRun and Pong, on one board
16 x 2Characters on the whole screen
1 Arduino UnoPlus an LCD and push buttons
Summer 2023At CTY
Pick a game: "Run or Pong?", then Run: jump the blocks while the score counts up
The last rally of a game of Pong, then "GAME OVER" and "Jerry WINS"

At CTY in the summer of 2023 we built a game console on a breadboard: an Arduino Uno, a 16x2 character LCD and push buttons. It runs two games: Run, where you press a button to jump over the blocks coming at you, and Pong, where two players each get a button and a ball crosses the screen between them.

It was a long time ago and I no longer remember most of the details, so this page is built mostly from the footage.

From a drawing to a console

Before wiring anything, we drew the circuit in Fritzing: the Arduino, the LCD, the buttons and their resistors. The drawing also has a buzzer and a row of LEDs.

Jul 31, 2023: the circuit drawn in Fritzing, with the Arduino, the LCD, the buttons and their resistors
Jul 31, 2023: the circuit drawn in Fritzing, with the Arduino, the LCD, the buttons and their resistors

That evening it was on a full-size breadboard on a black base, with the Arduino Uno at one end and the LCD in the middle.

The breadboard the same evening, with the LCD lit
The breadboard the same evening, with the LCD lit

Run came first, on a smaller board, and Pong next, on the bigger one. The final version put both games on one board behind a menu: "Run or Pong?", then "Press Start" for Run, or "PING PONG, PRESS A BUTTON" for Pong.

The menu on the final board: "Run or Pong?"
The menu on the final board: "Run or Pong?"

Run

A 16x2 character LCD has no pixels to draw with: the whole screen is 32 character cells. So in Run the player and the blocks are drawn in those cells, the blocks scroll in from the right one cell at a time, a button press makes the player jump, and the score takes the last few cells of a line and keeps counting.

The first version ran on a smaller breadboard. On the final board it sits behind the menu, next to Pong.

The first, smaller board: "Press Start"
The first, smaller board: "Press Start"
Run on the final board: the player and the blocks are character cells
Run on the final board: the player and the blocks are character cells

Pong

The first Pong just said PLAYER1 and PLAYER2. The final version turned it into a complete console. It opens on "Run or Pong?". For Pong, each player scrolls through a list of names and picks their own, the screen shows who is playing whom, and then "PING PONG, PRESS A BUTTON".

The first Pong: "PLAYER1" and "PLAYER2", one button at each end

After every point it shows the score, at the end it shows "GAME OVER" and the winner, and "Show Score?" then lists how many games each player has won, adding up from game to game.

Ready: "PING PONG, PRESS A BUTTON"
Ready: "PING PONG, PRESS A BUTTON"
"Show Score?": the screen that lists every player's wins
"Show Score?": the screen that lists every player's wins

Up close, a rally is one dot crossing the 16 characters of a line, with a thumb on the button.

A rally, up close: the ball is a dot crossing the screen
"GAME OVER", "Jerry WINS"
"GAME OVER", "Jerry WINS"

When it glitched

Problem A scrambled screen

Sometimes the LCD filled up with blocks and random symbols instead of the game. It is the one failure we caught on film.

The cause was a loose jumper wire on the breadboard. The screen is wired the usual Arduino way, in 4-bit mode: every character and every command goes over just four data wires in two halves, high half first, and the LCD takes in each half when the Arduino pulses its Enable wire. The two have to stay in step on which half comes next. A wire that is not pushed all the way into the breadboard can drop a pulse or add one, and from then on the LCD pairs up the wrong halves: every character and command after that is garbage, all over the screen, until the display is started over.

Calculation Why one bad pulse scrambles the whole screen

Data wires in 4-bit mode4 (DB4 to DB7)HD44780 datasheet, the usual controller on these screens
Bits in one character or command8same datasheet
Characters on the screen16 x 2 = 32our LCD
  1. Transfers per character: 8 bits / 4 wires = 2, high half first, one Enable pulse each
  2. Filling the screen: 32 characters x 2 = 64 pulses, plus the commands between them
  3. Miss or add one pulse and each byte after it is the low half of one byte glued to the high half of the next

One glitch on a loose wire is enough to turn every character and command after it into a different one, which is why the whole screen goes, not just one letter.

From the datasheet's 4-bit transfer order; a counting argument, not a measurement of our board.

Fix Fixed

Seating the loose jumper firmly and restarting the board fixed it. The full demo we filmed after this clip runs for almost three minutes, through Run, a whole game of Pong and the score screen, without a scrambled character.

Why a 4-bit LCD falls out of step, and the usual fix (solid, short wires): bperrybap on the Arduino forum.

The screen filling up with blocks and random symbols instead of the game