หมวดวิศวกรรม/เทคโนโลยียานยนต์ => การทดสอบกล่อง => การซ่อมกล่อง ECU => กล่อง ECU => อิเล็กทรอนิกส์ยานยนต์ => Arduino for CAR => ข้อความที่เริ่มโดย: Auto Man ที่ 09 กรกฎาคม 2565, 15:55:53

หัวข้อ: FORD 1996 CKP crank signal simulator 36-1
เริ่มหัวข้อโดย: Auto Man ที่ 09 กรกฎาคม 2565, 15:55:53
     เป็นเครื่องซิมมูเลเตอร์ สำหรับให้นักเรียน/นักศึกษา ฝึกใช้เครื่องสแกนเชื่อมต่อกับกล่อง ECU
เพื่อการอ่านค่าดาต้าลิสต์ โดยไม่ต้องไปต่อกับเครื่องยนต์จริง ประโยชน์คือประหยัดน้ำมันและอื่นๆ

    สามารถนำไปใช้ได้กับรถ/กล่องบ้านเรา โดยเฉพาะกล่องของรถโตโยต้า รุ่นยอดฮิต 1NZ-FE
ยัดลงกล่อง แล้วใช้ Arduino สร้างสัญญาณ CKP, CMP ป้อนเข้ากล่อง ต่อปลั๊ก OBD-II
และอื่นๆ สามารถจำลองสัญญาณต่างๆ ได้

   FORD 1996 CKP crank signal simulator 36-1   
https://forum.arduino.cc/t/crankshaft-sensor-code/144435

โค๊ด: [Select]
/* FORD 1996 CKP crank signal simulator 36-1
 by Ichabod mudd
 */
#include "Arduino.h"
#define PULSE_PIN 10
#define CAM_PIN  8
#define MPH_PIN 12
int mph_toggle = 1 ;

// the setup routine runs once when you press reset:
void setup()
{
  pinMode(PULSE_PIN, OUTPUT);
  pinMode(CAM_PIN, OUTPUT);
  pinMode(MPH_PIN, OUTPUT);
}


//reluctor wheel
// subroutines first

//function to first go HiGH

void triggerHigh(int duration, int count)
{
switch (count)
{
  case 1:  // cam CMP pin 8
digitalWrite(CAM_PIN, HIGH);
break;
  case 2:
digitalWrite(CAM_PIN, LOW);
digitalWrite(MPH_PIN, LOW); //VSS
break;
   
  case 12:
digitalWrite(CAM_PIN, HIGH);
break;
  case 13:
digitalWrite(CAM_PIN, LOW);
break;
  case 24:
digitalWrite(CAM_PIN, HIGH);
break;
  case 25:
digitalWrite(CAM_PIN, LOW);
break;
} // end cases


  //hold CKP PIN high for this delay.
  digitalWrite(PULSE_PIN, HIGH);
  delayMicroseconds(duration);
  // now CKP go low
  digitalWrite(PULSE_PIN, LOW);
  delayMicroseconds(duration);
  // end function
}

//Simulate the reference marker on a
//reluctor wheel for #1 cyclinder firing
//function to do trigger
void triggerReference(int duration)
{
  // pin should be low already see above....
  delayMicroseconds(duration);
  // add more duration to make ECU HAPPY

}
//end function


//Simulates a 36 tooth reluctor wheel
//with a  1 tooth reference

// begin main loop program section
void loop()
{
  // read potentiometer wiper pin 0?
  // analog A/D channel 0
  int val = analogRead(0);
  // analog pin A0
  val = map(val, 0, 1023, 150, 1000);
  // for loop 36 counts  , 150 uS to 1000 uS or  5000 to 800 rpm
  for (int i = 0; i <= 34; i++)
  {
    // go high then low , in Symmetry
    triggerHigh(val,i );
   
      }
  // end for 35   pulse loop
  // simulate the missing tooth next
  triggerReference(val); // cyl, 1 firing now.
  // 35+1 = 36 total
     
      digitalWrite(MPH_PIN, HIGH);
           
  }
// end main loop  version 7 , now perfect  800 rpm to 5000
// added cam pulse 7/4/2013 
// using Delay calls, suck but , this is easy.
// the switch case trick, gets the cam sensor working.
// the engine fires every 120 degr. on crank, 12 teeth, and 10 degr per tooth=120
// added MPH pin, for VSS signals to ECU


ตรงนี้มีภาพ! แต่ท่านจะมองไม่เห็น , ท่านต้อง  สมัครสมาชิก หรือ ลงชื่อเข้าระบบ
 (http://upic.me/show/62801365)
หัวข้อ: FORD 1996 CKP crank signal simulator 36-1
เริ่มหัวข้อโดย: Auto Man ที่ 09 กรกฎาคม 2565, 15:58:27
ตรงนี้มีภาพ! แต่ท่านจะมองไม่เห็น , ท่านต้อง  สมัครสมาชิก หรือ ลงชื่อเข้าระบบ
 (http://upic.me/show/62801366)

ตรงนี้มีภาพ! แต่ท่านจะมองไม่เห็น , ท่านต้อง  สมัครสมาชิก หรือ ลงชื่อเข้าระบบ
 (http://upic.me/show/62801368)

ตรงนี้มีภาพ! แต่ท่านจะมองไม่เห็น , ท่านต้อง  สมัครสมาชิก หรือ ลงชื่อเข้าระบบ
 (http://upic.me/show/62801367)