Nithish Kumar

This is application code developed for RKE project with following features. The requirements are taken from https://cruizbyte.co.in/training-blog/f/remote-keyless-entry


The Block diagram for the feature is given below



PROJECT – I

REMOTE KEYLESS ENTRY

(Without CAN)

 

/*CREATED BY: NITHISH KUMAR*/

/*SOFTWARE USED : ARDUINO IDE*/

 

/*====KEY FOB====*/ //BUTTONS PRESENT IN THE REMOTE KEY FOB

int RKE; //RKE KEY FOB

bool lock_BUTTON; //LOCK BUTTON PRESENT IN KEY FOB

bool unlock_BUTTON; //UNLOCK BUTTON PRESENT IN KEY FOB

bool trunk_BUTTON; //TRUNK BUTTON PRESENT IN KEY FOB

 

/*====BUTTON TIMER====*/ //BUTTON PRESS & HOLD DURATION

int lock_TIMER; //LOCK BUTTON PRESS & HOLD DURATION IN KEY FOB

int unlock_TIMER; //UNLOCK BUTTON PRESS & HOLD DURATION IN KEY FOB

int trunk_TIMER; //TRUNK BUTTON PRESS & HOLD DURATION IN KEY FOB

 

/*====BUTTON CLICKS====*/ //BUTTON CLICK COUNT

int lock_COUNT; //LOCK BUTTON CLICK COUNT IN KEY FOB

int unlock_COUNT; //UNLOCK BUTTON CLICK COUNT IN KEY FOB

int trunk_COUNT; //TRUNK BUTTON CLICK COUNT IN KEY FOB

 

/*====CAR SWITCHES====*/ //DOOR SWITCHES IN THE CAR

bool switchStatus; //VEHICLE SWITCH STATUS

bool drv_SWITCH; //DRIVER DOOR SWITCH

bool pass_SWITCH; //PASSENGER DOOR SWITCH

bool releft_SWITCH; //RAER LEFT DOOR SWITCH

bool reright_SWITCH; //REAR RIGHT DOOR SWITCH

bool trunk_SWITCH; //TRUNK DOOR SWITCH

 

/*====SOLENOID VALVES====*/ //DOOR VALVES IN EACH DOOR OF THE CAR

bool valveStatus; //VEHICLE VALVE STATUS

bool drv_SOLVALVE; //DRIVER DOOR VALVE

bool pass_SOLVALVE; //PASSENGER DOOR VALVE

bool releft_SOLVALVE; //REAR LEFT DOOR VALVE

bool reright_SOLVALVE; //REAR RIGHT DOOR VALVE

bool trunk_SOLVALVE; //TRUNK DOOR VALVE

 

/*====INDICATION LAMPS====*/ //INDICATION LAMP FEEDBACK

bool headlight; //HEADLIGHT

bool hazR1_LAMP; //FRONT RIGHT TURN LAMP

bool hazR2_LAMP; //REAR RIGHT TURN LAMP

bool hazL1_LAMP; //FRONT LEFT TURN LAMP

bool hazL2_LAMP; //REAR LEFT TURN LAMP

 

/*====IGNITION STATUS====*/ //KEY CYLINDER STATUS

int ig_status; //1 = LOCK POSITION, 2 = ACCESSORY POSITION, 3 = ON POSITION

 

/*====IMPORTANT PARAMETERS====*/

bool child_lock; //CHILD LOCK BUTTON

bool vhl_buzzer; //VEHICLE BUZZER FOR TURN LAMP INDICATORS

bool intr_buzzer; //VEHICLE INTERIOR BUZZER

bool airbag; //AIRBAG

bool horn; //VEHICLE HORN

int vehicle_speed; //VEHICLE SPEED

int timer; //ACTION TIMER

int feed; //VARIABLE USED IN LOOPING STATEMENT

 

/*====STATES====*/

// 1 = TRUE/ON/HIGH/UNLOCK/OPEN/YES/UNARMED

// 0 = FALSE/OFF/LOW/LOCK/CLOSE/NO/ARMED

 

void setup()

{

  Serial.begin(9600); //Setting up Serial Communication Baud rate to 9200

}

void loop()

{

  if (Serial.available() > 0)

  {

    RKE = Serial.parseInt();

    switch (RKE)

    {

      case 1:

        if ((lock_BUTTON == 1) &&

            (ig_status == 1 || ig_status == 2) &&

            (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0))

        {

          RKE_LOCK(); //Lock Function

        }

        break;

 

      case 2:

        if ((unlock_BUTTON == 1) &&

            (ig_status == 1 || ig_status == 2) &&

            (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0))

        {

          RKE_UNLOCK(); //Unlock Function

        }

        break;

 

      case 3:

        if ((trunk_BUTTON == 1) &&

            (ig_status == 1 || ig_status == 2))

        {

          RKE_TRUNK(); //Trunk Function

        }

        break;

 

      case 4:

        if ((unlock_TIMER == 3) &&

            (drv_SOLVALVE && pass_SOLVALVE && releft_SOLVALVE && reright_SOLVALVE == 0) &&

            (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH == 0) &&

            (ig_status == 1 || ig_status == 2))

        {

          RKE_SEARCH(); //Search Function

        }

        break;

 

      case 5:

        if ((lock_BUTTON == 1) && (drv_SWITCH || pass_SWITCH || releft_SWITCH || reright_SWITCH != 1))

        {

          RKE_THEFT_ALARM(); //Theft Alarm Function

        }

        break;

 

      case 6:

        if ((lock_TIMER == 5) &&

          (valveStatus && switchStatus == 0) ||

            (valveStatus && switchStatus == 1) &&

            (ig_status == 1 || ig_status == 2))

        {

          RKE_PANIC_ALARM(); //Panic Alarm Function

        }

        break;

 

      case 7:

        if ((vehicle_speed >= 20) &&

            (ig_status == 3) &&

            (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0))

        {

          RKE_AUTO_LOCK(); //Auto Lock Function

        }

        break;

 

      case 8:

        if ((vehicle_speed == 0) &&

            (ig_status == 2) &&

            (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0))

        {

          RKE_AUTO_UNLOCK(); //Auto Unlock Function

        }

        break;

 

      case 9:

        if (((drv_SWITCH || pass_SWITCH || releft_SWITCH || reright_SWITCH != 0) ||

             (drv_SOLVALVE || pass_SOLVALVE || releft_SOLVALVE || reright_SOLVALVE != 0)) && (timer >= 30) &&

            (drv_SWITCH = pass_SWITCH = releft_SWITCH = reright_SWITCH = trunk_SWITCH == 0) &&

            (ig_status == 1 || ig_status == 2 || ig_status == 3))

        {

          RKE_AUTO_RELOCK(); //Auto Relock Function

        }

        break;

 

      case 10:

        if ((drv_SOLVALVE == 0) &&

            (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0) &&

            (ig_status == 3))

        {

          RKE_CENTRAL_LOCK(); //Central lock Function

        }

        break;

 

      case 11:

        if (airbag == 1)

        {

          RKE_EMERGENCY_UNLOCK(); //Emergency Unlocking

        }

        break;

 

      case 12:

        if (drv_SWITCH = pass_SWITCH = releft_SWITCH = reright_SWITCH = trunk_SWITCH == 0)

        {

          RKE_BEEP(); //Beep Function

        }

        break;

 

      case 13:

        if ((lock_BUTTON == 1) &&

            (drv_SWITCH || pass_SWITCH || releft_SWITCH || reright_SWITCH || trunk_SWITCH != 1))

        {

          RKE_SPECIALS(); //Special Circumstances

        }

        break;

    }

  }

}

/*------------------------------------------------RKE_FUNCTIONS------------------------------------------------*/

//------------------------------------------------1. LOCK

void RKE_LOCK()

{// When lock button is pressed, all the valves are locked

  drv_SOLVALVE = 0;

  pass_SOLVALVE = 0;

  releft_SOLVALVE = 0;

  reright_SOLVALVE = 0;

  trunk_SOLVALVE = 0;

  Serial.println("[1]: VEHICLE LOCK SUCCESSFUL");

  Serial.println("LOCK FEEDBACK ENABLED:"); //user feedback

  for (feed = 1; feed <= 1; feed++)

  {

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS:");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 1);

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS:");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 0);

  }

  Serial.println("END");

}

 

//------------------------------------------------2. UNLOCK

void RKE_UNLOCK()

{// When unlock button is pressed, all the valves are unlocked

  drv_SOLVALVE = 1;

  pass_SOLVALVE = 1;

  releft_SOLVALVE = 1;

  reright_SOLVALVE = 1;

  Serial.println("[2]: VEHICLE UNLOCK SUCCESSFUL");

  Serial.println("UNLOCK FEEDBACK ENABLED:");

  for (feed = 1; feed <= 2; feed++)

  {

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 1);

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 0);

  }

  Serial.println("END");

}

 

//------------------------------------------------3. TRUNK

