Show Posts
Pages: [1] 2 3 4
1  Using Arduino / Project Guidance / Re: Remote vehicle ignition on: January 30, 2013, 12:23:07 pm
Thanks guys for all the inputs! i guess the logical way to go would be to read the tach and make a decision based off of that.
Wildbil, no i havn't as of yet.

The code for the project was mostly written by another member on this forum, as i'm quite new to the world of arduino i'm not that fluent with the language yet and had no idea how to create a state machine, but i will try and implement the tach sense completely myself..

Will update and do a project write up once it is completely finished smiley
2  Using Arduino / Project Guidance / Re: Remote vehicle ignition on: January 29, 2013, 11:47:23 am
I'll look into it!
Hopefully i can find a solution that works within 1000ms or less, as starter motors arn't cheap smiley-wink

Thanks!
3  Using Arduino / Project Guidance / Remote vehicle ignition on: January 29, 2013, 11:31:15 am
Hi there!
Some might remember me from around 7 months ago, i had an idea to make a remote vehicle ignition that could start a car via txt message.

Well, some months on i've pretty much finished the project, and all runs well in my EFI car and has done for months without a hitch.

I've got a friend who has an old toyota hilux and wants me to install one, the problem being this:
The way my prototype works is, it receives the ignition code/pin via text message through the GSM board, then checks to see whether the car is already running; if not it will then put the car onto the reds (ON), then after a few seconds it will proceed to fire the starter motor.
It will do this until either until a 10 second timer is up or it senses 12v from a random wire i found behind the dash that is only powered when the car is running, therefor it assumes the car is running and shuts off the starter motor.

The problem is this, my friends old non EFI hilux doesn't have a computer nor any other 12 source that i can find that is live only when the car's engine is running.

What possible ways would there be for my arduino to detect that the vehicle is running after cranking and thus turn off the starter motor?
Would an option be to make a revolution sensor?

Regards!
4  Using Arduino / Programming Questions / Re: An error... on: August 12, 2012, 05:28:32 am
Well, no i didn't fix it, you kind people did.
And along the way, i learnt some good lessons, cheers everyone!

It compiles, uploads and works perfect.
5  Using Arduino / Programming Questions / Re: An error... on: August 11, 2012, 09:43:25 am
Thank you Paul for the sarcastic reply.
I'm fairly sure i now understand.

Regards.
6  Using Arduino / Programming Questions / Re: An error... on: August 11, 2012, 09:40:49 am
This compiles:
Code:
//Remote Vehicle Ignition
//State Machine begin
#include <SoftwareSerial.h>

char inchar;

SoftwareSerial cell(2,3);

// system states
#define STOPPED   0
#define STARTING  1
#define CRANKING  2
#define RUNNING   3

#define FUEL_PUMP_PRIME_TIME  5000
#define RUNNING_TIMEOUT 60000UL

const int ignitionPin = 12;
const int onPin = 11;
const int ledPin = 13;
const int onledPin = 9;
const int alternatorPin = 4;

int state = STOPPED;        // master variable for the state machine
unsigned long StartingTime; // fuel pump priming
unsigned long RunningTime;  //  ten minute timeout

