The main purpose of this stage is to show a circuit that can regulate the current flow to a constant value, besides it can be energized by batteries. that can be recharged.
I'll use the L7805CV voltage regulator, the datasheet is here:
The batteries can be of different values of voltage, but this is not a problem with the L7805CV, as long as the voltage remains in the limits provides for the datasheet, for a fixed output regulator the circuit is:
And the recommended circuit for a current regulator is:
But I'll use:
It can provide 5 v with 500 mA in a constant way (due the resistor is 10 ohms), this circuit must be a common ground with the Arduino:
To charge the batteries you can use any lipo charger like TP4056 module, and the batteries that I use are two Li-ion 3.7V recycled from an old laptop battery.
Is important consider the power dissipation in form of heat from the regulator and the maximum power supported by the resistance, to calculate if you can use these equations:
Finally here you have a picture of my circuit:
*Due that the power through the resistance are 1.5 wats is not necessary a 10 wats resistor, but is what I have at the moment.