This mimic of a Simon-Says game was the culmination of all of the knowledge and skills obtained in physical computing so far. It included Arduino programming, circuitry, and design all in one project. Below is the basic description of the game:
“A simple memory game, press any button to begin. After one second, a random sequence of neo-pixel strips will illuminate. Four strips, each of seperate color will illuminate
in random sequence five times (at first). One strip (solid color) may occur more than once
in a sequence.
If the user cannot reproduce sequence with correct button press sequence, all lights will illuminate, and the game will reset.
If user correctly reproduces sequence a delay will occur, then the next sequence will begin,
adding one additional strip to illuminate on top of the initial five that will already be occurring. So, five + 1 (for every round you complete).
When user is attempting to copy the sequence, the button press corresponding to each color strip will illuminate the strip they choose.”
Much like the Simon says game, our game had simple buttons and lights. The inputs were the four color coded buttons placed next to the Neo-Pixel strips. The goal of the input buttons was to make them provide some sort of user feedback. So every time a button is pressed by the user, the light that corresponds to it would illuminate, confirming the button press to the user. The buttons themselves were three terminal micro-switches, with a nice lever action that provided a satisfying “clicky” feeling when pressed.
Instead of using single L.E.D.s like previous projects, our group decided on using neo-pixels for the game. One neo-pixel strip was cut up into four strands for the four separate colors needed for the game.
The construction (hardware) of the game can ultimately be divided into two parts. The enclosure, and the circuitry. First, the circuitry. The game uses one Arduino Uno, a breadboard, jumper wires, three terminal micro-switches, resistors, and a A/C to D/C wall plug to power the Arduino. Each strand of neo-pixels, as well as each button is connected to an individual digitalOUT pin. The neopixel pins (power 5V, Ground, and data), were respectively soldered to three individual jumper wires that plug into the breadboard. The micro-switches also got two wires each soldered to them, (normally closed and normally open). The micro-switches and neo pixels had these wires soldered onto them so that the breadboard and Arduino could remain seated at the bottom of the enclosure, and the four strands and four switches could be fixed at the top inside portion of the box closet to the user.
The mess of wires isn’t desirable and a shift register or multiplexer could have been used, but given the scale of the project, jumper wires to all Arduino pins was satisfactory.
The second part of the construction was the enclosure. We knew we wanted a simple box, so we used the site Maker Case, and put in our dimensions for our desired box. You need to input your desired dimensions and material thickness, and the site will do the rest. You will be given a .SVG file in which you can vector cut on a laser cutter with extreme precision. The maker case site has the ability for you to select how your box will fit together. We chose the little finger slots, which make putting the box together effortless. Just join and glue. A nice enclosure really provides a desirable look to the game.
The game runs off an Ardunio using the Arduino coding software. This is easily the most challenging part of the project. Before the coding even began, a state diagram was drawn out that illustrated the game description given at the introduction of this post.
Below is a rudimentary version of the state diagram that illustrates all the different ‘states’ the game could be in when being played. The arrow at the top represents the start state when the game is initially turned on, then the bubbles below represent all the different states that proceed during the playing of the game.
In order for the game to work, the coding required lots of attention to detail and organization. After an initial attempt to write code, it all had to be redone, and restructured using arrays. This game needs arrays. Because, there are random sequences of lights flashing, and user inputs that need to be taken into account. The program needs to remember and store values that correspond to the random sequence provided, and the user’s input that is given. There is a lot to remember in a game like this, and arrays allow for the game to store all those values.
Difficulties & Problems
Before the coding for the game itself began, a diagnostic sketch had to be made. This diagnostic sketch involved pressing the buttons and waiting to see if the neo-pixels would light up. This was necessary in order to test to see if our circuit was working, and thankfully it did work.
One thing we didn’t take into account at first was that our buttons needed a resistor. Luckily, Arduino has a built in resistor in the digitalOUT pins, called a Pull Up resistor, and once this was activated, our buttons were safe to use and working properly.
The biggest difficulty, was coding the game. Like stated before, the game needed arrays, and there was an outside and inside array. One outside array stored all the values for the moves (light flashes) of the game. While a smaller inside array stored and remembered the values for which light flash the game was currently on, inside the larger outer array!
I think two 7-segment displays would go a long way in making the game more user friendly.These displays would be used to aide the user in remembering which round they were on. Once the user completes a correct sequence, the score on the display would increase by +1, and if the user missed, then it would reset back to zero.
The construction of the box could be a little bit better as well. Since we know the size of the circuit now, we can shrink the enclosure, and have the buttons sit flush in the enclosure. Some laser etching, color, and or vinly stickers would also go a long way in improving the overall look and feel of the game.