A-Z of car ignition systems
-
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.
-
is it better to get a proper PCB made for the final product?
-
We-ell, it depends what you want to do really.
It looks nicer, and depending on how well you've breadboarded your prototype it might last longer.
Personally I probably wont bother, or at the very most will do a toner transfer board etch. (Harvey Norman have a reasonable laser printer for between $44 and $49 at the minute if you're wanting one).
I've never actually gone the whole hog and had someone produce a board for me though. -
cool cool, just looking at my breadboard and start attempt and its pretty dodgy
-
I'm looking up toner transfer now
But that means I have to get a pcb design right first
-
so bought most of my components today and started work on the prototype board
looks horrible i know but its a start.gotta wait for my reader and arduino to arrive before i can put it into full gear....
i will post the breadboard representation of the work im doing as well so that people can see what actually to put where instead of my mess of components and wires