void RKE_TRUNK()

{// When trunk button is pressed, trunk valve is unlocked

  trunk_SOLVALVE = 1;

  Serial.println("[3]: TRUNK UNLOCK SUCCESSFUL");

  Serial.println("TRUNK FEEDBACK ENABLED:");

  for (feed = 1; feed <= 2; feed++)

  {

    Serial.print("HAZARD LAMPS STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = 1);

    Serial.print("HAZARD LAMPS STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = 0);

  }

  Serial.println("END");

}

 

//------------------------------------------------4. SEARCH

void RKE_SEARCH()

{// When unlock button is pressed for 3 secs, search function is enabled

  Serial.println("[4]. VEHICLE SEARCH ACTIVATED");

  Serial.println("SEARCH FEEDBACK ENABLED:");

  for (feed = 1; feed <= 10; feed++)

  {

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 1);

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 0);

  }

  Serial.println("END");

  Serial.println("PRESS AND HOLD THE 'UNOCK' BUTTON AGAIN TO SEARCH VEHICLE");

  if (unlock_COUNT == 2) // When unlock button is pressed for 2 secs, search function is disabled

  {

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 0);

    Serial.println("VEHICLE SEARCH STATUS: DISABLED");

  }

}

 

//------------------------------------------------5. THEFT ALARM

void RKE_THEFT_ALARM()

