Technical How to implement a low-cost, accurate state-of-charge gauge for an electric scooter Manfred Brandl
How to implement a low-cost, accurate state-of-charge gauge for an electric scooter Manfred Brandl Electric scooters are most commonly manufactured and used in China: there, the emphasis is on low cost, and most electric scooters today offer only the most basic features (see Figure 1). In particular, scooters have no fuel gauge or State of Charge (SOC) meter; a voltmeter dial is the only battery measurement provided to the rider, and the battery voltage provides a very crude indication of SOC. The voltage of a lead acid battery tends to maintain a fairly constant voltage through most of its discharge cycle, before dropping sharply as it nears a state of complete discharge. This means that the rider has very little warning that the battery is about to go flat; and, if the battery is partly discharged, no indication of how much energy (and therefore time) is required to completely recharge it. Fig. 1: a typical electric scooter manufactured in China. This model was used in road tests during the development of the SOC gauge described in this article. It would be very convenient for the rider, then, to be able to see an accurate and precise measurement of the battery s SOC. The average range (in kilometres) of a fully-charged battery is easily known. With an accurate reading of the percentage of battery charge remaining, the rider can estimate the remaining range. Page 2 / 8
This article describes a way to implement an accurate SOC gauge for four series-connected 12V lead acid batteries, the normal energy storage system in electric scooters and similar vehicles, while keeping to a very low bill-of-materials (BoM) budget, an essential requirement in the electric scooter market. Available as a reference design and a demonstration board, this battery sensor solution uses standard components readily available to electronics manufacturers. Basic architecture of the SOC gauge The SOC gauge system (see Figure 2) is built around a sensor interface IC, the AS8510 from ams, which combines low noise and accuracy with wide dynamic range. Current, voltage and temperature signals are amplified and digitised in the AS8510, which provides a serial digital interface to a simple 8-bit microcontroller (MCU). The MCU uses the inputs from the sensor interface to calculate an SOC value. This value may be displayed to the rider in a variety of ways, with the degree of sophistication of the display depending on the BoM budget available to the designer. UART serial Fig. 2: diagram showing the main functional blocks in the e-scooter fuel gauge reference design Page 3 / 8
Achieving high accuracy in current, voltage and temperature measurements The AS8510 sensor interface provides measurements of the total and individual battery voltages, the battery current, the temperature of the most negative battery pole, and the charge flowing in and out of the battery. Furthermore, it enables calculation of the batteries series resistance through synchronous acquisition of current and voltage changes when connected to a dynamic load. Current measurement is accomplished via a 100µΩ shunt of high current-carrying capability. The excellent analogue characteristics of the AS8510 it is virtually offset-free and provides intrinsically linear, low-noise outputs mean that the system can measure accurately across a current range from ±2.5mA to ±1,500A a dynamic range easily wide enough for use in the application described in this article. The device offers two independent 16-bit data acquisition channels which are clocked by the same internal precision RC oscillator for synchronous capture of shunt current and battery voltage. The voltage channel has an internal multiplexer allowing it to switch between measurements of the differential input voltage, two single-ended inputs for external temperature measurements, and an internal temperature sensor. In addition the internal current source can be programmed to drive external temperature sensors. The current measurement circuit consists of the shunt, which delivers its measurement signal through an optional low-pass filter into the sensor interface; this then amplifies the signal with a gain factor of 25. One of the requirements of this application is to measure separately the voltage of each of four batteries: in this reference design, the voltage measurement path is multiplexed between the four batteries in the series string and the temperature channel. This is accomplished through four precision voltage dividers, which are accessed through discrete FET switches controlled by the microcontroller. The sensor measures battery current at a sample rate of 1ms, and the four voltage tabs of nominally 12V, 24V, 36V and 48V sequentially, also at a 1ms interval, each voltage sample synchronous with a current sample. If any of the cells is found to be at a lower voltage than its normal range, a warning signal is produced. Page 4 / 8
Fig. 3: the e-scooter SOC gauge reference design board The rest of the board (shown in Figure 3) consists of: An input protection circuit comprised of two diodes and a capacitor to suppress high energy pulses on the supply line The sensor power supply: an AS1360 linear regulator powered from a 12V source. An e- scooter will normally feature a DC-DC converter to power 12V loads. An LED indicator to signal the operating status Connections for the microcontroller s programming interface and the display unit The sensor s operating current is typically 8mA, dropping to a minuscule 100µA in stand-by currentmonitoring mode. As shown above, the analogue front end provides a highly integrated means to deliver accurate voltage, current and temperature measurements across all four batteries. But these signals need to be processed before they can provide a useful SOC reading to the rider. To achieve this, ams developed two sets of firmware. Data logging firmware In the absence of datasheets or evaluation data for the batteries used in the test scooter, a method was devised to measure data during test drives which would enable the evaluation of the battery s performance. In particular, it was important to establish the parameters that would indicate when the battery was fully charged and fully discharged. Page 5 / 8
The test method used the sensor circuit described above, connected directly to a standard SD memory card over an SPI interface. The firmware accessed a FAT directory system on the SD card and wrote a log file in.csv format directly to it. Fig. 4: real-world data from test drives of the e-scooter shown in Figure 1 This approach is simple: the developer can remove the SD card from the logger, insert it in a PC and analyse the data using Matlab or Excel. Examples of data from the test drives are shown in Figure 4; they enable the developer to match the behaviour of the battery in the real world with the SOC readings produced by the measurement algorithms. SOC gauge display firmware With the performance data from the batteries in hand, it is possible to implement a simple algorithm to calculate the SOC. Tests showed that the cells had an open circuit voltage (OCV) of around 13.1V when fully charged, and 12V when fully discharged. The algorithm detects when a no-load condition has lasted for at least five minutes (which is the typical recovery time of this type of battery), when it can register the OCV; it then uses a linear interpolation to calculate an estimated SOC from the cell with the lowest voltage (since that is the one most likely to be fully discharged first). This interpolation is informed by voltage data acquired during the course of the road tests. Page 6 / 8
As soon as current starts flowing in or out of the battery, the algorithm switches to a chargeintegration ( coulomb counting ) method of measurement. Benefiting from the highly precise, zerooffset architecture of the AS8510, the system can accurately integrate the measurements of all the charge transferred into and out of the battery, to produce a value for total energy consumption. Since the amount of energy in the battery is known (from the initial OCV measurement), it is possible to continuously estimate a value for SOC, until another OCV event occurs. The algorithm developed for this reference design is quite rudimentary: a more sophisticated algorithm would additionally compensate for temperature and ageing of the battery (the energy capacity of a lead acid battery declines over a number of charge/discharge cycles). Nevertheless, road tests proved that this solution achieves accuracy of better than ±5% - a perfectly adequate performance in this application. To be useful, this accurate SOC estimation needs to be displayed to the reader. Two different display methods have been developed in this reference design. A very low cost, but informative, option is a simple LED stripe display. This uses the AS1110 16-channel LED driver IC to drive a string of red, orange and green LEDs. The LEDs show the SOC of the battery in the form of a bar graph each LED represents a 6% segment of the battery s total charge. The display is connected directly to the sensor unit via the expansion port, and is accessed via a synchronous serial interface. To demonstrate a more optically pleasing display, ams also implemented code to drive a colour graphics LCD panel from Electronic Assembly (see Figure 5). This display will not only show the SOC as a classic fuel gauge, but also the voltage at each cell, and the current flowing in and out of the battery, which provides interesting information to the rider. Fig. 5: LCD display showing the SOC reading and voltage readings for each of the four batteries Page 7 / 8
Conclusion This design shows that for Absorption Glass Mat (AGM) batteries such as those typically used in e- scooters, a good SOC calculation based on OCV and current integration can be made, provided it is based on highly accurate current and voltage measurements. This design, which uses the highly integrated AS8510 sensor interface, and thus requires relatively few, inexpensive associated components, meets the requirement of the e-scooter market for very low cost. Including the simple LED bar graph display described above, a reasonable estimate of the BoM component cost of this reference design in production volumes is around 3. The firmware described in this article is available on request from ams. Assembled demonstration boards are also available on request. For more information about the AS8510 sensor interface, go to www.ams.com/products/data-converters/data-acquisition-front-end/as8510 For further information ams AG Tel: +43 (0) 3136 500 info@ams.com www.ams.com Page 8 / 8