Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. intergrating with existing project car starter

intergrating with existing project car starter

Scheduled Pinned Locked Moved Development
3 Posts 2 Posters 1.0k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • markjgabbM Offline
    markjgabbM Offline
    markjgabb
    wrote on last edited by
    #1

    hi everyone
    so i have a project for a nfc car starter ive just recently completed....
    i was wondering about integrating it into a node so that i could prestart and warm up my car in the mornings....

    however ive never dreamed of mysensors before that last few months and prebuilding my own seems a little out of my league....

    anyone have any advice on how i could integrate?
    thanks in advance to anyone who can give me even a hint
    this is running on an arduino nano

    int accessories = 2; //accessory
    int CarOn = 3; //power
    int Starter = 4; //ignition
    int indicatorPin1 = 5;
    int indicatorPin2 = 6;
    int indicatorPin3 = 7;
    int indicatorPin4 = 8;
    int handbrakePin1 = 9;
    int carRunState = 0;
    int handbrakeState = 0;
     
      #include <Wire.h>
      #include <PN532_I2C.h>
      #include <PN532.h>
    
      PN532_I2C pn532i2c(Wire);
      PN532 nfc(pn532i2c);
     
    void setup(void) {
      pinMode(accessories, OUTPUT);
      pinMode(CarOn, OUTPUT);
      pinMode(Starter, OUTPUT);
      pinMode(indicatorPin1, OUTPUT);
      pinMode(indicatorPin2, OUTPUT);
      pinMode(indicatorPin3, OUTPUT);
      pinMode(indicatorPin4, OUTPUT);
      pinMode(handbrakePin1, INPUT);
      Serial.begin(115200);
      Serial.println("Hello! I'm a Car!");
    
      nfc.begin();
    
      uint32_t versiondata = nfc.getFirmwareVersion();
      if (! versiondata) {
        Serial.print(versiondata);
        Serial.print("PN53x key scanner board not online");
        while (1); // halt
      }
      
      // Got ok data, report state
      Serial.print("Reader Online1, ");
     
      
      // Set the max number of retry attempts to read from a card
      // This prevents us from waiting forever for a card, which is
      // the default behaviour of the PN532.
      nfc.setPassiveActivationRetries(0xFF);
      
      // configure board to read NFC tags
      nfc.SAMConfig();
        
      Serial.println("Waiting for a valid key");
    }
    
    void loop(void) {
      String ringUid;
      boolean success;
      uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };  // Buffer to store the returned UID
      uint8_t uidLength;                        // Length of the UID (4 or 7 bytes depending on ISO14443A card type)
      
      // Wait for an ISO14443A type cards (NFC Ring, Mifare, etc.).  When one is found
      // 'uid' will be populated with the UID, and uidLength will indicate
      // if the uid is 4 bytes (Mifare Classic) or 7 bytes (NFC Ring or Mifare Ultralight)
      success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, &uid[0], &uidLength);
      
      if (success) {
        // Display some basic information about the card
        
    //    Serial.print("  UID Length: "); Serial.print(uidLength, DEC); Serial.println(" bytes");
        Serial.print("  UID Value: ");
        for (uint8_t i = 0; i < uidLength; i++)
        {
          Serial.print("..");
          Serial.print(uid[i], HEX);
          ringUid += String(uid[i], HEX);
          
    
        }
        Serial.println(ringUid + "\n");
        if (ringUid == "42cbfd26f3f81" || ringUid == "4b4c22993c81" || ringUid == "4323222993c81" || ringUid == "4a2cd26f3f80"){
          Serial.println("Key accepted!");
    
      }
        
        
        if ((ringUid == "42cbfd26f3f81" || ringUid == "4b4c22993c81" || ringUid == "4323222993c81" || ringUid == "4a2cd26f3f80") && (carRunState == 0)){
          Serial.println("PERMISSION GRANTED, SYSTEMS ON");
          digitalWrite(accessories, HIGH);   // sets latching relay trigger on for ignition mode in car to allow start
          digitalWrite(indicatorPin2, HIGH); //show state, second LED
          //delay(100);                  // waits briefly
          digitalWrite(CarOn, HIGH);    // removes latching relay trigger
          delay(1500);
          carRunState = 1;
        }
        else if ((ringUid == "42cbfd26f3f81" || ringUid == "4b4c22993c81" || ringUid == "4323222993c81" || ringUid == "4a2cd26f3f80") && (carRunState == 1)){
         // if (handbrakeState = 0){if handbrake is on then safe to crank car, if not then skip this mode entirely
           { Serial.println("ENGINE CRANKING");
                delay(100);
           digitalWrite(Starter, HIGH);   // triggers output for engine starting
            digitalWrite(indicatorPin3, HIGH); //show state, third LED
            delay(1000);                  // waits for a second
            digitalWrite(Starter, LOW);    // removes triggered output 
          delay (1000);
            Serial.println("ENGINE CRANKING COMPLETE");
          }
          carRunState = 2;     
        }
        else if ((ringUid == "42cbfd26f3f81" || ringUid == "4b4c22993c81" || ringUid == "4323222993c81" || ringUid == "4a2cd26f3f80") && (carRunState == 2)){
         
           {
            
            digitalWrite(indicatorPin3, LOW); //turn off 3rd LED
                     // waits for a second
            Serial.println("ENGINE SHUTDOWN");
          //delay(200);                  // waits briefly  
          digitalWrite(CarOn, LOW);   //reset relay 
          digitalWrite(accessories, LOW);   
        delay(3000);
        carRunState = 0;
        digitalWrite(indicatorPin1, LOW); //LED1 off 
      }
      }
      }
    }
    
    
    1 Reply Last reply
    0
    • H Offline
      H Offline
      hek
      Admin
      wrote on last edited by
      #2

      Cool project!
      Just use a simple relay example. Insert the start-car code somewhere here:

      https://github.com/mysensors/MySensors/blob/development/examples/RelayActuator/RelayActuator.ino#L83

      1 Reply Last reply
      0
      • markjgabbM Offline
        markjgabbM Offline
        markjgabb
        wrote on last edited by
        #3

        @hek looks good...thanks for that ill investigate over the next week getting it running

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        18

        Online

        12.0k

        Users

        11.2k

        Topics

        113.4k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular