Exit Full View

Arduino Simon

An Arduino based circuit to play the copy-cat colour matching game, Simon.

Start the game by pressing any button. Then repeat the sequence of colours displayed.

Breadboard Diagram

Arduino Simon Circuit.png

Notes

I bent the legs of the switches in on themselves a little, so that they are one columns narrower than normal. Orient the switches so that the legs can be seen at the sides (not at the top and bottom).

Each of my LEDs require a different value resistor. Use whatever value resistor is appropriate for your LEDs.

Key

SymbolDescriptionQuantityPhoto
resistor-10K.png
10K ohm Resistor5{{plainthumb(page="resistors.jpg")}}
resistor-1K.png
1K ohm Resistor1{{plainthumb(page="resistors.jpg")}}
resistor-560.png
560 ohm Resistor2{{plainthumb(page="resistors.jpg")}}
green led.png
Green LED
The longer leg is +
1{{plainthumb(page="leds.jpg")}}
amber led.png
Amber LED
The longer leg is +
1{{plainthumb(page="leds.jpg")}}
red led.png
Red LED
The longer leg is +
1{{plainthumb(page="leds.jpg")}}
blue led.png
Blue LED
The longer leg is +
1{{plainthumb(page="leds.jpg")}}
button.png
Button4{{plainthumb(page="button.jpg")}}
potentiometer.png
Potentiometer1{{plainthumb(page="potentiometer.jpg")}}
piezo.png
Piezo Element1{{plainthumb(page="piezo.jpg")}}

Connections

Output Pins 6,7,8 and 9

Turn the LEDs on/off.

Held in an array called ledPins

Input Pins 2,3,4 and 5

Detect when any of the four buttons are pressed.

Held in an array called buttonPins

Output Pin 10

Named speekerPin in the code.

Operates the piezo-electric buzzer, which plays notes (see the "playTone" function).

Analogue Pin 0

Named speedPin in the code.

Detects the position of the potentiometer. Its value will range from 0V to 5V depending on the position of the potentiometer.

It is read at the beginning of each game :

   delayDuration = analogRead( speedPin );

and is used to determine how quickly the notes are played back :

   playSequence( delayDuration );

Code

simon.pde

Possible Improvements

Keep a record of the high score, and play a tune when its bettered.

Add a time limit. If no button is pressed within the time limit, that's the same as getting it wrong, and the game ends. Perhaps have a couple of beeps when the limit is near? This time limit should be related to the position of the potentiometer, (which currently governs the speed the notes are played back).

Make the game get faster when the sequence exceeds 10 colours (and again at 15, 20, 25 etc).

Make the sound effects better.

At the beginning of the game, turn each of the LEDs on and off in sequence, cycling round. The speed is goverened by the potentiometer, so the player has some feedback on how hard the game will be - it will also look neat!

More types of games (for example, a two player game, where each player chooses how to extend the sequence).