push button start idea

Hello,

Ive been following this website for a long time desided to join. So i am new and after a while not getting how to understand the language i thought i would join a community.

Anyways my project, push button start, and not something i have seen yet done in the fashion i seek.

I want to use a nissan r35 gtr switch, its a single button that lights up, then on the upper crest of the button there is 3 led lights "lock, acc, on" . I want the button to function as close to stock as possible.

For those who dont know how that works is with the car is off you can hit the button once will go into acc, depress it again goes into "on" mode, but does not engage the starter. Put your foot on the brake depress it again it then starts the vehicle. Once running depress it again it would turn off. If you did not start the vehicle once in on mode and depressed the button again in on mode without starting the vehicle it would cycle back to off.

One other mode is a quick start, vehicle starts in off mode, depress brake pedal depress button goes straight into starting mode. I know im not including a switch, or rfid, or keypad that activates this but i wanna get one idea working.

If im wrong correct me, its basicly a single button that changes modes each mode would activate a relay and an indicator led . Acc then on, then start would be momentary. Leaving acc and on so the vehicle would stay on once started. An input from the brake pedal would be a high low value that would allow starting, and or bypassing habing to push the button 3 times, down to one, turning on acc and on relays at the same time and activating the starter.

I dono if it should be specified amount time for the starter to run, momentary hold on button allows starter to turn over as long as button is depressed. Or use a tach signal so its the same as the new smart ignition systems in new cars.

I hope i have given enough info for someone to help me. Thanks to all who help. Also looking for friends to colaberate with.

It sounds to me like that switch is working. So what are you trying to do?

Well a switch is just a switch.

I wanna build that circuit. So it will function like it would in a newer stock car

Look up Finite State Machine. That seems to be what you want to do.

alphawolf620:
Well a switch is just a switch.

I wanna build that circuit. So it will function like it would in a newer stock car

How would it function in a newer stock car? Are you saying you want to recreate the same functionality in a vehicle that doesn’t already have it?

alphawolf620:
Anyways my project, push button start, and not something i have seen yet done in the fashion i seek.

Writing code to make LEDS work in the sequence you mention is pretty straightforward. Each press of the button moves the system on to the next state. And it could fall back to the OFF state if there was an error in the sequence or if it was not completed in time.

Whether the project could do more than make some LEDs switch on and off is a different matter.

Starting an engine is not nearly as simple as it looks. We humans apply a lot of intelligence to that task.

And the fine print at the very bottom of the Atmel datasheet says that the Atmega chips should NOT be used in automotive applications.

…R

Sorry i dont know how to quote multiple posts on my tablet.

Yes i want to put that functionality into an older vehicle.

I want it to control leds and relays, its a carb vehicle so its simple, so just to simplify it i would be happy with it only triggering the starter with my foot on the brake and while my finger is on the button. So no tach or timer function is needed. Brake switch is simple its only high and low sig. If it can turn on a led it can power the sig aide of a relay only needing mili volts to trigger.

Suggestions say dont use arduino in vehicular applications, but many do so with no failure, i am a honda trained tech, and training in heavy truck, i am very well versed in automotive electrical, and atmegas are used in vehicles all the time. Its not going to be a daily driver. Its being built as a show/ weekend cruiser. I would not implement this in a daily driver for the fact of human error due to- at the end of the day i am human. So its more of a custom touch that is for show.

I need to learn code, books are not helping. I see so patterns in how the code is written but i want to understand how it works. Im In norcal and tinkering does not to be a hobby as much as "i did this but i bought it at a store". I make everything myself from 510 paracord belts, to my house to building my cars from the ground up other than things that can not be safely reproduced by a diy perspective. I love arduino. And i want it to become a staple in my diy knollage list.

It shouldn't be too difficult. I recall years ago I modified a MK1 Ford Cortina to start automatically, using a bunch of relays, salvaged from a fruit machine. This was an automatic (quite unusual here in the UK at the time). I had also disabled the inhibitor switch on the gearbox (that prevents the vehicle being started whilst in gear).

I loaned the car to my brother and it somewhat caught him out. The engine stalled at a junction and as he was searching around for the handbrake (it was fitted to the dashboard, not in the normal position between the front seats) The thing automatically restarted itself and started to move off while he was still in a confused state.

I found it quite hysterical when he told me about it but he obviously felt it was dangerous.

It's probably easier to illustrate this with some code than to describe how to write the program

char starterState = 'L' // L = Lock, A = Acc, N = oN,
boolean engineRunning = false


void setup() {
    // usual stuff
}

