A-Z of car ignition systems
-
That link isn't showing up for me, are you able to give me a part number?
-
@lokki 255-1066-ND on digikey.com.au
-
@MarkGabb said:
255-1066-ND
ok, my bad. The diagram I knocked together for you was related to a motorbike project I was asked about... so while it's relevant it's not as relevant as it could have been in a better world.
The Panasonic relay is a latching type, what it does differently is that when you trigger one side of the relay coil it locks in position one way, then you trigger the other side of the coil and it releases. This is what you'll use to set the car OFF or ON. We use this one so that if power is lost to the arduino for whatever reason then we don't suddenly lose power to the car while driving.Again, my fault entirely. This makes the following change - you have three outputs from the arduino instead of only two. All three are basically the same, transistor/resistor/diode, and two of them go to the same relay.
I haven't got a picture of the latching relay for a fritzing diagram unfortunately. -
@lokki all cool good sir. So if I just add another transistor and resistor with a diode in between. But put it to the second part of the relay? So does that mean I did select the correct part?
-
Yeah that's the right part, I guess you got it from my rough BOM on my car starter thread.
It's basically the same kind of relay only it has two states and both are persistent.
so instead of two contacts for the coil there are four, two go one way and two go the other basically just reversing the polarity of the magnet in the thing according to which one is triggered.I'm really kicking myself over that though, I had both projects in my head and the newest/latest one came out on top.
- I think the moral of the story here is to listen to the spirit of what I say and ignore the specifics. Sometimes. ;-)
-
got it!@lokki so do i win for tonight? or did i just blow my circuit up....
in deference to you i have done it in schem mode hope i did it right
sorry reverse the tags on the on and ignition tabs
-
Ok, we're nearly there - I just noticed that the flyback diodes need to be flipped so they're pointing towards positive, not negative (I think I did that to you as well!) but apart from that we're golden.
That's your basic start circuit I reckon. Next you can customise and add in whatever else you need.
-
i think that will do untill ive got that installed and working.....
i guess the code is another story all together?
ill have to work on that at a later date.....later on i would like to add the door locks in, and maybe a door popper....
that would be it for my caryou mentioned earlier the the chip can reset it self....does that mean you would have to double tap the NFC sensor then to turn the car off...?
-
You could quite happily use the latest code from my thread, this hardware is basically the same as what I have at the moment though I'm experimenting with a safety cutout for the reader hooked through the handbrake switch - so the reader will only work while the handbrake is on.
What I have noticed occasionaly is that for whatever reason my unit resets itself occasionally. The latching relay doesn't allow the car to cut out at this point which is good... but we were resetting to the point where the arduino thought the car was off and would engage the starter motor again briefly.
To combat this I'm going to use one of the inputs on the unit to let the arduino know if the engine is already running and allow the next ring read to shut off the car power instead of grinding the starter.
I'll add this to the code as part of an IF AND statement. -
awesome ill look at the code over the next day o0r so and see if i can work it out
-
Here you go, modify at will. I think this is the latest version that I had posted.
int triggerPin1 = 2; int triggerPin2 = 3; int triggerPin3 = 4; int carRunState = 0; #include <Wire.h> #include <PN532_I2C.h> #include <PN532.h> PN532_I2C pn532i2c(Wire); PN532 nfc(pn532i2c); void setup(void) { pinMode(triggerPin1, OUTPUT); pinMode(triggerPin2, OUTPUT); pinMode(triggerPin3, OUTPUT); 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 Online, "); // 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 == "4db5e2b62880" || ringUid == "48fc02b62880" || ringUid == "4c9232b62880"){ Serial.println("Key accepted!"); } if ((ringUid == "4db5e2b62880" || ringUid == "48fc02b62880" || ringUid == "4c9232b62880") && (carRunState == 0)){ Serial.println("PERMISSION GRANTED, SYSTEMS ON"); digitalWrite(triggerPin3, HIGH); // sets latching relay trigger on for ignition mode in car to allow start delay(200); // waits briefly digitalWrite(triggerPin3, LOW); // removes latching relay trigger carRunState = carRunState++; } else if ((ringUid == "4db5e2b62880" || ringUid == "48fc02b62880" ||ringUid == "4c9232b62880") && (carRunState == 1)){ Serial.println("ENGINE CRANKING"); digitalWrite(triggerPin1, HIGH); // triggers output for engine starting delay(2000); // waits for a second digitalWrite(triggerPin1, LOW); // removes triggered output Serial.println("ENGINE CRANKING COMPLETE"); carRunState = carRunState++; } else if ((ringUid == "4db5e2b62880" || ringUid == "48fc02b62880" ||ringUid == "4c9232b62880") && (carRunState > 1)){ Serial.println("SYSTEM OFF, SLEEP TIME"); digitalWrite(triggerPin2, HIGH); // Trigger latching relay to reset for vehicle OFF delay(200); // waits briefly digitalWrite(triggerPin2, LOW); // Removes latching relay reset trigger delay(3000); carRunState = 0; } } }
-
@lokki what happens if the car doesn't start in the 2 seconds allowed? Do you have to cycle back and start again?
-
@MarkGabb if it didn't start then yeah, you'd have to cycle through again. It's never come up as an issue for me.
Additional to that, with the 'engine on input' set up properly we'll be able to re write the code to compensate for not starting.
-
Yes yes. I see what you mean. Doesn' look classy if it resets while driving and you have to grind the starter to turn it off
What were you thinking for the sensor? Voltage test? So it picks up the alternator output?
-
ring ordered today...time to wait and see while all parts are on order
-
I'm thinking of just taking a feed from the tacho output and seeing if I can use that. I'll have to explore it a little more I think.
-
that would do the job, but wouldnt be universal....as alot of cars dont have a taco
-
Yeah, that one might have to be on a case by case basis. It's difficult because a lot of things switch on just when you're cranking the engine with it not necessarily running.
-
very true....is it possible to have a circuit in place that can tell when the alternator is running? I know standard car voltage jumps from between 10-12.5 up to 14 or so
not sure if that's a valid option......
hmmmm im really not sure....have to think about that one
-
You could try measuring voltage and that might do it. I'll have to have a think about that.