About op-amp digital interfacing...

Thread Starter

szabikka

Joined Sep 3, 2014
113
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!
 

dl324

Joined Mar 30, 2015
16,846
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.
 

Thread Starter

szabikka

Joined Sep 3, 2014
113
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.
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.
 

dl324

Joined Mar 30, 2015
16,846
Hmm, that's a nice idea, I will try it.
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.
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.
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).
 

Thread Starter

szabikka

Joined Sep 3, 2014
113
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).
Thank you for the advice. Will try. ;)
 

AnalogKid

Joined Aug 1, 2013
10,987
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
 

Thread Starter

szabikka

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

PeterCoxSmith

Joined Feb 23, 2015
148
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
 

hp1729

Joined Nov 23, 2015
2,304
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
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.
 

Attachments

Top