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

Arduino UNO Controlled Touch-Activated LED Circuit

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Touch-Activated LED Circuit

Circuit Documentation

Summary of the Circuit

This circuit is designed around an Arduino UNO microcontroller and includes a simple LED circuit with a resistor for current limiting. The LED is controlled by the Arduino, which turns it on when a metal contact connected to another pin is touched, creating a connection to ground. The circuit uses alligator clip cables for connections and includes a pull-up resistor configuration for the metal contact input.

Component List

Arduino UNO

Resistor

LED: Two Pin (red)

12978-alligator_clip_cable_half-yellow

12978-alligator_clip_cable_half-blue

Wiring Details

Arduino UNO

Resistor

LED: Two Pin (red)

12978-alligator_clip_cable_half-yellow

12978-alligator_clip_cable_half-blue

Documented Code

// Declaration of pins
const int ledPin = 9;       // LED pin
const int metalPin = 2;     // Pin for metal contact
const int resistorValue = 220; // Value of the resistor

void setup() {
  // Initialize the LED pin as an output
  pinMode(ledPin, OUTPUT);

  // Initialize the metal pin as an input with internal pull-up
  pinMode(metalPin, INPUT_PULLUP);

  // Turn off the LED by default
  digitalWrite(ledPin, LOW);
}

void loop() {
  // Read the state of the metal contact
  int metalContact = digitalRead(metalPin);

  // If metal touches the conductor (contact with GND)
  if (metalContact == LOW) {
    // Turn on the LED
    digitalWrite(ledPin, HIGH);
  } else {
    // Turn off the LED
    digitalWrite(ledPin, LOW);
  }
}

File Name: sketch.ino

This code is written for the Arduino UNO and controls an LED based on the state of a metal contact. The LED is connected to pin D9 and is turned on when the metal contact connected to pin D2 is touched, pulling the pin to ground. The internal pull-up resistor on pin D2 ensures that the pin is normally high when the contact is not touched.