Vehicle remote ignition - Some questions.

Hi there everyone, i'm new here as you can probably see :slight_smile:
Firstly a little bit about me, i'm 21 and i'm an Apprentice in Electronics.

I purchased my Arduino UNO R3 last week and have been having some fun with it, and then came up with a project idea.
My idea is to be able to remotely start my car via text message, so i can warm it up before getting in it.

Whilst reading this, remember this car is old and has no immobilisation/alarm (which makes this easy)
I've already gotton as far as being able to start the car via the web with the Arduino hooked up to my laptop via USB whilst the laptop is connected to my home WiFi, and running a PHP script which i can access via my phone on the same network.
The way the relays are connected is basically just before the key barrel, i've spliced the Accessories, On, Ignition and Earth wires and put my relays between. <kind of primitive i guess.
I'm fairly sure i can work around the cell part of the project once i get my cell shield, but i only have one small issue.

Once you've warmed the car up and have gotton in it, naturally you need to put the key in and turn to the ON position to release the steering lock, which is fine.
But once i do this, i need the arduino to then turn off/release the relays so when i turn my car off via the key, the car shuts down.
It's probably a simple fix, but i just cannot work out how to do it.
The only other way was to give the arduino say, a 10 minute delay, then release the relays (hopeing by then you have the key in) but i'd rather not do that.

If anyone could shed some light on this, it would be greatly appreciated!
I also wish to make a fully comprehensive tutorial on how to do this once i'm finished :slight_smile:

My project is similar, but you could tap into your ignition line(its only hot if the key is in the on position) and then step it down to logic levels, and feed that into one of the pins; Testing for HIGH or LOW in the arduino.

AKA

If your key is to the ON positiion, it energizes the ignition wire; You have your arduino setup to sense this (probably by stepping it down from 12 volt to 5) and connecting it to a general I/O pin; When the arduino senses the ignition wire is energized, it releases the relay.

I thought about that, and thought that if i did that, once the key is in the on position, the key on circuit becomes closed, thus shorting out the arduino, but, if i connected the earth to the battery/body, when the key is in the on position, its hot, not shorted.
i'm an idiot :\ i don't know how i didn't see this earlier.

The other thing is, the delay for the ignition relay is around 1200, normally enough time for the car to fire up without burning the starter motor, but what about those cold mornings where it takes that little extra? how would i add a sense to send confirmation to arduino that the car is on and thus shut off the ignition relay? i would think the same sort of way as you posted, but when the car is in the on position, everything that would be on when the car is actually running is on, thus, nothing to jump off..

Uhmmm.......That is a tough one; I would probably tap into the tachometer wire and get a reading from where it is at when its started VS stopped; that way you can "sense" the RPM's, letting you know if its started or not; That or maybe something in your OBDII plug.

What sort of car is it?

You could wire the ignition switch through a twin throw relay so that when you turn on the ignition switch it turns the Arduino off (and the ignition circuit on), and when you turn the ignition off it turns the Arduino on again (and the ignition circuit off). I recommend putting a switch on the throttle pedal so that the Arduino gets reset if anyone opens the throttle. This means that if anyone sees the running car and tries to drive off, even if they overcome the steering lock it'll die as soon as they try to pull away.

By the way, you might want to check the legal situation. In the UK I believe it's illegal to leave a vehicle unattended on a public road with the engine running.

most remote starter systems cheat and monitor voltage from the battery. When its 14.0 the car started alternator charging well at least here in the states.

sprocket1597:
What sort of car is it?

A shitty old hilux, just the work pig.

PeterH:
You could wire the ignition switch through a twin throw relay so that when you turn on the ignition switch it turns the Arduino off (and the ignition circuit on), and when you turn the ignition off it turns the Arduino on again (and the ignition circuit off). I recommend putting a switch on the throttle pedal so that the Arduino gets reset if anyone opens the throttle. This means that if anyone sees the running car and tries to drive off, even if they overcome the steering lock it'll die as soon as they try to pull away.

By the way, you might want to check the legal situation. In the UK I believe it's illegal to leave a vehicle unattended on a public road with the engine running.

