Whac-A-Mole Game Device Based on micro:bit

Whac-A-Mole Game Device Based on micro:bit

Whac-A-Mole Game Device Based on micro:bit

Whac-A-Mole Game Device Based on micro:bit

The Whac-A-Mole game is familiar to everyone; it once became a sensation, whether in the form of a computer mini-game or a handheld toy, the presence of the Whac-A-Mole game is hard to miss. Today, we will utilize the wireless communication feature of the micro:bit to create a modular Whac-A-Mole game device that allows multiple participants and is more flexible and varied. The hardware list is shown in the attached table, with some hardware illustrated in Figures 1 to 6.

Whac-A-Mole Game Device Based on micro:bit

Figure 1 Game Console Buttons

Whac-A-Mole Game Device Based on micro:bit

Figure 2 Micro Switch, LED, and Bracket Inside the Game Console Button

Whac-A-Mole Game Device Based on micro:bit

Figure 3 micro:bit

Whac-A-Mole Game Device Based on micro:bit

Figure 4 Expansion Board

Whac-A-Mole Game Device Based on micro:bit

Figure 5 Round Plastic Container

Whac-A-Mole Game Device Based on micro:bit

Figure 6 Battery Holder

Whac-A-Mole Game Device Based on micro:bit

Design Concept

The Whac-A-Mole game device can be divided into two parts: the button part and the scoring part, both controlled by the micro:bit, which displays real-time scoring data through wireless communication. Each game module consists of a micro:bit, an expansion board, game buttons, LEDs, micro switches, and a battery pack. During the game, the LED lights up randomly, and if the game button is pressed while the LED is lit, the micro:bit in the game module sends a wireless signal to the micro:bit responsible for scoring.

In the scoring part of the game, assuming there is one red and one blue button game module, if the LED of the red game module lights up, the micro:bit responsible for scoring will increase the score upon receiving the signal from the red button game module; if it receives a signal from the blue button module, the score will decrease.

Due to the device’s wireless transmission and modular design features, we can arbitrarily increase the number of red and blue button game modules and change their placement, thus enhancing the game’s scalability and flexibility. I designed a Whac-A-Mole game device consisting of 6 game modules, as shown in Figure 7.

Whac-A-Mole Game Device Based on micro:bit

Figure 7 The Whac-A-Mole Game Product I Made

Wiring Connections

The wiring connections of the game module are relatively simple; the two ends of the micro switch inside the button do not need to distinguish between positive and negative, connecting to pin 5 of the expansion board. The two ends of the LED bracket are distinguished as positive and negative, with the positive connected to pin 1 of the expansion board. The micro:bit is powered by two AA batteries, and the actual wiring connection is shown in Figure 8.

Whac-A-Mole Game Device Based on micro:bit

Figure 8 Actual Wiring Connection Effect

The scoring part only requires one micro:bit connected to the battery pack. To enhance the gaming experience, a small speaker can be externally connected to add sound effects to the game.

Program Development

The game program can be written using any software that supports micro:bit; I will use the graphical programming software Mind+ for explanation.

First, write the main program for the game module (see Figure 9), enabling the wireless communication feature of the micro:bit. Through a loop detection, if the button is pressed while the light is on (flag=1), a wireless signal is sent (the red module sends ‘red’, and the blue module sends ‘blue’), while a prompt sound is played. Then, control the LED to light up randomly through the game module subroutine (see Figure 10).

Whac-A-Mole Game Device Based on micro:bit

Figure 9 Main Program of the Game Module

Whac-A-Mole Game Device Based on micro:bit

Figure 10 Subroutine of the Game Module

In the main program of the scoring module (see Figure 11), the wireless communication feature of the micro:bit must also be enabled, and the wireless channel must be set to the same channel used by the game module to achieve wireless communication. The initial score is set to 5, displayed on the micro:bit’s LED matrix. Then, write the subroutine for the scoring module (see Figure 12); when the wireless signal ‘red’ is received, the score increases by 1; when the wireless signal ‘blue’ is received, the score decreases by 1; if the score is less than 0, the blue side wins; if the score is greater than 10, the red side wins.

Whac-A-Mole Game Device Based on micro:bit

Figure 11 Main Program of the Scoring Module

Whac-A-Mole Game Device Based on micro:bit

Figure 12 Subroutine of the Scoring Module

Finally, simply insert the micro:bit with the written program into the expansion board, place the circuit into the round plastic container, and a Whac-A-Mole game device is completed (see Figure 13).

Whac-A-Mole Game Device Based on micro:bit

Figure 13 Whac-A-Mole Game Device

The Whac-A-Mole game can train the player’s reaction ability, but it is mostly limited to single-player games, with variations only in the frequency of the moles appearing. Our Whac-A-Mole game device based on micro:bit, through wireless connection, increases the flexibility of the game, allowing each game module to be placed in different locations, which not only trains reaction speed but also physical fitness. Most importantly, it adopts a modular design, making it easy to expand, allowing multiple players to participate, promoting communication and collaboration among people. It is better to enjoy together than alone, as shown in the game scene in Figure 14.

Whac-A-Mole Game Device Based on micro:bit

Figure 14 Whac-A-Mole Game Scene

Leave a Comment