Servo Segment Display
.png)
Welcome to My Project: ServoSegmentDisplay!
Hello, my name is Ishandeep Khinda, and in this Instructable, I will be walking you through my newest project: ServoSegmentDisplay, a fully interactive Arduino-based multiplication game that gets harder over time!
In this project, I’ve combined many different components to create a single game that challenges your multiplication skills while adding a couple of fun twists to it, a mechanical Seven-Segment Display physically outputting the numbers you've entered, and levels that progressively get harder and harder over time!
My Inspiration:
The concept of the whole ServoSegmentDisplay game was originally thought out all by me, but I got the idea to make a mechanical Seven-Segment Display to output various numbers by seeing videos of similar ones online. I thought it was really cool how numbers could be shown through a few Servo Motors, and was fixated on incorporating it into my project!
Full Game Description:
The game starts off by displaying all of the instructions on a small OLED display, guiding the player on how to play. Once you start playing, the game randomly generates two numbers for you to multiply. You then enter your answer using 10 push buttons for numbers 0-9.
As you move through the levels and progress through the game, it slowly but surely gets tougher by noticeably reducing the time you have left to answer each and every question. If you end up answering correctly, your score increases by 1, and once you have finally reached a score of 10, you have beaten the game and won! Congrats :)
What makes this project unique is the way it displays and outputs the numbers you've entered. Not only does it use two Seven-Segment Displays, but also Seven Servo Motors acting as a Seven-Segment Display to visually represent the digits by moving to form new numbers, similar to how digital clocks work. Combining Servo Motors and Seven-Segment Displays is where I got the name ServoSegmentDisplay from, cool right!
Additionally, the game uses an RGB LED to indicate correct or incorrect answers, 2 LEDs (Yellow and Green) to show when the Servo Motors are in the process of outputting the number you entered (Yellow), and once they've fully outputted/displayed it (Green), a Piezo Buzzer used to generate in-game sound effects, and several other components to provide feedback and make gameplay more exciting.
In this Instructable, I’ll walk you through every step you need to build your very own ServoSegmentDisplay, from gathering all of the materials, planning the project, placing down/wiring the components, coding the game, creating the prop, and finally testing and playing the game.
Let’s get into it!
Gather the Components

- 1x Mega Arduino
- 2x Breadboard
- 7x Servo Motors
- 1x OLED Display (128 x 128)
- 11x Push Buttons
- 2x Seven-Segment Display
- 1x RGB LED (Common Anode)
- 2x Assorted LEDs (Yellow and Green)
- 18x Resistors (7x 330Ω Resistors + 11x 10KΩ Resistors)
- 7x 10uF Capacitor
- Jumper Wires
- Pin Headers (To Connect Servo Motors into the Breadboard)
READ: (Not using an RFID Scanner in this project anymore)
Plan the Project

I believe that planning and having a clear idea of what you're going to do on a project is the best way to go before starting it. In these designs, I made the project I was going to make in real life, but online. This helped assure me that the project would work when I tried building it by hand.
Planning the project helped me create a neat and tidy Breadboard when I built the project by hand, and I recommend that everyone do this before starting a new project, as it helped me a lot!
Place Down the Components



READ: Please ignore the RFID Scanner, as I'm not using it anymore
- Here are some pictures of how the Components should be placed before we start wiring them!
- Make sure to neatly place down every component so the project can be as neat and clean as possible!
Questions You May Have:
Why are we using 10uF capacitors on the breadboard connected to each and every Servo Motor?
- We are using 10uF capacitors on each of our Servo Motors in order to stabilize the power supply and minimize voltage drops. helping smooth out current spikes and reduce electrical noise. Additionally, this helps prevent the Servo Motors from causing voltage fluctuations that could interfere with the Arduino or other components connected to it.
Why are we using so many resistors on a lot of the components?
- We are using resistors on components we have, such as push buttons, LEDs, and Seven-Segment Displays, in order to limit the flow of electrical current, reduce voltage, and protect other components on the breadboard. Essentially, we need to use resistors in order to prevent too much current from going into the Arduino, which can fry it.
You got this :)
Wiring





