# Frequency counter measuring burst signal

I want to build a frequency counter for measuring mobile transmitter by using Arduino atmega328.

It can measure frequency range from 100MHz to 600MHz (1GHz will be advanced), and display freq. on LCD1602 (16x2).

It can measure both continue carrier and burst carrier (fixed freq, with about 30ms on, and 30ms off alternatively).

It can show the signal whether it is a continue or non-continue signal on LCD1602 (2x16). The LCD should show xxx.xxxMHz (accuracy in KHz is acceptable, in 100Hz would be advanced)

I am a beginner on arduino, but I have knowledge in C language, Any suggestion on this project ?

Thanks you very much !!

This would be difficult to do for measuring a continuous steady frequency but burst carrier makes the project a no no IMO. Other may beg to differ.

If I build the freq. counter to measure continuous carrier first. Any guildline/web for reference for me please ?

Maybe this will help and as the micro controller used is from the Atmel AT family it should convert quite well. Use "Frequency Counter Prescaler" as the google search term to find other examples.

Is my brain especially slow today ....

How can a 16MHz MCU measure a 100MHz signal ?

...R

Robin2: How can a 16MHz MCU measure a 100MHz signal ?

Using a prescaler or binary counter. You loose some accuracy unless you can stop the reference signal and inject your own (controlled) pulses to count how many more are needed to trigger the next output pulse.

Is it possible us the one or more "pulsein()" as the gate time, and then count the number of pulse during the gate time, so as to calculate the input freq. (no. of pulse / gate time) ?

prescaler = 1 (no prescaler) => accuracy = 1HZ prescaler = 100 => accuracy = 100HZ prescaler = 1000 => accuracy = 1KHz

chanman60: Is it possible us the one or more "pulsein()" as the gate time, and then count the number of pulse during the gate time, so as to calculate the input freq. (no. of pulse / gate time) ?

...R

If the input 100Mhz signal is divided by 100 with a prescaler, then the signal go into the MCU will be 1Mhz, the accuracy of counter become 100hz, am I rigjt?

I am sorry sorry that I do not understand the reply#5 the "reference signal" means the input signal or system clock? As the inject pulse frequency is unknown, number of pulse inject is also unknown, how can it help to find the frequency ? and also how the numbet of injected pulse trigger the next output pluse? I do not undersyand.

chanman60: I am sorry sorry that I do not understand the reply#5 the "reference signal" means the input signal or system clock? As the inject pulse frequency is unknown, number of pulse inject is also unknown, how can it help to find the frequency ? and also how the numbet of injected pulse trigger the next output pluse? I do not undersyand.

If you have a 100:1 pre-scaler then for every 100 input pulses it outputs 1 pulse. If your measuring over a fixed time period then you could have say 380 input pulses but only 3 output pulses in the period giving an 80 pulse error. If after the time period is finished you can stop/disconnect the input pulses and start injecting your own pulses until the output pulses one more time (in this example another 20 pulses) then you know to add another 80 to your (3*100) output count to give you a more accurate frequency count. Another way to do this is to measure the time between x output pulses instead of counting them over a fixed time period and this will also give you the frequency with a bit of maths.

chanman60: I am sorry sorry that I do not understand the reply#5

Always a good idea to say so. Otherwise we assume you do understand things and we do not know know that you need more advice.

...R

Robin2: Always a good idea to say so. Otherwise we assume you do understand things and we do not know know that you need more advice.

...R

Thank you for your reply Sorry for my poor english. It is clear now.

In the second method, but I do not know how to catch / predict / synchronize the start and the end time of the pulses. l have found a command "pulsein()", is it usefull to count the pulses in and stop time?

chanman60:
In the second method, but I do not know how to catch / predict / synchronize the start and the end time of the pulses. l have found a command “pulsein()”, is it usefull to count the pulses in and stop time?

By second method I assume your talking about measuring the time between x pulses?
I would use a timer in counting mode that marks the time and counts the pulses that’s fired by the prescaler output pulses. The main loop would zero/arm the interrupt and wait till enough pulses have been counted (the more pulses the more accurate the result) then get the time interval.
Have a look at this as it pretty much does what your software needs to do. Or this thread for an external counter.

Riva: By second method I assume your talking about measuring the time between x pulses? I would use a timer in counting mode that marks the time and counts the pulses that's fired by the prescaler output pulses. The main loop would zero/arm the interrupt and wait till enough pulses have been counted (the more pulses the more accurate the result) then get the time interval. Have a look at this as it pretty much does what your software needs to do. Or this thread for an external counter.

Using a counter and count up to a preseted number of pulse. mark the start and end time of the pulse, so the freq can be calculate. however, how to mark the start time ? by periodically interrupt and test whether there is any pulse at the input during the interrupt?

chanman60:
Using a counter and count up to a preseted number of pulse. mark the start and end time of the pulse, so the freq can be calculate. however, how to mark the start time ? by periodically interrupt and test whether there is any pulse at the input during the interrupt?

Your best bet is to read the pjrc link as it will probably explain better than I seem to be doing. It explains the difference between frequency counting and measuring and if you look at the libraries it uses you will maybe get some idea of how it’s doing it.

I have also attached some test code I wrote a while back to measure PWM frequency/duty cycle that may help a bit if you study it.

Frequency_Counter.ino (2.74 KB)