Above is a simple charging circuit for charging batteries with a DC generator. I don't know much about the theory of charging batteries but i believe this is one very basic method. The batteries are charged with 15v DC using a regulator attached to the generator.
I would like to use two analog inputs to read the battery voltage and generator voltage using a couple of voltage dividers. The arduino will work out when to charge the battery and when not. The readings are fine and independent of each other when not charging but when the relay is turned on and the current is flowing to the battery both readings are the same for battery and generator voltage.
Is there a way to read both battery and generator voltage separately when charging is enabled?
So what are your expectations of the generator's output voltage? I generator's output voltage is bound to change with load current requirements as well as rpm. Not sure how to best characterize/test the generator's output capacity, but of course the battery charging regulators output voltage will only be a stable +15vdc if the generator's output voltage is higher then the drop-out voltage rating of the regulator.
The generator can produce more than 17v easy so it's no problem for the regulator. Its rated at like 200W and can easy handle a few amps. But my question is, is it possible to read the voltage of both the generator and batteries simultaneously while charging? When i've tried before, both readings are the battery voltage, which only increases slightly as the generator spins faster and faster...
I feel your concept of charging a battery using a fixed voltage regulator is a little flawed.
Assuming your battery is lead acid chemistry, you need to control charge current and by definition, this cannot be achieved by a simple constant voltage source.
The fully charged voltage should be around 14.4volts so I suggest you install a series diode in the charge circuit from the 7815 (not 7805 as shown). This will drop around 0.7 volts so limiting battery voltage to around 14.3 or so.
Also fit a series resistor which will act as a charge current control. Resistor value to be based on permitted charge rate (C/7) and worst case drive voltage of around 4 volts (14.3 feeding a "flat" battery of around 10.3 volts)
So, if your battery is rated at 10AH the series resistor would be (14.3-10.3)/(10/7) = 2.8 ohms
I understand i have a lot to learn about charging batteries, thanks for your advice Is there a way to read the battery voltage while a higher voltage from the generator is being applied so i know to stop charging the the battery when it reaches the fully charged voltage? Also is there a way to detect generator voltage so if it reads below 17v, to stop charging the battery because the voltage isn't high enough?
I would recommend, in case you get into seperate applications that don't allow an entire arduino board, to look at the MAX1551 or the MAX1555, they are the same except when on single pin draw high. Its a very basic SO23 package, has 5 pins. very nice for charging a battery.
Although if you wanna do it with an arduino, no advice i have. (YODA!)