With the wiring for ServoSegmentDisplay, I tried to be as neat as possible and made sure to correctly trim every single wire I placed. I suggest you do the same.
Tips:
- Try using your hands to straighten the wires
- Rather than having wires all over the place, try to bend them at a 90-degree angle to make them neater and organized
If you're confused about my wiring, you can check out the code I made, or read below ↓↓↓
Seven-Segment Display:
Check out the Diagram I have given about Seven-Segment Displays above. In the code below, the numbers represent the pins on the Arduino. The letters represent pins on the Seven-Segment Display. If you look at the Seven-Segment Display, there are letters ranging from a - g. To wire this correctly, wire one end of a wire to the pin specified on the Arduino, and wire the other end of the wire onto the letter specified on the 7 Segment Display. For example, on the Arduino, pin 13 would connect to the top right of my first Seven-Segment Display. Pin A6 on the Arduino would connect to the top left of my first Seven-Segment Display. Remember, it gets easier with more practice, as I was also confused about how to wire Seven-Segment Displays!!
Servo Motors, RGB LED, LEDs, Buttons, Buzzer, and OLED Display:
This is where it gets a lot easier! Now, all you have to do is look at the number specified on each of the components on the Arduino Code, and wire it to the leg required.
Servo Motors: It goes to the Orange wire of each Servo Individual Servo
RGB LED (Common Anode):
- Pay attention to the letters R, G, B.
- 1st pin (redPin) = 5
- 2nd pin = 330Ω Resistor
- 3rd Pin (greenPin) = 4
- 4rd Pin (bluePin) = 3
LED and Buzzer: It goes to the positive leg of the component.
Push Button: It goes to the top left leg of the component.
OLED Display:
- Connect SCL on the Arduino to SCL on the Component
- Connect SDA on the Arduino to SDA on the Component
Upload the Code!



Now that everything is finished, upload the code I have made!!!
The Code is at the bottom.
READ: Please go to the next step for a much more detailed explanation on the whole code
The Game In-Depth:
- Starts off with the title screen on the OLED Display
- Shows instructions on the OLED Display
- You start the game by pressing the first Push-Button (labelled S)
- You are given 2 random combinations of numbers that you must multiply together
- You enter what you think the answer is through the Push-Buttons (0-9)
- What you clicked is outputted onto the two Seven-Segment Displays and the 7 Servo Motors
- The Yellow LED turns on while the motors are outputting a new number, and the Green LED turns on when the number has been outputted
- The RGB LED shows whether you got the answer correct or incorrect
- The Piezo Buzzer makes winning and losing sound effects for the game
- You either win the game by getting a score of 10, lose the game by miscalculating, or lose the game by running out the clock
- A new screen shows after you've either won the game or lost the game, counting down from 5 seconds to start the new round.
If you have kids, little siblings, or even younger family members, make sure to try this game out with them in order to improve their multiplication skills while also having fun :D
COMMON MISTAKES MADE:
- MAKE SURE you download all of the libraries that are in the code I made, or else your project won't work at all.
HERE IS THE CODE :)
Downloads
Code Variables

Let's now begin the coding!
In any Arduino project, the code is an extremely crucial step for the game, and the game won't even work if we don't have working code, so let's get started with the variables in the code!
COMMON MISTAKES MADE:
- MAKE SURE you download all of the libraries that are in the code I made, or else your project won't work at all.
Setup Function Code


Sets up all of the Inputs/Outputs
Displays the Start Screen and the Instructions Screen
Loop Function Code

Starts the game and calls the playGame() function.
Allows the playGame() function to keep running in a continuous loop to handle the game rounds.
Essentially, this starts the game when the start button is pressed. It then keeps calling the playGame() function repeatedly, so the game keeps running until you stop it.
Game Logic Functions








This section contains all the main game functions that handle generating questions, checking answers, displaying feedback, controlling LEDs, servos, sounds, and the Seven-Segment displays.
Each function is already fully commented in the code to explain its purpose and how it works.
Have Fun :D

Here’s a cool video showing my ServoSegmentDisplay game in action!
I hope you enjoyed following along with this project.
Thank you so much for checking it out! 😄