Menu Close

Frequency Meter – Arduino

This tutorial of Robo India explain, how to measure the frequency of the incoming signals using Arduino.

1. Introduction:

In this tutorial, we have measure the frequency of the signal generated by the 555 timer IC. This frequency meter can measure frequency up to 1MHz.

555 timer IC used in this tutorial are configured to work in astable mode i.e the output continually switches state between high and low without any user interfacing. This variable frequency will be send to arduino as input.

Arduino measures the time between HIGH and LOW level of the signal and returns the value in microseconds. After adding the duration of both the times between HIGH to LOW and LOW to HIGH, inverse of this value will give the frequency of the signal.

The range of frequency of the signal generated by the timer, is depend on the value of capacitor we have used. By rotating the preset attached with the circuit, we can increase or decrease the value of frequency displayed on the LCD.

1.1 555 Timer IC Pin Diagram:

555 timer IC is used as pulse generator. This IC can be used to provide time delays, as an oscillator, and as a flip-flop element.

Pin 1 (Ground pin) : Ground pin.

Pin 2 (Trigger pin) : Connects with Pin 6. If pin2 and pin6 are LOW, then output goes and stays HIGH, but if pin6 is HIGH and pin2 is LOW, then output goes LOW.

Pin 3 (Output pin) : Goes HIGH and LOW and will deliver up to 200mA.

Pin 4 (Reset pin) : To reset the chip.

Pin 5 (Control pin) : Provide control access to the internal voltage divider.

Pin 6 (Threshold pin) : Detects 2/3 of voltage to make output LOW, only if pin2 is HIGH.

Pin 7 (Discharge pin) : Open collector output which may discharge a capacitor between intervals.

Pin 8 (Supply pin): Connects with the 5V power supply.

2. Hardware required

S.No.ItemQuantity
1.Arduino 1
2.Breadboard 1
3.Capacitor 0.1uF 1
4.555 Timer IC 1
5.10k Preset 1
6.Male to Female Jumper Wires 4
7.Male to male Jumper Wires 11
8I2C Scanner LCD Backpack 1

3. Building Circuit

4. Programming

You may download this arduino sketch (code) from here.

#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3F,2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  //to get display on lcd

const int input = 7; // timer generated wave as input, given to Arduino

//----variable declaration-------------
int HighInput;       // store high time of wave
int LowInput;        // store low time of wave
float TotalInput;    // to store total time duration between high and low pulse
float frequency;     

void setup()
{
    pinMode(input,INPUT);
    lcd.begin(16, 2);
    lcd.backlight();
    lcd.setCursor(0,0);
    lcd.print("Robo India");
    lcd.setCursor(0,1);
    lcd.print("Freq Counter");
    delay(2000);
}
void loop()
{
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("Frequency:");
    lcd.setCursor(0,1);
    lcd.print(" ");
    
    HighInput = pulseIn(input,HIGH);
    LowInput = pulseIn(input,LOW);
    
    TotalInput = HighInput + LowInput; 
    frequency=1000000/TotalInput;      
    
    lcd.setCursor(0,1);
    lcd.print(frequency);
    lcd.print(" Hz");
    delay(500);
}

5. Output

Attached LCD displays the frequency of the signal.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

Leave a Reply