Tracking the 12v Battery with OBD2

Discussion in 'Hyundai Kona Electric' started by hobbit, Jan 26, 2020.

To remove this ad click here.

  1. hobbit

    hobbit Well-Known Member

    I'm not sure whether to post this here or in the "12V battery" thread... I was actually
    reading some of the "flat battery" threads over at speakev. Anyway, I went to revisit
    the Jeju PID for "aux battery current" which didn't seem to work for me as given.

    The file has "Aux Current,Aux Batt CURR,2102,(SIGNED(W)*256+V)/1000,-100,100,A,7E2"
    or the like. It's mostly right for the Kona, at least the ID and PID and bytes are okay,
    but the math is apparently wrong. Looking at the raw 16-bit value from W and V seems
    to center around 32768, with deviations above when the car is in ON and below when
    it comes to RUN state. I hooked up the ol' current-clamp so I could correlate values
    to the reality of what's going through the wires.

    Semi-long story short, it seems that this works well: (32768-((W*256)+V))/100
    showing discharge as positive, same as with the traction pack. Adapt as needed
    to your own PID definitions. Note that it's just current in/out of the 12V battery
    itself, and doesn't represent running 12V loads of the car once the DC/DC comes
    on. It stayed fairly negative on a drive this evening but slowly worked its way
    back toward 0, holding at about -2 amps by the time I got home. That's not
    enough to run headlights, butt-burner, gauges, etc ... but that's what the DC/DC
    was floating it at, still around 14.9 volts. I guess it wasn't long enough to reach
    that state where it drops to 13.6V during driving.

    The original equation must have been assuming milliamps centered around 0
    or something. This doesn't seem to work that way. It makes sense, as most
    current sensors power from 5V and swing output either side of 2.5. The question
    now is, where *is* the 12V current sensor, or is it a derived value from other
    hardware?? I dont see any hint of one in the schematics.

    _H*
     
    milesian likes this.
  2. To remove this ad click here.

  3. If you are asking the physical location of the 12 V current sensor, I believe it is located attached to the negative battery post as shown in this diagram:
    https://www.hkona.com/battery_sensor_description_and_operation-690.html
    I know this is the gas version but I believe the sensor is the same.
     
  4. Yep, on the negative.

    Will have to try that new formula. Thx, hobbit!

    03A74227-22A8-43D1-9D82-6D0DFC7612DF_1_105_c.jpeg
     
    Last edited: Jan 26, 2020
  5. I can't quite correlate this to the schematic however.

    upload_2020-1-27_17-58-16.png
     
  6. hobbit

    hobbit Well-Known Member

    So that little doohickey *is* a current shunt after all! I suppose I should have
    guessed, given the different metals little 2-wire connector coming off it. It seems
    to be pretty accurate, too, against my clamp-probe. *Absolutely* no hint of it
    on the schematics; the bit on the positive terminal is undoubtedly a remote
    voltage sense. [Prius has one too, and has to run the length of the car]

    _H*
     
    electriceddy likes this.
  7. To remove this ad click here.

  8. I edited the 12V battery current PID and did some 0.1 sec logging on a 5 min drive to the pub. One worry is that all the battery current readings have the values x.32 (right of the decimal point) leading to the stair-steps in the graph.

    8C7A586D-A1DF-433C-9EC9-BA44CCCAE49C_1_105_c.jpeg

    (The column to the right of Aux batt curr is just the negative of each value)

    Capture1.PNG
     
  9. hobbit

    hobbit Well-Known Member

    I started thinking that maybe it's supposed to be "+X" instead, since it comes
    after W and a lot of other 16-bit values from the same ECU / id are presented
    as high,,low in the alpha order. It almost certainly isn't (V,,W) as W
    tracks rough current deltas reasonably well and V jumps all over the place.

    I could easily see different engineering groups for HV vs. 12V systems
    having their own preferred endian-ness for reporting and submitting their
    arbitrary parameter specs to whatever collective finally put it all into the
    EPCU code. We may have a "what were they thinking" reverse-engineering
    type of problem here...

    OBDlink is not your friendliest CAN debugging tool, but it was easy
    enough to make three simple "gauges" to just read V, W, X as raw (decimal)
    values, and play with various loads [lights, fan, butt-blasters]. I got
    these example combinations with higher and higher currents drawn, all
    in ON-mode discharge as it's easier to control:

    W V value
    124 156 31900
    123 212 31700
    122 168 31400
    122 68 31300
    121 224 31200
    121 124 31100
    120 180 30900
    119 236 30700

    X just sat there showing "69" the entire time, so it's evidently not in
    the picture despite my thinking that the value might be (W,,X) instead.
    But Jeju has that as 12V SOC [directly in decimal percentage, yet], so
    I wouldn't expect it to move much.

    It's clear that the combined value is stair-stepping by decimal hundreds when
    taken as a 16-bit value. The V figure sat quite steadily at the observed
    values, and didn't "bobble" around much at all. I would expect it to be far
    more variable, with minor changes such as a different seat-heater level or
    fan speed. Nope. Rigidly granular.

    My "/100" interpretation would also only deliver a maximum range of
    +/- 32.7 amps, and we know the 12V system is capable of much more. But
    reading this way *was* matching my amp-clamp quite closely in realtime,
    so while it's useful to have as is I'd rather figure out WTF is really
    going on here. I should repeat this table with the amp-clamp in, but
    it's dark and cold out at the mo'.

    Given that the SOC reports in decimal, maybe this is all about W times
    some factor centered around 128, only reporting in 8 bits, and the V byte
    is something else. A simplified (128-W) or the like wouldn't match my
    amp-clamp very well; maybe this too is a percentage of some known
    max/min value that the shunt can measure?

    Anyone know how to contact the mysterious Jeju??

    _H*
     
  10. hobbit

    hobbit Well-Known Member

    I got that bit about 327xx/100 limited to 32 amps wrong; it would be more like
    +/- 327 amps, wouldn't it. I did a little more measuring; the shunt seems to
    develop about 1 millivolt / 10 amps, so it's pretty wide range.

    Changing the constant in the equation to 32700 seems to still match reality,
    and then gives integer amp values for which we can knock off any decimal
    places. For this we don't really need any more granularity than 1 amp,
    especially when you can't use OBD2 to measure currents when the car
    is powered off.

    _H*
     
    KiwiME likes this.
  11. Yes, and now that it seems to work that is an unfortunate limitation regarding using this to diagnose the battery issue. I did some quick tests to confirm as you've mentioned that the data only flows when in RUN mode or when charging. I tried two differing OBD dongles, both behaved the same. Here, I've put the car in RUN mode to initiate TP, powered off, then allowed it to charge at 230V 7 amps for a few minutes. The 14.5 V is still a worry regarding this conventional-appearing starter battery.

    Capture2.PNG
    Just for an alternative view, here's a video from a Tesla guy on this subject with some interesting contrasts.
     
  12. To remove this ad click here.

  13. hobbit

    hobbit Well-Known Member

    12V battery current aside, I went after a slightly different aspect today.
    With the current shunt right on tne battery, that's not an indication of
    how much overall 12V current is being sent to tne car, once we come
    up into full RUN mode. Aux battery current eventually gets down to an
    amp or less of charge. What I wanted was the proper PID for low-voltage
    DC converter current, feeding everything. There are a couple of
    possibly-theoretical PIDs for the Niro or Soul, but they seemed to
    be wrong.

    I took another look at Jeju's research spreadsheet. In the "VCU" tab
    under PID 2102, we see "Aux battery curr" filled in with some sampled
    values. Given the foregoing discussion, the resultant value shown indicates
    that the battery is discharging, i.e. the car is in ON mode and the LDC
    isn't running at all. There are nearby pairs of bytes that are 0. I made
    the assumption that LDC current would never be negative, and could
    thus be zero-based rather than 327xx midpoint-based. I also made the
    assumption that since this all talks about many parameters of the
    VCU or PCU in general, the group concerned with the LDC might all
    be contained in this small block.

    I fiddled my "raw bytes" PIDs to watch P and Q, confirmed that they're
    00 00 in ON mode, and went to RUN. The two parameters gratifyingly
    changed as the 12V rail voltage went up. Q was a modest positive
    value, albeit somewhat variable; P was all over the place. Aha: probably
    high,,low ...

    Long afternoon short: I think I have a working PID for LDC current.
    ID 7E2, mode/pid 2102, math ((Q*256)+P)/100 ... same little-endian
    methodology, similar reduction from 16-bit. I managed to get my small
    current probe around the big LDC wire near the relay box. Problem is,
    current draw is highly variable -- I watched it on a scope, it has somewhat
    periodic waveforms varying by several amps sometimes. The scope's
    averaging function helped a little, but I still wasn't sure.

    Can someone with a bigger current clamp get it around the main LDC
    wire coming off the PCU, it's on the passenger side and the output fitting
    is black plastic with a red "+" on it? Bang this PID into your favored OBD2
    tool and run different loads ... rear defrost, fans/lights, butt-burners, the
    non-driver power windows are the big ones. See if I'm actually in the
    right ballpark WRT measured current here. Different refresh rates might
    give varying results. RUN with nothing else turned on seemed to sit around
    9 -10 amps; with bloody everything in play I could drive it to upwards
    of 100, and those wires were slightly warm.

    I didn't look at ab, ac, or anything up from there yet.

    _H*
     
  14. hobbit

    hobbit Well-Known Member

    So here's the present state of my "dashboard", based on all of the
    foregoing halfassery ...

    200201_dash_s.jpg

    Keeping it running takes a lot of phone battery, because it's polling
    for a lot of stuff. But I think I've got the important diagnostic basics,
    which are definitely worth checking in on here and there. Now it's fun
    to correlate some of this to what I see in the "electricity use" screen,
    and things match up pretty well, math-wise.

    This is just after charging to 90% this morning. Ambient temp around
    30F, but the pack has clearly retained a bit of heat from when charging
    ended sometime in the wee hours.

    _H*
     
    SkookumPete likes this.
  15. SkookumPete

    SkookumPete Well-Known Member

    That's awesome, hobbit, and even more awesome that you know what it all means.

    I see you're displaying what I think is battery temp of module 3. It's odd that there is no PID for calculating the average of all the modules. Maybe one of the OBD experts here could write one?
     
  16. Ok, armed with hobbit's LDC current PID, logged a drive, 25 min there, 29 back, 5 second logging interval.
    Assuming the voltage PID I'm using is accurate (post #67 image), I'm relieved that the battery voltage is mostly at 12.7 V which negates my fear of overcharging. Peaks are at 14.6 V typically, average is 13.0 V.
    Regarding 12V battery current, putting a trendline on that puts the average close to zero ... as you might expect.
    So, I think the aux battery is doing exactly what we expected it to do, provide a bootstrap for starting and acting as a capacitor on the LDC.
    Regarding the curves, there clearly is nothing that can be read into the jiggles. Aside from the sampling effects of 5 second logging, we know the current draw is highly variable, with every touch of the steering wheel causing significant current in and out of the EPS.
    It's the averages that count, and those seem to indicate that the aux battery is not being mistreated while driving.

    LDC, 5 sec logs over 25 min.PNG LDC, 5 sec logs over 29 min.PNG
     
  17. hieronymous

    hieronymous Active Member

    There is a PID for this, in "005_Kona&Niro_EV_Extra_gauges.csv", but it doesn't need an expert, just a simple equation of the form (a+b+c+d)/4

    Hence, we have the PID:
    004_CALC Average Battery Module Temperature,Batt AvgT,0x220101,(val{000_Battery Module 01 Temperature}+val{000_Battery Module 02 Temperature}+val{000_Battery Module 03 Temperature}+val{000_Battery Module 04 Temperature})/4.0,-40,80,C,7E4

    where the 4 Battery Module PIDs 01-04 are found in:
    "003_Niro_EV_BMS.csv"
     
    Last edited: Feb 2, 2020
    SkookumPete likes this.
  18. hobbit

    hobbit Well-Known Member

    At the time of plunking in battery temps I was more interested in heat, so
    watching the BMS "max temp" seemed like the best idea. I threw in temp
    3 just to see a single sensor too.

    Obviously I'm not using the Jeju CSV names and labels, I'm entering my own
    into "obdlink".

    I need to watch all the LDC stuff more on a "real drive", as I never went to the
    13.x volt state while just sitting in the driveway. For voltage I just use the one
    that the OBD2 widget directly reports at the DLC.

    _H*
     
    KiwiME likes this.
  19. This graph is while trickle charging the HV battery at 1.6 kW, car is otherwise "off". 27 minutes duration with quarter-second logging.
    The 12V aux battery remains at a constant 14.7 V despite aux battery current (charging) dropping to 1 amp.
    I would imagine that the LDC must remain "on" during all HV charging to support the OBC and HV contactor(s).
    I'll have to add the dongle voltage next time to validate the aux voltage PID I'm using.

    LDC, 0.25 sec logs over 27 min.PNG
     
  20. Here's a graph of aux battery parameters during "run" mode while parked and then charging at 1.6kW. Logging is at 0.25 sec. Main points are:

    1. In run mode the aux battery voltage is around 14.8 V and it's charging at a slowly decreasing current, 15 down to 8 amps during the several minutes.
    2. Car turned off and 1.6 kW charging initiated. Aux battery continues charging at the same voltage and a similar current profile.
    3. After some further minutes when aux charging current drops to about 4 amps the aux battery voltage drops decreases to 13.0 and aux charging current goes to zero.
    4. The glitch at the end is when I open the door to change the logging rate. HV charge rate goes to 0.5 kW AC input for a few seconds, as we all know.

    Questions: How can the aux battery current be zero (or specifically under 1 amp) in the later segment? I have to wonder if it is disconnected from the system or is the LDC clever enough to manage this? Perhaps the current shunt at the negative terminal is used to control LDC output?

    I'm not sure what causes the step changes in LDC current in the last 2/3rds.

    Run then charge mode.PNG
     
    milesian likes this.
  21. hobbit

    hobbit Well-Known Member

    I've added one more picture to my "auxbat" page, to wit:

    ldc_curr.jpg

    Scoping LDC current, showing a lot of variation at ~100 Hz or more.
    So our OBD readings are going to get messed up by a simple matter
    of sample rate.

    Remembering those old buzzer-style voltage regulators...

    _H*
     
  22. davidtm

    davidtm Active Member

    I finally got around to changing this pid, and I like the new equation in my Niro EV. However, it only seems to be in whole integers of amps, so it hangs around at 0 most of the time. Is it possible to add a significant figure (or two)?

    Sent from my Pixel 3a using Tapatalk
     
  23. hieronymous

    hieronymous Active Member

    Long press on the dashboard gauge for Item Options menu/Display Configuration/Number of decimal places
     

Share This Page