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

Arduino UNO-Based Piezo Sensor Triggered LED Indicator

View and Edit Project In Cirkit DesignerImage of Arduino UNO-Based Piezo Sensor Triggered LED Indicator

Circuit Documentation

Summary

This document provides a detailed overview of a circuit that includes an Arduino UNO microcontroller, a red two-pin LED, two resistors, a piezo sensor, and an OLED display. The circuit is designed to detect a threshold value from the piezo sensor and illuminate the LED when the threshold is exceeded. The Arduino UNO is used to read the sensor data and control the LED state.

Component List

Arduino UNO

LED: Two Pin (red)

Resistor (2x)

Piezo Sensor

OLED Display 2.42"

Wiring Details

Arduino UNO

LED: Two Pin (red)

Resistor (2x)

Piezo Sensor

OLED Display 2.42"

Documented Code

int sensoroutput = 3; // the analog pin connected to the sensor
int ledoutput = 0; // pin connected to LED
int THRESHOLD = 100;

void setup()
{
  pinMode(ledoutput, OUTPUT);   // this function is used to declare led connected pin as output
}

void loop()
{
  int value = analogRead(sensoroutput);  // function to read analog voltage from sensor
  if (value >= THRESHOLD)                    // function to check voltage level from sensor
  {
    digitalWrite(ledoutput, HIGH);
    delay(100); // to make the LED visible
  }
  else
  {
    digitalWrite(ledoutput, LOW);
  }
}

Filename: sketch.ino

Description: The code is written for an Arduino UNO microcontroller. It initializes a digital output pin for the LED and an analog input pin for the piezo sensor. In the main loop, the sensor's analog value is read and compared against a predefined threshold. If the value exceeds the threshold, the LED is turned on for a short period; otherwise, it is turned off.