Author Topic: Real time tracking update with GPS-Trace Orange  (Read 8976 times)

Offline DSS Circuits

  • Administrator
  • Sr. Member
  • *****
  • Posts: 366
Real time tracking update with GPS-Trace Orange
« on: April 12, 2013, 12:38:11 PM »
I wanted to give everyone a quick update on the status of my venture into making the Geogram ONE capable of providing real time updates to a server.  I decided to go with GPS Trace-Orange because they offer a free service and there's no need to install the software on your own hosted server.

The initial release will only support UDP but I hope to offer TCP down the road.  There's one last bug I need to figure out and that's an easy way to print leading zeros for longitude and latitude so the server can recognize the datagrams.  I'll also post some preliminary code soon for those of you that want to play around with it.

Offline Brescia

  • Newbie
  • *
  • Posts: 7
Re: Real time tracking update with GPS-Trace Orange
« Reply #1 on: May 06, 2013, 10:50:36 PM »
Excellent, looking forward to it.

Offline DSS Circuits

  • Administrator
  • Sr. Member
  • *****
  • Posts: 366
Re: Real time tracking update with GPS-Trace Orange
« Reply #2 on: May 07, 2013, 12:46:29 PM »
I hope to post it within the next couple of weeks.  I just need to integrate the settings for host and port in the EEPROM.  Other than that it works very well, I can do realtime updates in 3 second intervals ... haven't tried dropping down to 2 seconds yet though.

Offline rmartins

  • Newbie
  • *
  • Posts: 21
Re: Real time tracking update with GPS-Trace Orange
« Reply #3 on: May 11, 2013, 06:30:29 PM »
Hi Mr. Wayne, did make some progress with the real time tracking ?
I still using post mothod, but some times (I think that when the GSM signal is losted) the GEO crashes and also after a time it's loose completly the GSM and don't works again until reset it!
I have to work in the code to try prevent it!

BR,
Rodrigo.

Offline DSS Circuits

  • Administrator
  • Sr. Member
  • *****
  • Posts: 366
Re: Real time tracking update with GPS-Trace Orange
« Reply #4 on: May 11, 2013, 08:22:32 PM »
Hi Mr. Wayne, did make some progress with the real time tracking ?
I still using post mothod, but some times (I think that when the GSM signal is losted) the GEO crashes and also after a time it's loose completly the GSM and don't works again until reset it!
I have to work in the code to try prevent it!

BR,
Rodrigo.
Actually my initial tests show it's working very well.  It's stable at 2 second updates via UDP to the server (1 second updates not so much though) and recovers very well after a signal loss in no cell areas.  I'm working on getting the beta code posted soon.  The problem is I went through a major rewrite of the code to free up more space and incorporate the UDP support and I haven't tested the rest of the functinality yet.

Offline gregable

  • Newbie
  • *
  • Posts: 15
Re: Real time tracking update with GPS-Trace Orange
« Reply #5 on: May 27, 2013, 05:03:35 PM »
It would be awesome to take a look at your code, even if it's not all that polished yet or may be buggy.  For instance, I'd like to simply see the example code around how to make UDP calls with the SIM900 chip. 

Offline DSS Circuits

  • Administrator
  • Sr. Member
  • *****
  • Posts: 366
Re: Real time tracking update with GPS-Trace Orange
« Reply #6 on: May 28, 2013, 11:34:46 AM »
It would be awesome to take a look at your code, even if it's not all that polished yet or may be buggy.  For instance, I'd like to simply see the example code around how to make UDP calls with the SIM900 chip.
I haven't posted a full update because as I've been going through, I've been doing some major rewrites on all the libraries to make things more efficient and free up space.  But in the meantime here is the code for a UDP call for your perusal. 
Code: [Select]
void udpOrange()
{
if(!lastValid.signalLock)
return;
if(gprsInterval > 5)
sim900.gsmSleepMode(0);
GSM.println("AT+CGATT?");
if(sim900.confirmAtCommand(": 1",3000))
return;
GSM.println("AT+CIPSEND");
if(!sim900.confirmAtCommand(">",3000))
{
printEEPROM(IMEI);
printEEPROM(GPRS_HEADER);
GSM.print(lastValid.date);
// GSM.print("NA");
GSM.print(";");
GSM.print(lastValid.time);
// GSM.print("NA");
GSM.print(";");
GSM.print(lastValid.latitude);
GSM.print(";");
GSM.print(lastValid.ns);
GSM.print(";");
GSM.print(lastValid.longitude);
GSM.print(";");
GSM.print(lastValid.ew);
GSM.print(";");
GSM.print(lastValid.speed * KNOTSTOKPH);
GSM.print(";");
GSM.print(lastValid.course);
GSM.print(";");
GSM.print(lastValid.altitude);
GSM.print(";");
// GSM.println(lastValid.satellitesUsed);
GSM.println("NA");
GSM.println(0x1A,BYTE);
sim900.confirmAtCommand("\r\n",3000);
if(!sim900.confirmAtCommand(gprsReply,3000))
{
udp = 0;
if(gprsInterval > 5)
sim900.gsmSleepMode(2);
return;
}
}
GSM.println("AT+CIPSTATUS");
if(!sim900.confirmAtCommand("P DEACT",3000))
{
GSM.println("AT+CIPSHUT");
sim900.confirmAtCommand("OK",3000);
GSM.print("AT+CSTT=\"");
printEEPROM(GPRS_APN);
GSM.println("\"");
sim900.confirmAtCommand("OK",3000);
GSM.println("AT+CIICR");
sim900.confirmAtCommand("OK",5000);
delay(100);
GSM.println("AT+CIFSR");
sim900.confirmAtCommand("OK",2000);
return;
}
udp = 1;
for(uint8_t g = 0; g < 11; g++)
{
gprsReply[g] = EEPROM.read(GPRS_REPLY + g);
}
GSM.print("AT+CIPSTART=\"UDP\",\"");
printEEPROM(GPRS_HOST);
GSM.print("\",\"");
uint16_t portNumber = 0;
EEPROM_readAnything(GPRS_PORT,portNumber);
GSM.print(portNumber,DEC);
GSM.println("\"");
sim900.confirmAtCommand("T OK",2000);
sim900.gsmSleepMode(2);
}


Offline DSS Circuits

  • Administrator
  • Sr. Member
  • *****
  • Posts: 366
Re: Real time tracking update with GPS-Trace Orange
« Reply #7 on: June 04, 2013, 11:09:21 PM »
Disregard the last code snippet as I ran across a situation where it would not recover.  I've finally posted the beta code to Github that incorporates a lot of changes and provides UDP support to GPS Trace Orange real time tracking website.  For those of you wanting to beta test the code, please let me know if you have any problems.

There were a couple of major changes to the code as well:
1. Support for sending and receiving emails has been removed.  All communication needs to be done via SMS.  THe email aspect was confusing a lot of people and is not supported by a majority of SIM card providers. 

2.The EEPROM map has changed considerably so simply uploading the main firmware will not work.  There are two new sketches available in the directory when you go to open the main sketch.  One is labeled as GO_V1_1_EEPROM_Program and the other is GO_V1_1_EEPROM_Read.  The program sketch will write the new EEPROM map to the GO (and will show a verification after each write sequence) and the other sketch will simply read out the EEPROM contents.  As a side note, you can make any changes/additions to the sketch prior to uploading the EEPROM contents (ie pincode, default sms address, imei, etc...).  It's important to note that you need to program the IMEI number into EEPROM (it's on the sticker of the GSM chip on the main board) before being able to use it with GPS Trace Orange.  You'll also need to know the APN for your SIM provider to send data. 

The steup is capable of sending UDP updates down to 1 second intervals to the server, however I've noticed on occasion, the server may not respond every second so you'll see delays here and there (few seconds). To program the send interval, it's similar the SMS send interval of command 4.  In this case it is now command 8 for a UDP interval.  (ie to send every 5 seconds    1234.8.5.   to stop sending   1234.8.0. ) 

When signing up for a GPS Trace Orange account (it's free and there's a basic mobile app as well), during the setup choose the Wialon IPS as the device type. 

