1. ro
  2. en
28 July 2025

Repeat after me

Introduction

 

In the world of memory games, Simon Says stands as an undisputed classic—a simple yet captivating challenge where players must repeat sequences of lights and sounds with metronomic precision. Originally created in the 1970s as an electronic device combining sound, light, and visual memory, Simon quickly became a cultural phenomenon. Today, in the age of microcontrollers and STEM education, tech enthusiasts are reimagining it with flair, turning it into an ideal tool for interactive learning and DIY experimentation.

 

One such reinterpretation comes through the Arduino platform, where Simon Says receives a vibrant and musical upgrade: colorful LEDs, polyphonic tones assigned to each color, and a TM1637 digital display that adds a retro-cool visual layer by showing messages and scores in a dynamic way. The code behind the project is modular and clearly structured, designed for interactivity and instant feedback. Each component plays a well-defined role: LEDs signal the steps, the buzzer provides acoustic cues, and the buttons allow direct user interaction.

 

How the Game Works

 

The gameplay is intuitive. Upon startup, the red LED begins to blink, and the word “RED” appears on the display, signaling that the game is ready but awaiting user input. Pressing the red button triggers a countdown — 3, 2, 1— accompanied by rising beeps that build anticipation.

 

Immediately after, the system generates a random sequence of colors and tones. Each LED lights up in turn, paired with a specific sound frequency (e.g., 261Hz for yellow, corresponding to middle C on a piano, or 784Hz for blue, representing G in the fifth octave). The player must then reproduce the sequence by pressing the corresponding buttons in the same order. This activates both visual and auditory memory—an important detail for musically inclined users who may retain and reproduce melodies by ear. For this reason, the project can also serve as a training tool for artists or musicians.

 

If the player makes a mistake, a classic “wah-wah” sound signals failure, followed by a score reset and a brief visual animation on the display. If successful, the player is rewarded with a short melody that marks progress and encourages continued play. With each level, the sequence grows longer, increasing the difficulty and challenging the player’s concentration and reaction time.

 

Educational Potential and Expansion

 

The modular design allows for easy expansion with additional features: more complex visual effects, extra displays, EEPROM score saving, or even wireless connectivity for global leaderboards. It can also be adapted as a cognitive stimulation tool for children or seniors, making it ideal for training short-term memory in a playful and accessible way.

 

In essence, this Arduino-based version of Simon Says is more than just a retro remake—it’s a multisensory platform for exploring human-machine interaction, sequential logic, and active learning. It’s a complete project that blends nostalgia with innovation and demonstrates how educational hardware can become a source of creativity, knowledge, and joy.

 

Gameplay Summary

 

Once the system is activated, the red LED blinks and the display shows “ROSU,” indicating readiness. Pressing the red button starts the countdown—3, 2, 1—accompanied by energetic beeps.

 

The system then generates a random sequence of colors and tones. LEDs light up one by one, each linked to a distinct sound, engaging both visual and auditory memory.

 

The player must replicate the sequence by pressing the buttons in the correct order. With each successful level, the sequence grows, increasing the challenge. Mistakes end the round, and the system may display a motivational message or the final score.

As the game progresses, players are pushed to sharpen their focus, memory, and reflexes—making Repeat After Me not just a game, but a meaningful learning experience.

 

 

Game Rules – “Repeat After Me”

 

1. Starting the Game

When the system is activated:

  • The red LED begins to blink

  • The display shows the message “RED,” indicating the game is ready to start

  • The player must press the red button to begin

 

2. Countdown Sequence

After pressing the button:

  • The display counts down: 3, 2, 1

  • Rhythmic beeps build anticipation

  • Once the countdown ends, the system automatically begins generating the sequence.

 

3. Pattern Preview

The system creates a progressively complex sequence:

  • LEDs light up one by one, each representing a step in the sequence

  • Each LED is paired with a unique tone from the buzzer

  • The player must memorize either the order of the sounds or the colors displayed

 

4. Memory Challenge

  • The player must press the buttons in the exact same order as shown

  • Each press triggers immediate visual and auditory feedback (the LED lights up and the buzzer plays the associated tone)

  • The system checks each input step-by-step to verify accuracy

 

5. Progressive Levels

