jump to navigation

0.3 Alpha (3rd public release) 2011/04/05

Posted by Michael in 2JZduino.

I’m over-due for another release. As mentioned in my post 0.2 Alpha (2nd public release). I’ve been working on replacing the crank sensor intercept with IGT signal intercept. This is now working successfully and is implemented in v0.3 available here…
2JZduino at SourceForge

Here’s a list of significant features new to v0.3…

  • Developer notes are now found in “DevNotes.txt” (they used to be at the top of “IS300_MAPadd.cpp”).
  • Note the inclusion of “IS300_Arduino_EEPROM.exe” in the sourceforge download. This program will talk to and program the EEPROM values into 2JZduino.
  • Igniter control – the code no longer supports interception and reproduction of the crank signal. Instead it intercepts and reproduces the igniter signals: IGT1, IGT2, IGT3. “IGT ON” events are always executed immediately (which charges the igniter circuit). “IGT OFF” events (which marks the firing of the spark) are executed depending on TimingRetardTable[][] values.
  • Fuel Injector pulse-adjustments are now calculated based on the Fuel Injector size stored in EEPROM.
  • Simulated narrowband circuit ground is now connected through PortB0 (Arduino pin 53). The code floats this pin as an input until the LC-1s show they are ready. As an input, the high-impedance drives the stock Toyota ECU into open-loop mode until the LC-1 begins outputting a meaningful signal. When it switches to an input (held low), the ground patch triggers the stock ECU to switch into closed-loop.
  • Improved interrupt efficiency. Igniter interrupts are now always serviced within 40us of their occurrence (20us 95% of the time). Injector interrupts are serviced within 60us of their occurrence.
  • Engine speed now calculated from IGTon signals instead of Crank sensor signals.
  • Datalogger expanded to now include RPM, MAP, Bank1 AFR, Bank2 AFR, and Injector pulse-width data. Datalogger information is now saved in a .csv file by “IS300_Arduino_EEPROM.exe” using the current date/time in the filename.
  • Reduced amount of SRAM used at run-time.
  • Added advanced injector and MAF compensation logic to EEPROM that will scale fuel injectors based on the new vs. stock fuel injector size, new vs. stock MAF sensor intake tube diameter, fuel injector lag, and a DC bias for the MAF signal. *Note: this is experimental and unverified. More details on this in a future post.

Additionally, here’s a summary of the verification testing that I’ve completed since the last release. I’ll be posting some more analytical information on these in the near-term, but for now, here are the results.

  • My 2nd LC-1 wideband has been installed. I’ve now gathered more than 20hours of operation with 2JZduino providing the simulated Narrowband signal for closed-loop fuel control. It’s been successfully fooling the stock ECU into adjusting for an AFR of 15.1 instead of 14.7 while under closed-loop operation.
  • ~4 hours of operation with 2JZduino providing active Injector Scaling (providing leaner fuel injection amounts at wide-open-throttle).
  • Verified that all 10k resistors are indeed 10k resistors… one of the resistors in the circuit for Injector #4 was found to actually be a 220 Ohm resistor. This culprit was understandably causing me all kinds misfire problems for awhile. I’ve learned a good lesson here :)


1. Martin Johann Kloppers - 2012/02/27

Really great work.

I am trying to get a good clean RPM signal into my arduino, and this seems to be a good way to go. What kind of form is the final result of the code, is it an actual real-time RPM number? I see you are using an LCD display; I want to display RPM on my computer by grabbing the RPM from the arduino in the program Max MSP. However, the liason program between Max MSP and arduino, “Maxuino”, does not interpret interrupts.

Regarding the IGT signal, is it necessary to “intercept and reproduce” it in my case, since I am not trying to change or delay the data but just view it and then apply it?
From what I understand you are able to run the IGT signal directly into the arduino without having to add safety measures (exceeding voltage max/mins etc). Any other hardware that I will need?

In the MR2 pinout diagram, I do not see IGT1 IGT2 IGT3 like you have mentioned… perhaps I misunderstood. We just have IGT and IGF:

(mine is the JDM SW20 GEN2 1993, the third one down)

Any help much appreciated.

Michael - 2012/02/27

