Team 2 – Automated dice game – 421

Hello everyone,

Here is our final post regarding our project. We published an instructable where you can find all the information you need to make your own automated 421 !

It is right here :

You can also check Joachim’s final overview of our project out here :

Finally, we made a video to introduce you our full project, you can find it here :

We hope you will enjoy playing 421 with your friends, see you soon !

Team 2 – Automated dice game – Our model

Here’s our post about our model. This post will explain you how we made our model and where we will place the different components.

The game is made of wood and steel pieces we had as scrap. The hardware is composed of a board game painted in green to maximise the recognition of the dice, a USB webcam stands on top of a steel support, a screen and an electric motor. The height has to be enough to allow the camera to see the whole game plate. The score will be displayed on the screen. The plate will rotate to be positionned in front of each player. To do this, the electric motor is placed under the platform and is controlled by the arduino. The dice recognition is done by the raspberry pi.

You’ll also find information thanks to this video :

Hope you’ll enjoy it, see you soon !

Team 2 : Automated board game : Software

Hello everyone,

In this post we are going to globally explain you the code we need to make our project work but first we are going to quickly explain you how the game works.

About the game :
The game is divided in two phases. The goal of the first one is to share all the tokens between the losers. Depending on how many people are playing, we usually play with either 11 or 13 tokens. During the first phase, every player has to roll the dice once and whoever gets the lowest combination receives tokens. The number of tokens he receives depends on what the biggest score is. We keep doing that until there is no more tokens to give.
Now the second phase begins. The only people participating are the ones who received tokens (therefore who lost at least one turn during the first phase). The goal now is to get rid of all your tokens. The player who starts a turn of table is now allowed to choose if he rolls the dice once, twice or three times as he is playing. Once he’s done all the following players have to try and beat the best score with the same amount of rolls. Whoever gets the lowest score loses and receives tokens from the player who got the best score (the number of tokens once again depends on the best score achieved). When one player has all the tokens, the game is over.

About our code : 
We can divide it in 3 parts. The first two are used by the Raspberry to make the interface and the game. The third one is used by the Arduino to drive the motor.

First, we made a code which we use to follow the flow of the game. To do so, we translated the rules of the game into an algorithm and then added the code that counts the dice and the score of each player.
The tricky part here is what treatment we have to carry out to be able to count the dice and the score thanks to the picture our camera has taken.
The first step is to crop the picture so all we see is the gaming plate with the 3 dice on it. Afterwards, we have to use a RGB filter and a threshold (we are using white dice on a green background) to split the colors and fetch the dice (using contours). Once we found the 3 dice, we can start counting how many pips there are in each dice using smaller contours. To make it simple, we find big contours who symbolize the dice and then smaller contours who symbolize the pips. To count the score, we only count contours between a minimum size (size of a pip) and a maximum size (size of a dice).
We then have our result stored in a matrix [nbr of 1’s; nbr of 2’s;…;nbr of 6’s]. The code is also able to count how many dice there are on the gaming plate and to know if a dice is erroneous.

The second part is the one we use to make our interface. We were fairly new to making interface using python so we basically learned ourselves how it works.
Our interface is composed of a few pages. The first one is the “home” page where you can choose what game you wanna play. For now, the only game we developed is the one we explained earlier. The second page is used to choose how many people are playing and what’s their name. After that we have another page for the first phase and one for the second phase. Their goal is to show the score of each player, how many tokens players have and all the information useful to the game itself. Moreover, we are also planning on making a “settings” page that would allow the players to change the sense and speed of rotation of the gaming plate, for example, but we’re not quite sure yet.

The third and last part we made is the one that’s going to drive the motor to make the gaming plate rotate in the right position at the right time. The arduino receives information about the position the gaming plate has to be in next. It then uses this piece of information to drive the motor until the gaming plate is in the right spot.

Our code could be updated a bit later because our model isn’t 100% finished right now so we might have to make small adjustments.

Here’s Simon’s video about our software and game : Software and game

We hope you will enjoy it,
See you soon !

Team 2 – Automated board game – Software libraries

Hello everyone,

Here’s our third post about the software libraries that are going to be used in our project.

