How to detect frequency of square waveform?

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear Members,
I have to detect the frequency of a Square Wave. The frequency of the square wave is different at different times as per user requirements. I have to design one circuit which detects that square wave frequency.

Regards,

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use the ICP unit. Capture 2 rising or falling edges and that gives the period.

1) Studio 4.18 build 716 (SP3)
2) WinAvr 20100110
3) PN, all on Doze XP... For Now
A) Avr Dragon ver. 1
B) Avr MKII ISP, 2009 model
C) MKII JTAGICE ver. 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ICP is the typical answer, but it really depends on the frequency you need to measure. For higher frequencies it is better to use the external clock input on one of the timers and simply count for some short time period.

Martin Jay McKee

As with most things in engineering, the answer is an unabashed, "It depends."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The frequency range to be measured is at max 400 Hz

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

razesh wrote:
The frequency range to be measured is at max 400 Hz

And minimum?

It sounds like ICP could be a good option. At that frequency, however, you could simply poll the pin for a start and stop time ( or better, use a pin change interrupt ). Then you are not co-opting a timer for frequency measurement and ( on most newer AVRs ) you can use just about any pin as an input.

Martin Jay McKee

As with most things in engineering, the answer is an unabashed, "It depends."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

And minimum?

Minium is 50 Hz.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now what does your "detect" mean - lit a LED when a frequency in a range mentioned above presents, or measure this frequency and transmit its value to somewhere, or the same with a super-fine resolution? Why should we guess and beg you to say every next word?

Warning: Grumpy Old Chuff. Reading this post may severely damage your mental health.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

...or just type your assignment straight here?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I have to detect the frequency of a Square Wave. The frequency of the square wave is different at different times as per user requirements. I have to design one circuit which detects that square wave frequency.

Why are you telling us this? Or was there a question that you forgot to ask? I presume this is a school project yes/no?
IIRC this project came up about 12 months ago too by another student in India.

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is good. When employers decide they need engineers that can detect the frequency of a square wave, they will have a ready supply available on the subcontinent.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bobgardner wrote:
This is good. When employers decide they need engineers that can detect the frequency of a square wave, they will have a ready supply available on the subcontinent.
Yeah, but they will have to look elsewhere if they also want to know the duty cycle ... because of dear, someone did not generate a true square wave :lol:

Ross McKenzie, Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

valusoft wrote:
because of dear, someone did not generate a true square wave :lol:
Is that even legal?

Stealing Proteus doesn't make you an engineer.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ArnoldB wrote:
valusoft wrote:
because of dear, someone did not generate a true square wave :lol:
Is that even legal?
I am not a lawyer here, and certainly not in India ...

Ross McKenzie, Melbourne Australia