Continue to Site

Welcome to

Welcome to our site! is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Frequency meter doubts

Not open for further replies.


Member level 4
Mar 9, 2005
Reaction score
Trophy points
Activity points
cd4050 スレッショルド

recently I found this frequency measurement circuit in a magzine. It measures
frequencies upto 250kHz. Actually the author hasn't given the technical details of the circuit. my doubts are:-

1. what type of frequency can this circuit measure, i.e. can it measure sine wave?

2. as i feel after reading (from few details which are given in), the magzine the
resolution is 1 Hz, how can i incerease the resolution to 0.1 Hz or 0.01 Hz?

3. what's the role of T1, D5, and N1?

i think i've asked many questions,

D5 Protects the input to N1 from going below 0v
N1 is some type of buffer to condition the signal for the input to the uC
T1 is a transistor which amplifies the input signal

I don't see how that input circuit can work without any DC bias on T1. Also, D5 looks useless. Maybe the circuit is misdrawn.

N1 is a CD4050. It's being used as a poor-man's comparator to convert whatever input waveform to a square wave.

The counter's resolution is determined by whatever program is running inside the microcontroller. If you show us the code, maybe someone can suggest improvements.

Hi echo, why do u call it "poor man's comparator" ? actually what i'm trying to do is to measure Ac supply frequency at 0.1 or 0.01 resolution? i.e input is sinwave? what method can i use?

Added after 1 hours 4 minutes:

this picture shows the simulation results for the same circuit,

Oh, it's a 230VAC input! By luck the circuit will sort-of work, for a while, but you are driving the base-emitter junction into reverse breakdown, which can damage the transistor. You need to connect diode D1 from base-to-emitter instead of from collector-to-emitter.

The CD4050 is a CMOS hex buffer. It's not designed to be used as comparator, but it sort-of behaves like one, and you get six of them for little money. The input threshold voltage is unpredictable, but it will sharpen-up a high-amplitude signal like the pulses coming from Q1.


    Points: 2
    Helpful Answer Positive Rating
so should i use op-amp instead of cd4050?
how can i use a op-amp for this project please guide me. i want to thank you sincerely.

shaz , even if you wont break the B-E junction of transistor - you will run into problem with c1 being charged up to (Vin positive - 0.6 V) and if somehow one of the positive half of the input frequency will have little bit less voltage than previous one it will lead to one half period missed from detection. What you need is zero crossing detector . Search forum and net - there are a lot of examples .
Even one 100 kOm resistor and diode in backward direction connected in parallel to Q1's B E junction will improve your case . Using Schmidth trigger for U1A will also make a circuit better.

In this schematic i think D5 missplaced.
Catode of D5 must connect to Base of T1.

For increasing resolution by 10 (0.1Hz), you must increase sampleling period by 10 too.

The maximum frequency is determined by oscillator clock :
clock/12/2 for standard 8051. Upper limit will be 500kHz with 12MHz clock.
This figure is for square wave of 50% duty cycle. For narrow pulses the maximum input frequency should be lower, estimate by the formula:
clock/12/2/n, where n is the ratio of mark/space or space/mark whichever the greater.

Resolution can be exchange for measuring time, just change the program. Minimum gate time should be longer than 2 seconds for 0.01Hz in 50Hz. It is a bit too long for frequency meter in general.

Alternatively, if you just want to monitor AC line frequency, you can use the input signal as gate time, count the oscillator clock with timer0/1. It takes just 0.02 seconds to complete one measurement. Resolution is a lot better than 0.01Hz. This is the prefer way to measure low frequency.

for that purpose u must use pic 16fxx , transformer less , one capacitor resistor need.

hi man
i think that T1 is atransistor act as aswitch so it will convert the sine wave to square wave, and D5 used to clip the negative part from the sine wave signal
and the ic (N1) for ampificate the signal.
to increase the resolution by increasing the sampling frequency which require change the crystal by another large one if it can not call me


Not open for further replies.

Part and Inventory Search

Welcome to