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?
- 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.