ElectroQuest

by Bernard Amoateng in Circuits > Arduino

43 Views, 1 Favorites, 0 Comments

ElectroQuest

ELECTROQUEST
EDUCATIONAL GAME (1).png
60ca2fe8-d167-4ccd-acb5-8d5e5598bb92.jpg
b436d371-9dd1-4727-961b-f4f6ea81db09.jpg

ElectroQuest: The Ultimate Electronics Learning Game is an innovative educational tool designed to enhance students' understanding of electronic components through interactive gameplay. This Arduino Mega-based game integrates real hardware components installed on a wooden board, with each component represented by an LED. Using a pointer, students are tasked with identifying specific components as prompted by a 20x4 LCD display. Correct identification results in the corresponding LED lighting up and the component's name being displayed. The game features a 2-minute timer for each question, ensuring a dynamic and engaging learning experience. Future integrations include a buzzer for audio feedback and a speaker to pronounce the component names, further enriching the learning experience. ElectroQuest offers a hands-on approach to electronics education, making it ideal for classrooms, STEM clubs, and individual learners.

Objective

The primary goal of ElectroQuest is to provide a fun and interactive way for students to learn about electronic components. The game aims to:

  1. Enhance students' knowledge of electronics.
  2. Improve their ability to recognize and name various components.
  3. Provide immediate feedback to reinforce learning.
  4. Offer a hands-on learning experience that makes complex concepts more accessible.

How It Works

  1. Setup: All components are installed on a wooden board, each represented by an LED. The pointer, connected to the Arduino Mega, is used by students to interact with the components.
  2. Gameplay:
  3. The game begins by displaying an instruction on the 20x4 LCD, asking the student to point to a specific component.
  4. The student uses the pointer to touch the pin corresponding to the instructed component.
  5. Interaction:
  6. If the student points to the correct component:
  7. The corresponding LED lights up.
  8. The component's name is displayed on the LCD.
  9. A correct answer tone will sound (future integration).
  10. The timer stops, and the game moves to the next question.
  11. If the student points to the wrong component:
  12. A wrong answer tone will sound (future integration).
  13. The student is prompted to try again.
  14. Timer: Each question has a time limit of 2 minutes. If the time runs out, the game moves to the next component, and the timer is reset.



Supplies

Components Used

  1. Arduino Mega: The main controller for the game.
  2. 20x4 LCD Display with I2C Module: Displays the component names and game instructions.
  3. LEDs: Represent each electronic component.
  4. Pointer: Used by students to select components on the board.
  5. Buzzer (Future Integration): Provides audio feedback for correct and incorrect answers.
  6. Speaker (Future Integration): Pronounces the names of the components to the students.

Tools

  1. screws
  2. multimeter
  3. glue gun and sicks

Electronic Components Represented

  1. Small passive buzzer
  2. 2-color LED module
  3. Hit sensor module
  4. Vibration switch module
  5. Photo resistor module
  6. Key switch module
  7. Tilt switch module
  8. Infrared sensor module
  9. 3-color LED module
  10. Tilt open optical module
  11. Active buzzer module
  12. Temperature sensor
  13. Mini magnetic reed module
  14. Hall effect magnetic sensor
  15. Infrared sensor receiver
  16. Class Bihor magnetic sensor
  17. Magic light cup
  18. Rotary encoder
  19. Optical broken module
  20. Heartbeat detection module
  21. Reed module
  22. Obstacle avoidance sensor
  23. Hunt sensor module
  24. Microphone sound sensor
  25. Laser module
  26. 5V relay module
  27. Linear magnetic Hall sensor
  28. Flame sensor
  29. Sensitive microphone sensor
  30. Temperature and humidity sensor, etc.


Preparing the Wooden Board

