Big data

With the first BMW CSE out in the real world, driven everyday, I'm getting lots of good feedback for improvements to the dash app. Now that I have access to CAN messages from the BMS there's a lot more data to consume/display.

A screenshot of the BMS console page in the touchscreen mode of the dash app

It took a long time (and a few burnt out Raspberry Pis) to figure out how to get good, clean ground singals to the General Purpose Input Output (GPIO) pins of the Pi.  I have inputs to the Pi for ignition, park (remember the Tesla doesn't have park so we have to use the shifter to tell us), sport mode, cruise control, and screen paging.  I also have one output for turning on the brake lights when regenerative braking exceeds the braking threshold so cars behind don't rear us when we let off the throttle.  

You'd be surprised how dirty an automotive electrical system is.  Eventually we settled on using optocouplers instead of relays so that we could isolate the low voltage circuits from the rest of the car.  An optocoupler (also called optoisolator) is a semiconductor device that allows an electrical signal to be transmitted between two isolated circuits. Two parts are used in an optocoupler: an LED that emits infrared light and a photosensitive device that detects light from the LED.  So, basically, we complete a circuit on one side (say, putting the shifter into park) and that lights up an LED inside a chip, which is then sensed on the other side of the chip, where it completes a completely separate circuit.  It's like magic, with light.

Now that all the wiring is fixed, the app is working perfectly.  Paul has been driving his CSE everyday and recently installed the Orion Battery Management System (BMS), which led to a lot of new programming opportunities.

The BMS monitors the state of all the battery cells and tells the onboard charger how many amps to send to the cells when charging.  It also sends messages on the CAN bus about the state of the batteries and the charger itself.  I want to display some of that information on the dash.  For example, until now I've been estimating range based on instantaneous voltage messages from the Drive Unit Controller (DUC) but voltage dips dramatically when the throttle is applied and the pack discharges power to the motor.  This meant that I had to "smooth" the voltage out by averaging it over time in order to prevent the range from fluctuating constantly.  Still, this was all at best an approximation of available energy.

I evened out the variances by using an average over 1,000 readings (10 seconds, as the messages come in on the CAN bus at 100Hz) and it worked but wasn't perfect. Additionally, we were flying blind with regard to battery temperatures and had no insight into what was going on when charging. The BMS offered the opportunity to address all that. It allowed us to wire up the thermistors in each battery cell and has configurable CAN bus messages that it sends with a variety of battery information that I am able to use for better display of battery state, health, range, etc.

Here's a small sampling of the information I can now use and display from the BMS:

Pack State of Charge (SOC), Pack Adaptive SOC, Pack Health, Pack Amp Hours, Pack Adaptive Amp Hours, Pack Voltage, Pack Current, Discharge Current Limit, Charge Current Limit, Discharge relay state, Charge relay state, Charger safety state, Malfunction indication, Multi-Purpose Input signal status, Always-on signal status, Is-Ready signal status, Is-Charging signal status, J1772 Plug State (Plug is disconnected, Plug is inserted but the button is depressed, Plug is inserted and button is not pressed - BMS is preparing to allow charge, Plug is inserted and the BMS has activated the J1772 compatible charging station), DTC statuses (Discharge Limit Enforcement Fault, Charger Safety Relay Fault, Internal Hardware Fault, Internal Heatsink Thermistor Fault, Internal Software Fault, Highest Cell Voltage Too High Fault, Lowest Cell Voltage Too Low Fault, Pack Too Hot Fault, Internal Communication Fault, Cell Balancing Stuck Off Fault, Weak Cell Fault, Low Cell Voltage Fault, Open Wiring Fault, Current Sensor Fault, Highest Cell Voltage Over 5V Fault, Cell ASIC Fault, Weak Pack Fault, Fan Monitor Fault, Thermistor Fault, External Communication Fault, Redundant Power Supply Fault, High Voltage Isolation Fault, Input Power Supply Fault, Charge Limit Enforcement Fault), Highest Cell Temperature and Cell ID, Lowest Cell Temperature and ID, Average Cell Temp, Internal BMS Temp, Fan Speed, High and Low Cell Voltages with IDs, High and Low Cell Open Voltages with IDs, High and Low Cell Internal Resistances with IDs, Average Cell Voltage, Average Cell Open Voltage, Average Cell Resistance, Number of cells, Battery Cell Broadcast (per cell id, instant voltage, resistance, open voltage)

Whew! Those are just the values I am currently reading and integrating into the dash. There are actually lots of others: https://www.orionbms.com/manuals/utility_o2/  As you can imagine, the challenge is how to display all that in a logical, meaningful way, using primarily just the hole where the tach used to reside. In general, I tend toward displaying too much information and Paul leans towards consumer-like simple interfaces. The division of labor is: Paul does a design and I do the coding. Together, we're honing in on what I think is a really nice app.

The charging page that appears when the ignition is off and the car is plugged in

The digital speedo page with all the potential "idiot lights" (creep mode, traction control, cruise control, limp mode, instantaneous voltage dropping below min, CAN bus disconnected). The vertical gauge bars for range and temp also change color to orange, then red as they approach limits.

Analog speedo and power mode


The digital speedo page in sport mode (unlimited discharge current)


The digital speedo page in limp mode, with reason

The charging page with a BMS malfunction

I added a couple new pages to the app and some new "idiot light" icons to the main page. (Pages are accessed via button on the steering wheel stalk on Paul's modern steering column -- I haven't yet determined how I'm going to implement page toggling in my car). 

There is a new "charging" page that automatically pops up whenever we detect that the car is charging. This shows the current charging progress, volts, amps, most relevant (closest to max) temp, any malfunction information, etc. This page is not in the page "rotation" if not charging. 

There are, however, two new diagnostic pages in rotation, one for the BMS, and another for the batteries. These complement existing diagnostic pages already in rotation for Tesla-related information from the Drive Unit Controller. However, we found that it was annoying to have to cycle through too many pages while driving so I added a little logic so that if aren't toggling quickly I bypass all the "diagnostic" pages and just flip between the digital and analog speedo pages.

The round mode temp console page

The round mode battery console page

The round mode BMS console page


The round console page for values calculated from other inputs


The round console page for things we keep track of in the app


The round console page for speed and power 

There are also new pages in the touch screen version of the app that Paul isn't currently using but I plan to locate behind the speaker grill in the dash in my car. This screen allows changes beyond just what we can accomplish with a couple buttons (page toggling and sport mode via shifter).








You get the idea.  I can impart a lot of information via this app and there really are no limits, other than my imagination.  This is an older video but if you haven't seen it, check out the app in action:







Popular posts from this blog

Different strokes

Love that battery

Going Analog in a Digital World