Thanks. The code is calculating engine speed in Hz in real-time. It gets displayed in RPM whenever there is time (the display does not have priority.

I’m not familiar with Maxuino, but the EngineHz value is available as a byte.

In the 2JZ the IGT signal is 5V and directly compatible with an Arduino pin. It’s a well driven signal too so you should be able to “listen” to it without affecting it (I.e. Not having to reproduce it). I’d imagine its the same on your engine but can’t be sure obviously. And only having 1 IGT signal is probably because your engine is a 4cyl. I’ve never thought about this but you can get away with only 1IGT I guess when cylinders are all 90 degs apart.

If you wanted to, I diode could be used to protect the arduino input. But it seems pretty low risk if you don’t.

Martin Johann Kloppers - 2012/02/27

Thanks again, good info.
I checked it to see what my IGT put out for voltage, and it ranged between 719 – 730 mv, fluctuating a bit depending on RPM… With the ignition on but car not running I saw 1.6 mv.

I tied into the IGT signal wire and plugged it into the arduino digital input 8 to see what it might give me… and the car immediately stalled… lol. (My arduino is grounded to the chassis, most unused pins are also grounded, if that makes a difference).

What about the IGF signal, is it required in addition?

Michael - 2012/02/27

What did you use to measure it? Most voltmeters won’t be fast enough and you’ll probably need a scope. Strange that it killed the engine right away. The arduino was configured as an input with the pullup off? Maybe there is a 5v source further downstream in your mr2 electronics. Like I said… I’m not familiar with your ecu.

In any case, igf could also be a legitimate signal for capturing rpm. It confirms to the ecu when a spark fires.

2. Martin Johann Kloppers - 2012/02/28

Yes it was just an ordinary voltmeter, so its going to show what it thinks is a solid signal but in fact is square pulses… understood. I will have to get my hands on an oscilloscope.

I will also recheck to make sure that there aren’t any other sources downstream that would affect this.

I did get confirmation from another source that the 3sgte ecu IGT operates in the same way, 5v pulses.

Michael - 2012/02/28

Feel free to post your arduino code too. And while you’re tinkering, consider using a small resistor between the arduino input and the IGT signal… 200-1000 ohms. Just in case your arduino sinks a bunch of current from IGT.

3. Martin Johann Kloppers - 2012/03/01

How shall I post the code? its long, and is attempting to allow for both IGT and NE signals….

Martin Johann Kloppers - 2012/03/02

I created a SourceForge account… here is a link to the Wiki page for the code… I would welcome any recommendations on improving it, especially the IGT sections.


Something else that has been drawn to my attention: Due to the fact that I can only run one sketch in the arduino at a time, I would require an additional arduino to run a code other than the StandardFirmata currently utilizing the serial port in my arduino to run Maxuino/Max MSP. A second arduino could run this IGT code, and then feed the resulting value into one of the first arduino’s digital/analog inputs.

Would it not be best to then turn the resulting engineHz value into a voltage, from 0 – 5 volts? If so, how?

Martin Johann Kloppers - 2012/03/02

I guess it would have to be pwm output, which has 256 discreet values… which I guess is increments of about 29 RPM. That’s not bad, and can work. Ultimately the Max patch I wrote drives a servo which is based on the same 256 step sizes anyway.

Michael - 2012/03/02

Looking quickly, you don’t want to use pins 0 or 1 from what I remember. They are active during serial comma which overrides what you expect out of it (I think… It’s been awhile now but I remember some issues like this).

Regarding one sketch. You can run multiple tasks but it can get complicated when some of them need to be running real time. 2jzduino runs all engine management real-time, and all serial/LCD/non-essential code runs when cycles are available. Careful use of interrupts is required.

Lastly, getting a 0-5very out requires a DAC (digital-analog converter). Search the arduino site for more info. PWM will only give you 5v pulses at different frequencies.

Sent from my BlackBerry® PlayBook™ http://www.blackberry.com

4. Martin Johann Kloppers - 2012/03/05

Just off the top of my head, its interrupts 0 (dig #2) and 1 (dig #3) that were used… unless I missed it… Thanks for having a look :)

Will read up on DAC’s.

5. Martin Johann Kloppers - 2012/03/11

I am strongly considering audiorate monitoring, since Max MSP is very strong in this area (signal wavetype manipulation and analysis) with many tools such as oscilloscopes and precise frequency conversions, and it does it at interrupt level speed and priority. My Presonus Firebox audio interface (which is already installed in the car to provide firewire-quality sound to my amps) could take the signal wave as an audio input, and it would then go right into Max MSP. This would mean cutting the arduino and Maxuino out of the picture altogether for this task. I would still need them for many other tasks at the same time anyway though.

I would essentially be listening to the sound of the signal rate, turning the wave signal frequency into a useable real-time number value, simply scaling it to match RPM, and running the final value into my software digital tach interface. I can determine thresholds and up or down crossings etc, which should give me really clear results without even the need to smooth, average, or sample, making it real-time. I have a few hoops to jump through yet, but I believe it will work.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: