Smart Jack

Smart Jack

Pygame Raspberry Pi Python

The Smart Blackjack Table

Smart Jack is a project I made for an IOT group project during my first year of college. The game runs on a raspberry pi 4. It includes an eID card reader to identify the player and verify them. It also uses a hashed version of their national number to identify them in the database. The game itself is a custom blackjack game made with pygame. It is optimized to run on a raspberry pi 4 while retaining a smooth 60fps experience.

The Idea

For IOT we had to do a group project where we had to use sensors and actuators to create something cool. Our teacher had the mindset of “the crazier the better”. In our group we had a running joke about gambling, so naturally we decided to do something around that.


That is how Smart Jack was born.

The Game

We started by creating the game. I had plenty of pygame experience, so I took the lead on that part. It was very fun incorporating animations and game logic into the game. I analyzed the rules of blackjack and tried to implement them as accurately as possible.


The only challenge left was to get it up and running smoothly on a raspberry pi 4 as pygame is notorious for being slow because it is CPU bound and python is an interpreted language. We were aiming for a solid 60fps experience but would be happy if 30fps was achievable. I used delta time to make the game run at a constant speed regardless of the framerate.

Sensors and Actuators

We used arcade like buttons to control the game. Everything was displayed on a bigger screen and to incorporate I2C communication we used an LCD screen. The plan was to use a camera with AI to detect our student card and identify them. Unfortunately student cards differ to much from each other and the camera module was way to slow to get a good image.


I came up with the idea to use an eID card reader to identify the player. This was a much better solution as it is more secure and reliable. There is no official python library to read Belgian eID cards and the documentation is very poor. I found a C# code online that I ported to python. This eventually worked very well and we could retrieve all public information from the card.

Manual Labour

An arcade game is nothing without a good looking cabinet.

We used the available laser cutter at school to cut the wooden panels for the cabinet. They were then assembled using screws.

The overall cabinet was a bit wobbly, but it worked.

Final Result

Part of the project was to collect telemetry data.
ennl