Written by Frank Duignan, Electronics Engineer and Lecturer at TU Dublin, Ireland
This blog originally ran on the Frank’s website at ioprog.com. For more content like this, click here.
Dublin Maker is a celebration of Ireland’s makers that takes place every July. This year it featured an electronic badge that runs a set of games and a communications utility based on top of Zephyr RTOS. The code is developed in C++ and has the following structure:
The Console object encapsulates the badge functionality. The Display object controls the 240×240 LCD display and includes a range of drawing primitives such as fillRectangle, drawLine etc. The Controller object initializes and manages the user buttons and the Sound object manages a timer which is used to produce sound on the badge.
The underlying Zephyr OS provides additional functionality such as timing, digital I/O, and SPI. Zephyr also allows the badges to form a BLE mesh network. This allows for multiplayer games and text messaging. Badges can also relay messages for one another to extend their range.
All of this runs on a Nordic Semiconductor NRF52833 which is integrated into an EBYTE E73 2G4M08S1E module. The BBC Microbit V2 uses the same MCU and was used for initial prototyping.
Galaga
Brici (like breakout)
An adventure game called Microrealms
A version of the Battleship game for two players (we did this on paper when were in school)
And a communications “applet”
This uses BLE Mesh which is made possible by Zepher OS (version 2.6.0). When the badge is idle it shows the Dublin Maker logo which includes a city skyline containing “The spire”. This pretends to be a radio antenna as shown below in this video:
Code for all of this is over on github here https://github.com/fduignan/nrf52833
This will not be the end of the road for this badge. I plan to add additional software and upgrade to a more recent version of Zephyr although I will have to learn more about the PINCTRL mechanism first.