I am trying to build a centre-off model railway controller, no reversing switch. I am working on the overload/short detection part of the circuit based on sensing the voltage across a 0R68 resistor. I want to trigger at about 1A, i.e. approx. 0.7V across Rsense. The current flow will be bi-directional.

The "detection" is done by two comparators using diodes to give the 0.7V references, which worked fine. My next step was to use a rail-to-rail OpAmp to invert/shift the negative pulses to positive ones. In working through a circuit in LTSpice I hit "Simulate" before I'd hooked everything up and ... it did exactly what I need! But it bugs me that the inverting input of the OpAmp is floating. When I try to connect it I cannot get the correct result.

Could someone please explain how/why this works? And am I OK to let the input float?

Diagram and waveforms below.



enter image description here

enter image description here


Probably just an issue with the model in LTSPICE, coupled with the fact that op-amps use the difference in the currents being pulled out of or inserted into the pins. Since one pin is floating here, no current is going either way. That is not how you should use them though, since any noise in the system will couple into the input.

However, why are you even using one, just power both from +-5V and switch the inputs around on U1 and feed the output to the other diode, D3.


simulate this circuit – Schematic created using CircuitLab

The circuit would also be more accurate if you used resistors instead of the diodes in your reference, assuming the 5Vs are regulated properly.

  • 1
    \$\begingroup\$ Thanks. Not too worried about accuracy. Detecting c. 1A through Rsense is enough. \$\endgroup\$ – Duncan F Nov 16 '17 at 15:13
  • \$\begingroup\$ ... cut myself off there ... Thanks. Not too worried about accuracy. Detecting c. 1A through Rsense is enough. I tried previously reversing the inputs to U1 and it gives an output in the right sense (-5V space, 0V mark), but with the wrong absolute voltage. I can OR them through diodes, but would need to voltage shift the U1 output by +5V first. Which is where I was stumbling around when I came across this. Will check other models and see if the circuit fails as it should. \$\endgroup\$ – Duncan F Nov 16 '17 at 15:20
  • \$\begingroup\$ @DuncanF oh IC, I did not notice how you were powering those. Tie the power rails to +5 and -5V not single rail like you did. That will make the output swing +-5V on both. \$\endgroup\$ – Trevor_G Nov 16 '17 at 15:23

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.