Arduino Frequency Counter | Arduino Projects

This post shows how to build a frequency counter device using Arduino UNO board where signal frequency value is displayed on 1602 LCD screen.
With this counter we can measure frequency of PWM signals with peak voltage of 5V.

Related Project:
220/380V AC Frequency Meter with Arduino

Hardware Required:
This is a list of all components required to build this project.

  • Arduino UNO board   —-> Atmega328P datasheet
  • 16×2 LCD screen
  • 330 ohm resistor
  • 10k ohm variable resistor or potentiometer
  • Breadboard
  • Jumper wires

Arduino frequency counter circuit with LCD

Arduino frequency counter circuit:
Project circuit diagram is shown below.

The 16×2 LCD screen (2 rows and 16 columns) is used to display the values of frequency and period of the input voltage where:
RS —> Arduino digital pin 2
E   —> Arduino digital pin 3
D4 —> Arduino digital pin 4
D5 —> Arduino digital pin 6
D6 —> Arduino digital pin 7
D7 —> Arduino digital pin 8
VSS, RW, D0, D1, D2, D3 and K are connected to Arduino GND,
VEE to the 10k ohm variable resistor (or potentiometer) output,
VDD to Arduino 5V and A to Arduino 5V through 330 ohm resistor.

VEE pin is used to control the contrast of the LCD. A (anode) and K (cathode) are the back light LED pins.

Arduino frequency counter circuit with LCD

The PWM signal has two pins, let’s say positive (+) and negative (-), they are connected to the circuit as shown above.
The positive terminal is connected to Arduino digital pin 5 and the negative terminal is connected to Arduino GND pin.

Arduino frequency counter code
The following Arduino code requires a library which helps doing this project easily. This library is named FreqCount, it can be installed online through Arduino library manger (Manage Libraries…) or manually by downloading and installing its zip file. Download link is below:
Arduino FreqCount library    —-> direct link

The FreqCount library uses Timer/Counter1 module to count number of pulses during fixed time, Timer/Counter2 module is used for this fixed time.

Full Arduino code:

The video below shows a protoboard circuit of the project:


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

11 thoughts on “Arduino Frequency Counter | Arduino Projects”

  1. I like these types of projects. I would have liked to see the hidden lower portion of your breadboard. And, I’d be interested to know what the minimum and maximum frequencies are available with this setup. From your video I see it can go up to about 1.003MHz. Can this device go down to 0 or 1Hz?

  2. Hi, do you have the details for Adafruit Huzzah esp8266 for the FreqCountTimers.h
    ie the details as for example the Duemilanove
    // Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, etc
    #elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega168__)
    #define COUNTER_USE_TIMER1 // T1 is pin 5
    #define TIMER_USE_TIMER2

  3. Yes, I will really appreciate some help on how to increase accuracy of 0.XX for low frequency events.

    Best regards & thanks for the provided code, works very nice.

  4. i tried it with Proteus, it doesn’t work. the lcd is okay, but suddenly the pulse from generator dissapear

    1. Simple Projects

      Actually there’s no need to define frequency input pin because the frequency library (FreqCount.h) uses Timer/Counter1 module of the ATmega328P microcontroller to calculate number of pulses during a predefined period, this means pulses source must be connected to Arduino UNO digital pin 5.
      If you look at ATmega328P pin configuration then you may see (PCINT21/OC0B/T1) on pin RD5 (pin number 11).

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top