After each correctly reproduced sequence:

  • A new step is added to the sequence

  • Difficulty increases gradually, challenging the player’s focus, memory, and reflexes

 

6. Mistakes & End of Round

If the player presses the wrong button:

  • The game stops

  • The final score is displayed

  • All LEDs turn off, and the player can restart the game at any time—the system returns to its initial state

 

7. Objective & Benefits

“Repeat After Me” is designed to:

  • Improve your memory

  • Enhance visual-auditory coordination

  • Provide a fun and educational experience for players of all ages

 

 

 

 

🔌 The Circuit Diagram

 

At first glance, the circuit diagram might look intimidating—its lines twisting and turning like a never-ending technical tale. But don’t let appearances discourage you. We’ll walk through it together, step by step, decoding each symbol and uncovering the logic behind the layout. As we place the components onto the breadboard in a clear and intuitive way, you’ll see how quickly confusion turns into curiosity—and curiosity into confidence.

 

 

Wiring Overview: Connecting the Circuit

 

As you can see, the circuit is built from a series of straightforward connections between the Arduino and various components. Each wire has a purpose, and together they form the backbone of the game’s interactive experience. Here's how everything links up:

 

🔴 Red Button & LED

  • Red Button Terminal 1 → Arduino Pin D12

  • Red Button Terminal 2 → Arduino GND

  • Arduino Pin D7 → Resistor R1 (Terminal 1, for Red LED)

  • Resistor R1 (Terminal 2) → Positive (+) leg of Red LED

  • Negative (−) leg of Red LED → Arduino GND

 

🟡 Yellow Button & LED

  • Yellow Button Terminal 1 → Arduino Pin D6

  • Yellow Button Terminal 2 → Arduino GND

  • Arduino Pin D10 → Resistor R2 (Terminal 1, for Yellow LED)

  • Resistor R2 (Terminal 2) → Positive (+) leg of Yellow LED

  • Negative (−) leg of Yellow LED → Arduino GND

 

🟢 Green Button & LED

  • Green Button Terminal 1 → Arduino Pin D8

  • Green Button Terminal 2 → Arduino GND

  • Arduino Pin D4 → Resistor R3 (Terminal 1, for Green LED)

  • Resistor R3 (Terminal 2) → Positive (+) leg of Green LED

  • Negative (−) leg of Green LED → Arduino GND

 

🔵 Blue Button & LED

  • Blue Button Terminal 1 → Arduino Pin D9

  • Blue Button Terminal 2 → Arduino GND

  • Arduino Pin D5 → Resistor R4 (Terminal 1, for Blue LED)

  • Resistor R4 (Terminal 2) → Positive (+) leg of Blue LED

  • Negative (−) leg of Blue LED → Arduino GND

 

🔊 Speaker

  • Positive (+) terminal of Speaker → Arduino Pin D12

  • Negative (−) terminal of Speaker → Arduino GND

 

🖥️ TM1637 Display

  • CLK (Terminal 1) → Arduino Pin D3

  • DIO (Terminal 2) → Arduino Pin D2

  • GND (Terminal 3) → Arduino GND

  • VCC (Terminal 4) → Arduino 5V

 

 

 

Materials Needed

 

  • Arduino Uno or a compatible equivalent board

  • 4 LEDs (preferably 5mm) in different colors: red, yellow, green, and blue

  • 4 momentary push buttons (normally open) that can be mounted on a breadboard

  • 1 four-digit, seven-segment display controlled by a TM1637 driver chip

  • a speaker for sound feedback

  • 1 large breadboard (830 tie-points recommended)

  • Jumper wires for all necessary connections

 

 

 

🛠️ Installing Components on the Breadboard

 

As you’ll notice, the number of electrical connections required is quite manageable. You just need to pay attention to a few key details to ensure everything is set up correctly:

  • LEDs are polarized components, meaning they must be connected in the correct direction. To help guide you, we’ve labeled the legs as A (anode, +) and K (cathode, −). If installed backwards, the LEDs won’t light up.

 

  • Push buttons have four pins arranged in a rectangular layout—not a perfect square. This means they naturally fit into the breadboard in only one orientation, without forcing them.

  • Resistors are non-polarized, so they can be placed in either direction. Their role is to limit current and protect sensitive components, especially the LEDs.

  • The speakers may come with colored wires. If the terminals aren’t marked, remember: the red wire typically indicates the positive side and should be connected to Pin D12, while the black wire goes to GND.

  • Breadboard power rails are grouped in sets of 25 pins along the sides. To ensure consistent voltage across the board, it’s important to bridge the power rails—this keeps the power supply uniform throughout the entire length of the breadboard.

  • If this is your first time using an Arduino board, you can connect everything without worry. A fresh board won’t have any preloaded programs, so there’s no risk of unexpected behavior during setup.

 

 

 

Source Code

 

Before compiling the source code, you’ll need to install a library that enables communication with the 4-digit, 7-segment display powered by the TM1637 driver chip. The library is called “TM1637”, developed by Avishay Orpaz.

To install it:

  • Open the Library Manager in the Arduino IDE

  • Search for “TM1637”

  • Select “TM1637 by Avishay Orpaz”

  • Click “INSTALL”

 

You can download the source code here. The file includes detailed comments explaining nearly every line, making it easy to follow and customize.

 

Note: The link opens a .ino file in a new browser tab. Since most browsers treat it as plain text, you’ll need to save it properly:

  • Press Ctrl + S

  • In the “Save as type” dropdown, choose “All files”

  • Add the .ino extension to the filename (e.g., RepeatAfterMe.ino).  Alternatively, you can copy the entire code (Ctrl + A, then Ctrl + C), open a new sketch in the Arduino IDE, and paste it (Ctrl + V) directly.

 

Once your components are installed on the breadboard, simply upload the code to your Arduino board and enjoy the game! 🎮

 

 

⚠️ Before You Play: Common Issues & How to Fix Them

 

Even with everything wired up, a few things might go wrong. Here’s what to check if the game isn’t working as expected:

 

🔌 Improper Hardware Setup

  • Double-check that all pins are placed correctly on the breadboard according to the wiring diagram.

  • A single misplaced pin can disrupt the behavior of LEDs, buttons, or the display.

 

🔊 No sound from the speaker

  • Make sure the SPEAKER_PIN (12) is properly connected.

  • Confirm that the speaker’s terminals are wired correctly.

  • Check voltage levels and ensure GND/VCC connections are solid.

 

📟 Display not working

  • Inspect the CLK and DIO connections to the TM1637 display.

  • Try lowering the communication speed or test the display using a basic example from the TM1637 library.

 

💡 LEDs not lighting up

  • Ensure the LEDs aren’t reversed — the anode and cathode must be connected correctly.

  • Pins 7, 10, 4, and 5 should be configured as OUTPUT in your code.

 

🎮 Buttons Not Responding

  • Pins 11, 6, 8, and 9 should be set as INPUT_PULLUP.

  • If button presses aren’t detected, test each one individually using: Serial.println(digitalRead(pin)); 

 

🔁 Sequence Not Saving Properly

  • If the game resets unexpectedly, check whether the gameSequence[] array is being overwritten.

  • Also verify that gameIndex isn’t exceeding its intended limit — this can happen if its value is accidentally modified.

 

 

Code Structure & Flow

 

The game begins by importing the TM1637Display library, which enables control of a 4-digit display. This display is used to show the current level, messages like “RED” (prompting the player to press the red button at the start), and a countdown timer.

 

Pin Configuration

The following pins are defined for connecting components:

  • CLK and DIO — for the 7-segment display

  • SPEAKER_PIN — for the buzzer

  • Pins 7, 10, 4, and 5 — for the four LEDs

  • Pins 11, 6, 8, and 9 — for the four buttons

 

Each LED is paired with a unique musical tone (frequency), stored in the tones[] array. For example, the red LED triggers an 196 Hz tone, while the yellow one plays 784 Hz.

 

Audio Feedback

Two sound sequences provide auditory cues:

  • levelUpMelody[] — played when the user advances to the next level

  • wahwah[] — a sad tone played when the user makes a mistake

 

Game Logic & Flow

An instance of the display object is created, and the gameSequence[] array is defined to hold up to 100 steps. Each step is an index from 0 to 3, corresponding to a specific LED/button. The gameIndex variable tracks the current level.

To create synchronized audio-visual feedback, the function lightLedAndPlayTone(index, duration) lights up the selected LED and plays its associated tone.

 

