Shop OBEX P1 Docs P2 Docs Learn Events
Analog input mesure — Parallax Forums

Analog input mesure

ShyrbShyrb Posts: 2
edited 2005-07-13 14:43 in Robotics
Hi,
I need to measure 2 analog input signals·and to decide which signal is higher.
Which command(s) might help me?
········ Thanks,

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-12 19:19
    You need a 2-channel (or more) ADC. Once you retrieve the input values then a simple comparison operator (e.g., > ) will do the trick.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • KenMKenM Posts: 657
    edited 2005-07-13 03:01
    Another possibility is to use an op-amp·comparitor. This will cut down on the processing needed to know the result of which voltage is higher. You will only have to monitor a high/low signal.

    The ADC would require programming overhead to control the device and read the data.

    If you have plenty of programming space then the ADC is a good way to go since Parallax has many examples of using ADC's.

    What stamp module do you have?· The BS2Px has an analog comparitor function built in.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-07-13 14:33
    I too thought of an op-amp when I saw this post. It's not a straightforward design though, the voltage swing on the input will range from -5V to 5V, or a 10V voltage swing. This will need to be scaled down to a 5V swing (gain of 1/2) and the offset will need to be shifted to 2.5V. There are opamps which will permit you to define the opamp ground to be 2.5V and the Vcc = 5V and Vee = 0 V, this will take care of the offset issue, you just need to configure it for a gain of 1/2.

    As Ken mentioned, if you only care about which voltage is higher and not what the actual values are, you can simply use an analog comparator, the comparator has a 1 bit digital output. If the output is 1, the voltage on the V+ terminal is higher, if the output is 0, the voltage on the V- is higher.

    Post Edited (Paul Baker) : 7/13/2005 2:38:39 PM GMT
  • KenMKenM Posts: 657
    edited 2005-07-13 14:39
    I agree that if the input can swing to -5 v that adds some small headache, however I did not see that the input would swing negative....but a very valid point.

    I thought a LM339 quad comparitor was open collector output, but now I don't imediately see that on the spec sheet. Now that has me wondering because I know I have used an open collector op amp comparitor before.....device #...???

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ken
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-07-13 14:43
    Sorry ken, I had some confusion about your post at first, thats why I edited my post. No I don't think he has a -5V input, I just poorly communicated that a normal op-amp (not in comparator mode) would generate that sort of voltage swing when V- exceeds V+. But none of this is an issue with an analog comparator, only if he cares what the value of the difference is.
Sign In or Register to comment.