Electronics Arcade Game
Greetings, fellow makers! I'm excited to share my latest project with you on Instructables. As a student at Kwame Nkrumah University of Science and Technology, I've always been passionate about merging creativity with technology. Today, I'm thrilled to unveil my creation for the Fusion 360 Arcade Design Competition.
Supplies
Materials
- Arduino board
- 16x4 LCD display
- Push buttons (True and False)
- Buzzer
- 6 LEDs
- Jumper wires
- Breadboard
- Wood
Tools
- Glue gun and glue sticks
- Jig saw(optional)
- Tape Measure
Software:
- Arduino IDE(https://www.arduino.cc/en/main/software)
- Tinkercad
- Fusion 360( Autodesk Fusion 360)
Overview of the Project
The "Electronics Arcade Game" is an interactive quiz game designed to provide both entertainment and educational value. Players interact with the game by answering quiz questions related to electronics concepts using button inputs. The game features quick rounds with timed gameplay and scoring mechanics. The reward system provides positive reinforcement for active participation and achievement, encouraging students to invest time and effort in expanding their knowledge of electronics.
Designing the Project With Fusion 360
Using Fusion 360, begin the design process for the "Electronics Arcade Game." Create a 3D model of the arcade cabinet and its components, including the button inputs and display screen. Ensure that the design is ergonomic and visually appealing, considering factors such as button placement and overall aesthetics. Use Fusion 360's tools to optimize the design for manufacturability and assembly, keeping in mind the materials and fabrication techniques that will be used.
Cutting and Assembling the Wooden Parts
Using the Fusion 360 design as a guide, proceed to cut the various parts of the arcade cabinet and its components from wood. Ensure that the measurements and dimensions match the design specifications to achieve accuracy in assembly. Employ appropriate woodworking tools and techniques to cut the wood pieces with precision.
Once all the parts are cut, begin assembling them according to the Fusion 360 design. Follow the assembly instructions provided by Fusion 360, ensuring that each part is securely joined together as per the design. Pay close attention to details such as alignment and fitting to ensure a seamless assembly process.
- Cut various parts of the arcade cabinet and components from wood based on Fusion 360 design.
- Ensure measurements and dimensions match design specifications for accuracy.
- Utilize appropriate woodworking tools and techniques for precise cutting.
- Follow Fusion 360 design instructions for assembly.
- Securely join wooden parts together according to design specifications.
- Pay attention to details such as alignment and fitting during assembly for seamless construction.
Connecting Components to Arduino Using Tinkercad Circuit Schematics
- Begin by referring to the circuit schematics created in Tinkercad, which provide a visual representation of how various components such as buzzers, LEDs, and buttons are connected to the Arduino board.
- Identify the specific placement and wiring connections of each component as indicated in the schematics. Pay attention to the designated pins on the Arduino board to which each component should be connected.
- Follow the wiring configurations outlined in the schematics to establish the necessary connections between the components and the Arduino board. This includes connecting the power and ground pins of the components to the corresponding pins on the Arduino, as well as connecting any signal pins required for communication.
- Take note of any additional components that may be included in the circuit to ensure proper functionality and safety.
- Once the connections are established in Tinkercad, simulate the circuit to test its functionality and ensure that all components are working as expected. This step allows for troubleshooting any potential issues before proceeding to physical implementation.
- After successful simulation, replicate the wiring setup in the physical arcade cabinet by following the same wiring configurations and connections as indicated in the Tinkercad schematics. Ensure that all connections are secure and properly insulated to prevent any electrical hazards.
- Test the circuit in the physical setup to verify its functionality and make any necessary adjustments if components are not working as intended.
- Regularly refer back to the Tinkercad schematics during the physical assembly process to ensure accurate wiring connections and alignment with the original design.
- Open the Arduino Integrated Development Environment (IDE) on your computer.
- Copy the code into the Arduino IDE and ensure that it is properly formatted and free of syntax errors.
- Connect the Arduino board to your computer using a USB cable.
- Select the appropriate board type and port in the Arduino IDE by navigating to the "Tools" menu.
- Compile the code in the Arduino IDE to check for any errors and ensure compatibility with the Arduino board.
- Once the code has been successfully compiled, upload it to the Arduino board by clicking the "Upload" button in the Arduino IDE.
- Monitor the Arduino IDE's output window for any error messages during the upload process. If any errors occur, troubleshoot and resolve them accordingly.
- Test the functionality of the arcade game by interacting with the buttons and observing the response of the LEDs, buzzers, and other components as programmed in the code.
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h>
hd44780_I2Cexp lcd;
// Pin Definitions
int trueButtonPin = 6; // Button to answer "True"
int falseButtonPin = 7; // Button to answer "False"
int buzzerPin = 4; // Buzzer for feedback
const int ledStartPin = 12; // Pin where the first LED is connected
// Variables to track scores and questions
int scoreSet1 = 0;
int scoreSet2 = 0;
int currentQuestionIndex = 0;
bool set1Completed = false;
// Define the Question structure
struct Question {
const char *text;
bool answer;
};
// Set 1 Questions
Question questionsSet1[] = {
{"Diode allows one-way current?", true},
{"Electrons flow +ve to -ve?", false},
{"Triac is a type of semiconductor device.", true},
{"A diode has three terminals.", false},
{"Microcontroller has CPU?", true},
{"DC power changes direction periodically.", false},
{"Protons have a negative charge.", false},
{"Digital signals are continuous waveforms", false},
{"A resistor limits current?", true},
{"LED emits light?", true},
{"Analog signals are continuous?", true},
{"A capacitor's capacitance is measured in farads.", true},
{"Inverter converts DC power to AC power.", true},
{"A Zener diode is used to amplify voltage", false},
{"Transistor decreases electronic signals", false}
};
// Set 2 Questions
Question questionsSet2[] = {
{"AC stands for alternating current?", true},
{"Digital signals are discrete values.", true},
{"A rectifier converts DC to AC?", false},
{"Transistor amplifies signals?", true},
{"NAND gate is universal?", false},
{"A capacitor store electrical energy.", true},
{"A potentiometer varies resistance.", true},
{"A rectifier is used to convert DC to AC", false},
{"Protons move around electrons", false},
{"v=IR?", true},
{"A resistor increases current.", false},
{"A NAND gate is an analog logic gate.", false},
{"An op-amp is used for signal attenuation", false},
{"Zener diode regulates voltage?", true},
{"Protons have greater mass than neutrons", false}
};
// Calculate the number of questions in each set
const int numQuestionsSet1 = sizeof(questionsSet1) / sizeof(questionsSet1[0]);
const int numQuestionsSet2 = sizeof(questionsSet2) / sizeof(questionsSet2[0]);
// Function prototypes
void setup();
void loop();
void askQuestion(Question *questionSet, int numQuestions);
void checkAnswer(bool correctAnswer, bool userAnswer);
void showSet1Score();
void showSet2Score();
void showFinalScore();
// Setup function, runs once at startup
void setup() {
lcd.begin(20, 4); // Initialize the LCD display
lcd.backlight(); // Turn on the backlight
// Set button pins and LED pins as inputs/outputs
pinMode(trueButtonPin, INPUT);
pinMode(falseButtonPin, INPUT);
pinMode(buzzerPin, OUTPUT);
for (int i = ledStartPin; i <= ledStartPin + 5; i++) {
pinMode(i, OUTPUT);
}
// Display introductory message on LCD
lcd.clear();
lcd.print("ELECTRONICS ARCADE GAME");
delay(3000);
}
// Main loop function, runs repeatedly
void loop() {
// Check if Set 1 questions are completed
if (!set1Completed) {
if (currentQuestionIndex < numQuestionsSet1) {
askQuestion(questionsSet1, numQuestionsSet1);
} else {
showSet1Score(); // Show Set 1 score
set1Completed = true;
currentQuestionIndex = 0;
}
} else { // Set 2 questions
if (currentQuestionIndex < numQuestionsSet2) {
askQuestion(questionsSet2, numQuestionsSet2);
} else {
showSet2Score(); // Show Set 2 score
showFinalScore(); // Display final score and celebrate if high
}
}
}
// Function to ask a question and get user input
void askQuestion(Question *questionSet, int numQuestions) {
lcd.clear();
Question currentQuestion = questionSet[currentQuestionIndex];
lcd.print(currentQuestion.text);
lcd.setCursor(0, 1);
// Wait for user input (True/False button press)
while (true) {
if (digitalRead(trueButtonPin) == HIGH) {
checkAnswer(currentQuestion.answer, true);
break;
} else if (digitalRead(falseButtonPin) == HIGH) {
checkAnswer(currentQuestion.answer, false);
break;
}
}
currentQuestionIndex++;
}
// Function to check the user's answer and provide feedback
void checkAnswer(bool correctAnswer, bool userAnswer) {
lcd.clear();
if (correctAnswer == userAnswer) {
lcd.print("Correct!");
if (!set1Completed) {
scoreSet1++;
} else {
scoreSet2++;
}
digitalWrite(buzzerPin, HIGH);
delay(1000);
digitalWrite(buzzerPin, LOW);
} else {
lcd.print("Incorrect!");
digitalWrite(buzzerPin, HIGH);
delay(1000);
digitalWrite(buzzerPin, LOW);
}
delay(1000);
lcd.clear();
}
// Function to display Set 1 score
void showSet1Score() {
lcd.clear();
lcd.print("Set 1 Score: ");
lcd.print(scoreSet1);
delay(3000);
}
// Function to display Set 2 score
void showSet2Score() {
lcd.clear();
lcd.print("Set 2 Score: ");
lcd.print(scoreSet2);
delay(3000);
}
// Function to display final score and celebration
void showFinalScore() {
lcd.clear();
lcd.print("Quiz Over!");
lcd.setCursor(0, 1);
lcd.print("Total Score: ");
lcd.print(scoreSet1 + scoreSet2);
// If the total score is high, display congratulations and blink LEDs
if (scoreSet1 + scoreSet2 > 24) {
lcd.setCursor(0, 2);
lcd.print("Congrats! USD 300 ");
// Blink LEDs in celebration
while (true) {
for (int i = ledStartPin; i <= ledStartPin + 5; i++) {
digitalWrite(i, HIGH);
}
delay(100);
for (int i = ledStartPin; i <= ledStartPin + 5; i++) {
digitalWrite(i, LOW);
}
delay(100);
}
}
delay(3000);
}