That's actually a really good idea!
And i'm not fussed about legalities - i'm australian, enough said.

good chance on it not starting then... I dont know much about hilux's. you might be able to get some feed back off the dash warning lights to tell if its running or not... charge light or something?

Ah, i've already got the remote ignition up and running over wifi, it works fine?
But the way it's set up is in the arduino program it simply has a delay for the ignition relay to be on for, which is 1200ms
but like i said, for cold mornings, sometimes 1200ms isn't long enough.
i need some way of the arduino sensing that the car is running, and thus switching off the ignition relay

It's an old hilux with no immobilisation or anything so it's a piece of piss to get the starting side of it done.

Aussie_V8:
i need some way of the arduino sensing that the car is running, and thus switching off the ignition relay

you mean start relay?

If its petrol you could hook into the coil and read rpm. when it starts the rpm would go from cranking speed up to idle speed. diesel must have a sensor for the tacho, so you could tap into that. Also you would want it to check if the engines running after the 1200ms anyway, and kick it in the guts again if its not.

Check whether your engine will cold start reliably on a closed throttle - some engines won't. Also, some engines need a little throttle after they've started to pick the revs up high enough for the alternator to kick in. Depending on the engine and what type of idle speed control it has this may all work fine, but it's the sort of thing that could be a real problem on an older engine.

When the arduino senses the ignition wire is energized, it releases the relay.

This is what I would do. That, or use the ignition as a sense pin and have the Arduino always control the relay. I.e., start the car by closing the relay. Open the relay after 10 minutes. Cancel the kill timer if the key is inserted, and immediately open the relay if the key is removed.

For the engine start, you could try 1200ms, check engine pulses or battery level (both good ideas!), then delay for a few seconds, try again, check, delay, try again... After maybe four attempts, give up.

Yes that is the way i've decided to do it, as it's the simplest.
Thanks for all the ideas guys!

I bought a large prototype board, some proper relays & more transistors.
This is what i've come up with so far.

And here's the really basic code, i used a basic serial input code i found at ladyada then tweeked it to what i needed, basiclly, if it gets any input at all from serial, it will fire the code.

int onPin = 12;
int accPin = 11;
int ignitionPin = 10;
int usbnumber = 0;
void setup() {
    pinMode(onPin, OUTPUT);
    pinMode(accPin, OUTPUT);
    pinMode(ignitionPin, OUTPUT);    
    Serial.begin(9600);
}
void loop() {
    if (Serial.available() > 0) {
        usbnumber = Serial.read();
    }
    if (usbnumber > 0) {

        digitalWrite(accPin, HIGH);
        delay(500);
        digitalWrite(onPin, HIGH);
        delay(5000); //5 second delay because of glow plugs (diesel)
        digitalWrite(ignitionPin, HIGH);
        delay(800);
        digitalWrite(ignitionPin, LOW);
        delay(800);        
            
        usbnumber = 0;
    }
}

Obviously i havn't yet added any components or code for the sensing of the key, nor the ignition (car has started, switch off ignition)

As far as the sense for when the key has been switched on, i was going to use the idea given above, have the arduino's power source on a normally closed relay attached to the on position of the car, so when the key is switched on, the relay becomes open and the power to the arduino is cut off - this way requires no code.

As far as the car goes, it doesn't require any throttle to start, ever.

And as for the ignition sense, in the fuse box of the car is a 'charge' fuse (from the alternator regulator), that's only outputting 12v once the car has fired. today at jaycar (Australian electronics store) i mentioned the project to a staff member, and he suggested using a voltage regulator, he sold me a 7806CT. he said, it'l step the 12v from the alternator regulator down to 6v which according to him is safe for the arduino input..

Now, can the arduino sense that "okay, 5v has been applied, i'll wait 200ms just to be safe, then switch off ignitionPin" i'm 99% sure that can be done, but what code would i add for this? and also, would i be using the analog pins? or digital pins and have one for the +5 set to input?

Cheers guys :slight_smile:

On thing I don't see, is a way wait to only allow one start in a given period of time. If somehow, you were to accidentally spam the Arduino with start commands, it is going to try over and over again to start.

Now, can the Arduino sense that "okay, 5v has been applied, I'll wait 200ms just to be safe,

Are you talking about monitoring voltage of the battery to see if the engine has started? If so, I would use a voltage divider and make the output of the divider around 4 volts when the battery is 14volts. It will give you some room for higher battery voltages. You might need to go further with a protection circuit to avoid over voltage to the Arduino.

i need some way of the arduino sensing that the car is running

Do a websearch for 'split-charge relay'.

They energise at about 13.8V, ie, when the vehicle's alternator is running and I think some models have a built-in delay of 5 or so seconds.

Well, yes, i bought a 6 volt regulator. in the car's fuse box, there's a fuse for the alternator reg, that's only hot when the alternators outputting a charge, i've disconnected the fuel pump and attempted to start the car to check this.
i was going to put the 12v regulator in between that, and the arduino input pin. is 6v safe for the arduino "in" pins to handle?
And the code for that would also protect from firing the startor motor again such as giving it a way of checking before doing anything that the car's not running.
"am i getting an input from alternator?, yes i am, so don't allow the following code to be run"

Cutting power to the Arduino seems excessive. I wouldn't do it that way. Just control the starter and ignition relays in a sensible way. Use a state machine to track your status (idle, starting, retry delay, running, etc..)

If you're planning to run the Uno (rather than build your own breadboard/stripboard Arduino), it has a regulator built-in. However, dropping 12-14v down to 5v (onboard regulator), or 12-14v down to 6v (external regulator) involves quite a bit of linear regulation. I.e., heat, and wasted energy. I don't know exactly how long it'll take to drain a car battery -- probably a while -- nonetheless, it's not optimal, and will get quite warm.

Don't cascade those regulators, btw, as 6v isn't a good margin for the onboard regulator. Although, I don't know how comfortable I'd be passing 6v directly into the 5v input either. Basically, the LM7806 is not a great fit here at all. No linear regulator is, in fact. I would strongly encourage looking into switching regulators.

Now, all of the above is nearly a moot point in that you need significantly more filtering to run reliably from an automotive power system than from AC, batteries, or USB. I posted in another guy's thread here about the ignition sequencing computer he wants to build. The gist being, car power is dirty. There are lots of articles and forum posts on the topic, so start looking into it before you button this thing up in your car. Consensus is, a simple regulator and protection diode are not adequate. Be prepared for high voltage (50v typical, 100v+ common enough) spikes, negative voltages (hookup errors or coil transients), brown-outs (starter), and lots of noise.

Don't forget a fuse!

Oh, and definitely don't hook up anything from outside your stripboard straight to I/O pins without protection. If you can't isolate it entirely, then current limiting, reverse-polarity protection, under/over-voltage shunts, an inductor (if you can low-pass your input signal that much) would all be a good idea.

Thanks for that information!
Those three things that are cascaded are transistors for the relays, not reg's.
I've used this simple design for my relay setup Arduino Playground - HomePage

Well, the way i've currently wired it, the arduino and relay coils get their power straight from the battery, and the arduino has a 6v reg to step down from 12v, the bloke at jaycar said that the reg has inbuilt thermal and reverse polarity protection and should be sufficiant to protect the arduino from abnormalitys.
I've used a very expensive multimeter, which has a .01 sec refresh rate and also logs. i had it on the car battery whilst starting it, and the highest it jumped to was 14.8v half a second after starting. then back down to around 13v.

The only other option i was thinking of doing was having the arduino's power supply running from a seperate li-po battery, as i have plenty of these, could hook up a recharger that recharges the li-po's when the car's running.
thus eliminating the arduino's power supply completly from the cars supply.

As far as having a normally closed relay between the arduino's power supply and the "ON" key wire in the car, i thought this would be adequet enough and 100% safe as it kills the arduino's power completly, and as i mentioned in my first post, i'm sort of new to this field, so i thought this would be the best start point, i suppose eventually i'll move up to a state machine.

As for the fuse for the arduino's power supply, what's the rating i should use?

Or, how about a relay that grounds out the reset button?