BoardNode prototype

Prototyping a modular electronic gameboard with tiles that have RGB LEDs for gamestate indication, NFC sensing for gamepiece identification, and Hall sensors for gampiece orientation detection. Each BoardNode is made to be 9x9 tiles, and to fit a 16x16 studs LEGO plate, enabling easy customization. Multiple BoardNodes can be connected to a Controller to form a larger gameboard

In addition to enjoying making things with electronics, I also enjoy playing boardgames. And when my kids recently got old enough to start playing with LEGOs, I started thinking about how I could combine all of this into a project. I landed on making a boardgame platform that is enhanced by electronics and uses LEGO for gamepieces and possibly gameboard elements. After weighing several approaches and researching different existing LEGO games, I came across see-through LEGO baseplates. That seemed useful for LED backlighting. After further research it became clear that LEGO themselves don't produce these anymore, but they're available from third party vendors. And further that they are mostly available in the 16x16 stud variant. Given that LEGO minifigures typically fit comfortably on top of a 4x4 stud base, then the 16x16 stud baseplate would be perfect for making a 3x3 gametiles grid where the gametiles are 4x4 studs and separated by one stud. This allowed for using transparent bricks at the positions where I wanted LED lights to be.

To compensate for the relatively small 3x3 grid, I decided to introduce both NFC sensing for gamepiece identifiaction and Hall sensors for gamepiece orientation sensing. And further the idea was that multiple of these 3x3 boards, or Board Nodes as I started naming it, could be built together to form I.e. a 6x6 grid. Electrically this means making circuitboards that fit below a 16x16 LEGO baseplate, with nine NFC antennas in a 3x3 gametile grid, LEDs at the corner of each gametile, and four orientation sensing hall sensors for each gametile. In total 36 Hall sensors, 16 RGB LEDs, and 9 antennas multiplexed to one NFC reader. And all of this available over an external interface for a game controller. For the game controller I ended up defaulting to the easiest and quickest I could think of, namely a Raspberry Pi. I debated with myself a bit on exactly how the external interface should be made, but in the end I ended up with serial over USB for the prototypes. That would allow for easy connection with easily available USB-cables, easy interfacing with a PC for development and debugging, and easy interfacing with i.e. a python script running on a Raspberry Pi.

Bright living room with modern inventory
Bright living room with modern inventory

The LEGO pieces adds a bit of height to the game board, and importantly between the gamepiece and the sensing electronics beneath. It is therefore important to get the sensors as close to the LEGO baseplate as possible. The NFC antennas are not made for great detection distances, so they must be flush witth the back of the LEGO baseplate. But the Hall sensors should also be quite close to the baseplate as otherwise larger magnets must be used in the gamepiece to ensure reliable detection. But larger magnets means larger, and wider, magnetic fields, and that runs the risk of extending far enough to be detected by more sensors than intended. The concept I chose was to split the design into two PCBs, one with antennas and NFC interface, and another that lies flush beneath with LEDs and Hall sensors and the rest of the electronics. With cut-outs in the top PCB to make room for the LEDs and Hall sensors, this then enables both antennas and Hall sensors to lie directly under the LEGO baseplate. To match this I designed and 3D printed a gamepiece base with shapes underneath for placing magnet in and placing a NFC tag, and studs on top to glue in place a 4x4 LEGO plate.

With the concept in place, it was time to start designing the electronics. The schematic for the NFC PCB is very much a copy of my previous project, multiplexing NFC antennas, with some adjustments to make it a 3x3 grid instead of the original 2x4 grid, as well as a pin header for connecting to the Hall and LED layer PCB:

The layout similarly reuses much of that design, but adapted to a new board shape and antenna grid. The cut-outs / holes for the LEDs and Hall sensors are also introduced here, as well as a couple of mounting holes.

The Hall and LED PCB design reuses an Atmega328P microcontroller and USB-C interface design I've used in many other projects. The 16x WS2812B RGB LEDs I chose are MxN size such that they fit with the space for holes available in the NFC PCB. The 36x Hall sensors are too many to directly connect to the microcontroller, so Shift registers are instead used to stream in the Hall sensor states. And finally a pin header that matches the pin header on the NFC PCB is placed:

The layout is carefully matched to the physical locations I want for both the LED backlighting and the gamepiece orientation sensing on the gameboard. And the pin header and mounting holes is placed so that it lines up with the counterparts on the NFC PCB:

The finished and assembled circuitboards, separately and mounted together:

After flashing the bootloader onto the Atmega328P microcontroller, I wrote a test sketch that checked for occupancy by looking for Hall sensor activation, and for ID by checking occupied tiles for presence of a NFC tag. Then LEDs lit up based on the findings and indicates the sensed result. The first gif shows how detection of orientation lights up red LEDs based on where "forward" of the gamepiece points. The second gif shows how the NFC tags colors the tiles green or blue based on the individual NFC tags on the bottom of the gamepieces.

With this basis in place, the first building block for a modular electronics enhanced LEGO themed board game is ready. The next part will likely be to assemble three more of the prototype BoardNodes and combine them to a 6x6 grid, and hook it up to a game controller and design a demo application.