in , , , ,

Giant Battleships

- Werbung -
Reading Time: 3 minutes

Dan Aldred has now taken the concept one stage further by recreating the classic Battleships game on a giant colour LED matrix, with the player issuing shot co‑ordinates using the rotary dial of an old telephone.

“After creating my giant 10×10 LED board – which is great for light shows, lockdown discos, and general colour displays – I wanted to create a giant game,” he reveals. As he had previously coded his own version of Battleships for the Sense HAT, it seemed a natural choice. In this version, the game is played solo with a limited number of torpedoes to try to sink all the randomly placed ships. After a short introduction, the player is asked to select their first co-ordinate. “You simply dial a number and this is then sent as data to the LED board’s Raspberry Pi, which triggers another prompt telling the player to dial the second number,” explains Dan. “Once the co-ordinates have been dialled in, the board tracks the locations, flashes, and then calculates if the torpedo has hit a boat. If it was successful then a message is sent back to the telephone which triggers a random response consisting of an explosion (sound) and a voice update. If the torpedo misses, different data is sent to the telephone which triggers the miss response, the sound of empty water.”

- Werbung -
- Werbung -

Double helping of Raspberry Pi

While Dan originally intended to use a single Raspberry Pi for the project, he ended up using two of them – one inside the LED matrix and another in the telephone – to avoid the matrix’s NeoPixels interfering with the audio for the sound effects and speech, which is played through the telephone’s original handset speaker. “The simple solution was to use a second Raspberry Pi which would be situated away from the LED [matrix].”

Two-way communication between the project’s two Raspberry Pi boards is achieved using sockets controlled by Python, although Dan encountered some problems. “I did manage to establish one-way communication between the telephone and the LED board fairly early on in the project but could not get the board to communicate back to the telephone, which meant that I could not trigger the gameplay sounds and updates. Big thanks to Nicole Parrot who showed me that I was using redundant code and sent me an example of the new code and from then on it was plain sailing!”

The giant LED matrix comprises a 10×10 grid of NeoPixels, their light diffused by jars

Reading the dial

The method for how the Raspberry Pi reads the numbers from the phone’s rotary dial is simple, according to Dan. “Basically, you send a small current from a GPIO pin through the rotary dial and back to a GND pin on Raspberry Pi. When you dial a number, the circuit is broken or interrupted (often referred to as clicks). So if you dial a number one, you get one click, or one interruption; if you dial the number seven, you get seven clicks or interruptions.” Bought for just £5, the 1960s Bakelite phone had plenty of room for housing a Raspberry Pi.

Dan discovered it was made by Swiss manufacturer Zellwegger, which used to make government listening devices and phone tapping equipment. “This is where I got excited that perhaps my Swiss telephone had sat on the desk of an important person and been tapped!” says Dan.

While a thorough inspection of all the parts of the phone sadly revealed no bugging device, “There is something quite fun about hearing the instructions and game sounds coming through an old telephone handset.”

- Werbung -

The LED matrix doubles as an impressive disco light show. Dan is considering using it for Conway’s Game of Life

- Werbung -


- Werbung -

What do you think?

Schreibe einen Kommentar