You are visitor # 123count hit counter  


For our final project, we have decided to build a minesweeper game with a microcontroller and a PS/2 mouse to be displayed on the TV. Minesweeper is a famous game that comes with the MS-Windows operating system, and the objective of the game is to determine the location of mines on the board.

So, what exactly is “Minesweeper”?

“Minesweeper” is originally a PC game that comes along with the Windows bundle. For our design, there are 15 x 10 cells on the game board. At first, all 150 cells are covered, and the player can left-click the PS/2 mouse on a destined cell to uncover it, or right-click to mark the cell with a flag – a reminder to the player that the cell is possibly taken by a mine.

The objective of the game is to locate all the mines as quickly as possible without uncovering any of them. The default number of mines in our game is 25. If you uncover any of the mines, you lose the game. If a number appears on a square that you have uncovered, it indicates how many mines are in the eight squares that surround it.  

When you have successfully uncovered all cells without mines, you will then have won the game, and a “You Won” message would be shown on the TV screen. Else, if any cell with a mine is uncovered, the game is over and a “GAME OVER” message would be shown. In both cases, right click the mouse to restart the game.

There is also a timer in the lower right hand corner of the screen, showing how much time you are taking to play the game. Once you win or lose the game, the timer would stop.

Another feature is the “remaining mine count”. When you have marked a cell with a flag, the count shown in the lower left hand corner of the screen would decrease.

Why do we pick this project?

There are several reasons why we wanted to implement this “Minesweeper” game with TV display and PS/2 mouse control. First of all, the complexity of hardware in this project is of appropriate level but the cost required is cheap. All we needed to buy is the PS/2 receptacle for the mouse, which is just $0.99. The mouse that we use in this project is a used mouse and it is free. Moreover, the parts that we require can be easily replaced. Soldering would be needed to link the signaling wires to the mouse through the receptacle, but this can be done easily.

Secondly, we are already pretty familiar with the interfacing between the microcontroller and the TV after doing labs 3 & 4, so we can divert our attention to the mouse/microcontroller interfacing and game programming.

Thirdly, we feel that writing this game would be fun and yet challenging enough. Writing the game itself needs systematic and logical thinking: we must make sure that the big parts work so that the game can be played, but we must also pay attention to details, so that the game can run smoothly. Besides the game programming, the mouse interfacing would be another challenge to us, but we proceed with this idea, since the mouse is nevertheless the best controller to be used to play a game like “Minesweeper” and we had some good reference to back us up. A good challenge is what that makes this project meaningful. 

What we did?

We used two Atmel MEGA 32 microcontrollers for this project:  One  is used to produce signals to the TV display, while the other microcontroller  is used to get data from the mouse. The necessary game computation is also done in the second microcontroller and deliver to the first microcontroller through UART connection. Details are shown in the subsequent sections.