d4d72d57-a969-44c7-aacd-124c30abe345.jpg
05c8b1be-b3f5-4de5-909d-ae1463162a20.jpg
edc8f3b1-bb7a-4fcf-990e-bc2867d29743.jpg
  1. Mark the Board:
  2. Begin by marking locations on the wooden board for each electronic component, its corresponding LED, and a screw where the pointer will make contact.
  3. Ensure that the layout is organized, with even spacing between components, LEDs, and screws.
  4. Drill Holes for LEDs and Screws:
  5. LED Holes: Drill small holes for each LED, making sure they are snug enough to hold the LEDs with only the bulb exposed.
  6. Screw Holes: Next to each component and LED, drill holes to insert screws. These screws will serve as the contact points for the pointer (connected to the Arduino), allowing the player to interact with the game.
  7. Install the LEDs and Screws:
  8. LEDs: Insert each LED through its respective hole, ensuring the positive (long) lead is correctly oriented for wiring. The LEDs will light up when the student selects the correct component.
  9. Screws: Insert screws into the pre-drilled holes, securing them tightly. These screws will serve as the target for the pointer tool. When the pointer touches the screw, it will signal the Arduino to check the student's answer.


Wiring the LEDs and Screws

bf670b6b-391d-4590-958f-7ae331a7db00.jpg
c8ac8ede-efe0-4f60-9725-fe96816757fd.jpg
  1. Connect the LEDs:
  2. Ground Connections (GND): First, connect the negative (short) leads of all the LEDs together in a chain (common ground). You can do this by soldering wires to each LED’s negative terminal and connecting them to a single wire.
  3. Arduino Ground (GND): Take the midpoint of the common ground wire and connect it to one of the GND pins on the Arduino.
  4. Connect the LED Positive Leads:
  5. Individual Connections to Arduino Pins: For each LED, connect the positive (long) lead to an individual digital pin on the Arduino. This will allow the Arduino to control each LED independently.
  6. For example, if you have 10 LEDs, connect them to pins like 2, 3, 4, 5, etc. on the Arduino.
  7. Connect the Screws to Arduino Pins:
  8. Attach wires to each screw on the wooden board and connect them to individual pins on the Arduino. These screws will act as the contact points for the pointer.
  9. When the pointer touches the screw, it completes the circuit, allowing the Arduino to register which component the student is pointing to.


Attaching the Components to the Board

60ca2fe8-d167-4ccd-acb5-8d5e5598bb92.jpg
b436d371-9dd1-4727-961b-f4f6ea81db09.jpg

Prepare the Components:

  1. Gather all the electronic components (like resistors, capacitors, transistors, etc.) that will be represented in the game.
  2. Make sure each component is clean and dry, ready for mounting.

Position the Components:

  1. Place each component next to its corresponding LED and screw on the wooden board. Ensure they are properly aligned so that the player can easily identify them.
  2. The components should be arranged in a clear and organized manner for easy access during gameplay.

Secure the Components with a Glue Gun:

  1. Use a glue gun to secure each component to the wooden board.
  2. Apply a small amount of glue to the back of each component and press it firmly onto the board until it sticks securely.
  3. Be careful not to get glue on the LED or screw connections to avoid interfering with the electrical contact.

Let the Glue Dry:

  1. Allow the glue to dry for a few minutes. Check to ensure that all the components are firmly attached and won’t shift during use.


Uploading the Code to the Arduino

Prepare the Arduino IDE:

  1. Connect your Arduino Mega to your computer using a USB cable.
  2. Open the Arduino IDE (make sure you have the necessary libraries installed, such as the LiquidCrystal_I2C library for the LCD display).

Load the Code:

  1. Copy the the code that controls the game (the code is provided in this instructables ).
  2. Ensure that all pin assignments in the code match the actual connections on your board (LEDs, screws, and LCD).

Select the Correct Board and Port:

  1. In the Tools menu of the Arduino IDE, make sure the Board is set to Arduino Mega
  2. Under Port, select the port to which your Arduino is connected.

Upload the Code:

  1. Click the Upload button (the right arrow icon) in the Arduino IDE to upload the code to the Arduino.
  2. The IDE will compile the code and upload it to the board. Once uploaded, your game will be ready to run.

Verify the Functionality:

  1. Once the upload is complete, test the system by using the pointer to select the components.
  2. The corresponding LED should light up when the pointer touches the correct screw, and the LCD should display the component name.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Initialize the LCD with the I2C address 0x27, 20 columns, and 4 rows
LiquidCrystal_I2C lcd(0x27, 20, 4);

