Hey people, this time I have problem with this scenario:
I'm making an location tracker for my brother's motorbike, surely you know how wanted stuff those can be.
Idea is simple; when module is called on, it sends location data (google map would be awesome, but that should be done easily after getting raw data) via text message to number that is pre-set on code (so it doesn't send message to whoever calls it, only number that has been set on.
Trouble currecntly is that location data is also asked from SIM800 with AT commands, so that must be asked BEFORE entering SMS-state (all data that is written after switching to sms is sent in that message)
I thinked that solution would be that location data is first asked->save data (as string) to array->send that location data via SMS.
currently working code that I can use to send normal , simple data like millis, temperature, you get the idea:
I think that issuea is that I understand string bit wrong...
C:
#include <SoftwareSerial.h>
SoftwareSerial SIM800(10, 11); // RX, TX
String a;
String b;
void setup()
{
Serial.begin(9600); //harware serial, debugging purposes
SIM800.begin(9600); //SIM800 module, for sending AT-commands
SIM800.print("ATE0\r\n"); //echo off
}
void loop()
{
a = SIM800.readString(); //data from SIM800
if (a == "\r\nRING\r\n")
{
SIM800.print("AT+CMGF=1\r\n"); // Set the shield to SMS mode
SIM800.print("AT+CMGS=\"**********\"\r\n");
delay(200);
SIM800.print(millis()); //here is what data is to be sent
//SIM800.print((String)
SIM800.print("\r\n");
delay(500);
SIM800.print((char)26);//the ASCII code of the ctrl+z is 26 (required according to the datasheet)
delay(100);
SIM800.print("\r\n");
}
}
Nigel, SIM800 can give coordinates as location data, here's procedure for it:
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","your apn here"
AT+SAPBR=1,1
AT+CIPGSMLOC=1,1 (this command gives location codes, response is string of text containing lon-lat as well as date stamp. True GPS would be better of course since it would give speed also. I do have external GPS module, well actually shield)
That thing you linked looks neat, thanks for it.
The reason I decided to use SIM800 over pre-made models is that SIM800 can be programmed to do anything with arduino, so learning it's use would be benefitical for many automation applications, if there is no WLAN available (yes, esp8266 is on-learn list also.....)
Nigel, SIM800 can give coordinates as location data, here's procedure for it:
AT+SAPBR=3,1,"CONTYPE","GPRS"
AT+SAPBR=3,1,"APN","your apn here"
AT+SAPBR=1,1
AT+CIPGSMLOC=1,1 (this command gives location codes, response is string of text containing lon-lat as well as date stamp. True GPS would be better of course since it would give speed also. I do have external GPS module, well actually shield)
Presumably you are aware that the 'location' data using that method is EXTREMELY inaccurate?, and bears no resemblance to where you might be. I don't see much use in a 'tracker' that gives location data that could be kilometres away
That thing you linked looks neat, thanks for it.
The reason I decided to use SIM800 over pre-made models is that SIM800 can be programmed to do anything with arduino, so learning it's use would be benefitical for many automation applications, if there is no WLAN available (yes, esp8266 is on-learn list also.....)
What? Well that makes sense then why location is indeed quite a lot off, didn't know that.....bugger! Sometimes It's pinpoint accurate (luck probadly) and sometimes about hundred meters but I thought It's because I test it indoors.
I'll try to play with external GPS module, thanks for info.
I did make some progress, althought this progress is in "vain" now that you mentioned inaccurateness (<-is that even word?) of GPRS location method (no location data, but live data still directly from SIM800, signal quality):
C:
#include <SoftwareSerial.h>
SoftwareSerial SIM800(10, 11); // RX, TX
String a;
String b;
void setup()
{
Serial.begin(9600); //harware serial
SIM800.begin(9600); //bluetooth module, for sending AT-commands
SIM800.print("ATZ\r\n");
SIM800.print("ATE0\r\n");
}
void loop()
{
if (SIM800.available())
{
a = SIM800.readString(); //data from bluetooth
SIM800.print("AT+CSQ\r\n");
if (a.indexOf("+CSQ") > 0)
{
b = SIM800.readString();
}
if (a == "\r\nRING\r\n")
{
SIM800.print("AT+CMGF=1\r"); // Set the shield to SMS mode
SIM800.print("AT+CMGS=\"*\"\r\n");
delay(200);
SIM800.print(b); //kunhan jotain dataa
SIM800.print("\r\n");
delay(500);
SIM800.print((char)26);//the ASCII code of the ctrl+z is 26 (required according to the datasheet)
delay(100);
SIM800.print("\r\n");
}
}
}
Nigel, I'm quite sure issue was begin with that I confused this SIM800 module with SIM808 that does have GPS built-in: https://www.adafruit.com/products/2637
What? Well that makes sense then why location is indeed quite a lot off, didn't know that.....bugger! Sometimes It's pinpoint accurate (luck probadly) and sometimes about hundred meters but I thought It's because I test it indoors.
I'll try to play with external GPS module, thanks for info.
I did make some progress, althought this progress is in "vain" now that you mentioned inaccurateness (<-is that even word?) of GPRS location method (no location data, but live data still directly from SIM800, signal quality):
As there's no way it can know your location, it's just a 'wild guess' based on signal stength and triangulation (where you can receive 3 or more cell towers).
If you can only receive one (common round here), the best it can do is tell you the location of the cell tower.
Nigel, I'm quite sure issue was begin with that I confused this SIM800 module with SIM808 that does have GPS built-in: https://www.adafruit.com/products/2637
I've just ordered one of the trackers from Bangood, just to have a play with - I've been 'dithering' about oredring one for the last week or two
If you look on the Bangood website, and enter GSM in the search box, there are a good number of different options, including many non-GPS 'trackers' - which get absolutely destroyed in the customer comments section (and most have labels on saying GPS as well!).
Some cheap phones use the towers but it's useless and too slow GPS is only way to go I have a tablet that uses towers to tell where it is its been off 100 miles or more if you don't just set it in one place and leave it my s7 could hit a Nats butt but even GPS needs fast cpu to be dead on.
That's if the bike is moving.
I don't really see the relevance? - if the bike is moving it doesn't matter how fast the CPU is, by the time the GSM has been received the bike is no where near there anyway
OK pounder this then I'm driving 35 miles and hour my GPS with a 8 core cpu can tell me where I'm at at any point in time.
But the slower one can't keep up with where you are at and they both have same GPS module in them
I'm sure faster is better we use GPS tracking in are work vans the older slower hardware from same maker same module just slower cpu places the vans at the wrong place but the faster newer ones you see the van move in real time
OK pounder this then I'm driving 35 miles and hour my GPS with a 8 core cpu can tell me where I'm at at any point in time.
But the slower one can't keep up with where you are at and they both have same GPS module in them
I'm sure faster is better we use GPS tracking in are work vans the older slower hardware from same maker same module just slower cpu places the vans at the wrong place but the faster newer ones you see the van move in real time
Nigel, I'm quite sure issue was begin with that I confused this SIM800 module with SIM808 that does have GPS built-in: https://www.adafruit.com/products/2637
The data is sent on G3 network the older ones used G2 and can't send fast enough to track you in real time. It would be a simple matter to use a newer cheap cell phone that's on LTE light It has everything you need to track a car or bike and you can get a good fast one for less then $40 some times less then $20 at most
The data is sent on G3 network the older ones used G2 and can't send fast enough to track you in real time. It would be a simple matter to use a newer cheap cell phone that's on LTE light It has everything you need to track a car or bike and you can get a good fast one for less then $40 some times less then $20 at most
Currently lon/lat would be enough, last time I chekced location was off about 100m, adafruits GPS shield even more, several tens kilometers, which is odd.
Real-time would be great, say 5 minutes or 10 minutes update rate, maybe activated if bike is started before pressing button or some other automated process
Currently lon/lat would be enough, last time I chekced location was off about 100m, adafruits GPS shield even more, several tens kilometers, which is odd.
Real-time would be great, say 5 minutes or 10 minutes update rate, maybe activated if bike is started before pressing button or some other automated process
According to the research I did earlier, 100m is classed as very accurate for non-GPS GSM tracking, did you try it over a wide range of locations?.
'Real time' wouldn't be 5/10 minutes, but continuous - and of course for SMS 5/10 minute updates you need to ensure the card has enough credit on it.
You also need to be aware that SIM cards are deleted if they don't connect occasionally, so you need to arrange for the GSM modem to 'wake up' and connect to the network every now and again. In my previous project the time was adjustable, by sending a text message to the modem during it's initialisation period - as I recall once a month is probably plenty (I also took the opportunity to send the battery voltage as well, plus how many texts had been sent it total).
You also need to be aware that SIM cards are deleted if they don't connect occasionally, so you need to arrange for the GSM modem to 'wake up' and connect to the network every now and again
Never knew that either. As for credit issue, it's monthly fee of 3.3€/month+usage. I'll see if I can source proper GPS's somewhere, to counter accuracy....thanks for those links Nigel!