GPS CAR TRACKER WITH FUEL CUT OFF

Dear All

Please help. I am not so expert in programming. just a beginner.

I need a sketch for making a gps car tracker having following features

  1. SMS COMMAND for fuel cut off
  2. SMS COMMAND for getting location with reply SMS with google map link
  3. Live tracking on Google maps, weblink

I have following hardware

  1. Arduino UNO
  2. 4 RELAY MODULE for UNO
  3. SIM 808 Module

is that possible?

what should be the complete code?

I would appreciate your help

The code would look a lot like a combination of:
The SIM808 library example for getting a GPS location.
The SIM808 library example for sending and receiving SMS messages.

Have you had success running library examples? That would be the place to start.

Thanks indeed. But I need a code for relay cut off also. Ok in more simpler words. I need a code .... just one code for one arduino for

Gsm module
Gps module
Relay module

For using as car gps tracker and remote cut off

Would this be better in the gigs section?

prince2510:
Thanks indeed. But I need a code for relay cut off also. Ok in more simpler words. I need a code .... just one code for one arduino for

Gsm module
Gps module
Relay module

For using as car gps tracker and remote cut off

If you are looking for someone to develop the code for you, you should ask in the Gigs and Collaborations forum as TheMemberFormallyKnownAsAWOL suggested. That's where the folks that do it for you hang out.

The folks that hang out in this forum will help you with code YOU are working on. But not do it for you. johnwasser gave you a good place to start if you are up for the challenge.

Thanks folks

Ah. yes I am up for accepting challenge.

Only those fell from horse back who have the dare to ride a horse.

No matter if I fail to make a code, but i will definitely try.

Thanks . shall get back to you soon

Make sure you dont 'test' it on a vehicle thats using the public highway ...............

Can you imagine any automobile insurer approving a device that might deliberately (or accidentally) cut off the fuel in a car travelling at 60mph in the centre lane of a motorway?

I can't.

IMHO this project is a non-starter.

...R

Robin2:
Can you imagine any automobile insurer approving a device that might deliberately (or accidentally) cut off the fuel in a car travelling at 60mph in the centre lane of a motorway?

I can't.

IMHO this project is a non-starter.

...R

I have a Kia Soul : 5 days after buying it I was traveling in the OUTSIDE lane of a motorway, doing about 70mph, when the engine cut out !! I managed to make it to the hard-shoulder coasting, and then called the breakdown company. I had not ran out of fuel, the guage was lowish, but no fuel warning lights were on. We transported the car to the nearest service station, put more fuel in, and she started ok. I drove home with the breakdown truck following (just in case), and I booked it in to be seen to.

They diagnosed and replaced the fuel pump, and unbelievably I was told it has a sensor in it that shuts itself off if it believes you have run out of fuel ! They said it was "to protect the fuel pump from damage" ..

Utter madness - what about protecting the driver of the vehicle, and sod the fuel pump !!

daba:
They diagnosed and replaced the fuel pump, and unbelievably I was told it has a sensor in it that shuts itself off if it believes you have run out of fuel ! They said it was "to protect the fuel pump from damage" ..

On the other hand if the sensor had correctly detected that the fuel tank was empty the engine would have stopped with or without the sensor.

But, yes, sensors that are supposed to help just add another source of failure.

...R

#include <TinyGPS.h>
#include <SoftwareSerial.h>
#include <Sim800L.h>
SoftwareSerial Sim800L(7, 8);
int state =0;
const int pin = 9;
float gpslat, gpslon;
TinyGPS gps;
SoftwareSerial sgps(4, 5);

// Variable to store text message
String textMessage;

// Create a variable to store Lamp state
String Engine = “HIGH”;

// Relay connected to pin 12
const int relay = 12;

void setup() {
// Automatically turn on the shield
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);

// Set relay as OUTPUT
pinMode(relay, OUTPUT);

// By default the relay is off
digitalWrite(relay, HIGH);

// Initializing serial communication
Serial.begin(9600);
Sim800L.begin(9600);
sgps.begin(9600);

}

