Chinese gps tracker

http://automagucally.weebly.com

Moderators: davka003, Telldus

Post Reply
KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

I'm currently waiting for a cheap gps tracker from China ordered on eBay. Are thinking of connecting it into automagically during autumn. First function I plan to implement is geofence. Since these devices are dirt cheap, I plan to have them in cars, boat and mc.
Any interrest in the forum?
Marcus

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

So, my tracker arrived and the plugin is written (and attached).

There is a jungle on these Chinese trackers. They all look the same, but have different implementations.
The one I got uses an ASCII based protocol;
The hearbeat looks like this:

Code: Select all

(027043469204BP00000027043469204HSO)
(027043469204AP01HSO)
The position update looks like this:

Code: Select all

(027043469204BR00150630A5612.8060N01533.5777E000.5053425172.4800000000L00000000)
The tracker I ordered does not have the best GSM receiver, but it works and now connects to Automagically over GPRS.
The one I bought was this one: http://www.ebay.com/itm/121438088073
They first sent me the wrong item, but it finally arrived. It works as expected, with the quality matching its price :D

The plugin allows you to define a GeoFence position and will report distance from that position and if you are within 2km of the position or not.
When the tracker sends data, the plugin will publish on the bus. It can look like this:

Code: Select all

gps_tracker,data;status:OK;IMEI:027043469204;latitude:56.213433;longitude:15.559628;distance:376.959732774;geofence:OUTSIDE;speed:000.5;date:150630;time:053425;
Now it's just to hook it up to an e-mail sender and do the magic you normally do with Automagically.

Next version I consider to add code to remember where you where in relation to the GeoFence and send a signal "ENTER FENCE" and "LEAVE FENCE". I will also think how to add multple GeoFence positions and multiple devices.

Today you can connect up to 5 trackers; but they all use the same GeoFence.

Enjoy,
/Marcus
Attachments
gps_tracker_0.1.zip
(3.12 KiB) Downloaded 268 times

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

KHolm wrote: Now it's just to hook it up to an e-mail sender and do the magic you normally do with Automagically.
Next version I consider to add code to remember where you where in relation to the GeoFence and send a signal "ENTER FENCE" and "LEAVE FENCE".
Attached is version 0.2 which signals when it enters and leaves a geo fence. I also added a range setting to declare how wide the geo fence shall be.

When leaving the fence it signals:

Code: Select all

gps_tracker,data;fence:LEAVING;IMEI:027043469204;google:http://maps.google.com/?ie=UTF8&hq=&ll=59.327118,18.071359&z=15; 
When entering the fence it signals:

Code: Select all

gps_tracker,data;fence:ENTERING;IMEI:027043469204;google:http://maps.google.com/?ie=UTF8&hq=&ll=59.327118,18.071359&z=15; 
To get this into a mail I use the following signal transform:

Pattern to match: gps_tracker,data;fence:ENTERING;IMEI:%s;google:%s
Send the following...email::Leaving Geo Fence:IMEI $1 is leaving Geo Fence, try to locate it at $2

This will send you a mail which includes a URL to google maps to point where your device is.

For now I'll leave it like this. Next step is of course to support multiple devices; but then I need to go into the core of automagically, I think. That will be a later project for the autumn I guess.

Enjoy,
/Marcus
ps. I never got mail sending via smtp.google.com to work; using another smpt server. If anyone has succeeded, let be know your settings
Attachments
gps_tracker_0.2.zip
(4.02 KiB) Downloaded 215 times

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

KHolm wrote:Next step is of course to support multiple devices; but then I need to go into the core of automagically, I think.
Done, but a but tricker to install since I had to update automagically by adding another device type: GpsDevice
New in this version is a bit more stable TCP/IP implementation that survives changes in configurations.

Code: Select all

# Installation: Install new ~/source/automagically/site/core/admin.py and ~/source/automagically/site/core/models.py
#               sudo service apache2 stop
#               sudo service automagically stop
#               sudo rm ~/source/automagically/site/core/admin.pyc
#               sudo rm ~/source/automagically/site/core/models.pyc
#               cd ~/source/automagically/site
#               sudo python manage.py schemamigration core --auto
#               sudo python manage.py migrate core
#               sudo service apache2 start
#               sudo service automagically start
Add geo fences by adding GpsDevices. Leave IMEI blank to make it valid for all devices, or set IMEI to match what the client send to make it unique.

Next I might fork off Automagically since David seems to have abandoned it.

Have fun,
/Marcus
Attachments
gps_tracker_0.3.zip
(18.64 KiB) Downloaded 246 times

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

KHolm wrote:Next I might fork off Automagically since David seems to have abandoned it.
The fork is updated and a pull request has been submitted. Let's see if David is still alive.

Pull request: https://bitbucket.org/davka003/automagi ... aster/diff
The fork: https://bitbucket.org/MarcusKarlsson/automagically
Git: https://MarcusKarlsson@bitbucket.org/Ma ... ically.git

/Marcus

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

KHolm wrote: The fork is updated and a pull request has been submitted. Let's see if David is still alive.
Pull request: https://bitbucket.org/davka003/automagi ... aster/diff
The fork: https://bitbucket.org/MarcusKarlsson/automagically
Git: https://MarcusKarlsson@bitbucket.org/Ma ... ically.git
An update has been made, version 0.4 added and included in the above pull request.

The format has been updated slightly, note that geofence information has been removed from regular update:

