I would like to know how could I know the current consumed from a battery using this sensor, or other similar, using a microcontroller.
What I would like to know is shown in this video, where you can see the current consumption.
Answer
In order to measure the current consumption or the battery's state of charge, you need to integrate current over time. The most basic method is to sample a current sensor (be it a hall-effect, shunt resistor, whatever) at a fixed rate fast enough to capture your current signal (10-100 Hz might be fine for a RC plane), and multiply it by the sample time to obtain charge (A·h, mA·h, coulombs, whatever). The Allegro sensors have an adjustable bandwidth, so you could get away with fs = 2*BW
Once you have the current consumed, you could subtract that from your battery's capacity to obtain the 'fuel level', preferably padded with a good margin of safety.
This method will not be terribly accurate, because the battery's useful charge is not exact, and will fluctuate wildly depending on discharge rate and temperature, among other variables, but it should be good enough to provide a rough 'gas gauge'.
No comments:
Post a Comment