Perry, one of the few things I remembered. College was a long, long time ago. Transistors were pretty cool at the time but we learned vacuum tube theory too. 
grichfitz:
Hi Ron,
I have realised I need a resistor before the cap to slow the charge rate. My plan is probably for a 10uf cap and a 100ohm resistor before that, maybe more, I’m speculating at the moment. I’ll know more when I test.
Can you suggest anything?
All the GND are to arduino, so the batteries are kept separate.
I think I’m onto a solution now! Thanks.
I just do not see this approach as simple. Earlier I suggested using one of these. Been awhile so I dug one out and set it up. Not having a 12 and 24 volt battery I settled for some 9 volt I had laying around for smoke and CO detectors. I used a single 9 volt and a pair in series for 18 volts.
Now if this were a real work project (retired almost 7 years ago) I would have used a precision divider network and included a calibration trim pot(s) but for kitchen table science I just used a few 10K pots and adjusted one as a 3:1 divider and the other as a 6:1 divider. Since I had an LCD I included it. I didn't really use the programmable gain of my A/D so it was full scale and in the default mode, the setting is +/-6.144 volts. On the bright side it is a 16 bit A/D so even at default my resolution is a scale factor of 0.1875 mV per bit. Pretty good. Also I configured it for two channels of differential input. All of this took less than an hour to cobble together.
Here is what I got.
Looking at the LCD.
Here is what the code looks like:
#include <Wire.h>
#include <Adafruit_ADS1015.h>
#include <LiquidCrystal_I2C.h>
Adafruit_ADS1115 ads; // Declare an instance of the ADS1115
LiquidCrystal_I2C lcd(0x27,20,4); // set the LCD address to 0x27 for a 20 chars and 4 line display
int16_t rawADCvalue1; // The is where we store the value we receive from the ADS1115
int16_t rawADCvalue2;
float scalefactor = 0.1875F; // This is the scale factor for the default +/- 6.144 Volt Range we will use
float volts1 = 0.0; // The result of applying the scale factor to the raw value
float volts2 = 0.0;
void setup(void)
{
Serial.begin(115000);
ads.begin();
// Initialize LCD screen
lcd.init(); // initialize the lcd
lcd.init();
lcd.backlight();
}
void loop(void)
{
rawADCvalue1 = ads.readADC_Differential_0_1();
rawADCvalue2 = ads.readADC_Differential_2_3();
volts1 = (rawADCvalue1 * scalefactor)/1000.0;
volts2 = (rawADCvalue2 * scalefactor)/1000.0;
//Serial Print Sata
Serial.print("Battery 1 = ");
Serial.print((volts1 * 3),3);
Serial.println (" Volts");
Serial.print("Battery 2 = ");
Serial.print((volts2 * 6),3);
Serial.println (" Volts");
Serial.println();
// LCD Data
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Battery 1 = ");
lcd.print(( volts1 * 3),3); // Using 3:1 Voltage Divider so volts1 * 3
lcd.print(" V");
lcd.setCursor(0,1);
lcd.print("Battery 2 = ");
lcd.print(( volts2 * 6),3);
lcd.print(" V");
delay(1000);
}
The merit of using a few 10K 10 turn trim pots is you can tweak and peak for accuracy. While I know this can be done in code I like being able to just adjust for a nominal value. The ADS1115 also uses a simple I2C interface so it just connects right to the Arduino. Considering on Amazon the break out board modules cost about $7.00 it's hard to look away.
Granted this is your project but I just don't see using a cap charging and discharging as a good solution. Depending on timing there is also relay transition times. This is a good getting started tutorial on the method I suggest.
Ron