back to all blogsSee all blog posts

Space Sentry Challenge: An Open Liberty space odyssey with flying saucers, Lego, Arduino, and Java microservices

image of author
Prashanth Gunapalasingam on Feb 16, 2022
Open Liberty Space Sentry Challenge

A few years ago, we were looking for a cool and interesting way to showcase Open Liberty and its new features, like MicroProfile and Java EE. Frank Ji and I teamed up to accept a mission to build an engaging physical demo. Who knew that we would end up building something simply amazing that would travel across the world to various developer conferences and local developer meetups?

With our vague mission objectives firmly in our sights, we set forth to accomplish our task at hand. After many rejected ideas and sleepless nights, we were finally able to build an awesome cool demo called “Open Liberty Space Sentry Challenge” that covered all the requirements: from artwork to wires, from Arduinos to Raspberry Pis to modern software design with Lego.

What is the Open Liberty Space Sentry Challenge?

Open Liberty Space Sentry Challenge Gameplay

Open Liberty Space Sentry Challenge is an interactive Internet of Things (IoT) game designed to showcase microservices with modern Java technologies in a fun way. The player takes control of a spaceship made of Lego and a 3D printed model by using a PlayStation 4 controller and keyboard to shoot lasers. The objective is to shoot down as many randomly popping up targets as possible within 1 minute. At the end of the game, the final score is shown on the screen, along with the player’s position in the leaderboard.

How is it made?

The Space Sentry Challenge is built in two separate components; hardware and software. These components communicate through Java Socket connections.

Diagram of the hardware and software components of the Open Liberty Space Sentry challenge design

Hardware component:

The spaceship is 3D printed and is fitted on a 100% Lego 2-axis Pan & Tilt system to power the movement of the Spaceship. The movement of the spaceship is controlled by an Arduino microcontroller and servo motors, which is attached to a Wi-Fi module (ESP8266) that allows communication to be sent to Open Liberty. A laser is mounted on the top of the spaceship with blinking LEDs surrounding the base. The spaceship contains custom-designed printed circuit boards to improve the overall reliability of the system.

The target array system contains 5 3D printed targets that are situated on a Lego base. Each of the targets contains a Piezoelectric sensor to capture when the laser hits the targets. Like the Spaceship, the target movements are controlled via an Arduino with servo motors attached to it, and the communication is established via a Wi-Fi connection.

Software component:

Three microservices make up this game; the Game Service, the Leaderboard Service, and the Admin Service. Each service makes use of Open Liberty features such as JAX-RS and MicroProfile REST Client to provide and consume REST APIs for communication between the services and uses the other MicroProfile features such as MicroProfile Config, MicroProfile Health and MicroProfile Metrics to provide useful capabilities. The final score for the leaderboard is stored in a MongoDB database.

The game can be accessed via a web page in a browser from a static Web application that is hosted on Nginx.

The services run on Docker containers, within a Raspberry Pi, where a local Wi-Fi network is established for communication.

Diagram of the software architecture of the Open Liberty Space Sentry Challenge

Mission Complete!

Since the debut of this game, it has become an instant attraction at various developer conferences and local developer meetups. People loved the mechanics of the game as it was easy to learn but difficult to master. Moreover, having different technologies working together with the addition of Lego really helped us reach out to audiences and developers of different technical backgrounds. If you want to learn Java and microservices by using a different approach, take a look at our GitHub repository, which contains our entire project, including the Lego assembly instructions, Arduino codes, the Java microservices code, and the required Open Liberty configuration.

More to come…​

With this mission successfully completed, our space adventure journey is not done yet…​ Stay tuned for the next amazing demo build, coming to a galaxy near you!

Tags