Interesting design. Your code will be interesting and I expect you will have problems with loop timing. Second you will not have any control, the analog pins are inputs, not digital to analog (DAC) converters. Your Arduino is missing a voltage reference for the battery (Ground). I think this is what you are trying to do: The voltage, VIN (A0 is an input not a voltage output you need a DAC) which is the input voltage is given to the non-inverting input terminal. The inverting input terminal is driven by the feedback voltage which is across the RL resistor, 5 ohm in your design. ... That is, the load current, measured by A4, which is the input voltage, this should work. To be safe add maybe 5K or so resistance in series with this line incase to much voltage is applied to the battery + input.