/u/7434365
/joeiddon

A Classic Snake Game

For our first project we wanted to make something cool, but at the same time not too complex. We decided on a retro snake game.

We used an 8x8 LED matrix for the display as it would allow us for enough resolution to play the game, but was fairly cheap. To drive all 64 of the pixels, we used a specialised driver chip that would accept serial inputs called the MAX7219.

We started prototyping the game by connecting it loosely to an Arduino so we could focus our attention on the software (programming the game) rather than the hardware.

After a couple of weeks we managed to get the core design of the snake game working well using some little push switches for inputs.

The Arduino sketch (code) for this can be seen over on GitHub.

We were prototyping with an Arduino Mega and a breadboard connected with some jumpers:

Now that the code was working, we decided to start on the finished product. To do this, we needed to be able to solder (to make a proper controller) and this would be a valuable skill for the future. Everyone picked it up straight away.

We then gathered the components - the main thing being a more compact matrix. We brought one from Ebay quite cheaply but it required us to solder it together including a miniscule surface-mount chip.

Here's the driver chip that we tried to solder and a close-up of the LED matrix.

However, after soldering the different components onto the board, we realised that to make the project as small as possible, it would make sense to just use the larger matrix as this had enough space to mount everything on (the smaller one was basically too small!). So even though this was a valuable lesson on soldering, we ended up not using it!

Next, we made the controller board by soldering some push buttons to some copper stripboard. This then needed to be connected to the Arduino Nano (a smaller microcontroller), along with the LED matrix - we just used some single-core wire for this.

And that was pretty much it! We uploaded the sketch to the Nano that we had already got working for the Mega (the code was compatible between board types in this case) and we were ready to play our first game.

Here are some photos of the finished product, and finally a video of it in action.