Measure voltage of 2 different batteries on Arduino
The simplest solution is to create a common ground. Since you want to measure two batteries, you have to connect their grounds to the Arduino ground. If you do that to both, the Arduino ground has become the common ground.