{// When any of the doors are opened, theft alarm function is enabled

  Serial.println("[5]. THEFT ALARM ACTIVATED");

  Serial.println("THEFT ALARM FEEDBACK ENABLED:");

  for (feed = 1; feed <= 10; feed++)

  {

    Serial.print("HAZARD LAMPS AND HORN STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 1);

    Serial.print("HAZARD LAMPS AND HORN STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 0);

  }

  Serial.println("END");

  if (lock_COUNT == 2) // When the doors are closed, theft alarm function is disabled

  {

    Serial.print("HAZARD LAMPS AND HORN STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 0);

    Serial.println("THEFT ALARM STATUS: DISABLED");

  }

}

 

//------------------------------------------------6. PANIC ALARM

void RKE_PANIC_ALARM()

{//when the lock button is pressed for 5 secs, Panic alarm is enabled

  Serial.println("[6]. PANIC ALARM ACTIVATED");

  Serial.println("PANIC ALARM FEEDBACK ENABLED:");

  for (feed = 1; feed <= 10; feed++)

  {

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 1);

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 0);

  }

  Serial.println("END");

  Serial.println("PRESS AND HOLD THE 'UNLOCK' BUTTON AGAIN TO ACTIVATE PANIC ALARM");

}

 

//------------------------------------------------7. AUTO-LOCK

void RKE_AUTO_LOCK()

{//when the vehicle reaches a speed of 20KMPH, all the valves are locked automatically

  drv_SOLVALVE = 0;

  pass_SOLVALVE = 0;

  releft_SOLVALVE = 0;

  reright_SOLVALVE = 0;

  trunk_SOLVALVE = 0;

  Serial.println("[7]. AUTO-LOCKING SUCCESSFUL");

  Serial.println("END");

}

 

//------------------------------------------------8. AUTO-UNLOCK

void RKE_AUTO_UNLOCK()

{//when the vehicle is at halt, all the valves are unlocked automatically

  drv_SOLVALVE = 1;

  pass_SOLVALVE = 1;

  releft_SOLVALVE = 1;

  reright_SOLVALVE = 1;

  Serial.println("[8]. AUTO-UNLOCKING SUCCESSFUL");

  Serial.println("END");

}

 

//------------------------------------------------9. AUTO-RELOCK

void RKE_AUTO_RELOCK()

{//when the vehicle is remained unlocked for more than 45 secs, all the valves are locked automatically

  drv_SOLVALVE = 0;

  pass_SOLVALVE = 0;

  releft_SOLVALVE = 0;

  reright_SOLVALVE = 0;

  trunk_SOLVALVE = 0;

  Serial.println("[9]. AUTO-RELOCKING SUCCESSFUL");

  Serial.println("END");

}

 

//------------------------------------------------10. CENTRAL-LOCK

void RKE_CENTRAL_LOCK()

{//when driver door is locked, all the valves are locked

  pass_SOLVALVE = 0;

  releft_SOLVALVE = 0;

  reright_SOLVALVE = 0;

  Serial.println("[10]. CENTRAL LOCK SUCCESSFUL");

  Serial.println("END");

}

 

//------------------------------------------------11. EMERGENCY UNLOCK

void RKE_EMERGENCY_UNLOCK()

{//when the vehicle's airbag is released, all the valves are unlocked

  drv_SOLVALVE = 1;

  pass_SOLVALVE = 1;

  releft_SOLVALVE = 1;

  reright_SOLVALVE = 1;

  trunk_SOLVALVE = 1;

  Serial.println("[12]. EMERGENCY UNLOCKING SUCCESSFUL");

  for (feed = 1; feed <= 10; feed++)

  {

    Serial.print("HAZARD LAMPS, HEADLIGHT AND HORN STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = headlight = horn = 1);

    Serial.print("HAZARD LAMPS, HEADLIGHT AND HORN STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = headlight = horn = 0);

  }

  Serial.println("END");

}

 

//------------------------------------------------12. BEEP

void RKE_BEEP()

{// when a door is opened, the beep function is enabled until the door is closed

  if (switchStatus == 1)

  {

    Serial.println("[13]. INTERIOR BUZZER ACTIVATED");

    for (feed = 1; feed <= 10; feed++)

    {

      Serial.print("INTERIOR BUZZER ENABLED: ");

      Serial.println(intr_buzzer = 1);

    }

    Serial.println("END");

  }

  else if (switchStatus == 0)

  {

    Serial.println(intr_buzzer = 0);

    Serial.println("INTERIOR BUZZER STATUS : DISABLED");

    Serial.println("END");

  }

}

 

//------------------------------------------------13. SPECIALS

void RKE_SPECIALS()

{//when lock button is pressed when any of the doors are opened, the buzzer is enabled

  Serial.println("[14]. VEHICLE LOCKING UNSUCCESSFUL");

  Serial.print("INTERIOR BUZZER ENABLED: ");

  for (feed = 1; feed <= 10; feed++)

  {

    Serial.print("INTERIOR BUZZER ENABLED: ");

    Serial.println(intr_buzzer = 1);

  }

  Serial.println("END");

  if (switchStatus == 0)

  {

    Serial.println(intr_buzzer = 0);

    Serial.println("INTERIOR BUZZER STATUS : DISABLED");

    Serial.println("END");

  }

}

 

/**********END OF PROGRAM**********/


PROJECT- II

REMOTE KEYLESS ENTRY

 

/*CREATED BY: NITHISH KUMAR*/

/*SOFTWARE USED: ARDUINO IDE*/

 

#include <SPI.h> // Serial Peripheral Interface communication

#include <mcp2515.h> //CAN interface library

 

//For CAN message reception

struct can_frame canMsgr;

 

//For CAN message transmission

struct can_frame canMsg1; //Ignition OFF

struct can_frame canMsg2; //Ignition ACC

struct can_frame canMsg3; //Ignition ON

struct can_frame canMsg4; //Driver Door

struct can_frame canMsg5; //Passenger Door

struct can_frame canMsg6; //Rear Right Door

struct can_frame canMsg7; //Rear Left Door

struct can_frame canMsg8; //Lock

struct can_frame canMsg9; //Un Lock

struct can_frame canMsg10; //Trunk

struct can_frame canMsg11; //Search

struct can_frame canMsg12; //Theft Alarm

struct can_frame canMsg13; //Panic Alarm

struct can_frame canMsg14; //Auto Lock

struct can_frame canMsg15; //Auto Unlock

struct can_frame canMsg16; //Auto Relock

struct can_frame canMsg17; //Center Lock

struct can_frame canMsg18; //Emergency unlocking

struct can_frame canMsg19; //Special Circumstances

struct can_frame canMsg20; //Beep Function

struct can_frame canMsg21; //Mute Function

 

MCP2515 mcp2515(10); //Working with Arduino UNO

 

/*====CAN IDs====*/

int id_400[1]; //Ignition status

int id_425[1]; //Door switch status

int id_450[1]; //Key Fob status

 

/*====KEY FOB====*/ //BUTTONS IN THE REMOTE KEY FOB

int RKE; //RKE KEY FOB

bool lock_BUTTON; //LOCK BUTTON PRESENT IN KEY FOB

bool unlock_BUTTON; // UNLOCK BUTTON PRESENT IN KEY FOB

bool trunk_BUTTON; // TRUNK BUTTON PRESENT IN KEY FOB

 

/*====BUTTON TIMER====*/ //BUTTON PRESS & HOLD DURATION

int lock_TIMER; //LOCK BUTTON PRESS & HOLD DURATION IN KEY FOB

int unlock_TIMER; //UNLOCK BUTTON PRESS & HOLD DURATION IN KEY FOB

int trunk_TIMER; //TRUNK BUTTON PRESS & HOLD DURATION IN KEY FOB

 

/*====BUTTON CLICKS====*/ //BUTTON CLICK COUNT

int lock_COUNT; //LOCK BUTTON CLICK COUNT IN KEY FOB

int unlock_COUNT; //UNLOCK BUTTON CLICK COUNT IN KEY FOB

int trunk_COUNT; //TRUNK BUTTON CLICK COUNT IN KEY FOB

 

/*====CAR SWITCHES====*/ //DOOR SWITCHES IN THE CAR

bool switchStatus; //VEHICLE SWITCH STATUS

bool drv_SWITCH; //DRIVER DOOR SWITCH

bool pass_SWITCH; //PASSENGER DOOR SWITCH

bool releft_SWITCH; //RAER LEFT DOOR SWITCH

bool reright_SWITCH; //REAR RIGHT DOOR SWITCH

bool trunk_SWITCH; //TRUNK DOOR SWITCH

 

/*====SOLENOID VALVES====*/ //DOOR VALVES IN EACH DOOR OF THE CAR

bool valveStatus; //VEHICLE VALVE STATUS

bool drv_SOLVALVE; //DRIVER DOOR VALVE

bool pass_SOLVALVE; //PASSENGER DOOR VALVE

bool releft_SOLVALVE; //REAR LEFT DOOR VALVE

bool reright_SOLVALVE; //REAR RIGHT DOOR VALVE

bool trunk_SOLVALVE; //TRUNK DOOR VALVE

 

/*====INDICATION LAMPS====*/ //INDICATION LAMP FEEDBACK

bool headlight; //HEADLIGHT

bool hazR1_LAMP; //FRONT RIGHT TURN LAMP

bool hazR2_LAMP; //REAR RIGHT TURN LAMP

bool hazL1_LAMP; //FRONT LEFT TURN LAMP

bool hazL2_LAMP; //REAR LEFT TURN LAMP

 

/*====IGNITION STATUS====*/ //KEY CYLINDER STATUS

int ig_status; //IGNITION STATUS

int ig_status_OFF; //LOCK POSITION

int ig_status_ACC; //ACCESSORY POSITION

int ig_status_ON; //ON POSITION

 

/*====IMPORTANT PARAMETERS====*/

bool child_lock; //CHILD LOCK BUTTON

bool vhl_buzzer; //VEHICLE BUZZER FOR TURN LAMP INDICATORS

bool intr_buzzer; //VEHICLE INTERIOR BUZZER

bool airbag; //AIRBAG

bool horn; //VEHICLE HORN

int vehicle_speed; //VEHICLE SPEED

int timer; //ACTION TIMER

int feed; //VARIABLE USED IN LOOPING STATEMENT

 

/*====STATES====*/

// 1 = TRUE/ON/HIGH/UNLOCK/OPEN/YES/UNARMED

// 0 = FALSE/OFF/LOW/LOCK/CLOSE/NO/ARMED

 

void setup()

{

  //Starting Serial communication and setting baud rate at 9600

  Serial.begin(9600);

  //declaration of CAN ID, CAN data length and CAN data

  canMsg1.can_id  = 0x100; //Ignition OFF

  canMsg1.can_dlc = 1;

  canMsg1.data[0] = 0x01;

 

  canMsg2.can_id  = 0x105; //Ignition ACC

  canMsg2.can_dlc = 1;

  canMsg2.data[0] = 0x02;

 

  canMsg3.can_id  = 0x110; //Ignition ON

  canMsg3.can_dlc = 1;

  canMsg3.data[0] = 0x04;

 

  canMsg4.can_id  = 0x115; //Driver Door

  canMsg4.can_dlc = 1;

  canMsg4.data[0] = 0x08;

 

  canMsg5.can_id  = 0x120; //Passenger Door

  canMsg5.can_dlc = 1;

  canMsg5.data[0] = 0x01;

 

  canMsg6.can_id  = 0x125; //Rear Left

  canMsg6.can_dlc = 1;

  canMsg6.data[0] = 0x02;

 

  canMsg7.can_id  = 0x130; //Rear Right

  canMsg7.can_dlc = 1;

  canMsg7.data[0] = 0x04;

 

  canMsg8.can_id  = 0x135; //Lock

  canMsg8.can_dlc = 1;

  canMsg8.data[0] = 0x08;

 

  canMsg9.can_id  = 0x140; //UnLock

  canMsg9.can_dlc = 1;

  canMsg9.data[0] = 0x01;

 

  canMsg10.can_id  = 0x145; //Trunk

  canMsg10.can_dlc = 1;

  canMsg10.data[0] = 0x02;

 

  canMsg11.can_id  = 0x150; //Search

  canMsg11.can_dlc = 1;

  canMsg11.data[0] = 0x04;

 

  canMsg12.can_id  = 0x155; //Theft Alarm

  canMsg12.can_dlc = 1;

  canMsg12.data[0] = 0x08;

 

  canMsg13.can_id  = 0x160; //Panic Alarm

  canMsg13.can_dlc = 1;

  canMsg13.data[0] = 0x01;

 

  canMsg14.can_id  = 0x165; //Auto Lock

  canMsg14.can_dlc = 1;

  canMsg14.data[0] = 0x01;

 

  canMsg15.can_id  = 0x170; //Auto Unlock

  canMsg15.can_dlc = 1;

  canMsg15.data[0] = 0x01;

 

  canMsg16.can_id  = 0x175; //Auto Relock

  canMsg16.can_dlc = 1;

  canMsg16.data[0] = 0x01;

 

  canMsg17.can_id  = 0x180; //Center Lock

  canMsg17.can_dlc = 1;

  canMsg17.data[0] = 0x01;

 

  canMsg18.can_id  = 0x185; //Emergency Unlocking

  canMsg18.can_dlc = 1;

  canMsg18.data[0] = 0x01;

 

  canMsg19.can_id  = 0x190; //Special Circumstances

  canMsg19.can_dlc = 1;

  canMsg19.data[0] = 0x01;

 

  canMsg20.can_id  = 0x205; //Beep Function

  canMsg20.can_dlc = 1;

  canMsg20.data[0] = 0x1;

 

  canMsg21.can_id  = 0x210; //Mute

  canMsg21.can_dlc = 1;

  canMsg21.data[0] = 0x1;

 

  mcp2515.reset();

  mcp2515.setBitrate(CAN_500KBPS, MCP_8MHZ); //setting bitrate for can protocol

  mcp2515.setNormalMode(); //initialization of normal mode

}

void loop()

{

  //To read the CAN messages

  if (mcp2515.readMessage(&canMsgr) == MCP2515::ERROR_OK)

  {

    switch (canMsgr.can_id)

    {

      case (0x400): //CAN MSG_ID - 400 for Ignition Status

        for (int i = 0; i < canMsgr.can_dlc; i++)

        {

          id_400[i] = (canMsgr.data[i]);

          Serial.println("CAN Message ID - 400");

        }

 

        switch (id_400[0])

        {

          case 1:

            ig_status = ig_status_OFF; //Setting ignition status as OFF

            Serial.println("Ignition OFF");

            Serial.println();

            RKE_AUTO_UNLOCK(); //Auto Unlock

            mcp2515.sendMessage(&canMsg1); //CAN message declaration

            break;

 

          case 2:

            ig_status = ig_status_ACC; //Setting ignition status as ACC

            Serial.println("Ignition ACC");

            RKE_PANIC_ALARM(); //Panic Alarm

            RKE_CENTRAL_LOCK(); //Center Lock

            Serial.println();

            mcp2515.sendMessage(&canMsg2);

            break;

 

          case 4:

            ig_status = ig_status_ON; //Setting ignition status as ON

            Serial.println("Ignition ON");

            Serial.println();

            RKE_AUTO_LOCK(); //Auto Lock

            mcp2515.sendMessage(&canMsg3);

            break;

        }

        Serial.println();

        break;

 

      case (0x425): //CAN MSG_ID - 425 for Door Switch Status

        for (int i = 0; i < canMsgr.can_dlc; i++)

        {

          id_425[i] = (canMsgr.data[i]);

          Serial.println("CAN Message ID - 425");

        }

        switch (id_425[0])

        {

          case 1:

            drv_SWITCH = 0; //Initially Driver door is closed

            Serial.println("Driver door Switch");

            Serial.println();

            mcp2515.sendMessage(&canMsg4);

            break;

 

          case 2:

            pass_SWITCH = 0; //Initially Passenger door is closed

            Serial.println("Passenger door Switch");

            Serial.println();

            mcp2515.sendMessage(&canMsg5);

            break;

 

          case 4:

            reright_SWITCH = 0; //Initially Rear Right door is closed

            Serial.println("Rear Right door Switch");

            Serial.println();

            mcp2515.sendMessage(&canMsg6);

            break;

 

          case 8:

            releft_SWITCH = 0; //Initially Rear Left door is closed

            Serial.println("Rear Left door Switch");

            Serial.println();

            mcp2515.sendMessage(&canMsg7);

            break;

        }

        Serial.println();

        break;

 

      case (0x450): //CAN MSG_ID - 450 for Key Fob Status

        for (int i = 0; i < canMsgr.can_dlc; i++)

        {

          id_450[i] = (canMsgr.data[i]);

          Serial.println("CAN Message ID - 450");

        }

        switch (id_450[0])

        {

          case 1:

            lock_BUTTON = 1; //Lock button is clicked

            RKE_LOCK(); //lock function enabled

            RKE_THEFT_ALARM(); //Theft Alarm enabled

            RKE_SPECIALS(); //Special Circumstances enabled

            Serial.println("Lock");

            Serial.println();

            break;

 

          case 2:

            unlock_BUTTON = 1; //Unlock button is clicked

            RKE_UNLOCK(); //Unlock function enabled

            RKE_SEARCH(); //Search enabled

            Serial.println("Unlock");

            Serial.println();

            break;

 

          case 4:

            trunk_BUTTON = 1; //Trunk button is clicked

            RKE_TRUNK(); //Trunk enabled

            Serial.println("Trunk");

            Serial.println();

            break;

 

          case 8:

            vehicle_speed = 0; //Vehicle speed reaches 0 KMPH

            RKE_AUTO_RELOCK(); //Auto Relock enabled

            RKE_EMERGENCY_UNLOCK(); //Emergency Unlock enabled

            Serial.println("Trunk");

            Serial.println();

            break;

        }

        Serial.println();

        break;

    }

  }

}

/*------------------------------------------------RKE_FUNCTIONS------------------------------------------------*/

//------------------------------------------------ LOCK

//Lock function

void RKE_LOCK()

{

  if ((lock_BUTTON == 1) &&

      (ig_status == 1 || ig_status == 2) &&

      (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0))

  {

    drv_SOLVALVE = 0;

    pass_SOLVALVE = 0;

    releft_SOLVALVE = 0;

    reright_SOLVALVE = 0;

    trunk_SOLVALVE = 0;

    Serial.println("[1]: VEHICLE LOCK SUCCESSFUL");

    mcp2515.sendMessage(&canMsg8);

    Serial.println("LOCK FEEDBACK ENABLED:"); //User feedback when lock function is activated

    for (feed = 1; feed <= 1; feed++)

    {

      Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS:");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 1);

      Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS:");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 0);

    }

    Serial.println("END \n");

  }

}

 

//------------------------------------------------ UNLOCK

void RKE_UNLOCK()

{

  if ((unlock_BUTTON == 1) &&

      (ig_status == 1 || ig_status == 2) &&

      (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0))

  {

    drv_SOLVALVE = 1;

    pass_SOLVALVE = 1;

    releft_SOLVALVE = 1;

    reright_SOLVALVE = 1;

    Serial.println("[2]: VEHICLE UNLOCK SUCCESSFUL");

    mcp2515.sendMessage(&canMsg9);

    Serial.println("UNLOCK FEEDBACK ENABLED:");

    for (feed = 1; feed <= 2; feed++)

    {

      Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 1);

      Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 0);

    }

    Serial.println("END");

  }

}

 

//------------------------------------------------ TRUNK

void RKE_TRUNK()

{

  if ((trunk_BUTTON == 1) &&

      (drv_SOLVALVE || pass_SOLVALVE || releft_SOLVALVE || reright_SOLVALVE == 1) &&

      (drv_SWITCH || pass_SWITCH || releft_SWITCH || reright_SWITCH == 0) &&

      (ig_status == 1 || ig_status == 2))

  {

    trunk_SOLVALVE = 1;

    Serial.println("[3]: TRUNK UNLOCK SUCCESSFUL");

    mcp2515.sendMessage(&canMsg10);

    Serial.println("TRUNK FEEDBACK ENABLED:");

    for (feed = 1; feed <= 2; feed++)

    {

      Serial.print("HAZARD LAMPS STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = 1);

      Serial.print("HAZARD LAMPS STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = 0);

    }

    Serial.println("END");

  }

}

 

//------------------------------------------------ SEARCH

void RKE_SEARCH()

{

  if ((unlock_TIMER == 3) &&

      (drv_SOLVALVE || pass_SOLVALVE || releft_SOLVALVE || reright_SOLVALVE == 1) &&

      (drv_SWITCH || pass_SWITCH || releft_SWITCH || reright_SWITCH == 1) &&

      (ig_status == 1 || ig_status == 2))

  {

    Serial.println("[4]. VEHICLE SEARCH ACTIVATED");

    mcp2515.sendMessage(&canMsg11);

    Serial.println("SEARCH FEEDBACK ENABLED:");

    for (feed = 1; feed <= 10; feed++)

    {

      Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 1);

      Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 0);

    }

    Serial.println("END");

    Serial.println("PRESS AND HOLD THE 'UNOCK' BUTTON AGAIN TO SEARCH VEHICLE");

  }

  else if (unlock_COUNT == 2)

  {

    Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

    Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = vhl_buzzer = 0);

    Serial.println("VEHICLE SEARCH STATUS: DISABLED");

    mcp2515.sendMessage(&canMsg21);

  }

}

 

