I have been working on a simple project to read the analog voltage input on Arduino. I'm having problem to read the correct value on Arduino. I know what's causing the problem. I'm using the virtual ground on the op amp non-inverting side but Arduino is referencing to the digital ground instead of the virtual ground when reading the analog input value on pin A0. How can I solve this issue?

enter image description here

  • \$\begingroup\$ "Virtual ground" doesn't mean that it becomes ground for the whole circuit. \$\endgroup\$ Jun 11, 2016 at 0:33

1 Answer 1

  • Make sure that op-amp GND (connected to its pin 4) is also connected to the Arduino GND.
  • Connect virtual ground to Arduino A1. Now the Arduino will be able to measure the reference voltage.
  • In your code the analog reading is A0 - A1.

This will give you positive values when A0 > A1 and negative values when A0 < A1.

  • \$\begingroup\$ I tried your suggestion and yea it works. This is what I wanted. thanks \$\endgroup\$
    – rajk
    Jun 11, 2016 at 18:32
  • \$\begingroup\$ You might add a 10u electrolytic in parallel with R3. That will keep your reference voltage stable in the presence of power supply noise. Thanks for accepting my answer. \$\endgroup\$
    – Transistor
    Jun 11, 2016 at 18:35

Your Answer

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

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