0
\$\begingroup\$

I am trying to determine if it is feasible to use an op-amp to interface a button 25 meters away. A user suggested this solution to me and im trying to explore it. He suggested to use a differential configuration to protect against common mode transients and false button presses. I tried recreating the circuit in proteus for simulation but i am getting weird results, i do not know if its proteus that is wrong or if its actually correct.

enter image description here

The circuit supposedly outputs 5v if a button is not pressed and 0v if the button is pressed

I am using a generic simulation model for the op amp. Notice the oscilloscope reading at the start you see a flat line at the beginning that is 0v. When a button is pressed it dips down to a - 5v but the voltmeter on the output will show 0v (not -5v like the oscilloscope). When button is released it shoots up to 2.5 volts and gradually go to 0v, but the voltmeter will read 5v, notice the leading point of the line where it is near zero but the voltmeter is at 5v?

Which one do i believe? Have i missed something? I have checked the schematic and it seems to match from other sources (example). The actual op-amp i plan to use is this.can i actually expect the proper voltages (0v and 5v) on the output of the op-amp in reality?

here is the op-amp property the one used above. I have actually tried using a model of an actual IC and the behaivor is the same where i am getting negative voltages on button press.

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ You may want to reconsider a switch with bounce time and choose a filtered debounce time to prevent bounce and improve on noise immunity. Such as an RC filter with a logic device with a Schmitt trigger input such as '14 family \$\endgroup\$ Jul 11, 2020 at 19:59

2 Answers 2

2
\$\begingroup\$

The reason is that the yellow channel in the scope is AC coupled. Set it to DC coupled.

\$\endgroup\$
4
  • \$\begingroup\$ This fixed it ! But why though? aint AC coupling better than DC? \$\endgroup\$
    – Jake quin
    Jul 12, 2020 at 7:02
  • 1
    \$\begingroup\$ Well it depends on the definition of better, and since you expect to see a DC signal then DC coupling is better. AC coupling will remove DC voltage so everything that is DC will get removed and the signal slowly drifts to 0V which you did not seem to want. \$\endgroup\$
    – Justme
    Jul 12, 2020 at 7:21
  • \$\begingroup\$ if a GPIO was connected on that output though what would that GPIO see? intuitively speaking it would be the DC signal but if the AC coupling sees a negative voltage wouldnt that also mean the GPIO is experiencing negative voltage? \$\endgroup\$
    – Jake quin
    Jul 12, 2020 at 14:58
  • 1
    \$\begingroup\$ It would see the DC coupled voltage. Unless you add AC coupling yourself. \$\endgroup\$
    – Justme
    Jul 12, 2020 at 15:05
1
\$\begingroup\$

A better solution is to use logic 74HC14 Schmitt Inverter ( and use correct scope settings )

enter image description here

  • 10k is to current limit charge transfer
  • 100k 0.1uF is to prevent false trigger from 10 ms bounce example.
  • twisted pair is about 60pF/m, coax ~ 90 pf/m
    • With cap removed. enter image description here
\$\endgroup\$
3
  • \$\begingroup\$ Thank you for offering another solution , which i think is much better since it requires less components than the one i currently looking. I do apologize i cant accept it as an answer because the question is about why i am getting the negative voltage. If you dont mind me asking though, I noticed that button debounce IC's such as the max6818 uses a d-flipflop rather than using this method. Is there a reason for that the schmitt trigger is not used? \$\endgroup\$
    – Jake quin
    Jul 12, 2020 at 14:54
  • \$\begingroup\$ Simplicity , cost , availability but both are ok. \$\endgroup\$ Jul 12, 2020 at 14:58
  • \$\begingroup\$ I know its been a while to ask but would there be problems if an ordinary wire is used( not twisted pair/ coax). On the simulation i adjusted the capacitance to a bit higher value and it still would work great, and on my circuit i placed TVS diodes before the 10k to suppress some induce currents or voltages \$\endgroup\$
    – Jake quin
    Jul 26, 2020 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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