Battleship Radio With LED Display
by mars91 in Circuits > Arduino
241 Views, 2 Favorites, 0 Comments
Battleship Radio With LED Display


.jpeg)

This project shows how to use a blank SAMD21 chip for a custom circuit, like a Battleship radio game with LED display. You could swap the microcontroller for a pre-programmed Arduino Nano, but I wanted experience with the SAMD21, a more modern MCU. Hopefully, this instructables helps someone build their own SAMD21 project or build this radio Battleship game.
The final build has an awesome 64 bi-color LED display, that's easily controlled. And an RFM69HCW radio with reliable ~100m range (in my dense city apartment).
The 64 bi-color LEDs are really 128 tightly packed LEDs arranged into two 8×4 grids. Turning on two adjacent LEDs gives a third color. Essentially giving 192 (64 × 3 = 192) unique pixels.
The RFM69HCW radio balances range and data transfer. There's also plenty of open-source code for these two-way radios. Why radio instead of WiFi... Because radio feels more “Battleship”.
***These radios use the 915 MHz band, legal in North America. If you're elsewhere, use the right frequency and antenna for your region***
This project uses two essential communication protocols, I²C for the LED matrix and SPI for the radio. Only 5 pins on the ATSAMD21E18A's 32-pins go unused.
Supplies
.jpg)


This project might feel a bit intimidating at first, it was for me. But once I built a few of them, I felt more comfortable.
You can use the programming tools below for future projects. Prices are USD and really vary based on order size, distributor, etc...
Programming Tools, to program a blank SAMD21:
- J-LINK EDU MINI – $60
- J-LINK Cable – $3
- Breakout J-LINK Pinks – $3
- Free Atmel Studio – more on this below
My go-to is macOS or Linux, and was a bit nervous Atmel Studio only runs on Windows. Luckily, I had a (very old) Windows laptop. You can also use a Windows virtual machine on macOS/Linux.
Radio Battleship Supplies (everything listed is doubled—for two radios):
- 128 bi-color LEDs (size: 0606; I used orange + blue) – $6
- 10 Tactile Buttons (size: 6mm x 6mm) – $1
- 2 MBR120 Diodes (size: SOD-123F) – $0.30
- 10x 10μF Capacitors (size: 0603)
- 2 RFM69HCW radios (915 MHz) – ~$7
- 14x 10k resistors (size: 0603) – pull-ups
- 2x HT16K33A (size: 28-SSOP) – LED drivers – $1
- 2x 5.1k resistors (size: 0603) – from SAMD21 datasheet
- 4x 100k resistors (size: 0603) – from RFM69 datasheet
- 2 power indicator LEDs (size: 0805) – $0.30
- 2 AP2112K voltage regulators – $0.40
- 2 915 MHz quarter-wave antennas
- 2x 1μF capacitors (size: 0603) – filtering
- 2x WS2812B-2020 addressable RGB LEDs – $0.80
- 2x ATSAMD21E18A chips (size: 32-TQFP)
- 2x Micro USB connectors – $4
Solder Tools I Used:
- 110V 850W hot plate (mine’s big, a smaller one is fine)
- Solder paste, flux, squeegee
Game Play

.jpeg)
You’ll have two working radios that play Battleship. Of course, turn both radios on. Your ships will be randomly placed on the left screen in blue. Use the four direction buttons to move your cursor on the right screen. Press the fire button to attack. A miss lights up pink, a hit shows orange. When it’s the other player's turn, the WS2812B-2020 LED turns red.
Your own ships (left screen) show orange when hit and pink when missed. When a player loses all their ships, the game sends a winner transmission message. Any player can press fire to start a new game.
You can also upload your custom code using USB. You've now got a working radio with a cool LED matrix!
For the ultimate test, I handed one to my girlfriend. She figured it out quickly and we have played many times. She somehow wins most of the time, despite my custom "math-based" strategy...
Programming & Building the Board







This was my first time working with a blank from-the-factory ATSAMD21E18A. A small but impressive chip:
- Ultra-low power
- 48 MHz CPU (ARM Cortex-M0+)
- 256KB Flash
- UART, I²C, SPI
- 10-bit DAC (!)
You can order the board and stencil here
kicad files here, for more detailed look at pcb and schematic
Assembly Notes:
Align the stencil, apply solder paste, place components (watch silkscreen triangles for chip orientation), and melt the solder on the hot plate (I place the assembled board when the plate is off and remove the board when the plate reaches 215 °C).
Watch for:
- LEDs have a tiny green dot on their ground side
- LED grid orientation (left screen = GND pointing down, right screen = GND pointing up)
- Carefully placing 64 LEDs by hand took about 30 minutes :|
- Clean any solder bridges with flux + a soldering iron
- Test continuity before power up
One hiccup: I forgot two break out pads for JTAG programming (VIN, GND). Luckily, I found using the through holes in the RFM69HCW works. Not great, but it works. In the future, I’ll add 5 test pads to all SAMD21 projects: VIN, GND, SWDIO, SWCLK, RST.
Solder male pins to the bottom pads and the radio's VIN, GND holes. I use clay to help hold the pins still when I solder pins to a pad. See attached images.
Programming the SAMD21 (Bootloader)
A blank SAMD21s needs a bootloader before you can upload code. Yep, you need to upload code just to upload code.
Here are the best step-by-step directions I used.
My summary:
- Google how to write a bootloader. Find an article called "How Much Pain Do You Want"
- Then instead, download Adafruit’s bootloader-QTPy_m0-v3.16.0.bin from here.
- Set up Atmel Studio on a Windows machine (real or virtual)
- Plug in J-LINK and update its firmware
- Connect to board via VIN, GND, SWDIO, SWCLK, RST
- In Atmel Studio:
- Tools → Device Programming → ATSAMD21E18A → Apply
- Click Read → verify voltage and device signature
- Set BOOTPROT fuse to 0 bytes → Program, then Verify
- Flash the .bin bootloader file (Erase + Verify flash)
- Set BOOTPROT to 8192 bytes → Program
- Remove male pins with solder iron.
You now have a SAMD21 with Adafruit’s tested bootloader! The chip will show up as a USB device and can be programmed via Arduino IDE!
Downloads
Code

For the code... I tried to use ChatGPT to write a working code template. And I really tried. Detailed prompts and breaking it into pieces, hoping to get code I could just tweak and fix. But it never worked, not even as a jumping off point. Honestly, I think this project (with two-way RFM69HCW radios and a split HT16K33 LED display) is too custom for gen AI. So I wrote it from scratch.
The c++ code should be easy to follow and tweak. Upload using an Arduino IDE. Some pins may have uncommon names because it uses the adafruit bootloader.
Change these lines for each radio (swap 1 and 2)
Other notes:
- Radio 2 always goes first
- Ships are randomly placed
- Win/lose messages are sent over radio
- Uses RH_RF69 + RHReliableDatagram libraries
These lines set the frequency/power for North America. I think legally you can go as high as rf69.setTxPower(20, true); but check your regulations before increasing transmit power.
Downloads
Have Fun!

Play some radio battleship across your house, or follow these steps to build your own ATSAMD21E18A circuit. Thanks for checking this instructables out!