I mentioned earlier that I was planning to advance the base timing of my Civic to try and get better mileage out of the E85. The plan is to use an Arduino DUE to read and modify the cam and crank signals so that the ECU thinks the motor is in an advanced position. After reading the altered signals it will apply its normal maps and the result will be an advance of the base timing. I don't want to get into any mapping modifications because at that point I would probably want to start from scratch and use my dusty Megasquirt 3.
Here's a post where I was looking for connectors to hook up the Arduino DUE.
http://ecomodder.com/forum/showthrea...tml#post538255 I have the connectors. I think the only other hardware I need is a box and mounting hardware for the DUE, and a power supply.
Here's the code for the DUE. I'd love any feedback. I used example code and help from my good friend Karl Walter of Waltech Systems
Waltech :: Home. This will be to test the hardware before I try and changes.
//hardware test
//this code will read the cam and crank signals and relay them with the same timing
//no attempt is made to modify their timing in an effort to test the hardware setup.
const int crankInPin = 22; // the pin number of the crank signal
const int camInPin = 24; // the pin number of the cam signal
const int crankOutPin = 23; // the pin number of the modified crank signal
const int camOutPin = 25; // the pin number of the modified cam signal
void setup() {
// initialize the output pins:
pinMode(crankOutPin, OUTPUT);
pinMode(camOutPin, OUTPUT);
// initialize input pins:
pinMode(crankInPin, INPUT);
pinMode(camInPin, INPUT);
// Attach an interrupt to the ISR vector
attachInterrupt(digitalPinToInterrupt(crankInPin), crank_ISR, HIGH);
attachInterrupt(digitalPinToInterrupt(camInPin), cam_ISR, HIGH);
uint32_t timehi_crank = 0;
uint32_t timehi_cam = 0;
}
void loop() {
//simple counting timer to set pins back to low
//normally pulse width will be RPM dependent, this should work as long as the signal is short enough
//to not overlap at higher RPMs. Hopefully the ECU only uses the distance between the
//signals, not the signal width.
state = digitalRead(crankOutPin); //check pin state
if (state == HIGH)
{
timehi_crank ++;
if (timehi_crank > 1000) //adjust this number to get the signal pulse width you want //want
{
timehi_crank = 0;
digitalWrite(crankOutPin, LOW);
}
}
state = digitalRead(camOutPin); //check pin state
if (state == HIGH)
{
timehi_cam ++;
if (timehi_cam > 1000) //adjust this number to get the signal pulse width you want //want
{
timehi_cam = 0;
digitalWrite(camOutPin, LOW);
}
}