Close
0%
0%

Simon Says: Solder!

A minimalist version of Simon Says, designed as a tool for teaching folks of all ages about electronics.

Similar projects worth following
I have a passion for teaching people about electronics, programming, and robotics. The goal of this project is to provide a fun, inexpensive exercise for kids and adults who want to learn more about electronics and end up with something tangible that they have made themselves.

This kit can be provided as a workshop for makerspaces, classrooms, or parents, and can be tailored to suit any skill level.

Hardware

A Digikey cart for the kit can be found here. This cart contains all the elctronic components needed to build the kit (including the ATTiny programmer) except for the protoboard--at the time of this writing Digikey does not carry a protoboard with the correct dimensions (5cm x 7cm, or 2.75in x 2in). Protoboards of that size can be ordered through Adafruit here. Larger boards can obviously be used as well, and may be better suited for younger students. Solid core hookup wire can be found in a variety of places and quantities--I happened to have this kit from Sparkfun on hand. You will also need solder and a soldering iron to assemble this kit--both can be found on Sparkfun, Adafruit, Amazon, etc. The schematic for the circuit is below. For those who wish to go further and design a custom PCB for the game, the KiCAD project for the schematic is attached to this project.

Software

The code for the game is a relatively simple Arduino program. It is heavily commented to aid in understanding. Students are encouraged to modify different portions of the code to experiment with how the behavior changes. A good place to start is the number of levels in the game--by default there are 50 levels, but makers may understandably want to reduce that number! The code file is attached to this project, and listed in a project log below.

Tips for Educators

This kit is designed to be tailored to the skill level of the person making it. Here are some suggestions for parents and educators:

Beginner

  • Soldering Tutorial: Program and assemble the kit almost completely, but leave out one or two components (for young children I would suggest an LED, resistor, or button). Have the student solder in the missing components.
  • Programming Tutorial: Solder the kit completely, then help the student step through the code and program the ATTiny. Encourage them to tweak parameters such as the number of levels.

Intermediate

  • Soldering Connections: Solder all components in place, then have the student use the schematic to plan out paths for wires and solder bridges. Once they have the wires placed, let the students solder the paths themselves.
  • Program Your Way: Using the provided code as a reference, create a requirements list for students and allow them to write their own program that implements the requirements. This list can be as vague or detailed as makes sense for the students' skill level.

Advanced

  • Solder on Your Own: Give the students a printout of the schematic, and let them assemble the entire kit themselves.
  • Write Your Own Version: Without providing the existing source code or any detailed requirements, instruct students to "program Simon Says." Hints or other assistance can be provided according to their skill level.

simon-says-solder.MOV

Brief operation of the game.

quicktime - 8.84 MB - 09/10/2024 at 17:20

Download

simon-says-solder-kicad.zip

The KiCAD project for the circuit. Currently contains the schematic only. Made in KiCAD 8.0.

x-zip-compressed - 7.76 kB - 09/08/2024 at 16:56

Download

simon_says_solder.ino

The source code for the game.

ino - 7.23 kB - 09/08/2024 at 16:54

Download

  • 1 × Coin Cell Battery Clip BS-3-ND from Digikey
  • 1 × CR2032 Coin Cell Battery
  • 2 × SPST Tactile Button Switch 450-1650-ND from Digikey
  • 1 × 8-Pin IC Socket AE9986-ND from Digikey
  • 2 × 10K Ohm Resistors 1/4 Watt Axial