void setup()
{
  pinMode(onPin, OUTPUT);
  pinMode(onledPin, OUTPUT);
  pinMode(ignitionPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(alternatorPin,INPUT);
  Stop();
  cell.begin(9600);
  delay(30000);
  cell.println("AT+CMGF=1");
  delay(200);
  cell.println("AT+CNMI=3,3,0,0");
  delay(200);
}

void loop()
{
  switch(state)
  {
  case STOPPED:
    HandleStoppedState();
    break;
  case STARTING:
    HandleStartingState();
    break;
  case CRANKING:
    HandleCrankingState();
    break; 
  case RUNNING:
    if(millis()-RunningTime > RUNNING_TIMEOUT)
    {
      Serial.println("Running Timeout"); 
      Stop(); 
    }
    break; 
  default:
    Serial.print("Unknown State: ");
    Serial.println(state);
    Stop();
    break; 
  }
}

void Stop()
{
  Serial.println("TimeOut"); 
  digitalWrite(ignitionPin,LOW);
  digitalWrite(onPin,LOW);
  digitalWrite(onledPin,LOW);
  state=STOPPED;
}

void HandleStartingState()
{
  if(millis()-StartingTime > FUEL_PUMP_PRIME_TIME)
  {
    if(digitalRead(alternatorPin)==HIGH)
    {
      Serial.println("Abort cranking"); 
      Stop();
    }
    else
    { 
      Serial.println("Starting Vehicle"); 
      digitalWrite(onPin,HIGH);
      digitalWrite(ignitionPin,HIGH);
      state=CRANKING;
    } 
  }
}

void HandleStoppedState()
{
  if(cell.available() >0)
  {
    inchar=cell.read();
    if (inchar=='#')
    {
      delay(10);
      inchar=cell.read();
      if (inchar=='s')
      {

        delay(10);
        inchar=cell.read();
        if (inchar=='0')
        {

          digitalWrite(ignitionPin,LOW);
          digitalWrite(onPin,LOW);
        }
        else if (inchar=='1')
        {
          Serial.println("Priming Fuel Pump"); 
          StartingTime=millis();
          digitalWrite(ignitionPin,LOW);
          digitalWrite(onPin,HIGH);
          state=STARTING;
        }     
      }
    }
  }
}

void HandleCrankingState()
{
  if(digitalRead(alternatorPin)==HIGH)
  {   
    Serial.println("Vehicle Running"); 
    digitalWrite(ignitionPin,LOW);
    digitalWrite(onPin,HIGH);
    digitalWrite(onledPin,HIGH);
    RunningTime=millis();
    state=RUNNING;
  }
}

But I don't have your hardware, so I don't know if it works.

Thanks! shall test shortly.
But why are there so many braces at the end?
7  Using Arduino / Programming Questions / Re: An error... on: August 11, 2012, 09:24:30 am
I've litterally tried everything, i still keep getting compile error of:
Code:
void HandleCrankingState()
{  <<<COMPILE ERROR HIGHLIGHTS THIS
if(digitalRead(alternatorPin)==HIGH)
  {     
  digitalWrite(ignitionPin,LOW);
  digitalWrite(onPin,HIGH);
  digitalWrite(onledPin,HIGH);
  RunningTime=millis();
  state=RUNNING;
  }
}

With the following:
Code:









arduino_remote_start_final.cpp: In function 'void HandleStoppedState()':
arduino_remote_start_final:146: error: a function-definition is not allowed here before '{' token
arduino_remote_start_final:155: error: expected `}' at end of input
arduino_remote_start_final:155: error: expected `}' at end of input
arduino_remote_start_final:155: error: expected `}' at end of input
8  Using Arduino / Programming Questions / Re: An error... on: August 11, 2012, 08:59:03 am
Try to pinpoint what is not right. Like once you establish that HandleStartingState() is called, you may want to stop printing "In Starting Vehicle" as it will be called repeatedly. Then you might check the alternator pin is correct, verify the alternator pin is setup right in code, verify it is correctly wired and put a volt meter on it to see if ever does go high.

So just pinpoint what is not as expected by printing diagnostics and checking hardware.


I see.
I have tested this code numerous times via serial whilst hooked upto the vehicle and it indeed works perfect, as soon as i changed the code from serial to cell, it got messy and keeps giving bracket errors.
I honestly cannot work out why it won't compile when all i've done is remove anything serial and add a few lines of code for the cell part of it.
9  Using Arduino / Programming Questions / Re: An error... on: August 11, 2012, 08:28:20 am
I added an } after HandleCrankingState.

Would it be possible at all Paul, to maybe take an actual look at the code and explain just what i'm doing wrong when entering the cell code?

Regards.
10  Using Arduino / Programming Questions / Re: An error... on: August 11, 2012, 08:15:25 am
Got it to compile, although it wouldn't move to HandleCrankingState
11  Using Arduino / Programming Questions / Re: An error... on: August 11, 2012, 07:54:48 am
Thanks for the tip, i shall try now.

Although, before i inputted all the cell code, it worked fine...
12  Using Arduino / Programming Questions / An error... on: August 11, 2012, 07:28:57 am
Hi all, excuse the noobish post.
I've been working on a remote vehicle ignition for some time now, and have gotton over many hurdles thanks to members on this forum, and have learnt quite alot to something very new to me.

Currently, i'm at the programming stage.
I have had some coding help from a member here in the past, he wrote quite alot of the current code i am using. (i'm more of a designer rather than a programmer)

Here i have my current code, which is giving me a compile error of
Code:
arduino_remote_start_final.cpp: In function 'void HandleStoppedState()':
arduino_remote_start_final:150: error: a function-definition is not allowed here before '{' token
arduino_remote_start_final:160: error: expected `}' at end of input
arduino_remote_start_final:160: error: expected `}' at end of input
arduino_remote_start_final:160: error: expected `}' at end of input