In the setup() function, hardware is initialized: pins are configured, the display is activated, and the random number generator is seeded.

 

The game starts in initialState(), where the display shows “RED” and the red LED blinks. The player must press the red button to begin.

 

Once confirmed, a short countdown is triggered via countdown(), displaying 3 → 2 → 1 on the screen at one-second intervals, each accompanied by a tone.

 

Main game loop

Inside the loop() function — the core of the game — a new random step is added to gameSequence, and the current level is displayed. Then playSequence() runs through the entire sequence, lighting up the corresponding LEDs and playing their tones.

After playback, the player must reproduce the sequence by pressing the buttons in the same order. This is handled by checkUserSequence(), which compares each button press to the expected value in gameSequence. Correct inputs trigger feedback (LED + tone), while mistakes play the wahwah[] melody, flash the LEDs, and reset the game.

If the player succeeds, levelUpMelody[] is played, gameIndex is incremented, and the next level begins with a longer sequence.

 

Button input & game over

The readButtons() function detects button presses, waits for release (debounce), and returns the index — used to validate the player's input.

When the player fails, gameOver() is called. The display shows the final score, all LEDs light up in sequence, the failure melody plays, and the game returns to its initial state.

 

 

Potential enhancements for "Repeat after me"

 

Looking to take the project to the next level? Here are some exciting ideas to upgrade both the experience and functionality:

 

Visual Customization

  • Replace the 7-segment display with an OLED or LCD screen to show messages and animations

  • Design a custom 3D-printed case for a polished, professional look

 

Sound & Music

  • Add distinct sound effects for different stages: start, mistake, and victory

  • Compose a theme melody to play through the speaker during gameplay

  • Include a “silent mode” for quiet environments like libraries or classrooms

 

Difficulty Modes

  • Increase the sequence speed as the player progresses

  • Introduce a “Challenge Mode” where players must memorize the sequence in reverse

  • Add a “Time Attack” mode — respond correctly within a limited time window!

 

Save & Resume

  • Store the highest score in EEPROM for long-term memory

  • Allow players to resume from the last completed level after restarting

 

Multiplayer & Competition

  • Enable two-player mode, each with their own set of buttons and LEDs

  • Add a versus mode — whoever reproduces the sequence faster and more accurately wins

 

Bluetooth or Wi-Fi Integration

  • Send scores online to participate in global leaderboards

 

And That’s Not All…

You can take this project to the next level by integrating all components into a custom enclosure. If you have access to a 3D printer, you can design an attractive and ergonomic case tailored to your layout and style.

No 3D printer? No problem — an ABS plastic box, commonly used in electrical installations, is a great alternative. It offers durability, safety, and a clean, professional appearance.

With a proper enclosure, your project gains not only functionality but also a presentation that truly stands out.

Explore the resources and design ideas here...

 

 

 

 

Version 2.0 — A Twist of Chaos

 

It felt a bit too simple… so we’re throwing in some chaos. Let’s make that clear, pure CHAOS:

After the player is shown the main sequence to memorize, the program waits one second… and then unleashes a rapid-fire distraction sequence designed to throw them off. Only after surviving this visual storm can the player attempt to reproduce the correct pattern...

And this happens every round. Now the real show begins. Do you still remember the original sequence? Or were you dazzled by the fleeting brilliance of confusion?

 

You can download the source code here. The file includes detailed comments explaining nearly every line, making it easy to follow and customize.

 

Note: The link opens a .ino file in a new browser tab. Since most browsers treat it as plain text, you’ll need to save it properly:

  • Press Ctrl + S

  • In the “Save as type” dropdown, choose “All files”

  • Add the .ino extension to the filename (e.g., RepeatAfterMe.ino).  Alternatively, you can copy the entire code (Ctrl + A, then Ctrl + C), open a new sketch in the Arduino IDE, and paste it (Ctrl + V) directly.

 

 

 

 

 

Did you manage to memorize the colors? Let’s raise the stakes — Repeat After Me: Reverse Mode is where the real challenge begins!

Now it’s not just about remembering the sequence… It’s about replaying it backwards. Your memory, focus, and reflexes are about to be tested like never before.

Ready to flip the script? Let’s see what you’ve got.

 

​​​​​​​

​​​​​​​