Statcounter

Sunday, November 25, 2018

Cam signal simulator, Arduino Nano, 1999 JTEC







Getting the factory tach to work with an LS engine swap





Arduino IDE-



//Cam signal simulator




/*Goal is to provide a cam signal to a JTEC equipped 1999 Dodge Dakota to make the dash tach guage ​
 * work and make JETC think the engine is running. This JTEC seems to need a evenly spaced 8 pulse crank signal ​
 * and a cam signal that changes state every 180 degrees rotation of the cam. Also added a inverted cam signal output ​
 * which can be used in case there is a correlation issue with the JTEC. crank input D2, output on D6 and D12 */​
  int state=LOW;​
  int lastState=LOW;​
  int count=0;​
  ​
void setup() {​
  // put your setup code here, to run once:​
  ​
  pinMode(2, INPUT);​
  pinMode(13, OUTPUT);​
  pinMode(12, OUTPUT);​
  pinMode(6, OUTPUT);​
  state = digitalRead(2);​
  digitalWrite(13, HIGH);​
  digitalWrite(12, LOW);​
  digitalWrite(6, HIGH);​
}​
void loop() {​
  // put your main code here, to run repeatedly:​
  ​
  if (state == HIGH && lastState == LOW) {​
    count++;​
  }​
  if (count <= 7) digitalWrite(13,HIGH),digitalWrite(12,LOW),digitalWrite(6,HIGH);​
  if (count >= 8) digitalWrite(13,LOW),digitalWrite(12,HIGH),digitalWrite(6,LOW);​
  if (count >= 15) count=0;​
  lastState=state;​
  state=digitalRead(2);
 }

2 comments:

  1. Nice Job. Could you post a wiring diagram of the connections you used. If I'm looking at correctly, it appears the crank signal is read on D2 and the cam signal is output on D6. What are D12 and D13 for?

    ReplyDelete
  2. Crank input on D2, cam output on D6 and D12 with D12 being inverted in relation to D6. D13 just flashes in unison with D6 high so you can visually see if the Arduino is outputting anything. I made D12 inverted in case the JTEC wasn't happy about correlation. As it turned out using D6 worked OK and D12 isn't used. Only using four connections +5 volts and ground from the JTEC sensor circuit, Crank in on D2 and cam out on D6. Basically it is a divide by eight input states and then change output state. Hope this helps.

    ReplyDelete