Skip to content

Explore Electronic Design Simulators with Arduino MAX7219 Heart Match Game

October 30, 2025
Explore Electronic Design Simulators with Arduino MAX7219 Heart Match Game
Table of Contents
    You find it easier to test ideas when you’re not concerned about damaging a board. You find it easier to test ideas when you’re not concerned about damaging a board. If you seek innovation, use Electronic Design Simulators to test code, emulate hardware, and explore creative applications. These simulators allow you to experiment with different designs and troubleshoot potential issues before investing in physical components.

    They provide a platform for collaboration among engineers and designers, fostering innovation and knowledge sharing in the field. Electronic Design Simulators enable you to explore the boundaries of technological possibilities and bring your ideas to life in a virtual environment.

    Why are Electronic Design Simulators the need of the hour?

    The ease of availability of microcontrollers and electronic components has prompted hobbyists and educators to turn their ideas into visually appealing interactive devices. Electronic Design Simulators enable designers to creatively explore their ideas before purchasing or soldering components. Let’s look at the benefits that they have to offer:

    • Immediate feedback: By changing parameters or inputs and viewing the results visually, you get to observe how your circuit responds in real time. This helps you understand behaviour before committing to physical components.
    • Code-first iteration: You can improve firmware logic and display behaviour without compromising physical hardware. You find it easier to test ideas when you’re not concerned about damaging a board.
    • Safe experimentation: You can quickly and efficiently update designs without incurring high costs or wasting resources. Instead, you can explore, break, and rebuild in a virtual environment without having to search for missing components.
    • Faster re-iterations: You can load your program multiple times, modify the logic, and re-run it to test different ideas. This makes it easier to tweak your design without reassembling hardware or risking components.

    While working on designing a custom Fritzing part for the MAX7219 32×8 LED Dot Matrix Display, I wondered, what if I could incorporate live simulation with my blog post? Let me demonstrate how I made my first Electronic Design Simulator project using Wokwi. It’s called “Heart Match Game with MAX7219: Press to Win.”

    Here’s how it operates. When the simulation begins, the LED matrix displays the message “GO!!” to indicate the start of the game. The user interacts by clicking on a virtual red button, which activates a buzzer to begin. Pressing the button causes all four LED matrices to display random heart or cross symbols. If all four modules show hearts, the game awards a jackpot; a celebratory tone plays, and the hearts blink to indicate the win. If none of the modules have hearts (just crosses), the game plays a distinct error tone to indicate a loss. For all other combinations, the buzzer plays a standard tone and resets the display with crosses.

    MAX7219 32×8 LED Dot Matrix Display

    Breadboard View

    Schematic View

    PCB View

    Fritzing vs. Wokwi: A Comparison of Electronic Design Tools

    There are numerous beginner-friendly Electronic Design Simulators available, either completely browser-based or requiring download and installation on your computer. The specifications of your project fully determine the ideal option for you.

    Fritzing is an excellent tool for simulating how a project will appear on a real breadboard and even designing custom PCBs. Fritzing has a beta Electronic Design Simulation functionality starting with version 0.9.10. However, existing simulation capabilities in Fritzing still require improvement:

    • Components without SPICE models appear grey during the simulation.
    • LED indicators display basic ON/OFF, but other input signals do not support animations, scrolling, sparking effects or the rendering of bitmaps and characters.
    • There is no support for user input during the simulation, such as button presses or sensor readings.
    • There’s no way to tweak variables or watch the immediate visual response live on the display.

    Wokwi, on the other hand, delivers an exceptionally accessible online simulation environment that does not require users to sign up for basic Arduino project creation, simulation, or sharing public projects via URL. Anyone can build, experiment, run, and publish a project without authentication.

    The “Heart Match Game with MAX7219: Press to Win” is a simple sketch that uses the Arduino Nano Every, making it easy to implement. I decided to use Wokwi to create an Electronic Design Simulator for this project, and here is my experience with the platform:

    • You can start building and simulating immediately without creating an account.
    • You can edit projects while the browser tab is open, and you can share them through a live link.
    • Unsaved projects are public, and private saving requires signing up.
    • The platform includes a ready-to-use component library that receives periodic updates.
    • You can add custom parts, although the workflow for this is not fully explored here.
    • Using parts outside the built-in library generally requires a paid plan.
    • Large sketches that take more than 10 seconds to compile are discouraged to keep the editor responsive.
    • Components cannot be rotated in the editor, which limits how closely layouts can match real-life wiring.

    PROGRAMMING

    Sketch 1: Heart Match Game with MAX7219: Press to Win

    /*
     * Heart Match Game with MAX7219: Press to Win
     * Made by wiztaqnia.com
     * Modified date: 30/10/2025
     * Typical pin layout used:
     * ----------------------------------------------------------------
     * Signal              MAX7219 LED     Arduino    Piezo      Push                
     *                      Dot Matrix      Nano      Buzzer    Button            
     *                    4-in-1 Display    Every              
     * ----------------------------------------------------------------
     * 5V                      5V           +5V         --        --
     * GND(Ground)             GND          GND        GND         4                
     * DIN (Data Input)        DIN          D11        --         --
     * CS (Chip Select)        CS           D10        --         --
     * CLK (Clock)             CLK          D12        --         --
     *Buzzer Output pin        --           D2         +          --
     * Button Input pin        --           D3         --          1
     */
     #include <LedControl.h> // control MAX7219 LED matrix modules
    
    // Pin connections 
    #define DIN_PIN    12  
    #define CLK_PIN    11  
    #define CS_PIN     10  
    #define BUTTON_PIN 2   
    #define BUZZER_PIN 3   
    
    LedControl lc = LedControl(DIN_PIN, CLK_PIN, CS_PIN, 4); //LedControl(Data In, Clock, Chip Select, Number of MAX7219 LED matrix modules)
    bool startGame = true; // Flag to show "GO!!" only once at start
    
    // Bitmap for ❤️ Heart symbol (8x8 pixels)
    byte heart[8] = {
      B00000000,
      B01100110,
      B11111111,
      B11111111,
      B11111111,
      B01111110,
      B00111100,
      B00011000
    };
    
    // Bitmap for ❌ Cross symbol (8x8 pixels)
    byte cross[8] = {
      B10000001,
      B01000010,
      B00100100,
      B00011000,
      B00011000,
      B00100100,
      B01000010,
      B10000001
    };
    
    // Bitmap for letter G (corrected orientation)
    byte G[8] = {
      B00111100,
      B01000010,
      B00000001,
      B01110001,
      B10000001,
      B10000010,
      B01000010,
      B00111100
    };
    
    // Bitmap for letter O
    byte O[8] = {
      B00111100,
      B01000010,
      B10000001,
      B10000001,
      B10000001,
      B10000001,
      B01000010,
      B00111100
    };
    
    // Bitmap for exclamation mark (!)
    byte EXCL[8] = {
      B00011000,
      B00011000,
      B00011000,
      B00011000,
      B00011000,
      B00000000,
      B00011000,
      B00011000
    };
    
    void setup() {
      
      for (int i = 0; i < 4; i++) {
        lc.shutdown(i, false);    //Initialize LED Dot Matrix display 
        lc.setIntensity(i, 5);    //Set the brightness of the LED Dot Matrix. The range of brightness is 0 to 15
        lc.clearDisplay(i);       //Clear any previous data
      }
    
      pinMode(BUTTON_PIN, INPUT_PULLUP); //Use internal pull-up resistor
      pinMode(BUZZER_PIN, OUTPUT);       //Set buzzer pin as output
      displayGO();                       //Show "GO!!" message at start
    }
    
    void loop() {
    
      // Check if button is pressed (LOW because of pull-up)
      if (digitalRead(BUTTON_PIN) == LOW) {
        while (digitalRead(BUTTON_PIN) == LOW); 
        tone(BUZZER_PIN, 1000, 100); // Regular buzzer tone
    
        // Clear "GO!!" message only on the first button press
        if (startGame) {
          clearAll();        
          startGame = false; 
        }
    
        int heartCount = 0; 
    
        // Randomly display either a heart or a cross on each module
        for (int i = 0; i < 4; i++) {
          bool showHeart = random(2); //Randomly choose 0 or 1
          if (showHeart) {
            displayShape(i, heart);  //Show heart
            heartCount++;
          } else {
            displayShape(i, cross);  //Show cross
          }
        }
    
        delay(1000);   //Pause to let user see the result
    
        // If all 4 modules show hearts, it's a jackpot!
        if (heartCount == 4) {
          tone(BUZZER_PIN, 1500, 800); // Longer beep for jackpot
          blinkHearts(3);              // Blink hearts 3 times
        } else {
          tone(BUZZER_PIN, 400, 300); // Error buzzer tone
          clearAll();                 //Clear display if not a jackpot
        }
    
        delay(1500);  //Pause before next round
      }
    }
    
    // Display a given 8x8 shape on a specific module (0–3)
    void displayShape(int module, byte shape[8]) {
      for (int row = 0; row < 8; row++) {
        lc.setRow(module, row, shape[row]);
      }
    }
    
    // Show "GO!!" message across the 4 modules (right to left)
    void displayGO() {
      displayShape(3, G);     //Rightmost module shows 'G'
      displayShape(2, O);     //Next shows 'O'
      displayShape(1, EXCL);  //Then '!'
      displayShape(0, EXCL);  //And another '!' for emphasis
    }
    
    // Clear all modules by displaying ❌ on each
    void clearAll() {
      for (int i = 0; i < 4; i++) {
        displayShape(i, cross);
      }
    }
    
    // Blink all modules with hearts a given number of times
    void blinkHearts(int times) {
      for (int t = 0; t < times; t++) {
        clearAll();                   
        delay(250);
        for (int i = 0; i < 4; i++) {
          displayShape(i, heart); 
        }
        delay(250);
      }
    }

    OUTPUT

    Download the generated SVG images for each section, along with the resulting Fritzing part here: MAX7219 32×8 LED Dot Matrix Display

    Ready to Play? Try the Heart Match Game Live on Wokwi→ Heart Match Game with MAX7219: Press to Win

    video
    play-sharp-fill

    This post was inspired by Top 5 Best IoT Simulation Tools Online

    References:-

    Noor Fatimah I.H
    🍪⚙️