About op-amp digital interfacing...

Discussion in 'General Electronics Chat' started by szabikka, Jan 29, 2016.

  1. szabikka

    Thread Starter Member

    Sep 3, 2014
    77
    1
    Hi everyone!

    I am planning to use a PIR sensor as an "entry-detector", that counts how many times have a door been walked through per day. It would consist of a digital counter circuit (4510s and 4511s, nothing special) and a pir sensor that detects the "number of crossings". Problem is, I'd like to use a 12V power supply, but the PIR's output only produces an output signal of 3.3V. I'm planning to use an op-amp (open loop) to amplify that voltage to make the 4510s count (with a 12V supply I'd need at least 6V for a "high" signal and an open loop op-amp would be perfect for that, it even produces higher voltage than needed.) I have never interfaced an op-amp with digital circuits before. What should I look out for, is that possible or advised at all? (I'm pretty much worried about op-amp output and 4510 input impedance differences... should I be?). I would be highly grateful for any ideas!

    Thank you in advance!
     
  2. dl324

    Distinguished Member

    Mar 30, 2015
    3,244
    622
    If the PIR sensor outputs a 0V or 3.3V signal, just use a pull up on the CD4510 clock input.

    If you used an opamp, you don't need to be concerned about it's output impedance or the input impedance of the counter.
     
    szabikka likes this.
  3. szabikka

    Thread Starter Member

    Sep 3, 2014
    77
    1
    Hmm, that's a nice idea, I will try it. Frankly, I have created the circuit because I'm currently learning how op-amps work, what can be connected directly to them, etc. and I want to experiment with it, so it's the "main" part of the circuit.
     
  4. dl324

    Distinguished Member

    Mar 30, 2015
    3,244
    622
    Before you do it, examine the sensor output circuit. You'll likely be forward biasing a parasitic diode in a P MOSFET and you want to limit that current to 1mA or so.
    It's more typical to use a comparator when interfacing between analog and digital. The comparator has an uncommitted transistor as it's output so interfacing to the digital logic is straightforward and you don't need to worry about opamp voltage swing (or need to resort to one with rail-to-rail output).
     
    szabikka likes this.
  5. szabikka

    Thread Starter Member

    Sep 3, 2014
    77
    1
    Thank you for the advice. Will try. ;)
     
  6. crutschow

    Expert

    Mar 14, 2008
    13,014
    3,234
    An LM339 or LM393 are common, inexpensive comparators that should do what you want.
     
    szabikka likes this.
  7. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,539
    1,251
    In general terms, what you are describing is a level-shifter, a circuit that takes one set of logic high and low levels and shifts or translates them to the high and low levels for a different kind of logic. In your case you have a logic high output of 3.3V and a logic high input of 8-12 V. Many general purpose opamps such as the LM358, and most comparators that can run on 12 V can do this task, but there is a more simple way.

    If you are sure the output of the PIR can make 3.3V, then you can use a single 2N7000 or 7002 transistor and a pull up resistor as an inverting level shifter.

    ak
     
    szabikka and absf like this.
  8. szabikka

    Thread Starter Member

    Sep 3, 2014
    77
    1
    Thanks for the replies, guys. I think I will try all of the suggestions. But first, some datasheet reading about those comparators and transistors. :)
     
  9. PeterCoxSmith

    Member

    Feb 23, 2015
    148
    38
    Okay, first don't use an opamp use a comparator that is optimised for this function.
    Take a look at TLV1701, it can operate over a wide power supply range but you can define the output voltage to suit your circuit. Also use hysteresis to prevent spurious pulses on the output, read the datasheet, here is a sample:
    upload_2016-1-30_10-33-3.png
     
    szabikka likes this.
  10. hp1729

    Well-Known Member

    Nov 23, 2015
    1,954
    219
    2N7000? Practical, but "learning to use op amps" was hinted.
    Voltage comparators are nice. Op amp type inputs but open collector output to interface to logic. (LM393 dual, LM339 quad, LM311 single)

    LM311 example attached.
     
    szabikka likes this.
Loading...