• OBD, oh blah dah

    Eric Hertz02/25/2019 at 09:11 0 comments

    Update 3-3-19: Probed. See the bottom.

    Update 3-2-19 at the bottom.

    In another weird coincidence, it would seem my van does not, in fact, use CAN-bus, but in fact uses SAE-J1850 PWM

    (ooh, cool copy-paste result! I'mma leave that.)

    So, what's the weird coincidence? Friggin' #Floppy-bird.

    ...Yahknow, with PWM-based data-storage... 

    Seriously, who's ever heard of a PWM-based UART?! 

    (hrm, is that kinda what them LED-strings use?).

    On [ano]the[r] plus side, this is well within my means to tackle with parts on-hand... 

    ...CAN was looking iffy. 

    ...Had a vague idea of a somewhat-gnarly hack using a regular ol' AVR as a hacked-up SPI-slave via USI, (ala the half-duplex USI implementation of a software-UART, since there's no clock in CAN), a transistor, couple resistors, and some finger-crossing. It'da been near-maxed-out if my OBD port was 1Mb/s CAN, especially with them long packets... but, I'm pretty sure it coulda worked, despite not seeing anything remotely like it 'on the web.

    The surprisingly-not-found hack-therein, having been the idea of using a single-pin from the differential pair, with only common/discrete components, for receive-only (ala logging). (screw all them specialized chips!)

    ...

    Anyhow, the idea's a simple logger... converting 41.6Kb/s "PWM" input-data to, say, 115.2Kb/s RS-232 should be easy-enough... (or maybe even USB-CDC, if I'm feeling patient) it's even 0-5V. 

    Dunno if it's really even necessary to measure the pulse-widths, since otherwise it looks pretty much like a UART; if i can just set the UART's "sample"-timing between 8us and 16us into each 24us bit (like, say halfway through the bit, like most UARTs do), it'll sample 1 or 0, like any ol' UART-data.

    I'll leave the rest to linux.

    Ooh, a challenge: my dwindling AVR-supply is sans-U[S]ARTs... so bitbanging... I've already written that, but never had reason to go at such high bit-rates. Could be challenging.

    Easier, and more-direct, might be to just use an FT2232H, do they allow odd bit-rates? Maybe not as fun.

    We'll see if I actually get to it.

    Oh, some link[s], sure...

    https://learn.sparkfun.com/tutorials/getting-started-with-obd-ii/all

    http://pinoutguide.com/CarElectronics/ford_obd_2_pinout.shtml


    http://www.obdii.com/connector.html

    ---

    Update 3-2-19:

    From online-research: Looks like it's not quite like a typical UART byte-frame, so using a typical UART that samples mid-bit won't work. Not becase of the PWM-nature, but because of framing. Rather'n transmitting a start/stop bit with every byte, instead a start/stop indicator is sent once with every 12(?) byte frame.

    Little doubt a typical AVR USART *could* be hacked to work, e.g. by setting start/stop-bit-count to zero (is that possible?), and some realtime reconfig. But, again, I'm lacking AVRs with USARTs anyhow. Similar may be doable with USIs (realtime reconfig). But, this, I think definitely rules out using an FT2232. Which is fine by me... or would be, were my devel-setup more like it used to be. Bitbanging has the benefit of being non-reliant on specific hardware, so sometimes it seems more-rewarding to develop in that realm, anyhow. My "Polled UAR/T" code has been quite reliable, and developed/optimized enough as to only add a handful of instruction-cycles in a main() loop. Modifying that for this new protocol might result in some trickle-down improvements.

    Alternatively, and probably more-relevant to now, I could develop this alongside #Floppy-bird 's pwm-nibbles. Again, both projects would benefit each other. Which is kinda nice.

    Though, they do differ enough as to bring into question whether they should use the same code-structure. Chiefly: PWM-nibbles are >2-valued (ideally...

    Read more »

  • Applied Physics Question

    Eric Hertz01/18/2019 at 20:18 0 comments

    Imagine a system. wherein a controllable amount of fuel turns a shaft. Two gear-settings can be chosen, ideally for the least fuel-consumption, based on a varying load.

    Is there some sort of crossover-point where, for a specific load, the two gear-settings require the same amount of fuel to result in the same speed at the load?

  • hackacharge!

    Eric Hertz12/19/2018 at 12:57 0 comments

    ok, guess I left the dome-light on too long... 

    Starter cuts-out before it turns-over (long-story, let's just say some moron. [or greedo?] designed a system with a relay with too high a release-voltage).

    Gotta get some more juice in that batt.

    Have a jump-pack... Because of the relay, you're supposed to charge for a bit, rather'n jump... but either way, apparently that didn't have enough juice, either.

    Third-option (skipped over the obvious one...): House-batt... Obviously, jumper-cables from house-batt to starter-batt.... Yeah, didn't think of that.

    OTOH: house-batt is jury-rigged to charge (slowly) from main system through cigarette-lighter and a series resistor... And... it was plugged-in. So, house-batt-voltage probably equalled main-batt voltage. So, really probably doesn't matter that I somehow completely overlooked the obvious jumper-cabling in favor of:

    Jump-pack has a 120V charge-input... to charge the jump-pack. House-batt has a 125W 120V inverter.

    Yes, it *almost* sounds like a free energy scheme.

    Yep. Then, the brilliant idea that rather'n wanting to charge the jump-pack, what I really want to do is charge the main batt... Now, I'm almost certain jump-packs aren't usually designed for this... but mine didn't complain, and the inverter never once turned on its cooling-fan... so, it's obviously not charging anywhere near 125W... right? (well, it is quite cold out, and in, that was the whole point of starting the engine... anyhow...)

    So, about then, halfway in, I realize the jumper-cable possibility, then think of @Ted Yapo's attempts jump-starting a car from a coin-cell.

    The key, here, is that the house-batt voltage could be [drained to] quite a bit lower than we need on the main battery to start. We Have A Boost Converter, maybe a bit like joule-thieving?

    So, that combined with concern I'd blown a fuse in the jump-pack-charger, which might explain the inverter's silence, had me looking for ways to measure whether it was charging... yahknow, without having to move from my balled-up-trying-to-stay-warm position on my chair. 

    First stupid attempt:  I built-in a jumper for that! Measuring charge-current to the house-batt. Zero. Shit, the fuse is blown. No, wait, the inverter draws 0.6A unloaded, and it's light is on... OH, Right... charge-current *to* the house-batt.

    Now I'm debating unhooking yhe jump-pack from the main-batt to throw my meter between... but it's cold out there.

    And then the obvious, again a bit late, but not too [late]: Reach all of 2ft and measure the friggin' voltage from the lighter-outlet, see if it's increasing.

    Holy Snap... it hasn't even been an hour (Maybe half) and it's already reading 12.7V, 12.7, 12.8! Mind-you, we're charging two batteries, one of which is *significantly* larger than the charger was [likely] designed-for. And doing-so *in-system.* This is incredible!

    So, on to testing The Ted Theory: House-batt is a steady 12.03V. YEAH! Joule-thievery! er something.

    Disconnect... yep, 12.6, 12.5, 12.4... but pretty slow, surprisingly. And house-batt's like 12.1, now...

    So, definitely charging. Friggin' awesome.

    A few more minutes and give er a go... again lazy (mind you, it's 3:30AM at this point) and chilly, try to figure out how to remove the charger... I already put it through the wringer, starting with it connected would be cruel. But not cruel enough to step outside. What to do? Oh, huh... charger didn't have a switch... It's either plugged-in or not. And lo and behold there's a switch on the ol' inverter.

    Crank it over... and here we are, now cozy-warm and lazy, still "topping off" three batteries--main, the jump-pack, and house-batt--from my alternator,

    Man, this level of "lazy" might be borderline risky to these systems. I wouldn't recommend it. OTOH a well-designed multipurpose jump-pack with inbuilt-charger would be wisely-designed to handle AC charging of a car's main-batt. Nevermind fast pack-recharging...

    Read more »