Frequency Counter using Arduino - Internet of Things

Frequency Counter using Arduino

Arduino Frequency Counter Tutorial

Almost every electronic hobbyist must have faced a scenario where he or she must measure the frequency of signal generated by a clock or a counter or a timer.  We can use oscilloscope to do the job, but not all of us can afford an oscilloscope. We can buy equipment for measuring the frequency but all these devices are costly and are not for everyone. With that in mind we are going to design a simple yet efficient Frequency Counter using Arduino Uno and Schmitt trigger gate.

This Frequency Counter is cost effective and can be easily made, we are going to use ARDUINO UNO for the measuring the frequency of signal, UNO is the heart of project here.
To test the Frequency Meter, we are going to make a dummy signal generator. This dummy signal generator will be made by using a 555 timer chip. The timer circuit generates a square wave which will be provided to UNO for testing.
With everything in place we will have a Frequency meter and a square wave generator.

Required Components:
·         555 timer IC and 74LS14 Schmitt trigger gate or NOT gate.
·         1K resistor(2 pieces), 100 resistor
·         100nF capacitor (2 pieces), 1000µF capacitor
·         16*2 LCD,
·         47K pot,
·         Breadboard and some connectors.

Circuit Explanation:
The circuit diagram of the Frequency Meter using Arduino is shown in below figure. Circuit is simple, a LCD is interfaced with Arduino to display the measured frequency of signal. ‘Wave Inputis going to Signal Generator Circuit, from which we are feeding signal to Arduino. A Schmitt trigger gate (IC 74LS14) is used to ensure that only rectangular wave is fed to Arduino. For filtering the noise we have added couple of capacitors across power. This Frequency Meter can measure frequencies up to 1 MHz.
Signal generator circuit and Schmitt trigger have been explained below.

Signal Generator using 555 Timer IC:
First of all we will talk about 555 IC based square wave generator, or should I say 555 Astable Multivibrator.  This circuit is necessary because, with the Frequency Meter in place we must have a signal whose frequency is known to us. Without that signal we will never be able to tell the working of Frequency Meter. If we have a square have of known frequency we can use that signal to test the UNO meter and we can tweak it for adjustments for accuracy, in case of any deviations. The picture of Signal Generator using 555 Timer IC is given below:

Typical circuit of 555 in Astable mode is given below, from which we have derived the above given Signal Generator Circuit.
The output signal frequency depends on RA, RB resistors and capacitor C. The equation is given as,
Frequency (F) = 1/ (Time period) = 1.44/ ((RA+RB*2)*C).
Here RA and RB are resistance values and C is capacitance value. By putting the resistance and capacitance values in above equation we get the frequency of output square wave.
One can see that RB of above diagram is replaced by a pot in the Signal Generator Circuit; this is done so that we can get variable frequency square wave at the output for better testing. For simplicity, one can replace the pot with a simple resistor. 

Schmitt Trigger Gate:
We know that all the testing signals are not square or rectangular waves. We have triangular waves, tooth waves, sine waves and so on. With the UNO being able to detect only the square or rectangular waves, we need a device which could alter any signals to rectangular waves, thus we use Schmitt Trigger Gate. Schmitt trigger gate is a digital logic gate, designed for arithmetic and logical operations.
This gate provides OUTPUT based on INPUT voltage level. A Schmitt Trigger has a THERSHOLD voltage level, when the INPUT signal applied to the gate has a voltage level higher than the THRESHOLD of the logic gate, OUTPUT goes HIGH. If the INPUT voltage signal level is lower than THRESHOLD, the OUTPUT of gate will be LOW. We dont usually get Schmitt trigger separately, we always have a NOT gate following the Schmitt trigger. Schmitt Trigger working is explained here: Schmitt Trigger Gate
We are going to use 74LS14 chip, this chip has 6 Schmitt Trigger gates in it. These SIX gates are connected internally as shown in below figure.
The Truth Table of Inverted Schmitt Trigger gate is show in below figure, with this we have to program the UNO for inverting the positive and negative time periods at its terminals.
Now we will feed any type of signal to ST gate, we will have rectangular wave of inverted time periods at the output, we will feed this signal to UNO.

Arduino measures the Frequency:
The Uno has a special function pulseInwhich enables us to determine the positive state duration or negative state duration of a particular rectangular wave:
Htime = pulseIn(8,HIGH);
Ltime = pulseIn(8, LOW);
The given function measures the time for which High or Low level is present at PIN8 of Uno. So in a single cycle of wave, we will have the duration for the positive and negative levels in Micro seconds. The pulseIn function measures the time in micro seconds. In a given signal, we have high time = 10mS and low time = 30ms (with frequency 25 HZ). So 30000 will be stored in Ltime integer and 10000 in Htime. When we add them together we will have the Cycle Duration, and by inverting it we will have the Frequency.

  Demo & Code


Frequency Counter using Arduino Frequency Counter using Arduino Reviewed by XXX on สิงหาคม 27, 2560 Rating: 5

ไม่มีความคิดเห็น