Battery Stack Monitor Updated
This provides an update on the battery monitoring stack we built a couple of years ago. The sensor boards are the same, but the code and architecture has changed.We're using this system to monitor batteries at the Woodbridge Wireless Repeater Hut.
The system measures individual cell voltages (~2.3V) in a string of batteries. A BeagleBone White and custom sensor boards use photocouplers and an Analog to Digital Converter to provide voltage measurements to a time series database. The values can be plotted versus time using a web browser and Grafana. This allows us to track the performance of each cell in a bank of batteries. Alerts can be set to send e-mails if cell voltages exceed (+ or -) thresholds.
The sensor boards contain 7 sensors. Each sensor consists of a photocoupler and signal conditioning components. The sensors are connected to the ADC via a multiplexer. A Java program selects a sensor and samples the ADC. The median value of 30 samples is converted to a voltage by using a sensor specific look up table. The lookup table is created for each individual sensor to allow for variation between photocouplers and component values.
The Java program sends the values to a MQTT broker. A transfer application (telegraf) pulls the values from the MQTT broker and stores them in a InfluxDB time series database. Each measurement has a unique MQTT topic, which allows the graphing system to display individual cell voltages in graph. This architecture provides the ability to use cloud based services, which increases overall system flexibility. It also avoids the problem of storing data on a SD card. We found that constantly write data to an SD card eventually wore out the card and crashed the system.
In the graph to the right, you can see all the individual cell voltages are displayed on a single graph along with the total voltage. This is a typical graph in a grafana dashboard.
The sensor is based on the idea the transfer curve of the PS8501 photocoupler is linear between 0 and 10mA. Usually, photo couples are used as digital inputs. So this is a somewhat novel idea. (Not ours!) Calibration curves are generated by applying a known voltage to the sensor, reading the ADC value and storing the value in a file. A DAC was built onto each board to provide an accurate, variable voltage source. Here is the transfer curve of the photocoupler.
The calibration data was plotted and shown to be generally linear. Using a look up table for the ADC to Voltage conversion seemed better than trying to generate an equation through curve fitting. Values that fall between calibration data points are interpolated using a straight line approximation. We know the transfer function varies by temperature, but we haven't conducted a study to see by how much. Since we're after 'good' accuracy and 'relative' measurements, we thought this was a good first cut. Below is a plot of the typical calibration curve. The green dots are the data points. The yellow line represents a 'linear' curve fit. Notice the variation as the battery voltage approaches 2.3V. This correlates with the curve in transfer curve of the PS8501.
Each sensor measures between 1.68V and 2.33V. Since the max voltage of the BeagleBones' ADC is 1.8V, the output of the photocoupler is scaled such that the max output voltage is 1.8VDC. Using one of the calibration curves, we find the ADC values vary between 1.68V and 2.33 and correspond to ADC values from 3355 to 1048. (Inverting) This means each bit represents approximately .283mV. The graph below shows two sensor circuits, which use the PS8501. Note, the 5VDC supply source needs to be noise free and stable because any ripple will be read by the ADC.