Code: Select all

gps_tracker,data;status:OK;IMEI:027043469204;latitude:56.213433;longitude:15.559628;speed:000.5;date:150630;time:053425;
And, multiple geo fence signals can now be sent. Note tow types (direction and position).
Direction is when a device enters or leaves a Geo Fence. When the device is in steady position (outside or inside fence).

Code: Select all

gps_tracker,data;fence:TheBridge;IMEI:027043469204;direction:LEAVING;google:http://maps.google.com/maps/?q=loc:56.213433,15.588177&z=15; 	
gps_tracker,data;fence:TheGarage;IMEI:027043469204;position:OUTSIDE;google:http://maps.google.com/maps/?q=loc:56.213345,15.588177&z=15; 
/Marcus
Attachments
gps_tracker_0.4.zip
(18.67 KiB) Downloaded 223 times

cris77
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am
Location: Paris

Re: Chinese gps tracker

Post by cris77 » Thu Jan 18, 2018 11:08 am

Hello,
I think it's very iteresting what you done with the GPS-tracker and have some similar applications. I have ordered the same as you to play with.
Without programming knowledge and basic linux only I have a question as to install the plugin. Have tried to install using system update but no luck. Do I have to install plugin manually and if so how?
Thanks in advance


Edit: Sorry didn't read enough I managed to install ok.

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

cris77 wrote:I have ordered the same as you to play with.
How is your device? Mine has quite weak GSM signal and I'm planning to by another model to test with.

Also, I'd like to know if the one your ordered communicates using the same protocol. I.e. does it work with my plugin?
I've seen several variants of the protocol, but there seems to be two main variants.

BR, Marcus

cris77
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am
Location: Paris

Re: Chinese gps tracker

Post by cris77 » Thu Jan 18, 2018 11:08 am

Hello,
Finally I got some time to play with the tracker. Seems to be working ok using SMS. How do you judge GSM signal, mine responds quite quickly. Have you found a better one ?
However I can not get it to work using GPRS, don't see anything on the bus from the plugin. I have installed plugin ver. 0.4, enabled GPS-tracker and created a device. I probably missed something here and would like some help if possible.
My firmware version is:<VERSION>GT02A_30_7SPM_V72_D_LA <BRANCH>2011-5-21 GXQ23_08, is that the same as yours ? How do you see the version of protocol ?
I didn"t get a good manual with the unit do you have a full command-list
Thanks in advance
Cristian

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

cris77 wrote:Hello,
How do you judge GSM signal, mine responds quite quickly.
Nothing fancy, where I live my old SonyEricsson only has one bar - but the device will not attach at all. Does not respond to SMS or anything.
cris77 wrote: However I can not get it to work using GPRS, don't see anything on the bus from the plugin.
Have you set the APN and IP adress? APN you get from your service provider and IP would be the IP address you reach your Raspberry Pi from Internet. Make sure you have access and firewall is opened up. Do you have the SMS commands to set APN and Server?
cris77 wrote: I have installed plugin ver. 0.4, enabled GPS-tracker and created a device. I probably missed something here and would like some help if possible.
Make a simple test. Telnet to the external IP adress and send this text to it: (027043469204BP00000027043469204HSO)
You should get a response that says: (027043469204AP01HSO)

Enable signal trace and send: (027043469204BR00150630A5612.8060N01533.5777E000.5053425172.4800000000L00000000)

This should generate a signal in automagically.
cris77 wrote: My firmware version is:<VERSION>GT02A_30_7SPM_V72_D_LA <BRANCH>2011-5-21 GXQ23_08, is that the same as yours ? How do you see the version of protocol ?
I didn"t get a good manual with the unit do you have a full command-list
Thanks in advance
Cristian
I found a protocol on the internet. I can upload it here later. My manual was not at all good, it came on a CD-Rom.

When you know that the Pi is reachable from internet with the test above, I can help you start automagically from command line. If you also enable debug in the plugin, you will see quite detailed if someone tries to connect to it.

Don't have access to all information here and now, but I'll complement later.

/Marcus

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

KHolm wrote: I found a protocol on the internet. I can upload it here later. My manual was not at all good, it came on a CD-Rom.
Protocol is attached. Version of my device is the same as yours.

To set APN, SMS: APN,666666,YOUR_APN#

To set server, SMS: SERVER,666666,0,IP_OF_THE_PI,10000,0#

/Marcus
Attachments
GPS tracker Communication__ Protocol V1[1].51.zip
(222.77 KiB) Downloaded 311 times

cris77
Posts: 3
Joined: Thu Jan 18, 2018 11:08 am
Location: Paris

Re: Chinese gps tracker

Post by cris77 » Thu Jan 18, 2018 11:08 am

Hello,
Thank you very much for your help, it is working fine now. I get signal updates correctly. I messed up the port number, thats why it didn't work.
Thanks again,
Cristian

KHolm
Posts: 163
Joined: Thu Jan 18, 2018 11:08 am

Re: Chinese gps tracker

Post by KHolm » Thu Jan 18, 2018 11:08 am

cris77 wrote:Hello,
Thank you very much for your help, it is working fine now. I get signal updates correctly. I messed up the port number, thats why it didn't work.
Thanks again,
Cristian
Cool, what will be your use case?

Apart form the geo fence for the boat, I was planning to put a tracker in my car and when I enter the geofence - I'll turn on the porch light.

/Marcus

Post Reply