I have designed this project using Arduino UNO and have simulated in the Proteus software, which you all know is my favorite simulating software. :) The code is also quite simple which I have given below for download. The simulation is also included in download package but again I suggest you to design it on your own. If you got into any trouble then ask in comments and I will try to resolve them. Anyways let's get started with How to measure frequency using Arduino.
#include <LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
long freq, tempo;
int pulsos;
boolean pulso;
void setup() {
pulso=HIGH;
pinMode(2,INPUT);
lcd.begin(20, 4);
lcd.setCursor(0,0);
lcd.print("Frequency =");
lcd.setCursor(1,2);
lcd.print("www.TheEngineering");
lcd.setCursor(4,3);
lcd.print("Projects.com");
}
void loop() {
tempo = millis();
if(digitalRead(2)==HIGH)
{
if(pulso==HIGH)
{
pulsos = pulsos + 1;
}
pulso=LOW;
}
else{
pulso=HIGH;
}
if(tempo%2000==0){
freq = pulsos/2;
lcd.setCursor(12,0);
lcd.print(freq);
lcd.print("Hz");
pulsos=0;
}
}
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w