Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: FreqMeasure Libary Measure Voltage

  1. #1
    Junior Member
    Join Date
    Sep 2020
    Posts
    6

    FreqMeasure Libary Measure Voltage

    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

  2. #2
    Senior Member
    Join Date
    Feb 2018
    Location
    Corvallis, OR
    Posts
    243
    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.

    Click image for larger version. 

Name:	LevelShift2.jpg 
Views:	10 
Size:	76.7 KB 
ID:	21803

  3. #3
    Junior Member
    Join Date
    Sep 2020
    Posts
    6
    Quote Originally Posted by mborgerson View Post

    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.

    Click image for larger version. 

Name:	LevelShift2.jpg 
Views:	10 
Size:	76.7 KB 
ID:	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 .

    Click image for larger version. 

Name:	IMG_20200921_225251.jpg 
Views:	10 
Size:	118.9 KB 
ID:	21804

  4. #4
    Senior Member
    Join Date
    Jul 2020
    Posts
    463
    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.

  5. #5
    Senior Member
    Join Date
    Feb 2018
    Location
    Corvallis, OR
    Posts
    243
    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.
    Click image for larger version. 

Name:	LevelShift3.jpg 
Views:	18 
Size:	86.2 KB 
ID:	21805

  6. #6
    Senior Member
    Join Date
    Nov 2012
    Posts
    1,479
    Would using just two diodes in series drop the voltage from between 5V and 2V down to about 3.6V and 0.6V ?

    Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •