Frequency measurement

Thread Starter

drkblog

Joined Oct 4, 2012
109
Hello!

(Again) I have to measure a low frequency signal using a digital input. I did it with Arduino before, no I have to do it using a RaspberryPi. I know I can use almost the same circuit or even create one my self. But I want to fully understand the circuit I've used before:



C1 is the input for the analog signal (usually a sine). The second inverter is connected to a digital input. Where time between high and low leves ar counter for measuring frequency.
As far as I know this transistor Q1 is working in Cut-Off & Saturation mode. When input signal goes above Vbe cut-in voltage, first inverter input is pulled low. When Vbe is less than cut-in voltage, inverter is pulled up by R3.

I think I'm right in the previous reasoning. But yet I have some doubts like:

  1. I replaced R3 which was about 4.7kΩ for a preset in order to adjust input sensibility. I did it by trial-and-error and I don't know how does it work.
  2. What's the purpose of R2?
  3. Do R1 and C2 work as a low pass filter?
  4. Can I change VDD from 5V to 3.3V? (I guess I can, but just in case)
 

#12

Joined Nov 30, 2010
18,224
The input voltage and impedance are trying to cause current in Q1. If the input current and the gain of Q1 are sufficient, Q1 will go into saturation. I believe that a much higher value for R3 would be good because all you are trying to achieve is on and off, and U2A does not require much current to operate its input.

I think R2 should be from the base of Q1 to ground, not from base of Q1 to collector of Q1.

R1 and C2 dump high frequencies to ground, so yes, it is a sort of low pass filter.

Vcc to 3.3 volts? depends on the power voltage to the inverters. Is 3.3V high enough to be recognized as, "high" by the inverters?

I would also consider adding a diode from the base of Q1 to ground to avoid the input voltage from over volting the base emitter junction in reverse.
 

Thread Starter

drkblog

Joined Oct 4, 2012
109
I tested this circuit with 3.3V, using an sine input signal 1Vpp. I changed R3 for a 22k resistor and added a 4.7k resistor between emitter and GND. Because I was getting a double pulse (of 1µS) at the output. My reasoning was: adding a resistor between emitter and GND would raise the minimum input voltage needed to switch Q1. Since it worked, I guess I can place a preset instead, and use it for adjust the sensibility and get rid of the noise. Am I right?

PS: Using this circuit I'm counting frequency with a relative error under 0.5% at 4.4kHz. And the counting is good up to 80kHz which is far more that what I need right now.
 
Last edited:

Alec_t

Joined Sep 17, 2013
14,335
I replaced R3 which was about 4.7kΩ for a preset
It would be advisable to keep a fixed resistor (a few k) in series with the preset; otherwise if the preset somehow got set to minimum resistance you could have damaging current through Q1.
 

Thread Starter

drkblog

Joined Oct 4, 2012
109
You're right. But now R3 is fixed and the preset would be between emitter and GND.

Yet, I realize I was wrong. The emitter resistor lowers the voltage needed to turn Q1 on. I'm not sure why is that.
 

#12

Joined Nov 30, 2010
18,224
My reasoning was: adding a resistor between emitter and GND would raise the minimum input voltage needed to switch Q1.
No. You have to watch your zeros. As long as Q1 is off, there is zero voltage drop across the emitter resistor, therefore, the starting voltage is the same, only the slope of the current changes. Meanwhile, the emitter resistor increases the impedance of the base, so the input signal won't load down as much.

If you want to change the start voltage you can use 2 resistors to make a voltage divider with the base at the middle point of the 2 resistors. You could also add a second transistor just like Q1 and make a differential pair so you can use the second base for a dial-a-volt switching point. If I remember correctly, R4 and R5 can be zero ohms.
 

Attachments

Top