Introduction: Arduino Project // Simon Says (with Penatly Consequence)

Hi!

This is a very beginner friendly instructable, as this is actually my first arduino project as well. I created this project in order to pass the course I'm currently following, called If This Then That.

In this Instructable I'll show you how to make your own Simon Says game with a penalty consequence using the Arduino. I have chosen to add a penalty consequence to spice up the game a little more; it gives the user more interaction with the arduino instead of only following the lights and pressing the buttons in return.

The penalty consequence consists of the user pressing the pressure sensor. The arduino will react on the pressure the user has given and based on the pressure, the arduino returns a red or green LED lighting up. If the red LED lights up, this means the player gets a deduction point, if the green LED lights up, nothing happens. You can just reset the game and play it again.

With a whiteboard marker, you can mark down how many deduction point you have on the system itself. This gives you a bit of that extra interaction with the design of the project as well.

Step 1: MATERIALS

You might want to get yourself the materials first. I had purchased an electronics kit and wanted to use the items and tools which came in that kit only as I didn't want to purchase more electronics. Feel free to add something fun yourself.

Items used:

- Arduino Uno (1x)

- Breadboard (1x)

- LED's (4x and if possible, in different colors, as it makes the game more colorful)

- PCB Pushbutton (4x, 6x6mm size)

- 200 ohm resistors (4x)

- 10K ohm resistors (5x)

- Pressure Sensor (1x)

- Set of breadboard jumper wires

- Perf / Strip board (1x)

- Foamboard (white)

- Acetate foil

- Washi tape

- Cotton pads

- Painterly tape

- Glue

Tools used:

- Soldering iron

- Cutters

- Stripping Pliers

- Laser cutter

- Stanley knife

Step 2: SET UP YOUR CODE

Before I started programming myself, I looked up some other Simon Says games based on the arduino. I compared these in coding. I used these as a reference:

- Instructable with a schematic and code I. The code isn't explained so if you're unfamiliar with programming, this might be difficult to understand at once.

- Instructable with schematic and code II

- Instructable with schematic and code III


The game is divided into three seperate states: the START state, PLAY state and the GAMEOVER state. This is like a circle which repeats everytime when you play the game. You can find the rest of the explanation of the code here.

I used a timer for the penalty consequence. It keeps track of how long the sensor has pressure. Using if/else statements, it depends on your pressure if the red LED or the green LED ligths up.

"int onGameOver()
{ //Serial.print(millis());

Serial.print(" - ");

Serial.println(timer);

if (analogRead(A0) > 0)

{ //Timer zetten we op 2 seconden if (!setOnce)

{ Serial.println("clicked.");

setOnce = true;

timer = millis() + 2000; } }

if (millis() > timer && setOnce)

{ //Timer afgelopen

Serial.println("afgelopen.");

blinkOnce = false; setOnce = false;

return (analogRead(A0) < 512 ? 2 : 1); } }"



Step 3: SCHEMATIC

Use your breadboard to prototype your game. Keep in mind that the breadboard is connected.

You probably have noticed that many breadboards have numbers and letters marked on different rows and columns but these don’t serve any purpose than to guide you when you're building your circuit. If you know the row number of the connection you are trying to make, it makes it much simpler to plug a wire into that number rather than checking a hundred times.

Aside from horizontal rows, breadboards usually have what are called power rails that run vertically along the sides.

Step 4: SOLDERING

As I didn't wanted to take the risk that my project would literally fall apart during the time my teachers would grade me (I have to travel with public transportations as well), I choose to solder my project as well instead of keeping it on the breadboard.

I didn't map out the circuit, as I didn't know how to use the symbols and stuff, but if you do and you find that a better method for yourself before you're going to solder, that's fine too.

I studied my prototype on my breadboard and made sure that I understood exactly everything what was going on, on my breadboard. I made the connections and kept in mind that the negative side has to connect to the positive side.

I wrote down what pin go to which LED / button / wire / sensor kept this at hand when I soldered. At some point, you probably will become very frustrated with the amount of wires you have. What I did was write down what the function of the wire was and to which pin it'd go to on painterly tape and wrap it around the wire so it would be more clear to be what all the different wires were for.

Just make sure everything is connected and you're ready to go!

But a tip I'd like to give you is to keep your breadboard where you've made your prototype on with you while soldering so you can use it as a reference when you're not feeling sure about what you're doing. I've seen a lot of fellow students just breaking their prototype apart and then forgetting how they connected certain things.

Step 5: PACKAGING

I wanted to have a cube covering my arduino. I made a cube in Illustrator and went to laser cut this. For materials, I choose for foamboard, as I think that is easy to edit and a solid kind of material. As every laser cutter is different, you'd want to check the speed and the power for the laser yourself, depending on the thickness of your material as well.

The two regular squares are going to be the top and bottom side of the cube, the rest are going to stick on the side. You can use glue for that. There is one side which is shorter than the others, that's because you can stick your usb-cable from your arduino out of this cube and to your laptop if want you add any changes or want to turn the game on.

I simply slid the sides into each other and glued it for extra security. I lastly glued the top side of the cube because I wanted to fill the cube with cotton pads where the arduino could rest on. I taped my perf / stripboard to the top side of the cube after I used a Stanley knife to cut out the circles where the LED's would pop out, the squares where my buttons would be pressed on and the place where my pressure sensor could pop out and be ready to be pressed.

Use the washing tape to tape your acetate foil above the LED's and your own Simon Says game is good to go!