P1040428.JPG
P1040421.JPG
P1040430.JPG
I am in the process of designing a function generator and I needed a frequency counter to check it against. This project uses a minimal number of components for a very economical and compact design. A bare-bones Arduino clone is at the heart of this project and the measured frequency is shown on an LCD display.

The maximum frequency that this can measure is about 8 MHz (at a 50% duty cycle). Despite the fact that this counts the frequency on one of the digital pins, I have found that it will quite happily measure sine and triangle waves providing that they have a suitable amplitude.

Although the version that I built is a standalone unit, this circuitry could be easily incorporated into another project such as a function generator.
 
Remove these adsRemove these ads by Signing Up

Step 1: Bill of materials

(1x) 220R resistor
(2x) 10K resistors
(2x) 47uF electrolytic capacitors
(2x) 22pF ceramic capacitors

(1x) 1N4001 diode (any of the 1N400X series will do)
(1x) 16 MHz crystal
(1x) 7805 voltage regulator
(1x) ATmega328p-pu (programmed with the Arduino bootloader)
(1x) 2x16 LCD display (HD44780 compliant)

(1x) 28 pin DIL socket
(1x) SPST toggle/rocker switch
(1x) DC power socket
(1x) piece of stripboard 20 strips x 25 holes
(1x) project enclosure
(2x) 4mm banana sockets or (1x) BNC chassis-mount socket

The only tricky part to get for this project is the Atmel ATmega328p-pu microcontroller. Ordinarily this would not be a problem, but it has to have the Arduino bootloader installed on it. You can buy them on eBay very cheaply. You will also need a way to program the microcontroller. The easiest way to do this is using another Arduino board. See Step 5 for more details.
Jimmy Proton says: Apr 6, 2013. 3:01 PM
Could you just put a 5V regulator on the input?
pertti56 says: Nov 24, 2012. 2:49 AM
Hi,

Just built one. Great concept!
I happen to have a problem with mine. It won't measure the frequency. It only prints:
0 536 to the frequency area.

Would you happen to have any ideas what is wrong?
Harrymatic (author) says: Nov 24, 2012. 4:16 AM
What kind of signal are you trying to measure?
pertti56 says: Nov 24, 2012. 11:06 AM
1KHz Sine wave but it prints "0 536" even when not connected to any source.
Harrymatic (author) says: Nov 24, 2012. 1:02 PM
All I can recommend is that you check all of the soldering in case there are any bridged connections / dry joints etc. Failing that, it may be worth trying it with a different power supply - if you have a particularly noisy power supply it may be causing the microcontroller to crash on startup.

When you say it only displays 0536 in the frequency area, does it also display the first line of the LCD that should read 'Frequency /Hz' ?
pertti56 says: Nov 25, 2012. 2:51 AM
The first line is correct. It prints the 'Frequency /Hz'. Interesting is that why there is a space between the zero and the 5 in the frequency field. '0 536'
amandaghassaei says: Nov 14, 2012. 11:50 AM
can you explain a little bit more about how this measures frequency? does it only work for pulse waves? thanks!
Harrymatic (author) says: Nov 14, 2012. 12:55 PM
The software uses the FreqCounter library, which counts the number of 0V-5V cycles which occur per unit of time (this unit is specified in the code). It is not very accurate for counting frequencies lower than several hundred Hz, as there are fewer cycles per unit time, so the accuracy decreases with frequency. As most of the number crunching for this project is done by the FreqCounter library, you don't really see what is going on just be looking at the Arduino sketch.

Although you would expect it only to work with 0V-5V square/pulse waves as it is counting frequency at one of the digital pins, I have found that it will quite capably measure sine and triangle waves as well, provided they have a high enough amplitude.
amandaghassaei says: Nov 14, 2012. 1:34 PM
ok, you should check out what I did here:
http://www.instructables.com/id/Arduino-Frequency-Detection/
AtomRat says: Nov 11, 2012. 2:58 PM
exciting looking project and I cannot wait for the generator as well! Do you know if an Atmega32-8PC could work as I have a couple at home here
Harrymatic (author) says: Nov 12, 2012. 9:17 AM
Hmm, I've had a look at the datasheet - it may be possible. Take at look at this guide for how to run the Arduino bootloader on other kinds of Atmel microcontrollers. I'm not sure it will work as I think that the FreqCounter library is hard-coded to run on a 32p-pu, but it's definitely worth a go.
AtomRat says: Nov 12, 2012. 2:45 PM
Thanks for the info, I'm really new to Arduino as I started with PIC, but I should be able to figure it out. I'll tell you here if it works and if I can get the bootloader onto it. Thanks for the link!
ajoyraman says: Nov 11, 2012. 8:49 PM
Great Work !
Adding a 'Period' mode would make this counter more useful while measuring frequencies of 100Hz and below. Should be a quick software fix.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!