//------------------------------------------------ THEFT ALARM

void RKE_THEFT_ALARM()

{

  if ((valveStatus || switchStatus == 0))

  {

    Serial.println("[5]. THEFT ALARM ACTIVATED");

    mcp2515.sendMessage(&canMsg12);

    Serial.println("THEFT ALARM FEEDBACK ENABLED:");

    for (feed = 1; feed <= 10; feed++)

    {

      Serial.print("HAZARD LAMPS AND HORN STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 1);

      Serial.print("HAZARD LAMPS AND HORN STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 0);

    }

    Serial.println("END");

    if (lock_COUNT == 2)

    {

      Serial.print("HAZARD LAMPS AND HORN STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 0);

      Serial.println("THEFT ALARM STATUS: DISABLED");

      mcp2515.sendMessage(&canMsg21);

    }

  }

}

 

//------------------------------------------------ PANIC ALARM

void RKE_PANIC_ALARM()

{

  if ((valveStatus && switchStatus == 0) &&

      (valveStatus && switchStatus == 1) &&

      (ig_status == 1 || ig_status == 2 || ig_status == 3))

  {

    Serial.println("[6]. PANIC ALARM ACTIVATED");

    mcp2515.sendMessage(&canMsg13);

    Serial.println("PANIC ALARM FEEDBACK ENABLED:");

    for (feed = 1; feed <= 10; feed++)

    {

      Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 1);

      Serial.print("HAZARD LAMPS AND VEHICLE BUZZER STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = horn = 0);

    }

    Serial.println("END");

    Serial.println("PRESS AND HOLD THE 'UNLOCK' BUTTON AGAIN TO ACTIVATE PANIC ALARM");

  }

}

 

//------------------------------------------------ AUTO-LOCK

void RKE_AUTO_LOCK()

{

  if ((vehicle_speed >= 20) &&

      (ig_status == 1) &&

      (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0))

  {

    drv_SOLVALVE = 0;

    pass_SOLVALVE = 0;

    releft_SOLVALVE = 0;

    reright_SOLVALVE = 0;

    trunk_SOLVALVE = 0;

    Serial.println("[7]. AUTO-LOCKING SUCCESSFUL");

    Serial.println("END");

    mcp2515.sendMessage(&canMsg14);

  }

}

 

//------------------------------------------------ AUTO-UNLOCK

void RKE_AUTO_UNLOCK()

{

  if ((vehicle_speed == 0) &&

      (ig_status == 1 || ig_status == 2) &&

      (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0))

  {

    drv_SOLVALVE = 1;

    pass_SOLVALVE = 1;

    releft_SOLVALVE = 1;

    reright_SOLVALVE = 1;

    Serial.println("[8]. AUTO-UNLOCKING SUCCESSFUL");

    Serial.println("END");

    mcp2515.sendMessage(&canMsg15);

  }

}

 

//------------------------------------------------ AUTO-RELOCK

void RKE_AUTO_RELOCK()

{

  if ((valveStatus = 1) && (timer >= 30) &&

      (drv_SWITCH = pass_SWITCH = releft_SWITCH = reright_SWITCH = trunk_SWITCH == 0) &&

      (ig_status == 1 || ig_status == 2 || ig_status == 3))

  {

    Serial.println("[9]. AUTO-RELOCKING SUCCESSFUL");

    Serial.println("END");

    mcp2515.sendMessage(&canMsg16);

  }

}

 

//------------------------------------------------ CENTRAL-LOCK

void RKE_CENTRAL_LOCK()

{

  if ((drv_SOLVALVE == 0) &&

      (drv_SWITCH && pass_SWITCH && releft_SWITCH && reright_SWITCH && trunk_SWITCH == 0) &&

      (ig_status == 1 || ig_status == 2 || ig_status == 3))

  {

    pass_SOLVALVE = 0;

    releft_SOLVALVE = 0;

    reright_SOLVALVE = 0;

    Serial.println("[10]. CENTRAL LOCK SUCCESSFUL");

    Serial.println("END");

    mcp2515.sendMessage(&canMsg17);

  }

}

 

//------------------------------------------------ EMERGENCY UNLOCK

void RKE_EMERGENCY_UNLOCK()

{

  if (airbag == 1)

  {

    drv_SOLVALVE = 1;

    pass_SOLVALVE = 1;

    releft_SOLVALVE = 1;

    reright_SOLVALVE = 1;

    trunk_SOLVALVE = 1;

    Serial.println("[12]. EMERGENCY UNLOCKING SUCCESSFUL");

    mcp2515.sendMessage(&canMsg18);

    for (feed = 1; feed <= 10; feed++)

    {

      Serial.print("HAZARD LAMPS, HEADLIGHT AND HORN STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = headlight = horn = 1);

      Serial.print("HAZARD LAMPS, HEADLIGHT AND HORN STATUS: ");

      Serial.println(hazR1_LAMP = hazR2_LAMP = hazL1_LAMP = hazL2_LAMP = headlight = horn = 0);

    }

    Serial.println("END");

  }

}

 

//------------------------------------------------ BEEP

void RKE_BEEP()

{

  if (switchStatus == 1)

  {

    Serial.println("[13]. INTERIOR BUZZER ACTIVATED");

    mcp2515.sendMessage(&canMsg20);

    for (feed = 1; feed <= 10; feed++)

    {

      Serial.print("INTERIOR BUZZER ENABLED: ");

      Serial.println(intr_buzzer = 1);

    }

    Serial.println("END");

  }

  else if (switchStatus == 0)

  {

    Serial.println(intr_buzzer = 0);

    Serial.println("INTERIOR BUZZER STATUS : DISABLED");

    Serial.println("END");

    mcp2515.sendMessage(&canMsg21);

  }

}

 

//------------------------------------------------ SPECIALS

void RKE_SPECIALS()

{

  if ((lock_BUTTON == 1) &&

      (drv_SOLVALVE || pass_SOLVALVE || releft_SOLVALVE || reright_SOLVALVE || trunk_SOLVALVE == 1) ||

      (drv_SWITCH || pass_SWITCH || releft_SWITCH || reright_SWITCH || trunk_SWITCH == 1))

  {

    Serial.println("[14]. VEHICLE LOCKING UNSUCCESSFUL");

    Serial.print("INTERIOR BUZZER ENABLED: ");

    mcp2515.sendMessage(&canMsg19);

    Serial.println(intr_buzzer = 1);

    Serial.println("END");

  }

  if (switchStatus == 0)

  {

    Serial.println(intr_buzzer = 0);

    Serial.println("INTERIOR BUZZER STATUS : DISABLED");

    Serial.println("END");

    mcp2515.sendMessage(&canMsg21);

  }

}

 

/**********END OF PROGRAM**********/

Development of Instrument Cluster

The tell-Tles in the instrument cluster is given below

PROJECT -  III

INSTRUMENT CLUSTER TELL TALES AND WARNINGS

 

/*CREATED BY: NITHISH KUMAR*/

/*SOFTWARE USED: ARDUINO IDE*/

 

#include <SPI.h> // Serial Peripheral Interface communication

#include <mcp2515.h> //CAN interface library

 

//For CAN message reception

struct can_frame canMsgr;

//For CAN message transmission

struct can_frame BCMMsg1; //BCM Message 0x406

struct can_frame EMSMsg2; //EMS Message 0x411

struct can_frame EPSMsg3; //EPS Message 0x416

struct can_frame ESPMsg4; //ESP Message 0x421

struct can_frame SRSMsg5; //SRS Message 0x431

struct can_frame TCCUMsg6; //TCCU Message 0x436

struct can_frame TCUMsg7; //TCU Message 0x441

struct can_frame TPMSMsg8; //TPMS Message 0x446

 

MCP2515 mcp2515(10); //Working on Arduino UNO

 

/*BODY CONTROL MODULE*/

int BCMmsg_405[8]; //BCM Message - 0x405

//BCM Signals

int BCM_FogFront;

int BCM_FogRear;

int BCM_VehicleArmed;

int BCM_HeadHighBeam;

int BCM_HazardLampLeft[2];

int BCM_HazardLampRight[2];

int BCM_SwitchFrontLeft;

int BCM_SwitchFrontRight;

int BCM_SwitchRearLeft;

int BCM_SwitchRearRight;

int BCM_DoorTailGate;

int BCM_DoorAjar;

int BCM_LowWasherFluid;

 

/*ENGINE MANAGEMENT SYSTEM*/

int EMSmsg_410[8]; //EMS Message 0x410

//EMS Signals

int EMS_GlowPlug;

int EMS_WaterinFuel;

int EMS_CruiseControl[2];

int EMS_EngineOilPress;

int EMS_CheckEngine[2];

int EMS_OBDCheck;

int EMS_EngineSpeed[8];

int EMS_StartStop;

int EMS_BatteryCharging;

int EMS_DPFLamp;

int EMS_DEFLamp;

int EMS_ReducedPower;

 

/*ELECTRIC POWER STEERING*/

int EPSmsg_415;//EPS Message 0x415

//EPS Signal

int EPS_PowerSteering;

 

/*ELECTRONIC STABILITY PROGRAM*/

int ESPmsg_420[8];//ESP Message 0x420

//ESP Signals

int ESP_VehicleSpeed[8];

int ESP_WheelFrontLeftSpeed[8];

int ESP_WheelFrontRightSpeed[8];

int ESP_WheelRearLeftSpeed[8];

int ESP_WheelRearRightSpeed[8];

int ESP_VehicleOverspeed;

int ESP_HandBrake;

int ESP_ABS;

int ESP_ESPLamp[2];

 

/*SUPPLEMETAL RESTRAINT SYSTEM*/

int SRSmsg_430; //SRS Message 0x430

//SRS Signals

int SRS_SeatBelt;

int SRS_PassAirbagCutOff;

int SRS_AirBag;

 

/*TRANSFER CASE CONTROL MODULE*/

int TCCMmsg_435; //TCCU Message 0x435

// TCCM Signals

int TCCM_FWDWarn[2];

int TCCM_FWDLock;

 

/*TRANSISSION CONTROL UNIT*/

int TCUmsg_440; //TCU Message 0x405

//TCU Signal

int TCU_TransmTemp;

 

/*TYRE PRESSURE MONITORING SYSTEM*/

int TPMSmsg_445[8]; //TPMS Message 0x405

//TPMS Signal

int TPMS_TyreFrontLeftPress[4];

int TPMS_TyreFrontRightPress[4];

int TPMS_TyreRearLeftPress[4];

int TPMS_TyreRearRightPress[4];

int TPMS_TiretronicsLamp;

 

void setup()

{

  //Setting up Serial communication Baud rate to 115200

  Serial.begin(115200);

  mcp2515.reset();

  //At the Bitrate of 500kbps with the 80 MHZ Clock frequency

  mcp2515.setBitrate(CAN_500KBPS, MCP_8MHZ);

  mcp2515.setNormalMode();

  Serial.println("------- CAN Read ----------");

  Serial.println("ID    DLC    DATA");

}

 

void loop()

{

  if (mcp2515.readMessage(&canMsgr) == MCP2515::ERROR_OK)

  {

    //BCM CAN Message Data Recption

    if (canMsgr.can_id == 0x405)

    {

      //printing data

      for (int i = 0; i < canMsgr.can_dlc; i++)

      {

        BCMmsg_405[i] = canMsgr.data[i];

      }

      if (canMsgr.can_id == 0x405)

      {

        Serial.print(canMsgr.can_id, HEX);

        Serial.print(" ");

        Serial.print(canMsgr.can_dlc, HEX);

        Serial.print(" ");

      }

      for (int i = 0; i < canMsgr.can_dlc; i++)

      {

        Serial.print(BCMmsg_405[i]);

        Serial.print("  ");

      }

      Serial.println();

      for (int i = 0; i <= 7; i++)

      {

        if (BCMmsg_405[0] & (1 << i))

        {

          if (i == 0)

          {

            BCM_FogFront = 1;

            Serial.println("Front Fog Lamp ON ");

          }

          if (i == 1)

          {

            BCM_VehicleArmed = 1;

            Serial.println("Vehicle Armed Lamp ON");

          }

          if (i == 2 )

          {

            BCM_FogRear = 1;

            Serial.println("Rear Fog Lamp ON");

          }

          if (i == 3 )

          {

            BCM_HeadHighBeam = 1;

            Serial.println("HEAD_LAMP_HIGH_BEAM ON ");

          }

          if (i == 4 || i == 5)

          {

            if (i == 4)

            {

              BCM_HazardLampLeft[0] = 1;

            }

            else

            {

              BCM_HazardLampLeft[1] = 1;

            }

          }

          if (i == 6 || i == 7)

          {

            if (i == 6)

            {

              BCM_HazardLampRight[0] = 1;

            }

            else

            {

              BCM_HazardLampRight[1] = 1;

            }

          }

        }

        else if (0)

        {

          if (i == 0)

          {

            BCM_FogFront = 0;

            Serial.println("Front Fog Lamp OFF");

          }

          if (i == 1)

          {

            BCM_VehicleArmed = 0;

            Serial.println("Vehicle Armed Lamp OFF");

          }

          if (i == 2)

          {

            BCM_FogRear = 0;

            Serial.println("Rear Fog Lamp OFF");

          }

          if (i == 3)

          {

            BCM_HeadHighBeam = 0;

            Serial.println("HEAD_LAMP_HIGH_BEAM off ");

          }

          if (i == 4 || i == 5)

          {

            if (i == 4)

            {

              BCM_HazardLampLeft[0] = 0;

 

            }

            else

            {

              BCM_HazardLampLeft[1] = 0;

 

            }

          }

          if (i == 6 || i == 7)

          {

            if (i == 6)

            {

              BCM_HazardLampRight[0] = 0;

 

            }

            else

            {

              BCM_HazardLampRight[1] = 0;

 

            }

          }

        }

      }

      for (int i = 0; i <= 7; i++)

      {

        if (BCMmsg_405[1] & (1 << i))

        {

          if (i == 0)

          {

            BCM_SwitchFrontRight = 1;

            BCM_DoorAjar = 1;

            Serial.println("Door Ajar Warning Lamp ON");

          }

          if (i == 1)

          {

            BCM_SwitchFrontLeft = 1;

            BCM_DoorAjar = 1;

            Serial.println("Door Ajar Warning Lamp ON");

          }

          if (i == 2 )

          {

            BCM_SwitchRearLeft = 1;

            BCM_DoorAjar = 1;

            Serial.println("Door Ajar Warning Lamp ON");

          }

          if (i == 3 )

          {

            BCM_SwitchRearRight = 1;

            BCM_DoorAjar = 1;

            Serial.println("Door Ajar Warning Lamp ON");

          }

          if (i == 4)

          {

            BCM_DoorTailGate = 1;

            BCM_DoorAjar = 1;

            Serial.println("Tail Gate Open Lamp");

          }

          if (i == 5)

          {

            BCM_LowWasherFluid = 1;

            Serial.println("Low Washer Fluid Lamp ON");

          }

        }

        else if (0)

        {

          if (i == 0)

          {

            BCM_SwitchFrontRight = 0;

            BCM_DoorAjar = 0;

            Serial.println("Door Ajar Warning Lamp OFF");

          }

          if (i == 1)

          {

            BCM_SwitchFrontLeft = 0;

            BCM_DoorAjar = 0;

            Serial.println("Door Ajar Warning Lamp OFF");

          }

          if (i == 2)

          {

            BCM_SwitchRearLeft = 0;

            BCM_DoorAjar = 0;

            Serial.println("Door Ajar Warning Lamp OFF");

          }

          if (i == 3)

          {

            BCM_SwitchRearRight = 0;

            BCM_DoorAjar = 0;

            Serial.println("Door Ajar Warning Lamp OFF");

          }

          if (i == 4)

          {

            BCM_DoorTailGate = 0;

            BCM_DoorAjar = 0;

            Serial.println("Tail Gate Open Lamp OFF");

          }

          if (i == 5)

          {

            BCM_LowWasherFluid = 0;

            Serial.println("Low Washer Fluid Lamp OFF");

          }

        }

      }

 

      {

        if ( BCM_HazardLampLeft[0] == 0 && BCM_HazardLampLeft[1] == 0)

        {

          Serial.println("Hazard Lamp Left OFF");

        }

        else if ( BCM_HazardLampLeft[0] == 0 &&  BCM_HazardLampLeft[1] == 1)

        {

          Serial.println("Hazard Lamp Left SLOW BLINK");

        }

        else if ( BCM_HazardLampLeft[0] == 1 &&  BCM_HazardLampLeft[1] == 0)

        {

          Serial.println("Hazard Lamp Left FAST BLINK(MALFUNCTION)");

        }

        else if ( BCM_HazardLampLeft[0] == 1 &&  BCM_HazardLampLeft[1] == 1)

        {

          Serial.println("Reserved");

        }

      }

 

      {

        if (BCM_HazardLampRight[0] == 0 && BCM_HazardLampRight[1] == 0)

        {

          Serial.println("Hazard Lamp Right OFF");

        }

        else if (BCM_HazardLampRight[0] == 0 && BCM_HazardLampRight[1] == 1)

        {

          Serial.println("Hazard Lamp Right SLOW BLINK");

        }

        else if (BCM_HazardLampRight[0] == 1 && BCM_HazardLampRight[1] == 0)

        {

          Serial.println("Hazard Lamp Right FAST BLINK(MALFUNCTION)");

        }

        else if (BCM_HazardLampRight[0] == 1 && BCM_HazardLampRight[1] == 1)

        {

          Serial.println("Reserved");

        }

      }

      //EMS MESSAGE DATA RECEPTION

      if (canMsgr.can_id == 0x410)

      {

        Serial.print(canMsgr.can_id, HEX);

        Serial.print(" ");

        Serial.print(canMsgr.can_dlc, HEX);

        Serial.println(" ");

        {

          for (int i = 0; i < canMsgr.can_dlc; i++)

          {

            EMSmsg_410[i] = canMsgr.data[i];

          }

          for (int i = 0; i < canMsgr.can_dlc; i++)

          {

            Serial.print(EMSmsg_410[i], HEX);

            Serial.print("  ");

          }

          Serial.println();

          for (int i = 0; i <= 7; i++)

          {

            if (EMSmsg_410[0] & (1 << i))

            {

              if (i == 0)

              {

                EMS_GlowPlug = 1;

                Serial.println("Glow Plug Lamp ON");

              }

              if (i == 1)

              {

                EMS_WaterinFuel = 1;

                Serial.println("Water-in-Fuel Lamp ON");

              }

              if (i == 2 || i == 3)

              {

                if (i == 2)

                {

                  EMS_CruiseControl[0] = 1;

                }

                else

                {

                  EMS_CruiseControl[1] = 1;

                }

              }

              if (i == 4)

              {

                EMS_EngineOilPress = 1;

                Serial.println("Engine Oil Pressure Lamp ON");

              }

              if (i == 5 || i == 6)

              {

                if (i == 5)

                {

                  EMS_CheckEngine[0] = 1;

                }

                else

                {

                  EMS_CheckEngine[1] = 1;

                }

              }

              if (i == 7)

              {

                EMS_OBDCheck = 1;

                Serial.println("OBD Check Lamp ON");

              }

            }

            else if (0)

            {

              if (i == 0)

              {

                EMS_GlowPlug = 0;

                Serial.println("Glow Plug Lamp OFF");

              }

              if (i == 1)

              {

                EMS_WaterinFuel = 0;

                Serial.println("Water-in-Fuel Lamp OFF");

              }

              if (i == 2 || i == 3)

              {

                if (i == 2)

                {

                  EMS_CruiseControl[0] = 0;

                }

                else

                {

                  EMS_CruiseControl[1] = 0;

                }

              }

              if (i == 4)

              {

                EMS_EngineOilPress = 0;

                Serial.println("Engine Oil Pressure Lamp OFF");

              }

              if (i == 5 || i == 6)

              {

                if (i == 5)

                {

                  EMS_CheckEngine[0] = 0;

                }

                else

                {

                  EMS_CheckEngine[1] = 0;

                }

              }

              if (i == 7)

              {

                EMS_OBDCheck = 0;

                Serial.println("OBD Check Lamp OFF");

              }

            }

          }

          for (int i = 0; i <= 7; i++)

          {

            if (EMSmsg_410[1] & (1 << i))

            {

              EMS_EngineSpeed[i] = 1;

            }

            else

            {

              EMS_EngineSpeed[i] = 0;

            }

          }

          for (int i = 0; i <= 7; i++)

          {

            if (EMSmsg_410[2] & (1 << i))

            {

              if (i == 0)

              {

                EMS_StartStop = 1;

                Serial.println("Start/Stop Lamp OFF");

              }

              if (i == 1)

              {

                EMS_BatteryCharging = 1;

                Serial.println("Battery Charging Lamp OFF");

              }

              if (i == 2)

              {

                EMS_DPFLamp = 1;

                Serial.println("DPF Warning Lamp OFF");

              }

              if (i == 3)

              {

                EMS_DEFLamp = 1;

                Serial.println("DEF Warning Lamp OFF");

              }

              if (i == 4)

              {

                EMS_ReducedPower = 1;

                Serial.println("Reduced Power Lamp OFF");

              }

            }

            else if (0)

            {

              if (i == 0)

              {

                EMS_StartStop = 0;

                Serial.println("Start/Stop Lamp OFF");

              }

              if (i == 1)

              {

                EMS_BatteryCharging = 0;

                Serial.println("Battery Charging Lamp OFF");

              }

              if (i == 2)

              {

                EMS_DPFLamp = 0;

                Serial.println("DPF Warning Lamp OFF");

              }

              if (i == 3)

              {

                EMS_DEFLamp = 0;

                Serial.println("DEF Warning Lamp OFF");

              }

              if (i == 4)

              {

                EMS_ReducedPower = 0;

                Serial.println("Reduced Power Lamp OFF");

              }

            }

          }

          if (EMS_CruiseControl[0] == 0 && EMS_CruiseControl[1] == 0)

          {

            Serial.println("CRUISE_CONTROL OFF");

          }

          else if (EMS_CruiseControl[0] == 0 && EMS_CruiseControl[1] == 1)

          {

            Serial.println("CRUISE_CONTROL ON");

          }

          else if (EMS_CruiseControl[0] == 1 && EMS_CruiseControl[1] == 0)

          {

            Serial.println("Cruise Control FAST BLINK(MALFUNCTION)");

          }

          else if (EMS_CruiseControl[0] == 1 && EMS_CruiseControl[1] == 1)

          {

            Serial.println("Reserved");

          }

        }

        {

          if (EMS_CheckEngine[0] == 0 && EMS_CheckEngine[1] == 0)

          {

            Serial.println("CHECK_ENGINE LAMP OFF");

          }

          else if (EMS_CheckEngine[0] == 0 && EMS_CheckEngine[1] == 1)

          {

            Serial.println("CHECK_ENGINE LAMP ON");

          }

          else if (EMS_CheckEngine[0] == 1 && EMS_CheckEngine[1] == 0)

          {

            Serial.println("Check Engine Lamp BLINK(MALFUNCTION)");

          }

          else if (EMS_CheckEngine[0] == 1 && EMS_CheckEngine[1] == 1)

          {

            Serial.println("Reserved");

          }

        }

      }

      //EPS MESSAGE DATA RECEPTION

      if (canMsgr.can_id == 0x415)

      {

        Serial.print(canMsgr.can_id, HEX);

        Serial.print(" ");

        Serial.print(canMsgr.can_dlc, HEX);

        Serial.print("  ");

        for (int i = 0; i < canMsgr.can_dlc; i++)

        {

          EPSmsg_415 = canMsgr.data[i];

        }

        Serial.print(EPSmsg_415, HEX);

        Serial.print("  ");

        Serial.println();

        if (EPSmsg_415 & (1 << 0))

        {

          EPS_PowerSteering = 1;

          Serial.print("EPS Warning Lamp ON");

        }

        else

        {

          EPS_PowerSteering = 0;

          Serial.print("EPS Warning Lamp ON");

        }

      }

      //ESP MESSAGE DATA RECEPTION

      if (canMsgr.can_id == 0x420)

      {

        Serial.print(canMsgr.can_id, HEX);

        Serial.print(" ");

        Serial.print(canMsgr.can_dlc, HEX);

        Serial.print("  ");

        for (int i = 0; i < canMsgr.can_dlc; i++)  {

          ESPmsg_420[i] = canMsgr.data[i];

        }

        for (int i = 0; i < canMsgr.can_dlc; i++)

        {

          Serial.print(ESPmsg_420[i], HEX);

          Serial.print("  ");

        }

        //The 'random' function used here

        //will randomly generate a value between 0 to 250(assume in KMPH)

        ESPmsg_420[0] = random(0, 250);

        Serial.println();

        for (int i = 0; i <= 7; i++)

        {

          if (ESPmsg_420[0] & (1 << i))

          {

            ESP_VehicleSpeed[i] = 1;

          }

          else if (0)

          {

            ESP_VehicleSpeed[i] = 0;

          }

        }

        for (int i = 0; i <= 7; i++)

        {

          if (ESPmsg_420[1] & (1 << i))

          {

            ESP_WheelFrontLeftSpeed[i] = 1;

          }

          else if (0)

          {

            ESP_WheelFrontLeftSpeed[i] = 0;

          }

        }

        for (int i = 0; i <= 7; i++)

        {

          if (ESPmsg_420[2] & (1 << i))

          {

            ESP_WheelFrontRightSpeed[i] = 1;

          }

          else if (0)

          {

            ESP_WheelFrontRightSpeed[i] = 0;

          }

        }

        for (int i = 0; i <= 7; i++)

        {

          if (ESPmsg_420[3] & (1 << i))

          {

            ESP_WheelRearLeftSpeed[i] = 1;

          }

          else if (0)

          {

            ESP_WheelRearLeftSpeed[i] = 0;

          }

        }

        for (int i = 0; i <= 7; i++)

        {

          if (ESPmsg_420[4] & (1 << i))

          {

            ESP_WheelRearRightSpeed[i] = 1;

          }

          else if (0)

          {

            ESP_WheelRearRightSpeed[i] = 0;

          }

        }

        for (int i = 0; i <= 7; i++)

        {

          if (ESPmsg_420[5] & (1 << i))

          {

            if (i == 0)

            {

              ESP_VehicleOverspeed = 1;

              Serial.println("Vehicle Over Speed Lamp ON");

            }

            if (i == 1)

            {

              ESP_HandBrake = 1;

              Serial.println("Parking Brake Lamp ON");

            }

            if (i == 2)

            {

              ESP_ABS = 1;

              Serial.println("ABS Warning Lamp ON");

            }

            if (i == 3 || i == 4)

            {

              if (i == 3)

              {

                ESP_ESPLamp[0] = 1;

              }

              else

              {

                ESP_ESPLamp[1] = 1;

              }

            }

          }

          else if (0)

          {

            if (i == 0)

            {

              ESP_VehicleOverspeed = 0;

              Serial.println("Vehicle Over Speed Lamp OFF");

            }

            if (i == 1)

            {

              ESP_HandBrake = 0;

              Serial.println("Parking Brake Lamp ON");

            }

            if (i == 2)

            {

              ESP_ABS = 0;

              Serial.println("ABS Warning Lamp ON");

            }

            if (i == 3 || i == 4)

            {

              if (i == 3)

              {

                ESP_ESPLamp[0] = 0;

              }

              else

              {

                ESP_ESPLamp[1] = 0;

              }

            }

          }

        }

      }

      {

        if (ESP_ESPLamp[0] == 0 && ESP_ESPLamp[1] == 0)

        {

          Serial.println("ESP_WARN_ LAMP OFF");

        }

        else if (ESP_ESPLamp[0] == 0 && ESP_ESPLamp[1] == 1)

        {

          Serial.println("ESP_WARN LAMP ON");

        }

        else if (ESP_ESPLamp[0] == 1 && ESP_ESPLamp[1] == 0)

        {

          Serial.println("ESP_WARN LAMP FAST BLINK(MALFUNCTION)");

        }

        else if (ESP_ESPLamp[0] == 1 && ESP_ESPLamp[1] == 1)

        {

          Serial.println("Reserved");

        }

      }

      //SRS MESSAGE DATA RECEPTION

      if (canMsgr.can_id == 0x430)

      {

        Serial.print(canMsgr.can_id, HEX);

        Serial.print(" ");

        Serial.print(canMsgr.can_dlc, HEX);

        Serial.print("  ");

        SRSmsg_430 = canMsgr.data[0];

        Serial.print(SRSmsg_430, HEX);

        Serial.print("  ");

        Serial.println();

        for (int i = 0; i <= 2; i++)

        {

          if (SRSmsg_430 & (1 << i))

          {

            if (i == 0)

            {

              SRS_SeatBelt = 1;

              Serial.print("Seat Belt Lamp ON");

            }

            if (i == 1)

            {

              SRS_PassAirbagCutOff = 1;

              Serial.print("Passenger Airbag Cut-Off Lamp ON");

            }

            if (i == 2)

            {

              SRS_AirBag = 1;

              Serial.print("Airbag Lamp ON");

            }

          }

          else if (0)

          {

            if (i == 0)

            {

              SRS_SeatBelt = 0;

              Serial.print("Seat Belt OFF");

            }

            if (i == 1)

            {

              SRS_PassAirbagCutOff = 0;

              Serial.print("Passenger Airbag Cut-Off Lamp OFF");

            }

            if (i == 2)

            {

              SRS_AirBag = 0;

              Serial.print("Airbag Lamp OFF");

            }

          }

        }

      }

      //TCCU MESSAGE DATA RECEPTION

      if (canMsgr.can_id == 0x435)

      {

        Serial.print(canMsgr.can_id, HEX);

        Serial.print(" ");

        Serial.print(canMsgr.can_dlc, HEX);

        Serial.print("  ");

        TCCMmsg_435 = canMsgr.data[0];

        Serial.print(TCCMmsg_435, HEX);

        Serial.print("  ");

        Serial.println();

        for (int i = 0; i <= 2; i++)

        {

          if (TCCMmsg_435 & (1 << i))

          {

            if (i == 0 || i == 1)

            {

              TCCM_FWDWarn[i] = 1;

              Serial.println("Four-Wheel-Drive Warning Lamp");

            }

            if (i == 2)

            {

              TCCM_FWDLock = 1;

              Serial.println("Four-Wheel-Drive Lock Lamp OFF");

 

            }

          }

          else if (0)

          {

            if (i == 0 || i == 1)

            {

              TCCM_FWDWarn[i] = 0;

              Serial.println("Four-Wheel-Drive Warning Lamp");

            }

            if (i == 2)

            {

              TCCM_FWDLock = 0;

              Serial.println("Four-Wheel-Drive Lock Lamp OFF");

            }

          }

        }

      }

      //TCU MESSAGE DATA RECEPTION

      if (canMsgr.can_id == 0x440)

      {

        Serial.print(canMsgr.can_id, HEX);

        Serial.print(" ");

        Serial.print(canMsgr.can_dlc, HEX);

        Serial.print("  ");

        TCUmsg_440 = canMsgr.data[0];

        Serial.print(TCUmsg_440, HEX);

        Serial.print("  ");

        Serial.println();

        for (int i = 0; i <= 0; i++)

        {

          if (TCUmsg_440 & (1 << i))

          {

            if (i == 0)

            {

              TCU_TransmTemp = 1;

              Serial.print("Transmission Temperature Warning Lamp ON");

            }

          }

          else

          {

            if (i == 0)

            {

              TCU_TransmTemp = 0;

              Serial.print("Transmission Temperature Warning Lamp OFF");

            }

          }

        }

      }

      //TPMS MESSAGE DATA RECEPTION

      if (canMsgr.can_id == 0x445)

      {

        Serial.print(canMsgr.can_id, HEX);

        Serial.print(" ");

        Serial.print(canMsgr.can_dlc, HEX);

        Serial.print("  ");

        for (int i = 0; i <= canMsgr.can_dlc; i++)

        {

          TPMSmsg_445[i] = canMsgr.data[i];

        }

        for (int i = 0; i <= canMsgr.can_dlc; i++)

        {

          Serial.print(TPMSmsg_445[i], HEX);

          Serial.print("  ");

        }

        Serial.println();

        for (int i = 0; i <= 7; i++)

        {

          if (TPMSmsg_445[0] & (1 << i))

          {

            if (i >= 0 || i <= 3)

            {

              TPMS_TyreFrontLeftPress[i] = 1;

            }

            if (i > 3 || i <= 7)

            {

              TPMS_TyreFrontRightPress[i] = 1;

            }

          }

          else if (0)

          {

            if (i >= 0 || i <= 3)

            {

              TPMS_TyreFrontLeftPress[i] = 0;

            }

            if (i > 3 || i <= 7)

            {

              TPMS_TyreFrontRightPress[i] = 0;

            }

          }

        }

        for (int i = 0; i <= 7; i++)

        {

          if (TPMSmsg_445[1] & (1 << i))

          {

            if (i >= 0 || i <= 3)

            {

              TPMS_TyreRearRightPress[i] = 1;

            }

            if (i > 3 || i <= 7)

            {

              TPMS_TyreRearRightPress[i] = 1;

            }

          }

          else if (0)

          {

            if (i >= 0 || i <= 3)

            {

              TPMS_TyreRearLeftPress[i] = 0;

            }

            if (i > 3 || i <= 7)

            {

              TPMS_TyreRearLeftPress[i] = 0;

            }

          }

        }

        for (int i = 0; i == 0; i++)

        {

          if (TPMSmsg_445[2] & (1 << i))

          {

            if (i == 0)

            {

              TPMS_TiretronicsLamp = 1;

              Serial.println("Tiretronics Lamp OFF");

            }

          }

          else if (0)

          {

            if (i == 0)

            {

              TPMS_TiretronicsLamp = 0;

              Serial.println("Tiretronics Lamp OFF");

            }

          }

        }

      }

            //BCMMsg1 MESSAGE 406 TRANSMISSION

      BCMMsg1.can_id  = 0x406;

      BCMMsg1.can_dlc = 2;

      BCMMsg1.data[1] = 0x01;

      BCMMsg1.data[0] = 0x02;

      mcp2515.sendMessage(&BCMMsg1);

     

      //EMSMsg2 MESSAGE 411 TRANSMISSION

      EMSMsg2.can_id  = 0x411;

      EMSMsg2.can_dlc = 3;

      EMSMsg2.data[0] = 0x01;

      EMSMsg2.data[1] = 0x02;

      EMSMsg2.data[2] = 0x04;

      mcp2515.sendMessage(&EMSMsg2);

 

      //EPSMsg3 MESSAGE 416 TRANSMISSION

      EPSMsg3.can_id  = 0x416;

      EPSMsg3.can_dlc = 1;

      EPSMsg3.data[0] = 0x01;

      mcp2515.sendMessage(&EPSMsg3);

     

      //ESPMsg4 MESSAGE 421 TRANSMISSION

      ESPMsg4.can_id  = 0x421;

      ESPMsg4.can_dlc = 6;

      ESPMsg4.data[0] = 0x01;

      ESPMsg4.data[1] = 0x02;

      ESPMsg4.data[2] = 0x04;

      ESPMsg4.data[3] = 0x01;

      ESPMsg4.data[4] = 0x02;

      ESPMsg4.data[5] = 0x04;

     

      //SRSMsg5 MESSAGE 431 TRANSMISSION

      SRSMsg5.can_id  = 0x431;

      SRSMsg5.can_dlc = 1;

      SRSMsg5.data[0] = 0x01;

      mcp2515.sendMessage(&SRSMsg5);

     

      //TCCUMsg6 MESSAGE 436 TRANSMISSION

      TCCUMsg6.can_id  = 0x436;

      TCCUMsg6.can_dlc = 1;

      TCCUMsg6.data[0] = 0x01;

      mcp2515.sendMessage(&TCCUMsg6);

     

      //TCUMsg7 MESSAGE 441 TRANSMISSION

      TCUMsg7.can_id  = 0x441;

      TCUMsg7.can_dlc = 1;

      TCUMsg7.data[0] = 0x01;

      mcp2515.sendMessage(&TCUMsg7);

     

      //TPMSMsg8 MESSAGE 446 TRANSMISSION

      TPMSMsg8.can_id  = 0x446;

      TPMSMsg8.can_dlc = 3;

      TPMSMsg8.data[0] = 0x01;

      TPMSMsg8.data[1] = 0x02;

      TPMSMsg8.data[2] = 0x03;

      mcp2515.sendMessage(&TPMSMsg8);    }

  }

}

 

/**********END OF PROGRAM*********/

 CAN COMMUNICATION MATRIX

 

Created by: NITHISH KUMAR

Software used: Vector CANdb++

 

OVERVIEW:




  

Above CAN DBC shows the various networks nodes, ECUs, Messages and related Signals. By using these Messages, Signals can be transmitted and received by various ECUs.

 

NETWORK NODES:

 

            In this database, I have used various Network nodes like,

·        BCM(Body Control Module)

·        EMS(Engine Management System)

·        EPS(Electric Power Steering)

·        ESP(Electronic Stability Control)

·        IC(Instrument Cluster)

·        VIS(Vehicle Infotainment System)

·        PAS(Parking Assist System)

·        SRS(Supplemental Restraint System)

·        TCCU(Transfer Case Control Unit)

·        TCU(Transmission Control Unit)

·        TPMS(Tyre Pressure Monitoring System)

CAN MESSAGES:

 Various CAN messages and Signals created in the DBC are being mapped with a unique CAN message ID and are assigned to their respective transmitting and receiving ECU’s. The Message layout is arranged inside the CAN message with required Value tables and Attributes. The layout of the message EMSmsg (0x410) and its Signals are given below,

·        Battery Charging lamp

·        Check Engine Lamp

·        Cruise Control Lamp

·        DEF Indicator Lamp

·        DPF Indicator Lamp

·        ECO Mode Lamp

·        Engine Coolant Temperature Lamp

·        Engine Oil Pressure Lamp

·        Glow Plug Lamp

·        Low Fuel Lamp

·        OBD Check Lamp

·        Reduced Power Lamp

·        Engine Speed Indication

·        Start/Stop Lamp

 

CAN SIGNAL:

            It is an individual piece of data contained within the Can frame data field. Data field can contain up to 8 bits of data, a signal CAN frame can contains 0 to 64 individual signals. The below signal ‘EMS_BatteryCharging’ takes 2 bit of length to do its task (ON and OFF). Many signals may require more than 1 bit of data length for performing two or more tasks.

 

 

The CAN DBC files is the type of data that communicates over a CAN bus, these files can be helpful in identifying the data within the CAN frame by describing it. It contains of information for decoding raw CAN bus to physical value thus functioning as a signal library.