#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");
}
}
Trouble currecntly is that location data is also asked from SIM800 with AT commands
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.....)
#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");
}
}
}
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):
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
but even GPS needs fast cpu to be dead on.
That's if the bike is moving.
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
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
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!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
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?