Comparator isn't working as I expect it to.

Discussion in 'General Electronics Chat' started by ekkoshard, Sep 22, 2016.

  1. ekkoshard

    Thread Starter New Member

    Sep 22, 2016
    I've been attempting to get a temperature sensor (TMP01) hooked up and reporting to a Raspberry Pi as part of a project. As far as I can tell the temperature sensor works fine, and the voltage-to-frequency converter (AD654) I have it hooked into works...almost as well as the temperature sensor does. The main problem I have with it is that it outputs 2.8V on a low signal, and 3.5V on a high signal which, being a digital device, both register as "on" by the pi.

    My solution was to use a 3.3V pin on the pi as a reference point for a comparator (AD8561) to compare the converter's output with and output a proper high and low voltage that the pi will have no trouble recognizing. However, the comparator doesn't seem to be acting the way I expected it to.

    From the attached image you can see what I've measured going in and out from the pins on the comparator, as well as what I've measured coming from the converter and pi on the wires. I'm having trouble determining what the problem could be, let alone what I should do to solve it. I've had a friend of mine walk me through a few things to try and troubleshoot it, but he wasn't able to make heads or tails of what's going on with it. One of the things we tried was grounding out both inputs and found that the outputs weren't the same, shouldn't they be?

    Any suggestion as to what might be going on with the comparator, or another potential solution that hopefully doesn't involve slapping an Arduino in the middle to act as the voltage-to-frequency converter, would be quite appreciated.
  2. upand_at_them

    Senior Member

    May 15, 2010
    If your AD654 is outputting a square wave that bounces between 2.8V and 3.5V then you have something wrong. According to the datasheet it's good to drive TTL loads.

    Get each part working separately before putting them all together.
  3. blocco a spirale

    AAC Fanatic!

    Jun 18, 2008
    A complete schematic might help.
    dl324 likes this.
  4. ekkoshard

    Thread Starter New Member

    Sep 22, 2016
    I've attached a complete schematic to this post.

    You'll have to excuse my ignorance, but I have no idea what that means or what it would entail. Unfortunately asking Mr. Google has also yielded very little in the way of explanation other than what TTL is. If you could clarify further I'll look into getting it set up correctly.
  5. dl324

    AAC Fanatic!

    Mar 30, 2015
    If you attach a proper schematic, others might be more inclined to look at the circuit. I'm not going to take the time to look up the AD parts and what is a TMP01??

    Wikipedia article on Comparators

  6. wayneh


    Sep 9, 2010
    Read the data sheet! The output of the AD654 is open collector. It requires a pull-up resistor to get the high output voltage.

    You may not need the comparator once you fix that.
    OBW0549 likes this.
  7. OBW0549

    Distinguished Member

    Mar 2, 2015
    Pin 2 of the AD654 needs to be grounded, or your logic output can never go low. Also, I don't know what range of frequencies you expect this V/F converter to generate, but the values of the 1 MΩ resistor at pin 3 and the 1 μF capacitor connected between pins 6 and 7 look WAY too big. Consult the AD654 data sheet for appropriate values.

    The comparator is not needed.
  8. ekkoshard

    Thread Starter New Member

    Sep 22, 2016
    The TMP01 is a "Low power, programmable temperature controller" from Analog Devices. I am ignoring its hysteresis function and only pulling the direct temperature reading from it. I apologize for not having the tools and knowledge to draw up a proper schematic.

    I will look further into pull up resistors, thank you.

    The values on the capacitor and resistor are particularly high by design. I chose those values in order to produce a square wave large enough to see with a voltmeter, and will be changing them to appropriate values once I have confirmed that everything works as intended.