Thanks a lot for taking the time to look through this thingstodo! I appreciate it very much.
My code that is in the first post is quite dated. I have updated a fair amount of things from testing different portions of the code. However, I haven't put it all back together yet, thus I haven't reposted it.
I'm very glad you brought up the limitations of the float variable as it may be an issue. This is the latest code for the interrupt that I have been using. RawCurrentRead, CurrentRead, and AHused are all float type variables.
Code:
// interrupt to count amp hours used
ISR(TIMER1_COMPA_vect)
{
// read sensor output
RawCurrentRead = analogRead(CurrentPin);
// calibrate sensor
CurrentSensorCalib = analogRead(CurrentSensorCalibPin);
// Convert currentread to amps
CurrentRead = (RawCurrentRead - CurrentSensorCalib) * .78125;
// Convert to AH used and add to total
AHused = AHused + (CurrentRead * 0.0000002777);
}
I have yet to hook the arduino up to a more noise proof power source. I was going to do this but I am depending on the arduino's serial output to get feedback on the variables. I'm not sure how to connect the arduino to the computer without using the USB to power it. This is where a scope would come in quite handy.
Thanks for finding those chips! I'll have to take a look at them once I get the BMS in the car and running things properly.