My current code is:
Code:
//Remote Vehicle Ignition
//State Machine begin
#include <SoftwareSerial.h>

char inchar;

SoftwareSerial cell(2,3);

// system states
#define STOPPED   0
#define STARTING  1
#define CRANKING  2
#define RUNNING   3

#define FUEL_PUMP_PRIME_TIME  5000
#define RUNNING_TIMEOUT 60000UL

const int ignitionPin = 12;
const int onPin = 11;
const int ledPin = 13;
const int onledPin = 9;
const int alternatorPin = 4;

int state = STOPPED;        // master variable for the state machine
unsigned long StartingTime; // fuel pump priming
unsigned long RunningTime;  //  ten minute timeout

void setup()
{
pinMode(onPin, OUTPUT);
pinMode(onledPin, OUTPUT);
pinMode(ignitionPin, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(alternatorPin,INPUT);
Stop();
cell.begin(9600);

delay(30000);

cell.println("AT+CMGF=1");

delay(200);

cell.println("AT+CNMI=3,3,0,0");

delay(200);

}

void loop()
{
switch(state)
  {
  case STOPPED:
    HandleStoppedState();
    break;
  case STARTING:
    HandleStartingState();
    break;
  case CRANKING:
    HandleCrankingState();
   break;  
  case RUNNING:
    if(millis()-RunningTime > RUNNING_TIMEOUT)
      {
      Serial.println("Running Timeout");  
      Stop();  
      }
    break;  
  default:
    Serial.print("Unknown State: ");
    Serial.println(state);
    Stop();
    break;  
  }
}

void Stop()
{
Serial.println("TimeOut");  
digitalWrite(ignitionPin,LOW);
digitalWrite(onPin,LOW);
digitalWrite(onledPin,LOW);
state=STOPPED;
}

void HandleStartingState()
{
if(millis()-StartingTime > FUEL_PUMP_PRIME_TIME)
  {
  if(digitalRead(alternatorPin)==HIGH)
    {
    Serial.println("Abort cranking");  
    Stop();
    }
  else
    {  
    Serial.println("Starting Vehicle");  
    digitalWrite(onPin,HIGH);
    digitalWrite(ignitionPin,HIGH);
    state=CRANKING;
    }  
  }
}

void HandleStoppedState()
{

if(cell.available() >0)

 {
  
inchar=cell.read();

if (inchar=='#')

{
  delay(10);
  
inchar=cell.read();

if (inchar=='s')

{
  
delay(10);

inchar=cell.read();

if (inchar=='0')

{

digitalWrite(ignitionPin,LOW);
digitalWrite(onPin,LOW);
}

else if (inchar=='1')

{
  
  Serial.println("Priming Fuel Pump");  
  StartingTime=millis();
  digitalWrite(ignitionPin,LOW);
  digitalWrite(onPin,HIGH);
  state=STARTING;
  }      
}

void HandleCrankingState()
{
if(digitalRead(alternatorPin)==HIGH)
  {    
  Serial.println("Vehicle Running");  
  digitalWrite(ignitionPin,LOW);
  digitalWrite(onPin,HIGH);
  digitalWrite(onledPin,HIGH);
  RunningTime=millis();
  state=RUNNING;
  }
}

I've tried a few work around's but cannot seem to get past this.

If anyone would have some idea's, that would be greatly appreciated.

Using an Arduino UNO, with a sparkfun eval board which uses the SM5100b cell chip

This is the code before i wrote in the cell components, for testing i was using serial input.
Code:
//Remote Vehicle Ignition
//State Machine begin

// system states
#define STOPPED   0
#define STARTING  1
#define CRANKING  2
#define RUNNING   3

#define FUEL_PUMP_PRIME_TIME  5000
#define RUNNING_TIMEOUT 60000UL

const int ignitionPin = 12;
const int onPin = 11;
const int ledPin = 13;
const int onledPin = 9;
const int alternatorPin = 4;

int state = STOPPED;        // master variable for the state machine
unsigned long StartingTime; // fuel pump priming
unsigned long RunningTime;  // ten minute timeout

void setup()
{
pinMode(onPin, OUTPUT);
pinMode(onledPin, OUTPUT);
pinMode(ignitionPin, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(alternatorPin,INPUT);
Stop(); //
Serial.begin(9600);
}

void loop()
{
switch(state)
  {
  case STOPPED:
    HandleStoppedState();
    break;
  case STARTING:
    HandleStartingState();
    break;
  case CRANKING: //
    HandleCrankingState();
   break;  
  case RUNNING:
    if(millis()-RunningTime > RUNNING_TIMEOUT)
      {
      Serial.println("Running Timeout");  
      Stop();  
      }
    break;  
  default:
    Serial.print("Unknown State: ");
    Serial.println(state);
    Stop(); // Should never get here
    break;  
  }
}

void Stop()
{
Serial.println("TimeOut");  
digitalWrite(ignitionPin,LOW);
digitalWrite(onPin,LOW);
digitalWrite(onledPin,LOW);
state=STOPPED;
}

void HandleStartingState()
{
if(millis()-StartingTime > FUEL_PUMP_PRIME_TIME)
  {
  if(digitalRead(alternatorPin)==HIGH)
    {
    Serial.println("Abort cranking");  
    Stop();
    }
  else
    {  
    Serial.println("Starting Vehicle");  
    digitalWrite(onPin,HIGH);
    digitalWrite(ignitionPin,HIGH);
    state=CRANKING;
    }  
  }
}

void HandleStoppedState()
{
if (Serial.available() > 0)
  {
  Serial.read();
  Serial.println("Priming Fuel Pump");  
  StartingTime=millis();
  digitalWrite(ignitionPin,LOW);
  digitalWrite(onPin,HIGH);
  state=STARTING;
  }      
}

void HandleCrankingState()
{
if(digitalRead(alternatorPin)==HIGH)
  {    
  Serial.println("Vehicle Running");  
  digitalWrite(ignitionPin,LOW);
  digitalWrite(onPin,HIGH);
  digitalWrite(onledPin,HIGH);
  RunningTime=millis();
  state=RUNNING;
  }
}

Basically, i need the HandleStoppedState to be initiated upon recieving '#s1'
13  Using Arduino / Networking, Protocols, and Devices / Re: Anyone got a SM5100B Sparkfun shield working? on: June 05, 2012, 09:35:49 am
Hmm.
Contact sparkfun, i've heard people have had replacements.
I've just ordered mine, i'll let you know if i have any trouble with it.
14  Using Arduino / General Electronics / Re: Arduino vehicle power supply on: June 03, 2012, 03:19:55 pm
Hmm.
I would've like to do that, as i'm having alot of fun learning eagle, but i've already sent off the board design to be made.
And i guess, i have a hard time finding which diodes, caps and regulators to use as i'm quite the noob.
i.e, when i find a design for power supply, i try and find all the components, and one online store will have one, but not the other and vice/versa.

Thanks for the help winner smiley

regards.
15  Using Arduino / Networking, Protocols, and Devices / GSM shield sleep mode. on: June 03, 2012, 03:14:43 pm
Hi all.

I doubt this is possible at all, but it isn't possible to have a GSM shield 'sleeping' & then waking upon receiving a text message, And then send the command in the text to the arduino?

Only because i plan to have the GSM shield in a vehicle and i'm worried about the power consumption.
This specs on this model say that the average consumption is around ~500mA (with 2A bursts when TX/RX)

Also, between the sparkfun GSM shield: http://www.sparkfun.com/products/9607
And this one from eBay: http://www.anbere.com/10509N/SIM900/Schematic.pdf
Which would you recommend?
I also cannot understand from the datasheets of both shields, as to which pins it uses, only because my project uses pins 13,12,11 and 4 (i can change this of course, but i want to know what pins are free for me to use)

And in regards to the power, i'm going to be using a 12v DC-DC converter to power the GSM shield, and the arduino, and i also have another shield that i've designed to go on top with all the transistors and relays for my project.
The question is, with the sim900 shield, it wants 9v and around 2A, so can i use a 12v to 9V converter and connect it to the VIN pin on the arduino? Will the arduino accept 9V through VIN?


Regards.
Pages: [1] 2 3 4