First of all the Python software we’re developing has to include all the functions used by the dice counting. The counting is achieved thanks to an image processing code using the OpenCV and the Numpy libraries. The first one stands for Open Source Computer Vision Library and is widely used for computer vision applications as described here:
The second one is a Python library mostly dedicated to the handling of N-dimensional array objects such as pictures. Other information about it can be found here:

The installation of these libraries is a bit tricky. So we decided to follow a complete tutorial to install them on the Raspberry Pi 3: This tutorial recommends to create a virtual environment dedicated to OpenCV.

Luckily we spared a lot of time by finding a complete code using both libraries and counting dice from a jpg file. This code returns the number of dice, a vector containing the results and the number of erroneous objects. On another hand it also provides the result of the image processing. Our job is to sort and keep the parts of the code that are going to be useful for our application and to implement them properly.

To guarantee a transparent communication we joined the URL providing the original code we didn’t develop: You can also watch the video to learn a bit more about this code.

Then, we have to ensure the communication between the Raspberry Pi and the Arduino. In fact, the Raspberry Pi sends instructions to the Arduino which only contains the code to achieve these instructions. This communication is going to be handled by USB thanks to the Serial library.

For more information you can check Antoine’s video here : Software libraries

See you soon,

Team 2 : Automated board game – List of materials

Hello everyone,

Here’s our second post regarding our project. Today we will explain you what is needed to make our project work properly.

First of all, we decided to change the design of our project a little bit. The forward and backward motion of the gaming board has been scrapted in order to take less time between two dice rolls. Indeed, the game we want to automate is a rather fast game so we do not want to slow it down too much. Therefore, a stepper motor will allow the board to rotate in front of the right player when it’s his turn. In addition, this new design makes it possible to play on a smaller table.

Now let’s take a look at the list of materials. To realize our project we need :

  • A wooden (or an aluminium) board to make the playing board with some fixations (it has to be as light as possible) ;
  • 3 dice ;
  • A fulcrum to support the board and allow the rotation with a stepper motor ;
  • A stepper motor ;
  • A stepper motor driver to allow the communication between the motor and the arduino board ;
  • An arduino to control the stepper motor. Right now, we have 2 boards at disposal (an Uno and a Mega one) ;
  • A webcam or a camera for the Raspberry Pi to recognize the dices and detect the throws ;
  • A Raspberry Pi to control the camera and the sequence of the game. Two members of our team own a Raspberry Pi 3.
  • A screen to display all the needed information (players, scores, etc.)

As you can see, we should only have to buy the screen and the elements to build the gaming board.

We might don’t even need a screen if we manage to make it work on smartphones or tablets. If that’s the case, it could be used instead of the screen.

Our next post and video will be about the rules of the game and the algorithm used to make our project run smoothly.

Here’s the video explaining this post : List of materials 

See you soon,

Team 2 : Automated Board Game : Presentation

Hello everyone,

Here’s our first post regarding our Applied Electronics and Electrotechnics project. First of all, we would like to introduce all the members of our group:

Mathieu Colpin, 2MMEEA

Simon Coulon, 2MMEEA

Antoine Demanet, 2MMEEA

Sebastien Gilis, 2MMEEA

Gaetan Dainotti, 2MMEET

Joachim Yazigi, 2MMEEA

As you can see, our group is mainly composed of students following the specialization in automation while Gaetan is a thermal student.

Before we met at the start of the first year of our master degree, Joachim got his bachelor’s degree in automotive while Gaetan used to work for AW Europe and Toyota Motor Europe before starting their master degree in order to become industrial engineers. The four other members of the group all obtained their bachelor’s degree in industrial sciences.

Right now, we’re all at the same point in our studies as we are in the second and last year of our master degree in electromechanical engineering and all hope to graduate from HELHa next June. Thus, we will work as a team in order to make this project a great experience for us all and try to make it work the best way possible. As a group working together towards the same goal, everyone is willing to reach that main objective and therefore, will try and bring their assets to the table to contribute to the progress of our work.

Some of us are more experienced than others working with Arduino and Raspberry so our first two labs definitely helped some trying to get more acquainted with the way we should use those two technologies.

Our first idea, for our project, is to automate the flow of a board game based on dices. The application would then be able to move the gaming plate in the right spot (in front the right player at the right time), count the scores of the dices and display them on a screen or a smartphone. We will give you more insights and details later with our next posts and videos.

Here you can find the first video quickly presenting our team and our project : Automated Board Game

See you,