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?
1 Answer
- 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\$– rajkJun 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\$ Jun 11, 2016 at 18:35