View all 10 components

  • Video Uploaded

    Alex Ryker09/10/2024 at 17:20 0 comments

    A brief video of the game's operation has been attached to the project.

  • Video Forthcoming!

    Alex Ryker09/08/2024 at 17:03 0 comments

    Due to a lack of planning on my part, I am out of coin cell batteries. Once I grab one from the store I will upload a video of the game running!

  • Code

    Alex Ryker09/08/2024 at 16:54 0 comments

    For easy copy-paste, the code for the Simon Says game is below. It is also attached as a file to this project.

    /**
     * Simon Says
     * 
     * This program represents a simple game of Simon Says with two LEDs and two push buttons.
     * It is designed to showcase a minimalistic circuit that still does something interesting.
     * 
     * When the circuit is powered on, both LEDs will blink three times. Then, LEDs will light up
     * one at a time in a random pattern that the user must duplicate using the push buttons.
     * Once the sequence has completed, each button controls an LED. The pattern in which the
     * LEDs blink is randomly generated, and has a length measured in blinks. The patterns begin
     * with one blink, then increase by one blink each time the player correctly mimics the sequence.
     * 
     * If the user gets the sequence wrong, both LEDs will blink three times, then start a new
     * pattern at length 1. The game will continue until the pattern is 50 blinks long. If the
     * user correctly mimics all 50 patterns, the game is over and the LEDs will blink in a
     * celebratory pattern until the circuit is power cycled.
     * 
     * This code can be run on an Arduino, but is designed for the ATtiny85 microcontroller.
     * 
     * Author: acr
     */
    
     // pin configuration
     const int greenLED = 4;
     const int redLED = 1;
     const int greenButton = 3;
     const int redButton = 2;
    
     // debounce
     unsigned long lastGreenDebounceTime = 0;
     unsigned long lastRedDebounceTime = 0;
     unsigned long debounceDelay = 50;
    
     // game data
     char pattern[50] = {0};
     int curPatternLength = 1;
     int greenButtonState = 0;
     int redButtonState = 0;
     int lastGreenButtonState = 0;
     int lastRedButtonState = 0;
    
    void setup() {
      // initialize LED pins as digital outputs
      pinMode(greenLED, OUTPUT);
      pinMode(redLED, OUTPUT);
    
      // initialize button pins as digital inputs
      pinMode(greenButton, INPUT);
      pinMode(redButton, INPUT);
    
      // seed random number generator
      randomSeed(analogRead(0));
    }
    
    /**
     * Blink both LEDs in the pattern that occurs when
     * the player has lost the game.
     */
    void blinkLose() {
      for(int i = 0; i < 3; i++) {
        digitalWrite(greenLED, HIGH);
        digitalWrite(redLED, HIGH);
        delay(500);
        digitalWrite(greenLED, LOW);
        digitalWrite(redLED, LOW);
        delay(500);  
      }  
    }
    
    /**
     * Blink both LEDs in the pattern that occurs when
     * the player has won the game.
     */
    void blinkWin() {
      for(int i = 0; i < 2; i++) {
        digitalWrite(greenLED, HIGH);
        digitalWrite(redLED, LOW);
        delay(500);
        digitalWrite(greenLED, LOW);
        digitalWrite(redLED, HIGH);
        delay(500);
        digitalWrite(greenLED, LOW);
        digitalWrite(redLED, LOW);
      }
    
      for(int i = 0; i < 2; i++) {
        digitalWrite(greenLED, HIGH);
        digitalWrite(redLED, HIGH);
        delay(500);
        digitalWrite(greenLED, LOW);
        digitalWrite(redLED, LOW);  
        delay(500);
      }
    }
    
    /**
     * Generate a blink pattern that is length blinks long,
     * and store that pattern in the pattern array.
     */
    void generatePattern(int length) {
      for(int i = 0; i < length; i++) {
        int rand = random(10);
        if(rand < 5) {
          pattern[i] = 'r';
        }else {
          pattern[i] = 'g';
        }
      }
    }
    
    /**
     * Turns off all LEDs.
     */
    void turnLightsOff() {
      digitalWrite(greenLED, LOW);
      digitalWrite(redLED, LOW);
    }
    
    /**
     * Turns on all LEDs.
     */
    void turnLightsOn() {
      digitalWrite(greenLED, HIGH);
      digitalWrite(redLED, HIGH);
    }
    
    /**
     * Turns both lights on and blocks all other activity.
     * For use in case of an error state to indicate that
     * the user should check the logs and power cycle.
     */
    void error() {
      while(1) {
        turnLightsOn();
      }
    }
    
    /**
     * Display the current pattern stored in the pattern array
     * using the red and green LEDs.
     */
    void displayPattern() {
      for(int i = 0; i < curPatternLength; i++) {
        turnLightsOff();
        delay(500);    
        if(pattern[i] == 'g') {
          digitalWrite(greenLED, HIGH);
          delay(500);
        }else if(pattern[i] == 'r') {
          digitalWrite(redLED, HIGH);
          delay(500);
        }else {
          error();
        }
      }
      turnLightsOff();
    }
    
    /**
     * Check whether the color at position pos in the pattern
     * matches the given color. Returns 1 if true, 0 if false.
    ...
    Read more »

View all 3 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates