FreqMeasure Libary Measure Voltage

Status
Not open for further replies.

BenJo

Member
Hello Board,

I have a question about the standard FreqMeasure Libary on a Teensy ++2.0 and I hope somebody can help!

On the input Pin 17, I have a rectangular curve between p-p +2V and +5V and I want to measure the frequency of it. Unfortunatly, it seems, that this libary can not detect any frequency, as long as the curve don't cross the voltage of around 1,3 V or less. (maybe low?)

My question is, can I change the libary so, that it detects a frequency at "HIGH" state? (means hit the 5 Volts)
Would be greate!!

Thanks for your help!

Regards,
Ben
 
I don't think you'll have much luck finding a software-only solution as the FreqMeasure library needs signal transitions and I think those transition thresholds are fixed in the hardware of the I/O ports.

You could always use a capacitor and a couple of resistors to shift the signal down a volt or two. The values of the resistors and capacitor will depend on the input frequency.

LevelShift2.jpg
 
You could always use a capacitor and a couple of resistors to shift the signal down a volt or two. The values of the resistors and capacitor will depend on the input frequency.

View attachment 21803

Thats absolutely right, but the input Pin 17 is hard on VCC+5 volts and if i use a capacitor and resistors to pull it down, it ends in crazy distortion.
Left picture is the signal directly from 5 V OPA out into Pin 17
Right one is with capacitor in between and two resistor to pull it closer to 0V .

IMG_20200921_225251.jpg
 
The values depend on the frequency, those values don't work down to the frequency you're using. Add a resistor in series with the input
pin too so that it won't be driven over or undervoltage too hard by the capacitor.
 
My original values worked OK for 500Hz. If you want to go down to 100Hz, you need larger resistors and capacitors. It will also depend on the value of the internal pullup resistors on Pin 17. I have no idea what the pullup might be for the T2.0++, as I work only with T3.X and T4.X boards.

MarkT's point about a current-limiting resistor between the level shifter and Pin 17 is also valid.
LevelShift3.jpg
 
Would using just two diodes in series drop the voltage from between 5V and 2V down to about 3.6V and 0.6V ?

Pete
 
Status
Not open for further replies.
Back
Top