Build your home-made 500Khz Frequency meter!
Home-made, accurate, and simple solution!
Based on the famous AT89C52 microcontroller , this 500 Khz frequency-Meter will be enough to trace and debug most of your circuits, to adjust 555 timers frequency and perform all kind of frequency measurements in Digital circuits. And once you have this tool between your hand, you will get used to it to the point of no-return! and you will say "remember the days we adjusted the frequency by trial and error till we get it..!"
Note: This tutorial assumes you already have some basic notions about microcontrollers and general electronics skills.
To understand the block diagram below, you should recall the simplest definition of frequency: "the number of occurrences within a given time period". What we are trying to do is to count the number of electric pulses during a time of one second. To do this we need a counter, to count the pulses, and a timer so that every 1000 milliseconds, the processor stop counting, calculate the frequency and display it, then start counting again from zero.
This is the principle of operation of a frequency meter, however, to build a reliable frequency meter, we will need to do some more mathematical operations. For example: Some operations will accurately predict the frequency before waiting for a whole second to elapse, which will also increase the refresh rate. Another minor upgrade is to to display the average of the last 5 reading rather than displaying the frequency instantaneously (which can cause lot of display flickering if the frequency being measured is not very stable).
This project will be discussed in two Parts, the Hardware and the Software.
And by the way, after I hacked that poor Avo-Meter, I also used the same leads for our frequency meter.
Finally you can also notice the 2 connections for the leads (Blue shaded area). those connectors are standard for the test leads of most AVO meters and testing devices.
Before Getting into the electronics, here is a final trick: To make the display look even neater and Protect it from dust and scratches, simply add a thin plastic film on top of it (it will be firmly held in its place when the frequency meter is re-assembled).
I am sure that you understand that to accomplish this project, we will need to perform some mathematical operations, as mentioned before, to increase the performance of the device. Thus we will rely on an AT89C52 microcontroller to perform all the required tasks in this project.
While being very simple (as you can see in this diagram), the display system can seem complicated due to the high number of connections (as you can see in the schematic below).
The main idea for this display system, is to connect all the 7-segment cells together in parallel, but only power one of them in the same time.
9-wait for a short time delay..
12-wait for a short time delay..
13-Start over from the step No: 1.
Believe it or not, the human eye wont notice anything wrong, because, with the given delays the display will refresh at the rate of 375 cycles per second (375 Hz!) and the human eye can hardly notice some flickering in a display refreshing at 24 Hz.
Now That you understand the display process, you should be able to easily follow the schematic above.
Q1,Q2,Q3,Q4 2N2222 switching transistors to drive the 7-segment displays.
DD1 to DD4 7-segmets display, common Anode type.
Nothing really critical about this part, since we only intend to measure TTL frequencies, the input is directly fed to the TO pin of the AT89C52, which will be used as a counter (more details about this in the software part).
P1 and P2 are simply the 2 connections for the test leads. Note that in order to make any kind of measurements on another circuit, the ground of the Measurement device and of the circuit being tested must be connected together, this is why there are at least 2 leads in any testing device (one for the Ground and one for the measured signal).
This part is standard in any circuit containing an AT89C52.
-The switch SW1 will reset the micro-controller and start the program from the beginning.
-C1 and C2 are 27pF, any nearby value between 20 and 40 pF will work just fine.
12Mhz crystals will result in maximum measurable frequency of 250 Khz instead of 500Khz.
Don't forget to connect the PIN 31 to the 5V, otherwise the microcontroller wont work.
Now you have to bear in mind the simple block diagram of a frequency meter shown at the top of the page. You can download the whole code in one file here, but even a professional programmer would easily get lost in someone's else code, so my advice is to try to understand how it is working, and then write your own version of the code.
Now, here is a simplified flow chart of the main loop. next to each box, you can see the corresponding source code, this can help you to understand how each step is programmed.
The Counter and the Timer.
Let us get in touch with you when we upload new interesting content.
Preview of the last 15 messages discussing this page. Messages are sorted from the newest to the oldest.
if I replace the AT89C52 with the Pic16f877A what I have to change than to get some good results ?
apparently that Mr:Ibrahim is not care about us >>>!!!
so we can help each other .
It's not that i don't care, it's that it have been years since i last used a 8051. I don't even have the tools (software/hardware) to develop 8051 applications..
Anyway, i also don't understand what is your problem and how can i help...?
we had been waiting a long time but no body answer !!!
apparently that Mr:Ibrahim is not care about as>>>!!!
Hello ! I'm student and I'm trying to do the same project ! With the difference of limit of 2MHz.
Trying to take ur example, I loaded the *.hex to AT89C52 of Proteus, but I doesn't work, I've checked ur code and are somethings that I'm not understan very well.
Basically we take an external input for Timer 0 and that is our frequency to measure ? I really apreciate if u can give some help or orientation about this !
Something like the algorithm of ur program for better understanding !
I would like to know about how to make the software < then how to connect the microcontroller for the software .
Tell us some more info... after you burn and verify, verify is OK?
when you say it doesn't work, u mean no any LEDs light? what exactly is the situation?
Quoting chats: Can this meter be used to verify output of a frequency generator.?
TTL = Transistor to Transistor logic, it is the most basic 0V / 5V logic levels.
You have to be a member to post replies.
Register now! it only takes an instant.
ikalogic.com: Electronics and Robotics related projects.
All content on this site is provided as is and without any guarantee of any kind. We cannot be held responsible for any errors, omissions, or damages arising out of use of information available on this web site.
IMPORTANT COPYRIGHT NOTE: Electronics and Robotics Articles by Ibrahim KAMAL are licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 United States License.