I am a person who loves games and my first start in this field was the snake game. This makes me nostalgic for the past
Inspired by my childhood, playing snake on my Nokia Mobile
Snake Game has been very popular since the beginning of Mobile phones. Initially, it came in Black and white cell phones and soon became very famous.
On the first day of makers diploma, I was fascinated by the design of GameKit and I wanted to know how it was designed.
so my design is kinda similar to the game kit.
Fusion 360 to make the sketches and the whole design
I started with the top side because the rest of the parts depend on it.
The square helped me to make the distances between the pushbuttons equal.
I took the LCD dimensions and draw a rectangle that fits the LCD area and placed it in the middle of the rectangle.
The bot side same as the top side without the LCD and pushbuttons.
so I copied the top side and deleted the LCD and pushbuttons holes.
The left side was kinda easy just a regular rectangular with fits and T-slot.
The other side is the same except the data cable and power hole for the Arduino.
Coming to the easiest part, which is the front and back side.
The left side is the same as the right side so I copied the part which i draw.
My final sketch
Then I extrude my sketch to make it 3D with 3.2 hight.
I assembled all the parts together with joints and then added wood theme to make it more real
Laser cutter machine to cut MDF
Laser cad for review send design to machine
3.2mm MDF
First thing in this process I imported all the DXF files in laser cad and make it fit the sheet,I used MDF and the cut parameters were
70 power and 20 speed
Put the MDF sheet, make sure of focus, download the file to the laser cut machine and set up the origin and start the process.
I used 4 pushbuttons to control the snake directions up down right and left
arduino ide for uploading the code on the board.
Jumbers to wire all components
10k potentiometer for lcd contrasts
circuit schematic
/*
PIN-1 : Ground connect to ground terminal of Arduino board
PIN-2 : +5V supply connect to +5V
PIN-3 : V0c is connect to 10k Variable Potentiometer for contrast control
PIN-4 : DI – Data Input pin is connect to Analog pin of Arduino (A3)
PIN-5 : R/W – Read-write pin is connect to Analog pin of Arduino (A2)
PIN-6-: E – Enable pin is connect to Analog pin of Arduino (A4)
PIN-7-14 : DB0-DB7 are connect to Digital pin of Arduino like- 8,9,10,11,4,5,6,7
PIN15 -16 : CS1-CS2 serial communication pins are connect to Analog pin of Arduino( A0-A1))
PIN17 – RESET
PIN18- : pot
PIN19- : A + for 5V Supply
PIN20- : K for Ground
*/
I used a 9v adapter to run my hole circuit
9V DC adapter
I included the library for my screen and set the correct connections in my code as a comment.
I defined the pins of the pushbutton.
My snake can move in four directions so I start to make statements that can determine in which direction the snake will move.
And based on the specific direction, the snake will be moved in that direction
The function of this two functions is to draw the snake's body and food.
This function is interested in knowing if the snake ate food, ate itself, or hit the wall.
If the food is eaten, the spawn food is called.
if the snake ate itself or hit the wall, game over function is called
This function is responsible for eating snakes and it appears in a random place using a random function.
When game over status is true this function will be called and print Game Over on the LCD.
Defining the controlling pins as an input.
And my setup part was just to call the functions.
I tried to make my game on a small LCD before receiving my final project components.
First of all, I soldered the LCD in the lab with female pin header
After receiving the LCD, I tested it and connected it, and figured out how it works.
There was a lot of wire but I was able to deal with it.
I started to check my LCD and try to connect it and make sure that my LCD is working.
Using 4 small push buttons and I started my game.
I started by attaching the Arduino on the bot side and attached the LCD and push buttons on the top side.
Then I connected the LCD and push buttons to the Arduino and before assembling it checked my circuit.
And after I make sure that my LCD and the code working as I want, I started to assemble my parts.
When I asked my teammates about what my design looked like after I assembled it, they told me you could write something on that side, like engrave the game kit name on the side of the GameKit.
It was my first time dealing with LCD like this and it was challenging for me because the LCD has 20 pins and I have to connect all of them at the same time and it was hard to get a library for my LCD model because it is not popular so I used another library for another model but it worked on it.
I searched about my LCD model and downloaded a data sheet (here) to know what is the functionality of each pin because there was no writing on the screen.
I searched a lot to know how to deal with this LCD, and I found this site that gives me the wiring of the LCD after the LCD worked, and my first test to write Hell World! on the LCD, I start to write my game code after the test.
Also, I didn't receive my 128x64 LCD so I tried to make my game on a small LCD add it was so fun.
I would like to add more games to my game kit.
so I want to add a menu from which you can choose which game you like to play when you run the game kit.