Hi there! I am Shivansh, a student at IIIT-Hyderabad. I am here with my first instructable which is a game inspired from Google Chrome's Dinosaur Jump game. The game is simple: Jump across incoming obstacles in order to score a point. If you collide, you loose and the score resets.
The highlighting feature of this project is that there is no use of an Arduino or any other microcontroller. It is purely derived from basic electrical components and involves the implementation of Finite State Machines (FSMs) with the help of logic diagrams, etc.
Interested? Let's get started.
- Basic know-how about electrical components like Resistors, Capacitors, Integrated Circuits (ICs).
- Basic knowledge of Logic Gates (AND, OR, NOT, etc.)
- Knowledge about working of Flip-Flop, Counter, Multiplexer, etc.
NOTE: The above-listed prerequisites are for understanding the entire working of the project. One not having in-depth knowledge of the same can also build the project following the steps in the instructable.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Developing the Working Model
The first task is to create a working model for the project. Only then can we decide the materials required for the project. The entire project can be broken into three parts.
Part-1: Obstacle generation
Firstly, we need to generate random obstacles for the Dot to jump across. Obstacles will also be in the form of a dot pulse which moves from one end of the LED Array to the other.
For generating obstacles, we make use of two Timer Circuits (circuit diagrams attached), one with a High Frequency (HF Timer) and another with a Low Frequency (LF Timer). The ‘randomness’ part is handled by the HF Timer whose output is seen on every rising edge of the LF timer (which is taken as CLK input). The Obstacle Generation Instruction is the state of the HF Timer on every rising edge of the LF Timer (1 -> Generate Obstacle | 0 -> Don't Generate Obstacle). The HF Timer is RESET on every ‘JUMP’ to ensure random obstacle generation. The output of the HF Timer is given as the D-input to a D Flip Flop (for storing instruction for the next cycle) with CLK input as LF Timer Output.
Once the binary instruction for obstacle generation is out, we need to generate the ‘obstacle pulse’ on the LED Array. We do so with the help of a 4-bit Counter whose output is given to a 4x16 demultiplexer (DeMUX). The output of the DeMUX would be making the 16 respective LEDs glow.
Part-2: The JUMP
For the JUMP Action, we will be taking the Push Button Input as the instruction. Once the instruction is given, the in-line object LED stops glowing and another LED above it glows, signifying a jump.
The result will be like: If the object crashes, RESET the game; else, increment the score.
The collision can be expressed as ANDing of both, the obstacle signal and the object signal for the ground position of the obstacle. If a collision does not take place, the Point Counter is incremented which is displayed on a pair of 7-segment displays.
Step 2: Gathering Components
The components required are as follows:
- PCB x 1, Breadboard x 3
- LEDs : Green(31), Red(1), BiColor:Red+Green (1)
- Push Button x 2
- 7-segment Display x 2
- IC 555 x 3 [for Timer Circuits]
- IC 7474 x 1 (D FlipFlop)
- IC 7490 x 2 (Decade Counter) [for displaying score]
- IC 7447 x 2 (BCD to 7-segment decoder) [for displaying score]
- IC 4029 x 1 (4-bit Counter) [for obstacle display]
- IC 74154 x 1 (DeMUX) [for obstacle display]
- IC 7400 x 3 (NOT gate)
- IC 7404 x 1 (NAND gate)
- IC 7408 x 1 (AND gate)
- IC sockets
- Voltage Source (5V)
- Soldering Iron
- Wire Cutter
Step 3: Obstacle Generation: Part-A
First, we need to set-up the timer circuits for generating Obstacle Generation Signal (HIGH/LOW).
The circuit will be set-up in accordance with the theory discussed earlier. The circuit diagram for the same is attached above. The circuit is implemented on a breadboard (though it can also be implemented on a PCB) as follows:
- Place the two 555 ICs and D Flip Flop (IC 7474) across the divider of the breadboard with some vacant space (4-5 columns) in between.
- Connect the top row of the breadboard with the positive terminal of Voltage Source and bottom row with the negative terminal.
- Make further connections following the circuit diagram. After the necessary connections, the circuit would look similar to the picture attached above.
NOTE: The values of resistances R1 & R2 and capacitance C is calculated using the following equations:
T = 0.694 x ( R1 + 2*R2 ) * C
where T is required Time Period.
D = 0.694 x [(R1 + R2)/T] *100
where D is the Duty Cycle i.e. the ratio of ON Time to Total Time.
In this project, for the High-Frequency Timer, T = 0.5 sec and for the Low-Frequency Timer, T = 2 sec.
Step 4: Obstacle Generation: Part-B
Now that we know when to generate the obstacle, we now need to display it. We will use a 4-bit counter, a Demultiplexer, a timer and an array of 16 LEDs. Why 16? That's because we will be mapping the 4-bit output of the counter to the 16 LEDs using the demultiplexer. It means that the counter will be counting 0 to 15 and the demultiplexer will be switching on the LED with that index.
The timer's role is to regulate the speed of counting, i.e. the speed of obstacle movement. The obstacle will shift one position in One Time Period of the timer. You can play around with different values of R1, R2, and C using the equations in the previous step to get different speeds.
For the LED matrix, solder 16 LEDs in a linear fashion with a common ground. The positive terminal of each LED will be connected to the DeMUX (after inverting using NOT gate, since the DeMUX gives a LOW output).
The circuit diagram for the same is attached above.
Step 5: The JUMP and the RESULT
Next thing is the jump action. For displaying a jump, just place a LED of different color above the matrix, ground it and attach its +ve terminal to a button. Attach the other end of the push button to the voltage source.
Also, take another push button, placed adjacent to the previous one and attach one of its terminals to +5V. The other terminal goes to a NAND Gate (IC 7404) with the other input of NAND Gate as the input to the LED just below the JUMP LED (i.e. the object LED). The output of the NAND Gate goes to RESET (PIN 2 and 3 of both the BCD Counters) of the score counter. With this what we do is that we reset the score if both the OBJECT LED (in base position) signal and the OBSTACLE signal is been given at the same time, i.e. the object and obstacle collided.
Make some arrangement to ensure that both the push buttons are pressed together. You may use a coin and stick both the buttons to it.
For setting up the score counter, follow the circuit diagram attached above (Pic source: www.iamtechnical.com).
NOTE: Do connect pin 2 and 3 to the output of the NAND Gate for it to reset the score in case of collision with the obstacle.
Step 6: Happy Playing!
That's it. You are done with your project. You can add some finishing to it so that it looks good. Rest is fine.
Participated in the