Just started getting into hardware programming so a little green. Been a long time Web programmer so I have a little understanding of programming.
I got a ardiuno uno to start messing with device programming. I'm looking to create a Mah Fuel gauge.
Here is why I want to do this. I fly remote control helicopters that are fueled by Lithium Ion batterys. Lithium Ion batterys do not like to be discharged over 80% of their capacity.
I usually fly with a timer on my Transmitter. I will fly for 5 min and land.
If I just practice autorotations or stationary hovering piros then usually I only discharge 50% of the lithium ion battery. If I fly hard and really heavy on the controls I could go over 80% on the capacity in 5 min.
So I thought it would be nice to keep track of the milliamps I consume durring the flight.
My larger helicopters can do peaks of 100 amps while my smaller one would do peaks of 50 or 60 amps.
I would probably start the project on the smaller one.
It takes a 1350 mah 25 Volt Lithium Ion (Lipo).
Once 1080 mah is used up from the Lipo I would have to land.
I was thinking I would use a ACS715 with my ardiuno uno for testing at first.
I get the hardware portion of it and have seen several examples on the internet.
But I'm trying to get my head around the calculations in the code.
To get a amp reading from the shunt I think I would do something like this,
sensorValue = analogRead(analogInPin); outputValue = ( ((long)sensorValue * 5000 / 1024) - 500 ) * 1000 / 133;
133 would be the sensors mv per amp of current.
So "outputValue" would be a milliamp reading at that one instance.
So if I do this in a loop and take a reading every (10 ms) and add all my amp readings I should get total milliamps used?
I feel like I am missing something here.
I think I need to take my milliamp readings and compare them to total time to get milliamps used in flight.
Of course the next step would be getting the data from the aircraft to the operator but I will get to that later.
Thanks in advance