0
\$\begingroup\$

I am struggling, and I would like to know how I can make a circuit that holds the following conditions:

  1. If the input voltage is negative, then the output should be zero volts.
  2. If the input voltage is zero or positive, then the output voltage should be the same as the input voltage.

Thanks in advance.

\$\endgroup\$
  • \$\begingroup\$ (1) What is the input signal? (Volts, amps & frequency.) (2) Where does it come from? (3) What is it feeding into? \$\endgroup\$ – Transistor May 25 '16 at 5:50
  • \$\begingroup\$ It is a DC voltage. \$\endgroup\$ – lmiguelvargasf May 25 '16 at 5:51
  • \$\begingroup\$ You need to answer all the questions otherwise we're all guessing what you want. \$\endgroup\$ – Transistor May 25 '16 at 5:56
  • \$\begingroup\$ Sorry, (1) it is a DC voltage, (2) It comes from the output of an operational amplifier which compares two voltages. (3) It will be sent to a microcontroller pin. \$\endgroup\$ – lmiguelvargasf May 25 '16 at 5:58
3
\$\begingroup\$

The simplest circuit:

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. Single diode rectifier.

  • The diode will conduct when Vin > Vout.
  • The diode will block when Vin < Vout.

Whether this is suitable for your application depends on whether you can tolerate a 0.6 or 0.7 V drop across the diode as well as any factors you haven't told us.


Sorry, (1) it is a DC voltage, (2) It comes from the output of an operational amplifier which compares two voltages. (3) It will be sent to a microcontroller pin.

Use @dim's circuit:

schematic

simulate this circuit

Figure 2. GPIO interface for bipolar signal. Use (a) when Vin ≤ Vcc. Use (b) if Vin ≥ Vcc.

Let's say that Vin is 15V. Isn't it dangerous to send that voltage to the GPIO?

Yes. We wouldn't connect 15 V directly to the input. If Vin ≥ Vcc then use Figure 2(b).

  • If Vin goes above V+ then D3 shunts the current to V+ and R2 limits the current to around a milliamp.
  • Between 0 and V+ the diodes don't affect the circuit.
  • Below 0 V D2 conducts and prevents the GPIO seeing any less than -0.6 to -0.7 V.
\$\endgroup\$
  • \$\begingroup\$ Isn't there another alternative? I have checked that diode, and it seems it is not available in my country. \$\endgroup\$ – lmiguelvargasf May 25 '16 at 6:10
  • 1
    \$\begingroup\$ Yes, any small signal diode will do. The 1N4148 is available internationally. It is the most popular small signal diode. \$\endgroup\$ – Transistor May 25 '16 at 6:11
  • \$\begingroup\$ you are right! I am so sorry. \$\endgroup\$ – lmiguelvargasf May 25 '16 at 6:13
  • 1
    \$\begingroup\$ Precision rectifier op amp configuration satisfies the 0V requirement. \$\endgroup\$ – Chu May 25 '16 at 13:36
  • 1
    \$\begingroup\$ @imiguelvargasf: See my update. \$\endgroup\$ – Transistor May 25 '16 at 17:11
6
\$\begingroup\$

What you are looking for is a rectifier, if the voltage drop of the diode is of no importance ,then this circuit will do the trick.

schematic

simulate this circuit – Schematic created using CircuitLab

But, if you want to compensate for the voltage loss over the diode you'll need an Opamp .

schematic

simulate this circuit

\$\endgroup\$
  • \$\begingroup\$ Wouldn't a (R2R) opamp without the diode do if the negative voltage is connected to GND? \$\endgroup\$ – glglgl May 25 '16 at 7:19
  • 1
    \$\begingroup\$ The problem with circuit (1) is that you have the diode drop on VIN. That is why I suggested the opposite (resistor on VIN, diode on GND). It has generally less side effects to alter the GND limit than the input voltage itself. \$\endgroup\$ – dim lost faith in SE May 25 '16 at 7:25
1
\$\begingroup\$

There is a very simple solution, but whether this works will depend on

  • the input impedance of the subsequent circuit
  • the output impedance of the previous circuit
  • the fact you can tolerate a small amount of remaining negative voltage (~0.4v).

You can put a resistor of about 1-10k between the input signal and the cathode of a diode (preferably schottky, like BAT54) with the anode of the diode tied to ground. The output signal will be taken between the resistor and the diode.

If the impedances/remaining negative voltage is a problem, a more complex solution would be to use an active device like an opamp, but I'll let someone else suggest this.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.