starting my kitcar with a push button

hi does anyone know if there are any posts that sound like this as i would not want to go over this again

. 1st press of the start button will turn on the acc and the ign pressing the start button the engine will run. If the controller( arduino) didn't receive any input from the start button within 30sec the controller will automatically de-activate. Pressing the start button in 3sec the engine will turn-off.
thanks for your time

Writing this code would be trivial. The real challenge will be interfacing it with your kit car. There are a whole lot of details about how the Arduino will interface with the car's circuitry, right? Is it as simple as opening or closing a relay to activate the accessories, the ignition, and so forth?

What I would suggest is that you start working through the Arduino examples until you can detect a button press and turn on/off an LED. Then build a circuit that has two LEDs and one button. The button is your ignition button. The two LEDs are "accessory" and "ignition". Get the program working just like you like it on the breadboard, then start thinking about how to incorporate it into the car.

No, but the process would be fairly simple to implement on an Arduino or any other microcontroller, for that matter:

ACC check:

  1. Has button been pressed? If no, continue with step 1
  2. Turn on ACC (some pin you define to trigger the ACC relay in the car)

Engine start check and time-out:

  1. Get the timer value as START-TIME
  2. Has the button been pressed? If no, continue with step 9
  3. Turn on START/RUN (some pins you define to trigger the starter relay in the car, as well as to keep the “run” connection closed - normally both are handled by the key switch)
  4. Wait “n” seconds (however long it takes for the engine to start)
  5. Turn off START
  6. Continue with step 12
  7. Get timer value as CURRENT-TIME
  8. Is CURRENT-TIME minus START-TIME >= 30 seconds? If no, continue with step 4
  9. Turn off ACC, continue with step 1

Three second hold to turn engine/ACC off:

  1. Turn off START (engine done cranking and is started)
  2. Get the timer value as START-TIME
  3. Has the button been pressed? If no, continue with step 13
  4. Get timer value as CURRENT-TIME
  5. Is CURRENT-TIME minus START-TIME >= 3 seconds? If no, continue with step 14
  6. Turn off RUN, turn off ACC, continue with step 1

Ok - I’m not going to say that the above sequence of steps are perfect, and some may need adjusting depending on how exactly you car -is- started and shut down, etc. Also, I hope the concept of the 3 second press to turn off the engine was interpreted right?

The logic above isn’t meant to be implemented exactly as written (though it could); it would be better to write it as a state machine (easier to follow, cleaner code, and expansion, if needed, would be easier), and also perhaps implement the countdown timer portion as a function called in two seperate areas in a “blink-without-delay” example manner.

You might also want to implement logic that only allows the button to be used at all if, for example, a certain RFID tag was in range (and would turn the car off / lockout the system if the tag goes out of range - even when the car is running).

That’s the basics - anyhow; use them as / how you see fit, I guess…

joshuabardwell:
The real challenge will be interfacing it with your kit car. There are a whole lot of details about how the Arduino will interface with the car's circuitry, right? Is it as simple as opening or closing a relay to activate the accessories, the ignition, and so forth?

Back in the day, most kit cars were based on VW chassis' - not sure what they are today, but for the most part, such electrical hook up tends to be dead easy.

Unfortunately, if this person's kit car is based on something more recent (say perhaps built within the last 10 or so years), then simply triggering the relays probably won't work at all. In fact, trying to do so may actually trigger a service code and lock the user out of starting the car period (thinking it is being hot-wired or something). Some cars have a much more complex relay sequence that has to be switched to get things going (with steps to validate/verify by the computer in-between - kinda like a POST before startup).

Other than that - it's fairly easy to trigger the relays in most cars - the standard relay/solenoid tutorial in the playground and elsewhere gives more than enough information.

The real tricky part, though, is isolating the Arduino properly so that some kind of kickback spike from the automobiles power distribution bus doesn't find it's way back to the digital pins of the Arduino and kill them; a good way to protect against that is to use some kind of automotive-grade opto-coupler to isolate the pins completely from the other side (there are other methods, too).

cr0sh:
The real tricky part, though, is isolating the Arduino properly so that some kind of kickback spike from the automobiles power distribution bus doesn't find it's way back to the digital pins of the Arduino and kill them; a good way to protect against that is to use some kind of automotive-grade opto-coupler to isolate the pins completely from the other side (there are other methods, too).

Boy, howdy. I am a convert to the church of opto-couplers. The kind of BS that occurs when you mingle grounds unnecessarily is unbelievable. I'm a huge van of the CPC1218 and its variant. Dead simple to wire up, galvanic isolation, and no need for an external current-limiting resistor.

Thanks for the replies
What I have is a rover based kit car
I got this start button http://www.ebay.co.uk/itm/Starter-button-Kit-Car-Classic-Cars-Project-Locost-Westfield-Lotus-7-Project-/380665986135?pt=UK_CarsParts_Vehicles_CarParts_SM&hash=item58a175fc57 I was going to use it then I thought I would use an arduino with a relay shield http://www.coolcomponents.co.uk/catalog/relay-shield-p-610.html
The car does have a key fob which opens the doors and turns off the immobiliser so I should find some output from that to start the arduino push button. Big thanks to cr0sh as this is on the lines I was thinking

cr0sh:
ACC check:

  1. Has button been pressed? If no, continue with step 1
  2. Turn on ACC (some pin you define to trigger the ACC relay in the car)

Engine start check and time-out:

  1. Get the timer value as START-TIME
  2. Has the button been pressed? If no, continue with step 9
  3. Turn on START/RUN (some pins you define to trigger the starter relay in the car, as well as to keep the "run" connection closed - normally both are handled by the key switch)
  4. Wait "n" seconds (however long it takes for the engine to start)
  5. Turn off START
  6. Continue with step 12
  7. Get timer value as CURRENT-TIME
  8. Is CURRENT-TIME minus START-TIME >= 30 seconds? If no, continue with step 4
  9. Turn off ACC, continue with step 1

Three second hold to turn engine/ACC off:

  1. Turn off START (engine done cranking and is started)
  2. Get the timer value as START-TIME
  3. Has the button been pressed? If no, continue with step 13
  4. Get timer value as CURRENT-TIME
  5. Is CURRENT-TIME minus START-TIME >= 3 seconds? If no, continue with step 14
  6. Turn off RUN, turn off ACC, continue with step 1

As you say
the above sequence of steps are not perfect, and some may need adjusting depending on how exactly my car -is- started and shut down, etc.

I have changed some of the the points and this is in no way what it will end up like as I am sure it will change in the future

ACC check and time-out:

  1. Get timer value as CURRENT-TIME
  2. Has button been pressed? If no, continue with step 4
  3. Turn on ACC and ign ( the shield to trigger the ACC relay in the car)
  4. Get timer value as CURRENT-TIME
  5. Is CURRENT-TIME minus START-TIME >= 30 seconds? If no, continue with step 2
  6. Turn off ACC, continue with step 1

Engine start check and time-out:

  1. Get the timer value as START-TIME
  2. Has the button been pressed? If no, continue with step 13
  3. Turn on START/RUN (relay shield to trigger the starter relay in the car, as well as to keep the "run" connection closed - normally both are handled by the key switch)
  4. Wait "n" seconds (however long it takes for the engine to start)
  5. Turn off START
  6. Continue with step 16
  7. Get timer value as CURRENT-TIME
  8. Is CURRENT-TIME minus START-TIME >= 30 seconds? If no, continue with step 4
  9. Turn off ACC, continue with step 1

Three second hold to turn engine/ACC off:

  1. Turn off START (engine done cranking and is started)
  2. Get the timer value as START-TIME
  3. Has the button been pressed? If no, continue with step 13
  4. Get timer value as CURRENT-TIME
  5. Is CURRENT-TIME minus START-TIME >= 3 seconds? If no, continue with step 14
  6. Turn off RUN, turn off ACC, continue with step 1

To get the behaviour you describe I'd power the Arduino from the ignition circuit and have a self-energising relay controlled by the Arduino to turn that on and off. That way the Arduino doesn't need to be powered up all the time so you don't need to worry about the battery being flattened. If you want to be able to kill the engine within 30 seconds of starting it and also want to be able to make multiple attempts to start without having to re-arm every time then you will also need to provide an 'engine running' signal from somewhere.

hi PeterH

i have not thought about powering the Arduino from the ignition circuit.
and have that turn the arduino on and off
the thing is i was going to do away with the key and only use for back up if i could find i 12v supply from the car alarm ( key fob ) this would be a nice.

i want to be able to make multiple attempts to start without having to re-arm every time this i a good point
the lines 5/ 6 / 7 would need to be looked at.
something like wait till engine was running this needs a input from car (need to some testing )
or keep the starter running when push button is pressed

  1. Turn on START/RUN (some pins you define to trigger the starter relay in the car, as well as to keep the “run” connection closed - normally both are handled by the key switch)
  2. Wait “n” seconds (however long it takes for the engine to start)
  3. Turn off START

i was going to see if i could provide an ‘engine running’ signal from the alternator i will have to look into this.

a big thanks for all the post this has given me somethings i need to think about

Regarding running the starter:
You probably want to have some sort of feedback signal from the engine to Arduino when the engine is running, since it takes a variable amount of time for the engine to start up. The feed back could be RPM is above a certain value., or voltage from alternator is above a certain value.

catsam:
the thing is i was going to do away with the key and only use for back up

Yes, I assumed that. This is why I suggested that you power the Arduino from the ignition supply and have the ignition supply controlled by the Arduino. The idea would be that you press the button to close a circuit that operated an ignition relay, once the Arduino is running it keeps the relay powered (self energizing) so that it remains powered even after you release the button. This way the Arduino can turn off the ignition circuit (and itself) whenever you decide, based on your timer and the engine-running signal.

hi its been a long time.
I started this some time a go and xmas and things got in the way and i have gone back to this here is my code it is on a loop for now but will change this .i am going to use a timer wich will give me time to getin the car and sart the car

 /* Program: button Car Start
 * Revised: 2013
 *
 * Inputs:  BT  "ON" signal
 *          Vehicle RPM Sensor
 *          keyfob input 
 *          
 * Outputs: Ignition Control Relay
 *          starter Control Relay
 *          power Control Relay
 *          light Relay
 */


  //EQUATES
  //Inputs
  int button = 2;                                   //push button "ON" signal to pin 2
  int rpm_sens = 3;                                //Vehicle RPM sensor  to pin 3

  //Outputs
  int ign_relay = 5;                               //Ignition Control Relay controlled by pin 5
  int starter_relay = 4;                             //Start Control Relay controlled by pin 4
  int arduino_power_relay = 6;                            //power realy to keep arduino on by pin 6
  int button_light = 7;                                  //light on pin 7

  unsigned long start_time;            //Variable used to store the time
                                      // at which the starter is engaged

  //DEFINITIONS
 void setup()
 {
   pinMode(button, INPUT);   //Define pin inputs and outputs
   pinMode(rpm_sens, INPUT);

   pinMode(ign_relay, OUTPUT);
   pinMode(starter_relay, OUTPUT);
   pinMode(arduino_power_relay, OUTPUT);
   pinMode(button_light, OUTPUT);
 
  }

    //PROGRAM

  //Loop function: Wait for a start button  to be pushed
                                   
 void loop()
 {
     digitalWrite(button_light, HIGH);      // bt light on 
     
     if (digitalRead(button) == HIGH)     //Check if button has been pushed set pin2 high
 {
     begin();                            //Begin start sequence if pin is high
  }
     else
 {
      loop();                              //Repeat this function until start button is pushed  
  }
  }



 //Begin function: Turn on ignition and power relay
 void begin()
 {
   delay(300),                                    //  delay
   digitalWrite(ign_relay, HIGH);                 //Turn ignition ON
  
    w_start();                                     //Go to w_sart funciton
  }

   // w_start see buton pushed to sart
 
 void w_start()                              
 { 
     if (digitalRead(button) == HIGH )        // check if btton pushed 
 {
     start();                                //Begin start sequence if pin is low
  }
     else
 {
     w_start();                              //Repeat this function until start button is pushed
  }
  }  
   
  

 //Start function: Engage starter only if engine is not already running.
 void start()
 {       
    if(digitalRead(rpm_sens) == LOW)                  //Continue start sequence only if vehicle is not running.
 {
      delay(900);                                    // delay 
      digitalWrite(starter_relay, HIGH);             //Engage starter
      delay(100);                                    // delay
      digitalWrite(arduino_power_relay, HIGH);       //turn power relay
      start_time = millis();           //Capture the time at which the starter was engaged
      
      starter_engaged();                             //Go to Starter_engaged function
  }
    else                                         
 {
     
      engine_running();                                                    //Exit start sequence if already running
  }
  }

 //Starter_engaged function: Disengage starter after vehicle is starter or turn off starter if
 //vehicle has not started within 4 seconds.

 void starter_engaged()
 {
 
   if (digitalRead(rpm_sens) == HIGH)            //Continue if engine has started
 {
    engine_running();                           //Go to disengage_starter after engine is running
  }
   else if ((start_time+4000) < millis())        //Test if 4 seconds has passed since the starter was engaged
 {
     disengage_starter_timeout();                 //Go to disengage_starter if engine has not started within 4 seconds of starter engagement
  }
   else
 {
     starter_engaged();                            //Repeat this function if engine has not started or 4 seconds has not elapsed
  }
  }

                                                 
         //Disengage_starter function: Disengage the starter.
        
 void engine_running()
 {
    digitalWrite(starter_relay, LOW);                   //Disengage the starter 
 {
   delay(500);
    if (digitalRead(button) == HIGH)                //Check if BT has set pin2 high
 {
      engine_off();                             //engine_off sequence if pin is high
  }
    else if (digitalRead(rpm_sens) == HIGH)     // if engine stalled 
    
      loop();
      
       else
 {
     engine_running();                           //Repeat this function until start button is pushed  
  }
  }  

  }
        //Disengage_starter_timeout function: Disengage the starter 
        //(used after 4 seconds has elapsed without an engine start)
       
 void disengage_starter_timeout()
 {
   digitalWrite(starter_relay, LOW);                     //Disengage the starter
  
    engine_off();                                      //Exit start sequence
  }


 //Vehicle_off function: Turns the vechile off and starts the whole program over

 void engine_off()
 {
   digitalWrite(ign_relay, LOW);                 //Turn ignition OFF
   digitalWrite(button_light,LOW);                     // turn light off 
   delay(1000),
   digitalWrite(arduino_power_relay,LOW);               // turn off power
   delay(5000),
  
  
   loop();                                      //Repeat program (look for start command)
  }

Hi

Nice to meet someone else using an arduino for their kit car :slight_smile: see my post:

http://forum.arduino.cc/index.php?topic=185754.0

I to have a starter button, the arduino in my project is being used to read a lot of switches lights indicators brake pedal hazards etc etc, I also have it reading the ignition switch and detecting what position it is in ie off and ign and also if the starter button is pressed, the plan is that if the ign is on it will switch on the ignition relay and if the ign and starter button is on it will switch on the ignition and starter relays, I'm not sure why u want it to turn off the starter relay after a fixed time period as most engine starter buttons are push to make so they are only on whilst u are pushing them so you can control them yourself ??

Also I noticed in your code that your are reading your buttons as high, presumably you are then sending 5 volts from the arduino to the button and back to the arduino, it may be better to read the switch press as ground is off ie low = on, (using internal pull-up resistor) in this way as the kit car has a negative earth you can earth the switch to the chassis close to the switch and u only need 1 wire. I am using optocouplers on the inputs to protect the input pins.

You need to protect the arduino from nasty automotive voltage spikes etc I have done this using an automotive USB module that is used for charging phones etc that has the protection circuits built in

Good luck feel free to message me if you want to talk more

Also looking at your switch it has a built in LED which will be designed for 12 v so if you want this to be lit you will need to push 12v through it which would be too high a voltage for the input pin so you would need a transistor or opto-isolator.

Thinking about your original plan are you planning on not having an ignition key at all? The only problem I can see with this is that you need 2 different systems to avoid the car being stolen for the IVA test, this is normally the ignition key and the steering lock if you are not using these then you will need an immobiliser etc, but if you are not using a steering lock then someone could tow you away, what most people do is to keep the ign switch to turn on the ignition and thus keep the steering lock and then use the starter button instead of the final starter position on the ignition switch

PeterH:
To get the behaviour you describe I'd power the Arduino from the ignition circuit and have a self-energising relay controlled by the Arduino to turn that on and off. That way the Arduino doesn't need to be powered up all the time so you don't need to worry about the battery being flattened. If you want to be able to kill the engine within 30 seconds of starting it and also want to be able to make multiple attempts to start without having to re-arm every time then you will also need to provide an 'engine running' signal from somewhere.

Hi all,
Can someone explain to me the post PeterH made of the idea that a self-energising relay to power up the Arduino .
How does the Arduino sense the Button to self energize if its not powered up?