Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO-Based Scoreboard with Light Detection and LED Indicators

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Scoreboard with Light Detection and LED Indicators

Circuit Documentation

Summary

The circuit is designed to function as a scoreboard system, utilizing two photocells (LDRs) to detect scores for two teams. When a score is detected, an LED for the corresponding team is illuminated. The Arduino UNO microcontroller reads analog inputs from the photocells and controls the LEDs based on the sensor values. The circuit includes resistors for current limiting and voltage division purposes.

Component List

Arduino UNO

Photocell (LDR)

Resistor (200 Ohms)

LED: Two Pin (red)

Wiring Details

Arduino UNO

Photocell (LDR)

Resistor (200 Ohms)

LED: Two Pin (red)

Documented Code

/*
  Scoreboard Project

  This code reads analog inputs from two photocells (LDRs) connected to pins A0
  and A1. If the analog value of either photocell is below a threshold, it
  indicates a score by turning on an LED connected to pin D13 for team 1 or
  pin D12 for team 2. Otherwise, it turns off the respective LED and prints the
  sensor values to the Serial Monitor.
*/

// Pin definitions
const int photocellPin1 = A0;  // Photocell for team 1 connected to A0
const int photocellPin2 = A1;  // Photocell for team 2 connected to A1
const int ledPin1 = 13;        // LED for team 1 connected to D13
const int ledPin2 = 12;        // LED for team 2 connected to D12

// Threshold for detecting a score
const int threshold = 10;

void setup() {
  // Initialize serial communication at 9600 bits per second
  Serial.begin(9600);
  // Initialize the LED pins as outputs
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
}

void loop() {
  // Read the input on analog pins A0 and A1
  int sensorValue1 = analogRead(photocellPin1);
  int sensorValue2 = analogRead(photocellPin2);
  // Check if the sensor value for team 1 is below the threshold
  if (sensorValue1 < threshold) {
    Serial.println("Team 1 Scores!");
    digitalWrite(ledPin1, HIGH);  // Turn the LED on for team 1
    delay(1000);  // Delay for 1 second
  } else {
    digitalWrite(ledPin1, LOW);  // Turn the LED off for team 1
    Serial.print("Team 1: ");
    Serial.println(sensorValue1);  // Print the sensor value for team 1
  }
  // Check if the sensor value for team 2 is below the threshold
  if (sensorValue2 < threshold) {
    Serial.println("Team 2 Scores!");
    digitalWrite(ledPin2, HIGH);  // Turn the LED on for team 2
    delay(1000);  // Delay for 1 second
  } else {
    digitalWrite(ledPin2, LOW);  // Turn the LED off for team 2
    Serial.print("Team 2: ");
    Serial.println(sensorValue2);  // Print the sensor value for team 2
  }
  delay(1);  // Delay in between reads for stability
}

Filename: Scoreboard sketch 20241008.ino