void loop()
{
while (sgps.available())
{
int c = sgps.read();
if (gps.encode(c))
{
gps.f_get_position(&gpslat, &gpslon);
}
}
if (digitalRead(pin) == HIGH && state == 0) {
Sim800L.print("\r");
delay(1000);
Sim800L.print(“AT+CMGF=1\r”);
delay(1000);
/Replace XXXXXXXXXX to 10 digit mobile number &
ZZ to 2 digit country code
/
Sim800L.print(“AT+CMGS=”+xxxxxxxxxxxxxx"\r");
delay(1000);
//The text of the message to be sent.
Sim800L.print(“Latitude :”);
Sim800L.println(gpslat, 6);
Sim800L.print(“Longitude:”);
Sim800L.println(gpslon, 6);
delay(1000);
Sim800L.write(0x1A);
delay(1000);
state = 1;
}
if (digitalRead(pin) == LOW) {
state = 0;
}

// Give time to your GSM shield log on to network
delay(20000);
Serial.print(“SIM900 ready…”);

// AT command to set SIM900 to SMS mode
Sim800L.print(“AT+CMGF=1\r”);
delay(100);
// Set module to send SMS data to serial out upon receipt
Sim800L.print(“AT+CNMI=2,2,0,0,0\r”);
delay(100);

if(Sim800L.available()>0){
textMessage = Sim800L.readString();
Serial.print(textMessage);
delay(10);

if(textMessage.indexOf(“ON”)>=0){
// Turn on relay and save current state
digitalWrite(relay, LOW);
Engine = “on”;
Serial.println(“Relay set to ON”);
textMessage = “”;

if(textMessage.indexOf(“OFF”)>=0){
// Turn off relay and save current state
digitalWrite(relay, HIGH);
Engine = “off”;
Serial.println(“Relay set to OFF”);
textMessage = “”;

if(textMessage.indexOf(“STATE”)>=0){
String message = "Engine is " + Engine;
sendSMS(message);
Serial.println(“Engine state request”);
textMessage = “”;
}
}

}

// Function that sends SMS
void sendSMS(String message){
// AT command to set SIM900 to SMS mode
Sim800L.print(“AT+CMGF=1\r”);
delay(100);
Sim800L.println(“AT + CMGS = “xxxxxxxxxxxxxxxxxx””);
delay(100);
// Send the SMS
Sim800L.println(message);
delay(100);

// End AT command with a ^Z, ASCII code 26
Sim800L.println((char)26);
delay(100);
Sim800L.println();
// Give module time to send SMS
delay(5000);
}
}

You have defined your sendSMS function inside of the loop function.

A very helpful troubleshooting tool is the Auto Format feature (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor). If you do an Auto Format and then compare the resulting indentation to your intended program structure, it will quickly point you to where there is a missing or extra brace.

Another useful feature of the Arduino IDE/Arduino Web Editor is that when you place the cursor next to one bracket, it puts a box around the matching bracket. In the Arduino IDE, if the cursor is next to the closing bracket and the opening bracket is off the screen then it will show the opening bracket line in a tool tip after a short delay.

Please use code tags when you post code or warning/error messages. To do this, click the </> button on the forum toolbar, then paste the text you want to be in the code tags. Finally, move the cursor out of the code tags before adding any additional text you don’t want to be in the code tags. If your browser doesn’t show the posting toolbar, then you can manually add the code tags like this:
[code]``[color=blue]// your code is here[/color]``[/code]

The reason for doing this is that, without code tags, the forum software can interpret parts of your code as markup, leading to confusion, wasted time, and a reduced chance for you to get help with your problem. This will also make it easier for us to read your code and to copy it to the IDE or editor.

Using code tags and other important information is explained in the “How to use this forum” post. Please read it.

I know nothing about sending and receiving SMSes other than typing one in on my mobile and reading those that come in.

But am I right in thinking that this system allows you to send a message to an Arduino in your car, which message will then turn off the engine? Seems to check if the incoming message contains “OFF”, then turns off the engine. If so, unless you can guarantee the vehicle is stationary, that’s crazy.

you are cross posting

you abandoned your thread

https://forum.arduino.cc/index.php?topic=648623.0;topicseen

@prince2510

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Please READ THIS POST to help you get the best out of the forum.

Bob.

sayHovis:
unless you can guarantee the vehicle is stationary, that's crazy.

Let me re-phrase: unless you can guarantee the vehicle is safely stationary, that's crazy.

(Being stationary in a level-crossing, for example, would be unwise.)

@prince2510

TOPIC MERGED.
if you continue to abuse the forum you will suffer a BAN !

Bob.

Ok. I stand corrected.

What I mean from Engine off is actually ACC off. Any suggestion now for relay triggering?