Frequency multiplierLCD-LED Display

Frequency counter using Arduino (upto 40KHz) Schematic Circuit Diagram

Many people have been inquiring about a frequency counter, and I finally had the opportunity to create one. This Arduino-based frequency counter is designed for the UNO version and can count frequencies up to 40KHz. It utilizes a 16×2 LCD display to show the frequency count. The circuit is simple, requiring minimal external components, and directly counts the frequency. However, please note that the input frequency’s amplitude should not exceed 5V. If you need to measure signals above 5V, you’ll need to add additional limiting circuits, which I’ll cover at a later time. For now, let’s focus on working with 5V signals.

Frequency Counter

The frequency you want to count is connected to digital pin 12 of the Arduino. In this project, we use the pulseIn() function to count the frequency connected to pin 12. The pulseIn() function tallies the number of pulses (either HIGH or LOW) arriving at a specific Arduino pin. Its general syntax is pulseIn(pin, value, time), where pin is the pin’s name, value can be either HIGH or LOW, and time is the duration for which the function waits for a pulse. If no valid pulse is detected within the specified time, the function returns zero. The pulseIn() function can count pulses with time periods ranging from 10 microseconds to 3 minutes. You can find the circuit diagram for the frequency counter using Arduino below:

Frequency counter using Arduino (upto 40KHz) Schematic Circuit Diagram

We use Potentiometer R1 to fine-tune the contrast of the LCD screen, while Resistor R2 serves to limit the current flowing through the backlight LED.

In our program, we employ separate pulseIn() functions to measure the high and low times of the input signal. Afterward, we add these high and low times together to obtain the total time period of the signal. Calculating the frequency is as simple as taking the reciprocal of the time period in seconds. Since the pulseIn() function provides the time period in microseconds, we first divide the total time period in microseconds by 1000 to convert it to milliseconds. Then, we calculate the frequency in hertz by taking 1000 divided by the result. Below, you’ll find the program for the Arduino-based frequency counter:

Program

 

#include 
int input=12;

int high_time;
int low_time;
float time_period;
float frequency;
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup()
{
pinMode(input,INPUT);
lcd.begin(16, 2);
}
void loop()
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Frequency Meter");

high_time=pulseIn(input,HIGH);
low_time=pulseIn(input,LOW);

 
time_period=high_time+low_time;
time_period=time_period/1000;
frequency=1000/time_period;
lcd.setCursor(0,1);
lcd.print(frequency);
lcd.print(" Hz");
delay(500);
}

You can provide power to the circuit through the Arduino’s 9V external power jack. For the 5V DC needed in certain parts of the circuit, you can draw power from the Arduino’s built-in 5V regulator. Essentially, this is a straightforward Arduino-based counter circuit. It’s possible to adapt this circuit for various other purposes, such as a tachometer or an intrusion counter, with some modifications.

Tags

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button
Close
Close