Upgrade Procedure:
1. Load sketch for writing EEPROM (make any necessary changes to parameters before uploading)
2. Upload sketch using FTDI cable (remember to remove the jumpers)
3. Open Serial Monitor and set Baud Rate to 9600
4. Wait a few seconds and press any key then Enter
5. You should see the dialog along with all the values written on the screen.
6. Next open Geogram sketch and upload as normal.
7. When finished remove cable, reset power to Geogram ONE.

That's it.

I'll be putting together some more detailed instructions later and remember this is a beta so if you find any bugs please report them to me so I can get them fixed.

One more thing, if you plan on making changes to any of the settings in EEPROM that have to do with worded messages (ie HTTP1, SPEEDMSG, FENCEMESSAGE, IMEI, etc) or anythng that has to do with IP addresses or usernames and passwords, you will need to end the SMS message with two consecutive periods.  If you are unsure which parameters require the consecutive periods you can always end the commands with two periods and it will work regardless.

Example:

1234.6.0.5555..    //change passcode to 5555
« Last Edit: June 07, 2013, 12:05:05 PM by DSS Circuits »

Offline Hugh

  • Newbie
  • *
  • Posts: 26
Re: Real time tracking update with GPS-Trace Orange
« Reply #8 on: June 05, 2013, 05:15:34 AM »
I've just uploaded the latest ROMs and gone for a quick test and WOW!

I'll continue to have a play but it seems really stable and only dropped a few points, probably due to network rather than the code.

Many thanks for this, it's moved the device to a whole new level!

Offline DSS Circuits

  • Administrator
  • Sr. Member
  • *****
  • Posts: 366
Re: Real time tracking update with GPS-Trace Orange
« Reply #9 on: June 05, 2013, 12:59:19 PM »
Glad to hear it!!!
I have discovered a couple of minor bugs with interfacing with GPS Trace Orange, mainly if you program in a timezone offset other than 0 (UTC) the update time on the server gets messed up.  However, leaving it at zero on the GO and adjusting it on Orange will result in the correct time.

Offline Hugh

  • Newbie
  • *
  • Posts: 26
Re: Real time tracking update with GPS-Trace Orange
« Reply #10 on: June 05, 2013, 01:21:29 PM »
The only suggestion this far is related to battery.  I use it in my car and I want it to stay on for 5 minutes after I get out, but that 5 minutes of sending data every 2-5 seconds drains the battery very quickly.

Can there be a way to restrict sending data if there hasn't been any movement of the GO?

Offline rmartins

  • Newbie
  • *
  • Posts: 21
Re: Real time tracking update with GPS-Trace Orange
« Reply #11 on: June 05, 2013, 02:38:54 PM »
Hi Mr. Wayne,

As I go to home, I'll try this ! I just get registered on GPS Trace-Orange website, and I'm looking to the Geogram-One at Device type to add the GEO, but I can't find...
How can I proceed in this case ?
Follow the picture attached!

Thanks!

Offline Hugh

  • Newbie
  • *
  • Posts: 26
Re: Real time tracking update with GPS-Trace Orange
« Reply #12 on: June 05, 2013, 02:44:09 PM »
When signing up for a GPS Trace Orange account (it's free and there's a basic mobile app as well), during the setup choose the Wialon IPS as the device type. 

Use the Wialon IPS and it works a treat!

Offline rmartins

  • Newbie
  • *
  • Posts: 21
Re: Real time tracking update with GPS-Trace Orange
« Reply #13 on: June 05, 2013, 03:19:04 PM »
When signing up for a GPS Trace Orange account (it's free and there's a basic mobile app as well), during the setup choose the Wialon IPS as the device type. 

Use the Wialon IPS and it works a treat!

Thanks Hugh! I just missed up this on the Wayne post!
Thanks!

Offline DSS Circuits

  • Administrator
  • Sr. Member
  • *****
  • Posts: 366
Re: Real time tracking update with GPS-Trace Orange
« Reply #14 on: June 05, 2013, 09:33:12 PM »
Quote
Can there be a way to restrict sending data if there hasn't been any movement of the GO?
Yes.  This should be pretty easy to implement.  COmpletely untested but should work:

in the setup() section add this to the end.
Code: [Select]
BMA250enableInterrupts();
and in the first line of the void udpOrange function on the UDP_Orange.pde tab add this to the first line:
Code: [Select]
if(!move)
  return;
move = 0;

It will only send data when motion has been detected.