View Single Post
Old 03-09-2011, 01:59 PM   #6 (permalink)
EcoModding Apprentice
Join Date: Jan 2010
Location: Newark, DE
Posts: 143

'91 CRX - '91 Honda CRX DX
90 day: 34.91 mpg (US)
Thanks: 0
Thanked 14 Times in 14 Posts
MPGshield sounds decent enough.

Yeah, as soon as read off the VSS error code I realized what was happening and thought to myself that it's a basic 5V or 12V on/off sensor signal... It's already more or less conditioned for microprocessor use which makes the optocoupler overkill.

The injector on the other hand is a big inductive device, and we're tapping directly into one of its power supply lines. Inductors like to produce big voltage spikes under the right conditions (conditions the ECU probably protects against, but none the less)... For instance, the ignition coil(s) that fire the spark plugs rely on that inductor effect. Thankfully, being an electrically heavy device means the ECU doesn't notice a few milliamps to drive the optocoupler LED. In fact, the way the injector is wired up in my case (constant power, switched ground) means the switched-power circuit for the optocoupler LED shows up as a few milliamp parasitic draw through the closed injector (nowhere near enough to open it or hold it open), and as zero draw when the ECU opens the injector.
As for timing delays, I hooked the opto-coupled injector input up to a function generator spitting out TTL levels (5V) and the interrupt routine's pulsewidth output was accurate up to about 20KHz (down to ~50us) over the function generator's full duty cycle range (5% - 89%). The same bit of code has done better in the past, so I'm not saying there's no effect, but it's negligible when talking about a signal that will never break 100 Hz (well, unless someone sticks this on a sport bike or a jet engine). Also, according to the optocoupler's spec sheet, response times improve as emitter current goes up. Since emitter current is dependent on the current limiting resistor and input voltage to the circuit (12V when installed in a car vs. the 5V I was testing with), its effects should be still more marginal in actual use.

As for the cost of replacing an ATMEGA168 or '328, yeah they're not that expensive. But we're not necessarily just talking about a '168 or '328 chip anymore... Some Arduino boards (both clones and the official boards) use surface mount chips that can't just be popped out of their DIP sockets and replaced. The Arduino Uno is being manufactured in a DIP version, but supply issues resulted in them more recently producing a model using a '328 chip in the ball grid array surface mount package. Leaded surface mount chips can be handled with fairly standard soldering tools. BGA requires a hot air station.
What I'm getting at is that we're not necessarily talking about replacing just a $5 chip anymore, we're talking about a $20 - $60 Arduino board.

So yeah, I'll try the higher value resistor on the VSS line later today and ditch the optocoupler all together if the ECU still isn't happy or it causes some kind of signal error (I'm reading both pulse count and frequency - distance and speed).

Here's the current code if someone wants to play with it:

Last edited by bobski; 03-09-2011 at 02:12 PM..
  Reply With Quote