Shop OBEX P1 Docs P2 Docs Learn Events
analog input with VCO? — Parallax Forums

analog input with VCO?

FlyingFishFingerFlyingFishFinger Posts: 461
edited 2005-06-29 03:57 in BASIC Stamp
Hello!
I just thought of a simple way to input analog signals into the stamp: Use the analog voltage to change the frequency of a VCO (Voltage Controlled Oscillator) and then read the resulting pulses with the Stamp. Has anyone done this before? Maybe it's really stupid, just an idea of mine...would it work? I tried it with an audible 555 VCO and the pulses (read with COUNT) seemed pretty random. Should I clean them up with a Schmidt trigger ?

Comments

  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2005-06-28 02:16
    flyingfishfinger,

    This method is used often... instead of cleaning up your signal from the 555 with a schmidt trigger, why not base
    your oscillator around a schmidt trigger to begin with?


    Here is an interesting circuit that I have used before, that can multiplex two analog signals into one PWM signal
    that the Stamp can read.

    Use PULSIN with the "state" descriptor to get a reading from t1 or t2

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
    885 x 633 - 13K
  • FlyingFishFingerFlyingFishFinger Posts: 461
    edited 2005-06-28 03:06
    In your circuit, the duration of the pulse (1 or 0) is proportional to the voltage at the input, right? But then does that mean that I have to have both inputs used to provide a referenve voltage for the other one? If I groung one, the other one would read a permanent hight, right ? ? ? The circuit looks good from my point of view though, because I'm trying to interface 2 Sharp GP2D12 sensors.
    Thanks for the moment anyway.
  • Beau SchwabeBeau Schwabe Posts: 6,557
    edited 2005-06-28 03:24
    This circuit provides a relatively high impedance (2.2Megs) at the input. If no input were involved at all, you would have about a
    50% duty cycle on the output signal. The inputs "skew" the duty cycle in one direction or the other by about 20%, so your PWM
    ranges from 30% to 70%. Feel free to experiment with other values to get more range out of this if you want.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • FlyingFishFingerFlyingFishFinger Posts: 461
    edited 2005-06-29 03:57
    Hi!
    The circuit you suggested did not work for me (probably because of my insufficient knowledge of electronics), but I used my 555 scheme and it did work. This is no problem since I have enough breadboard space and I/O pins to spare. Thanks for your help, I consider the topic closed.
Sign In or Register to comment.