Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Samantha Ghartey
Published

Frequency Detection Circuit

A frequency detection circuit made with Arduino in TinkerCad

BeginnerFull instructions provided148
Frequency Detection Circuit

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Buzzer, Piezo
Buzzer, Piezo
×1
LED (generic)
LED (generic)
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 220 ohm
Resistor 220 ohm
×1

Software apps and online services

Tinkercad
Autodesk Tinkercad

Story

Read more

Schematics

Frequency Detection Circuit in TinkerCad

Code

Arduino Code for Frequency Detection Circuit

C/C++
// C++ code
//

const int redPin = 13;
const int greenPin = 10;
const int yellowPin = 8;
const int buzzerPin = 3;



void setup()
{
 pinMode(redPin,OUTPUT);
 pinMode(greenPin,OUTPUT);
 pinMode(yellowPin,OUTPUT);
 pinMode(buzzerPin,OUTPUT);
  Serial.begin(9600);

}

void loop()
{
  int freq = random(600,2000);
  digitalWrite(buzzerPin,HIGH);
  tone(buzzerPin,freq);
  
  Serial.print("Frequency: ");
  Serial.print(freq);
  Serial.print("\n");
  
  if(freq < 800){
    digitalWrite(redPin,HIGH);
    digitalWrite(yellowPin,LOW);
    digitalWrite(greenPin,LOW);
  }else if(freq >= 800 && freq <= 1500){
    digitalWrite(redPin,LOW);
    digitalWrite(yellowPin,HIGH);
    digitalWrite(greenPin,LOW);

  }else{
    digitalWrite(redPin,LOW);
    digitalWrite(yellowPin,LOW);
    digitalWrite(greenPin,HIGH);

  }
  delay(1000);
  noTone(buzzerPin);
  delay(500);
    

} 

Credits

Samantha Ghartey
2 projects • 0 followers
I am an electrical engineering student by day and an absolute tech addict by night.
Contact

Comments

Please log in or sign up to comment.