Probably essentially the most intimidating step for me on this entire course of was writing the Arduino Code. As I discussed earlier, this code writing stuff was all new to me. However, it went fairly fast with the flowchart in hand.
You’ll discover within the first a part of the code that two totally different alerts can be utilized to provoke the automotive begin command:
1) Sending an “s” to the Arduino through the bluetooth module (which is appearing as a serial port) can be utilized to provoke the beginning sequence. This is used when beginning the automobile from a terminal on a pc.
2) Setting a pin on the Arduino excessive may even provoke the beginning sequence. This enter pin on the Arduino is related to the Bluetooth board. When utilizing the Daisy On/Off app from an Android cellphone, the app will trigger the pin on the Bluetooth board to be set excessive, which in flip will probably be seen by the Arduino and trigger the beginning sequence to start.
Here is my code:
/* Program: Remote Car Start
* Author: Chris Johnson
* Revised: December fifth, 2011
* Inputs: BT Module “ON” sign
* BT Module “OFF” sign
* Vehicle RPM Sensor
* Vehicle Neutral Position Sensor
* Vehicle Speed Sensor
* Serial port
* Outputs: Ignition Control Relay
* Accessory Control Relay
* Starter Control Relay
* Clutch Safety Switch Relay
* Serial Port
int BT_on = 2; //Bluetooth “ON” sign inputed to pin 2
int RPM_sens = three; //Vehicle RPM sensor inputted to pin three
int neutral_sens = four; //Vehicle Neutral Position Sensor inputted to pin four (12 volts +/- zero.5 volts)
int speed_sens = 5; //Vehicle Speed Sesor inputted to pin 5
int BT_off = 7; //Bluetooth “OFF” sign inputed on pin 7
int ign_ctrl = eight; //Ignition Control Relay managed by pin eight
int start_ctrl = 9; //Start Control Relay managed by pin 9
int clutch_sfty = 10; //Clutch Safety Swithc Relay managed by pin 10
int acc_ctrl = 11; //Accessory Control Relay managed by pin 11
unsigned lengthy start_time; //Variable used to retailer the time at which the starter is engaged
char knowledge = zero; //Variable used to retailer knowledge acquired through the serial port
//Loop perform: Wait for a START command to be acquired (command through serial port or
//voltage utilized to BT_on pin)
//Check perform: Test for correct character set from BT
//Begin perform: Turn on accent and ignition
//Neutral perform: Check if the automobile’s transmission is within the impartial place.
// Continue if automobile is in impartial. Exit begin sequence if automobile is in gear.
//Start perform: Engage starter provided that engine isn’t already working.
//Starter_engaged perform: Disengage starter after automobile is starter or flip off starter if
//automobile has not began inside four seconds.
//Disengage_starter perform: Disengage the starter.
//Disengage_starter_timeout perform: Disengage the starter (used after four seconds has elapsed with out an engine begin)
//Vehicle_off_sense perform: Waits for an “off” sign to be despatched whereas the engine is working.
//If no “off” sign is acquired, turns off the automobile after 30 minutes has elapsed because the engine begin.
//Vehicle_off perform: Turns the vechile off and begins the entire program over