This is your standard game of battleship, each player starts with five ships that are equipped with capacitors on each space the ship takes up.
Two identical boards, one per player, each run by a Photon 2. They play over the Particle cloud with publish/subscribe, so the boards can sit across the table or across town.
Each board has two 10×10 LED grids: an Ocean grid showing your own fleet and incoming hits, and a Target grid showing your shots at the opponent. You move a cursor with a rotary encoder, press to fire, and the shot travels to the other board.
How a turn plays out
- Player A picks a cell on the Target grid and presses Fire.
- Board A publishes the shot; Board B checks it against its hidden fleet.
- Board B replies HIT, MISS or SUNK; both boards animate the result.
- On SUNK, Board B fires the full explosion on that ship's pop-up hatch.
The explosion (no real detonation)
Nothing actually blows up. Each sunk ship gets layered effects that read as an explosion:
- A capacitor-discharge solenoid kick — a charged 2200 µF bank dumps into a solenoid for a sharp physical thump under the board. This is where your capacitors do the work.
- A servo-released pop-up hatch that flips the ship model up or tips it over.
- A fire-and-smoke LED burst on the ship's cells plus a strobe ring.
- An explosion sound through a speaker, and a rumble motor.
- Optional water-mist "smoke" from an ultrasonic mist module lit orange from below.
Enclosure and lid: a 3 mm clear acrylic top sheet over the diffuser protects the LEDs and gives a clean game surface. Leave the electronics bay vented with a removable panel so the mist module, servos and caps stay reachable. The pop-up ships sit in cutouts in the lid so their hatches can flip.
One firmware image runs on both boards; each board keeps its own fleet secret and only ever publishes shots and results. Animations run off millis() so input, cloud events and effects never block each other.
Game states: BOOT → PLACE_SHIPS → WAIT_READY → MY_TURN ⇄ THEIR_TURN → GAME_OVER. The board with the lower device ID shoots first.
Libraries: Particle's neopixel for the grids, an Adafruit PCA9685 servo-driver port for the hatches, and a DFPlayer library (or the module's simple serial commands sent directly).
Boom driver with the safety limits built in:
const int BOOM_PIN = D6;
const uint32_t BOOM_PULSE_MS = 40;
const uint32_t BOOM_MAX_MS = 60; // hard ceiling
const uint32_t BOOM_COOLDOWN_MS = 1000;
uint32_t boomStart = 0, lastBoom = 0;
bool boomOn = false;
bool fireBoom() {
if (boomOn || millis() - lastBoom < BOOM_COOLDOWN_MS) return false;
digitalWrite(BOOM_PIN, HIGH);
boomOn = true;
boomStart = lastBoom = millis();
return true;
}
void serviceBoom() { // call every loop()
if (boomOn) {
uint32_t on = millis() - boomStart;
if (on >= BOOM_PULSE_MS || on >= BOOM_MAX_MS) {
digitalWrite(BOOM_PIN, LOW);
boomOn = false;
}
}
}
void setup() {
pinMode(BOOM_PIN, OUTPUT);
digitalWrite(BOOM_PIN, LOW); // gate held low from boot
}Optional phone control: expose a Particle.function("fire") so a player can fire from the Particle app or a small web page instead of the encoder.
Build one board end to end on the bench before cutting materials for the second; each phase ends with something you can test.
- 1. Grid on the bench: one 10×10 serpentine grid on the Photon 2 through the level shifter; ripple, cursor and fire animations running.
- 2. Input + local game: encoder and FIRE button, ship placement with rotate and overlap checks, a single-board game against a hard-coded fleet.
- 3. Cloud play: two Photon 2s trading shot and result events; full game across two breadboards.
- 4. Boom circuit: build the bank on its own with a meter; check polarity, bleed-down time and pulse limits before wiring it to the Photon 2.
- 5. Ships and effects: servo hatches, sound, rumble and mist sequenced into the explosion timeline.
- 6. Enclosure: frame, egg-crate grid, diffuser, 3 mm acrylic lid with ship cutouts, vented service panel, fused power entry.
- 7. Second board + playtest: duplicate, flash the same firmware, tune brightness, volume and the boom pulse.


Comments