// Define the pins for the LEDs, component areas, and buzzer
const int ledPins[] = {2, 3, 4, 5, 6, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30};
const int componentPins[] = {31, 32, 33, 34, 35, 36, 37, 38, 39\, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, A0};
const char* componentNames[] = {
"Small passive buzzer", "2-color LED module", "Hit sensor module", "Vibration switch module",
"Photo resistor module", "Key switch module", "Tilt switch module", "Infrared sensor module",
"3-color LED module", "Tilt open optical module", "Active buzzer module", "Temperature sensor",
"Mini magnetic reed module", "Hall effect magnetic sensor", "Infrared sensor receiver",
"Class Bihor magnetic sensor", "Magic light cup", "Rotary encoder", "Optical broken",
"Heartbeat detection", "Reed module", "Obstacle avoidance sensor", "Hunt sensor module",
"Microphone sound sensor", "Laser module", "5V relay module", "Linear magnetic Hall sensor",
"Flame sensor", "Sensitive microphone sensor", "Temperature and humidity sensor"
};
int currentComponent = 0;
int correctAnswers = 0;
int wrongAnswers = 0;

// Timer variables
unsigned long questionStartTime;
const unsigned long questionTimeLimit = 10000; // 10 seconds
unsigned long previousMillis = 0; // For updating the display periodically
bool timerRunning = true; // Flag to indicate whether the timer is running

void setup() {
lcd.begin(20, 4); // Initialize the LCD with 20 columns and 4 rows
lcd.backlight();

// Initialize LED pins as outputs
for (int i = 0; i < sizeof(ledPins) / sizeof(ledPins[0]); i++) {
pinMode(ledPins[i], OUTPUT);
}

// Initialize component area pins as inputs with pull-up resistors
for (int i = 0; i < sizeof(componentPins) / sizeof(componentPins[0]); i++) {
pinMode(componentPins[i], INPUT_PULLUP);
}

pinMode(10, OUTPUT); // Initialize the buzzer pin as an output

askQuestion();
}

void loop() {
unsigned long currentMillis = millis();
for (int i = 0; i < sizeof(componentPins) / sizeof(componentPins[0]); i++) {
if (digitalRead(componentPins[i]) == LOW) {
delay(200); // Debounce delay
if (i == currentComponent) {
correctAnswer();
} else {
wrongAnswer();
}
delay(2000); // Wait before asking the next question
askQuestion();
}
}
// Check for timeout only if timer is running
if (timerRunning && currentMillis - questionStartTime >= questionTimeLimit) {
timeout();
delay(2000); // Wait before asking the next question
askQuestion();
}
// Update the display every 200 ms
if (currentMillis - previousMillis >= 200) {
previousMillis = currentMillis;
if (timerRunning) {
displayTimeRemaining();
}
}
}

void askQuestion() {
currentComponent = random(0, sizeof(componentNames) / sizeof(componentNames[0])); // Randomly select a component
questionStartTime = millis(); // Record the start time of the question
previousMillis = millis(); // Reset the display update timer
timerRunning = true; // Start the timer
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Point to:");
// Display component name starting from the first line and continuing to the next line if necessary
lcd.setCursor(9, 0); // Position the cursor after "Point to:"
lcd.print(componentNames[currentComponent]);

// If the name is too long, continue on the next line
if (strlen(componentNames[currentComponent]) > 11) {
lcd.setCursor(0, 1);
lcd.print(componentNames[currentComponent] + 11);
}

lcd.setCursor(0, 3);
lcd.print("Score: ");
lcd.print(correctAnswers);
lcd.print("/");
lcd.print(correctAnswers + wrongAnswers);
}

void correctAnswer() {
correctAnswers++;
digitalWrite(ledPins[currentComponent], HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Correct!");
lcd.setCursor(0, 1);
lcd.print(componentNames[currentComponent]);
tone(10, 1000, 200); // Play a tone for 200 ms at 1000 Hz
delay(1000);
digitalWrite(ledPins[currentComponent], LOW);
timerRunning = false; // Stop the timer
}

void wrongAnswer() {
wrongAnswers++;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Wrong! Try again.");
tone(10, 500, 200); // Play a tone for 200 ms at 500 Hz
}

void timeout() {
wrongAnswers++;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Time's up!");
tone(10, 200, 500); // Play a tone for 500 ms at 200 Hz
}

void displayTimeRemaining() {
unsigned long timeRemaining = questionTimeLimit - (millis() - questionStartTime);
lcd.setCursor(0, 2);
lcd.print("Time left: ");
lcd.print(timeRemaining / 1000); // Convert milliseconds to seconds
lcd.print("s ");
}