Hit the Number

This game was my AS level electronics project. I had a few photos and screenshots lying around from the report, so I thought I'd put them up here.

This is a primitive game in which you have to hit a randomly generated number within a particular time to score a point. If you miss the target the game ends.

Given the fact that programming equates to cheating, I ended up implementing the thing the manual way with counter and logic chips. I did get away with one PIC to act as a keypad driver though.

The system had a number of important component parts;

...plus some simple logic to tie them together (when the time runs out disable the keypad and beep, when the correct button is pressed increment the score counter and regenerate).

The random number generator is really bad. It relies on the inaccuracy of RC timing circuits! You have two 555 chips, one is set as a very fast astable (oscillator), the other as a much slower monostable (switches "on" for a while when the input is pulsed before switching itself off again).

The output of both is ANDed and sent to the clock of a counter chip, so when the monostable's input is triggered the counter counts up very quickly for a short space of time before the monostable switches off again and there's your "random" number.

The '8' and '2' outputs of the counter are ANDed together and connected to the reset pin, so when the counter reaches 10 (8+2) it automatically resets to 0.

Click for a circuit diagram. In the photo, the two small 8-pin chips are evidently the 555s, and I guess that the chip on the right is the 7-segment display decoder, the one to the left of that is the counter and the second left chip is a series of AND gates.

The keypad driver is a cheat, as I mentioned. To keep it looking like too much of a programming assignment, I used a flowchart programming language.

The logic is this; it sets the rows of the keypad high, then checks the columns until it finds one that's connected, at which point it outputs the result. If no key is detected it outputs %1111. It also checks if the "random" pin is high (this signifies a new random number is being generated) and if so it outputs %1111 anyway.

To test it, there are some LEDs on the output. 1+4=5, good. The wires going to the left are the output lines going to our next exciting section.

To see if you have the correct button pressed or not, I built a nybble comparer (ringed).

In the bottom-left of the photo is the logic to detect when to increment the score (it checks if the current value isn't %1111 - that is, it only accepts a "correct button" result if the button isn't %1111, which indicates no button pressed). If all is hunky-dory it triggers a monostable to fire once (the 555 next to it) which increments the score, and triggers the random generator again.

The delay timing is, yep, another 555 monostable. The pot controls the speed of the game, the black push button is a master reset that clears the score, restarts the main timer and forces a new random number to be generated.

The score is just two counters, one for units and one for tens.

Sound generation; two 555s (one very fast, one quite slow) through an AND gate give you a beep..beep..beep thing which would do for "game over". A switch to disable it retains the sanity of others in the room.

The whole thing.