Shop OBEX P1 Docs P2 Docs Learn Events
Frequency to Voltage con on sx28 ??? — Parallax Forums

Frequency to Voltage con on sx28 ???

Gold_DaddyGold_Daddy Posts: 7
edited 2007-02-10 23:09 in General Discussion
Hi Everyone

·· I am looking for a way to input a·varying sine wave·frequency (from 5 Hz to 3000 Hz) and assign either a voltage or a number to it.· I would like to compare it to a table of pre-set frequencies and output an alert when certain frequencies are hit exactly.· I need to use an sx28 @ 50 Mhz.·

·· Would I need an ADC or an FVC·or can the sx28 handle the conversion?
·· Do I need to filter the signal to eliminate harmonic overtones and how can I do this?
········ (RC filters maybe???)

Any ideas or help with programing and hardware design would be greatly appreciated ! smile.gif


Gold_Daddy

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-02-09 03:05
    Here is an example of frequency detection
    http://www.sxlist.com/techref/ubicom/lib/math/dsp/freqdet/index.htm

    regards peter
  • Gold_DaddyGold_Daddy Posts: 7
    edited 2007-02-09 05:28
    ··· Peter --- Thank You·---· This will help!!!

    · The only problem with the code you referenced; it is single ended.

    · It only finds the amount of a single frequency chosen by the user.· I need the (program/hardware) to·differentiate between over a hundred different frequencies!·
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-02-09 08:42
    To detect varying frequencies a spectrum analyzer is needed.
    See next article about an analyzer using a pic. This could possibly be·adapted
    to a sx if you leave out the display code.
    http://www.circuitcellar.com/library/print/0998/Lacoste98/lacoste98.pdf

    Here is the pic source code for the·above article.
    ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/1998/Issue_98/
    download picspectrum.zip

    The·code is also interesting for just the math (FFT,sin.logarithm,fixedpoint)!

    regards peter
  • BeanBean Posts: 8,129
    edited 2007-02-09 12:07
    Are you inputting a single frequency or multiple frequencies ?

    If it's a single frequency, then I would just use the Schmitt trigger option for the input pin and time the pulse.

    FreqIn  PIN RB.0 INPUT SCHMITT
     
    cnt     VAR WORD ' Holds period in 2.56uSec; freq = 1/(cnt * 0.00000512); cnt = 65 = 3004Hz; cnt = 39062 = 5.0001Hz
     
     
    ' Clear period counter
    cnt = 0
     
    ' Wait for input to go low
    DO
    LOOP UNTIL FreqIn = 0
     
    ' Wait for input to go high
    DO
    LOOP UNTIL FreqIn = 1
     
    ' Increase period counter while input is high
    DO
      PAUSEUS 2.56 ' Tweak this value down to account for program overhead
      INC cnt
      IF cnt = $FFFF THEN EXIT ' Abort if counter is at max
    LOOP UNTIL FreqIn = 0
    


    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheap used 4-digit LED display with driver IC·www.hc4led.com

    Low power SD Data Logger www.sddatalogger.com
    SX-Video Display Modules www.sxvm.com
    Stuff I'm selling on ebay http://search.ebay.com/_W0QQsassZhittconsultingQQhtZ-1

    "USA Today has come out with a new survey - apparently, three out of every four people make up 75% of the population." - David Letterman

    Post Edited (Bean (Hitt Consulting)) : 2/9/2007 12:19:44 PM GMT
  • Gold_DaddyGold_Daddy Posts: 7
    edited 2007-02-10 21:52
    ······ DON'T YOU GUYS EVER SLEEP ? ! ? !
    ·
    · Like I should talk smile.gif

    ····· Peter;· Thank you again for your input
    ·HOW DO YOU FIND THIS STUFF?·
    I haven't had a chance to go over the links you refer to, but they sound very helpfull!

    ······ Bean;· Think of the source as a violin played by a beginner (my daughter is learningeyes.gif·)· The sine waves vary from moment to moment but they may not be true to notes desired.· Similarly, I am trying to determine when a stream of varying waves hit certain frequencies but I only have to denote when the frequency matches/ or does not match, a set of predetermined frequencies.· I would be happy with a green led for hit and a red led for not true to data set.

    Thanks again,·I'll need some time to absorb the files you mentioned
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2007-02-10 23:09
    To find stuff for the sx, you should always include pic.
    I just googled for pic spectrum analyzer

    regards peter
Sign In or Register to comment.