void loop() {
    switchState = digitaRead(switchPin);
    brakeState = digitalRead(brakePin);

    if (switchState == LOW) { // assumes active LOW
        if (starterState == 'L') {
            starterState = 'A';
        }
        if (starterState == 'A') {
            starterState = 'N';
        }
        if (starterState = 'N' && engineRunning == true) {
            stopEngine();
            starterState = 'A';
        }
        if (starterState = 'N' && brakeState == LOW and engineRunning == false) {
            starterState = 'L';
        }
        if (starterState = 'N' && brakeState == LOW && engineRunning == false) {
            operateStarter();
        }
    }
}

This is far from complete but it should illustrate the idea.

As you are trying to use the same button to step through the sequence you would probably need some code to debounce the button (i.e. to ignore several spurious contacts that may happen in a very short interval)

And you would probably need a timeout (using millis()) to make it go back to Acc if the enigine was not started in a reasonable time.

I suspect it would be possible to tidy up the logic to avoid the need for complex IF statements.

...R

Thank you Robin.

What is a good way to understand and learn code, i have not found much book wise that makes it easier. I have never had a problem picking up a skill but even when i read a book and for ex. "If "statements i can read what they are and how to make use in the code with them but i dont get what the function is doing. It reminds me of word problems in high school math.

I'm pretty sure that Atmel does sell automotive-grade controllers. Wouldn't you hate to find out the hard way that there's a reason?

alphawolf620: but i dont get what the function is doing. It reminds me of word problems in high school math.

Are you referring to the functions I have in my code - stopEngine() and operateStarter() ?

They are things that you need to write to make that stuff happen.

To start with (sorry for the pun) you need to write down in plain language the steps that you need to go through to get an engine to start. I reckon it is not simple.

Stopping a spark-ignition engine should be straightforward.

This Thread about Planning and Implementing a Program may also give some general guidance.

...R

In an older car it is simple. The spark is controlled by a coil, controlled by points. In terms of switching im wanting to do it from the ignition switch location. So its all a constant voltage is what ill be working with. And high and low inputs and outputs.

I know commands make stuff happen but i want to understand why they work and how, i like to dissect things to know the workings.

alphawolf620: What is a good way to understand and learn code, i have not found much book wise that makes it easier.

Apply yourself. And embrace "the reading thing", that's essential. Read and re-read the Arduino reference, over and over and over (no cost beyond internet access). And, by all means, keep the Arduino plugged in and do stuff, even simple things, applying the learning with LEDs, a switch or three and Serial Monitor .

Buy the Simon Monk books http://www.amazon.com/Programming-Arduino-Getting-Started-Sketches/dp/0071784225 http://www.amazon.com/Programming-Arduino-Next-Steps-Sketches/dp/0071830251

Boxall's book is good, too http://www.amazon.com/Arduino-Workshop-Hands--Introduction-Projects/dp/1593274483

alphawolf620: In an older car it is simple. The spark is controlled by a coil, controlled by points. In terms of switching im wanting to do it from the ignition switch location. So its all a constant voltage is what ill be working with. And high and low inputs and outputs.

I know commands make stuff happen but i want to understand why they work and how, i like to dissect things to know the workings.

I don't see any question in this.

If you ask a question I will try to help.

...R

GoForSmoke:
I’m pretty sure that Atmel does sell automotive-grade controllers. Wouldn’t you hate to find out the hard way that there’s a reason?

That do. For the most part, it’s just the working temperature range that’s different (-40 to +125 instead of -40 to +85).

Ian.

So he can use an automotive grade stand-alone AVR in the actual car, and be more covered. If a truck hits you and the lawyers find anything wrong, that's where you lose.

GoForSmoke: So he can use an automotive grade stand-alone AVR in the actual car, and be more covered. If a truck hits you and the lawyers find anything wrong, that's where you lose.

I wasn't commenting on the legalities of what the OP wishes to do, just that you can get automotive grade AVR devices.

That said, using an AVR in an automotive application is fine for non critical systems. I'm using one myself for a audio project. I wouldn't choose to hook into any critical systems with one personally, but that's more a reflection on my skills with electronics and programming than anything else. Atmel don't produce automotive grade products solely for hobbyists, so they obviously intend for these devices to be be fitted in cars at some point. Speed and processing power probably precludes their use in anything 'mission critical' such as ABS or Airbag systems, but plenty of other applications are perfectly suited to an AVR or similar MCU.

Ian.

The system in witch im trying to control it not critical to controlling anything other than on and off, i will have a redundant overide for emergency purposes.

I will do what you said robin and write down the steps of what needs to happen.

As well as having the software keep track of what state the ignition is in, it would also be good to have some sort of hardware feedback for each stage so you can be sure that what you asked to happen actually did happen.
Ian.