Skip to content

Instantly share code, notes, and snippets.

@soshial
Last active October 12, 2025 15:45
Show Gist options
  • Select an option

  • Save soshial/d07919e0fac67f5501a38fe3c39be416 to your computer and use it in GitHub Desktop.

Select an option

Save soshial/d07919e0fac67f5501a38fe3c39be416 to your computer and use it in GitHub Desktop.

Revisions

  1. soshial revised this gist Apr 29, 2024. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -22,8 +22,8 @@ In this article I listed some common problems I encountered when I tried to use
    1. **OBD**. If you have a car manufactured before 2000s, it probably will not support the OBD specification. I've also seen many complaints that Freematics has numerous problems with electric vehicles. In my case, Freematics DIDN'T work with my Renault's OBD-II port. I tested to figure out the perpetrator: an expensive OBD-reader from another manufacturer could read my ODB data, and Freematics was able to read other car's data. But eventually I realized, that OBD data is not that really needed for my purposes of tracking vehicle's location and movement. The main advantage of Freematics is that tha hardware comes with fully libre software, that you may customize as you wish. Do not expect that Stanley Huang (the creator of Freematics) will help you with your problems - you're on your own.
    2. **External GNSS**. I didn't want to buy the GNSS receiver from Freematics store (costs $40 + $17 delivery; €33 + €13 delivery) - it is definitely overpriced, so I bought one from AliExpress for €10 (+ €1 delivery). Same functionality, but 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    3. **SIM module**. Choose SIM7600 module since it's the only one that supports 4G networks (along with 2g/3g). SIM7600E is for Europe and the whole world. SIM7600A if for US and Canada. On Freematics website SIM module costs $45 and you may buy an identical module for $35 on Aliexpress.
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: a flat fee of €0.012 per 1 MiB which is the same in all supported countries, very extensive list of countries (as of 2024): <img width="727" alt="MTX coverage in 2024" src="https://github.com/ilius/pyglossary/assets/100644/178946d7-4fdb-48d5-bcc0-16c259d8bff7">. Although there is one downside:
    > Also, please keep in mind that in our "Description of Services" says that you can' use our sim in same country more than 60 days continuously: "Permanent Roaming" means the use of Services within the same country for more than 60 (sixty) cumulative days within any 4 (four) consecutive months’ period;
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: a flat fee of €0.012 per 1 MiB which is the same in all supported countries, very extensive list of countries (as of 2024): <img width="727" alt="MTX coverage in 2024" src="https://github.com/ilius/pyglossary/assets/100644/178946d7-4fdb-48d5-bcc0-16c259d8bff7">. Although there is one [downside](https://faq.mtxc.eu/en-us/article/what-is-permanent-roaming-wlaxze/):
    > Also, please keep in mind that in our "Description of Services" says that you can' use our sim in same country more than 60 days continuously: "Permanent Roaming" means the use of Services within the same country for more than 60 (sixty) cumulative days within any 4 (four) consecutive months’ period


  2. soshial revised this gist Apr 29, 2024. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,9 @@ In this article I listed some common problems I encountered when I tried to use
    1. **OBD**. If you have a car manufactured before 2000s, it probably will not support the OBD specification. I've also seen many complaints that Freematics has numerous problems with electric vehicles. In my case, Freematics DIDN'T work with my Renault's OBD-II port. I tested to figure out the perpetrator: an expensive OBD-reader from another manufacturer could read my ODB data, and Freematics was able to read other car's data. But eventually I realized, that OBD data is not that really needed for my purposes of tracking vehicle's location and movement. The main advantage of Freematics is that tha hardware comes with fully libre software, that you may customize as you wish. Do not expect that Stanley Huang (the creator of Freematics) will help you with your problems - you're on your own.
    2. **External GNSS**. I didn't want to buy the GNSS receiver from Freematics store (costs $40 + $17 delivery; €33 + €13 delivery) - it is definitely overpriced, so I bought one from AliExpress for €10 (+ €1 delivery). Same functionality, but 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    3. **SIM module**. Choose SIM7600 module since it's the only one that supports 4G networks (along with 2g/3g). SIM7600E is for Europe and the whole world. SIM7600A if for US and Canada. On Freematics website SIM module costs $45 and you may buy an identical module for $35 on Aliexpress.
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: a flat fee of €0.012 per 1 MiB which is the same in all supported countries, very extensive list of countries (as of 2024): <img width="727" alt="MTX coverage in 2024" src="https://github.com/ilius/pyglossary/assets/100644/178946d7-4fdb-48d5-bcc0-16c259d8bff7">
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: a flat fee of €0.012 per 1 MiB which is the same in all supported countries, very extensive list of countries (as of 2024): <img width="727" alt="MTX coverage in 2024" src="https://github.com/ilius/pyglossary/assets/100644/178946d7-4fdb-48d5-bcc0-16c259d8bff7">. Although there is one downside:
    > Also, please keep in mind that in our "Description of Services" says that you can' use our sim in same country more than 60 days continuously: "Permanent Roaming" means the use of Services within the same country for more than 60 (sixty) cumulative days within any 4 (four) consecutive months’ period;


    ### Problems with Freematics I encountered and fixed:
  3. soshial revised this gist Feb 29, 2024. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,8 @@ In this article I listed some common problems I encountered when I tried to use
    1. **OBD**. If you have a car manufactured before 2000s, it probably will not support the OBD specification. I've also seen many complaints that Freematics has numerous problems with electric vehicles. In my case, Freematics DIDN'T work with my Renault's OBD-II port. I tested to figure out the perpetrator: an expensive OBD-reader from another manufacturer could read my ODB data, and Freematics was able to read other car's data. But eventually I realized, that OBD data is not that really needed for my purposes of tracking vehicle's location and movement. The main advantage of Freematics is that tha hardware comes with fully libre software, that you may customize as you wish. Do not expect that Stanley Huang (the creator of Freematics) will help you with your problems - you're on your own.
    2. **External GNSS**. I didn't want to buy the GNSS receiver from Freematics store (costs $40 + $17 delivery; €33 + €13 delivery) - it is definitely overpriced, so I bought one from AliExpress for €10 (+ €1 delivery). Same functionality, but 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    3. **SIM module**. Choose SIM7600 module since it's the only one that supports 4G networks (along with 2g/3g). SIM7600E is for Europe and the whole world. SIM7600A if for US and Canada. On Freematics website SIM module costs $45 and you may buy an identical module for $35 on Aliexpress.
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the flat fee of €0.01 per 1 MiB which is the in all supported countries, very extensive list of countries and free traffic for messengers (Telegram etc.)
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: a flat fee of €0.012 per 1 MiB which is the same in all supported countries, very extensive list of countries (as of 2024): <img width="727" alt="MTX coverage in 2024" src="https://github.com/ilius/pyglossary/assets/100644/178946d7-4fdb-48d5-bcc0-16c259d8bff7">


    ### Problems with Freematics I encountered and fixed:
    1. ✘ GPS, ✓ Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
  4. soshial revised this gist Jun 30, 2022. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ In this article I listed some common problems I encountered when I tried to use
    6. Doesn't send cell tower data (called MCC, MNC, LAC, CID, RSSI). **FIXED** [traccar](https://github.com/soshial/traccar/commit/ea9238cd727de74a96a45fbb573bd7cad58ef7d8) [Freematics](https://github.com/soshial/Freematics/commit/e6ca381ae7505b6156bbe6c4913dc791d2a74b0c)
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sometimes sends 2 streams of locations. **NOT FIXED**
    10. Freematics had had no support for sending ignition status (ON/OFF). **FIXED** [Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d). Sidenote, the default `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.0V.then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    10. Freematics had had no support for sending ignition status (ON/OFF). **FIXED** [Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d). Sidenote, I had to [lower the `JUMPSTART_VOLTAGE` threshold](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134-L135) from default 14.0V to as low as 13.0V, since my car OBD port provides lower voltage.
    11. Low battery alarm was not sent. [**FIXED**](https://github.com/soshial/Freematics/commit/ff6ca8ae4c584f92cc6a338c29667bbae5a8ebe8). Added `LOW_BATTERY_VOLTAGE` config parameter.
    12. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    13. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    @@ -48,4 +48,6 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9
    4. add settings needed for device networking: either WiFi or SIM (looks like simultanious usage is not possible)


    Please, send me a message or comment down below if I am wrong in some of my conclusions.
    We have a group chat in Telegram. If you'd like to join, write down a comment and I'll send you the invitation link.

    Please, send comment down below if I am wrong in some of my conclusions.
  5. soshial revised this gist Jan 9, 2022. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -29,14 +29,15 @@ In this article I listed some common problems I encountered when I tried to use
    2. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    3. Originally, Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). This format prevents data to be easily re-uploaded later (if device was offline). I fixed it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    4. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    5. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. [IMAGE](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png) **NOT FIXED**
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740). Doesn't send cell tower data (called MCC, MNC, LAC and CID). **NOT FIXED**
    5. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. **NOT FIXED** ![border problems 1](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png) ![border problems 2](https://user-images.githubusercontent.com/100644/148672297-4f436aa6-4715-4b1f-bf1d-720dd1583acb.jpg)
    6. Doesn't send cell tower data (called MCC, MNC, LAC, CID, RSSI). **FIXED** [traccar](https://github.com/soshial/traccar/commit/ea9238cd727de74a96a45fbb573bd7cad58ef7d8) [Freematics](https://github.com/soshial/Freematics/commit/e6ca381ae7505b6156bbe6c4913dc791d2a74b0c)
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sometimes sends 2 streams of locations. **NOT FIXED**
    10. Freematics had had no support for sending ignition status (ON/OFF). **FIXED** [Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d). Sidenote, the default `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.0V.then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. Low battery alarm was not sent. [**FIXED**](https://github.com/soshial/Freematics/commit/ff6ca8ae4c584f92cc6a338c29667bbae5a8ebe8). Added `LOW_BATTERY_VOLTAGE` config parameter.
    12. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    13. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    14. traccar main developer didn't foresee, that locations may arrive non-sequentially (sic!), for example when locations are re-uploaded. [**FIXED**](https://github.com/traccar/traccar/pull/4740), needs to be configured to avoid data duplication.

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
  6. soshial revised this gist Sep 12, 2021. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    In this article I listed some common problems I encountered when I tried to use **Freematics** OBD-reader together with **traccar** device-tracking server. Both are open-source, thanks to which I was able to improve both and their cooperation.

    **Freematics**: [official repo](https://github.com/stanleyhuangyc/Freematics/tree/master/firmware_v5/telelogger) and [my fork](https://github.com/soshial/Freematics/tree/traccar_integration/firmware_v5/telelogger).

    **traccar**: [official repo](https://github.com/traccar/traccar/) and [my fork](https://github.com/soshial/traccar/tree/freematics_update).

    ### What are the pitfalls and hardware drawbacks of Freematics?
  7. soshial revised this gist Sep 12, 2021. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,15 @@
    **Freematics**: [official repo](https://github.com/stanleyhuangyc/Freematics/tree/master/firmware_v5/telelogger) and [my fork](https://github.com/soshial/Freematics/tree/traccar_integration/firmware_v5/telelogger).
    **traccar**: [official repo](https://github.com/traccar/traccar/) and [my fork](https://github.com/soshial/traccar/tree/freematics_update).

    ### What are the pitfalls and hardware drawbacks of Freematics?
    1. Currently, Freematics cannot switch between WiFi and SIM depending on connectivity. If you want to switch to a different WiFi or mobile operator - you need to open your bloody Windows and recompile everything :)
    2. Doesn't work at all without external power, has no battery. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V). It means that if a theif cuts off the device, Freematics would not be able to send the SOS signal to the server.
    3. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use _OBD port extender_ to put the tracker higher with access to sky.
    4. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).

    ### How does Freematics work? (tracking logic of `firmware_v5/telelogger.ino` sketch)
    ### How does Freematics internally work? (tracking logic of `firmware_v5/telelogger.ino` sketch)
    ![PXL_20210711_091335589](https://user-images.githubusercontent.com/100644/132991900-67d69e05-721f-4053-81c7-b69991cb579c.jpg)

    1. It has 2 types of requests, the first sends only events and alarms (without location) and the other sends only key-value data payload (location, ODB data, etc.).
    2. Device gathers data every X milliseconds (see the `DATA_INTERVAL_TABLE` parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (`#define STORAGE STORAGE_SD`), since internal SPIFFS memory is very small and will cyclically rewrite itself.
    3. Freematics goes into _standby mode_ after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
  8. soshial revised this gist Sep 10, 2021. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,15 @@
    ### What are the pitfalls and hardware drawbacks of Freematics?
    1. Currently, Freematics cannot switch between WiFi and SIM depending on connectivity. If you want to switch to a different WiFi or mobile operator - you need to open your bloody Windows and recompile everything :)
    2. Doesn't work at all without external power, has no battery. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V). It means that if a theif cuts off the device, Freematics would not be able to send the SOS signal to the server.
    3. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use _OBD port extender_ to put the tracker higher with access to sky.
    4. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).

    ### How does Freematics work? (tracking logic of `firmware_v5/telelogger.ino` sketch)
    1. It has 2 types of requests, the first sends only events and alarms (without location) and the other sends only key-value data payload (location, ODB data, etc.).
    2. Device gathers data every X milliseconds (see the `DATA_INTERVAL_TABLE` parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (`#define STORAGE STORAGE_SD`), since internal SPIFFS memory is very small and will cyclically rewrite itself.
    3. Freematics goes into _standby mode_ after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
    4. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. **NOT FIXED** This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A. I will fix so that it will ping server and also transmit latest location. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)

    ### What are the pitfalls and hardware drawbacks of Freematics?
    1. It is not possible to switch between WiFi and SIM connections. If you want to switch to a different WiFi or mobile operator - you need to open your bloody Windows and recompile everything :)
    2. Doesn't work at all without external power, has no battery. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V). It means that if a theif cuts off the device, Freematics would not be able to send the SOS signal to the server.
    3. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.

    ### What hardware to buy?
    1. **OBD**. If you have a car manufactured before 2000s, it probably will not support the OBD specification. I've also seen many complaints that Freematics has numerous problems with electric vehicles. In my case, Freematics DIDN'T work with my Renault's OBD-II port. I tested to figure out the perpetrator: an expensive OBD-reader from another manufacturer could read my ODB data, and Freematics was able to read other car's data. But eventually I realized, that OBD data is not that really needed for my purposes of tracking vehicle's location and movement. The main advantage of Freematics is that tha hardware comes with fully libre software, that you may customize as you wish. Do not expect that Stanley Huang (the creator of Freematics) will help you with your problems - you're on your own.
    2. **External GNSS**. I didn't want to buy the GNSS receiver from Freematics store (costs $40 + $17 delivery; €33 + €13 delivery) - it is definitely overpriced, so I bought one from AliExpress for €10 (+ €1 delivery). Same functionality, but 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    @@ -28,8 +29,6 @@
    11. Low battery alarm was not sent. [**FIXED**](https://github.com/soshial/Freematics/commit/ff6ca8ae4c584f92cc6a338c29667bbae5a8ebe8). Added `LOW_BATTERY_VOLTAGE` config parameter.
    12. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    13. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    14. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).


    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
  9. soshial revised this gist Sep 10, 2021. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -4,27 +4,27 @@
    3. Freematics goes into _standby mode_ after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
    4. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. **NOT FIXED** This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A. I will fix so that it will ping server and also transmit latest location. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)

    ### What are the pitfalls of Freematics?
    1. It is not possible to switch between WiFi and SIM connections. If you want to switch between 2 networks or change WiFi password - you need to open your bloody Windows and recompile everything :)
    2. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. [IMAGE](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png)
    3. Doesn't work at all without external power, has no battery. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
    4. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    ### What are the pitfalls and hardware drawbacks of Freematics?
    1. It is not possible to switch between WiFi and SIM connections. If you want to switch to a different WiFi or mobile operator - you need to open your bloody Windows and recompile everything :)
    2. Doesn't work at all without external power, has no battery. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V). It means that if a theif cuts off the device, Freematics would not be able to send the SOS signal to the server.
    3. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.

    ### What hardware to buy?
    1. **OBD**. If you have a car manufactured before 2000s, it probably will not support the OBD specification. I've also seen many complaints that Freematics has numerous problems with electric vehicles. In my case, Freematics DIDN'T work with my Renault's OBD-II port. I tested to figure out the perpetrator: an expensive OBD-reader from another manufacturer could read my ODB data, and Freematics was able to read other car's data. But eventually I realized, that OBD data is not that really needed for my purposes of tracking vehicle's location and movement. The main advantage of Freematics is that tha hardware comes with fully libre software, that you may customize as you wish. Do not expect that Stanley Huang (the creator of Freematics) will help you with your problems - you're on your own.
    2. **External GNSS**. I didn't want to buy the GNSS receiver from Freematics store (costs $40 + $17 delivery; €33 + €13 delivery) - it is definitely overpriced, so I bought one from AliExpress for €10 (+ €1 delivery). Same functionality, but 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    3. **SIM module**. Choose SIM7600 module since it's the only one that supports 4G networks (along with 2g/3g). SIM7600E is for Europe and the whole world. SIM7600A if for US and Canada. On Freematics website SIM module costs $45 and you may buy an identical module for $35 on Aliexpress.
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the flat fee of €0.01 per 1 MiB which is the in all supported countries, very extensive list of countries and free traffic for messengers (Telegram etc.)

    ### Problems with Freematics I encountered:
    ### Problems with Freematics I encountered and fixed:
    1. ✘ GPS, ✓ Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
    2. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    3. Originally, Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). This format prevents data to be easily re-uploaded later (if device was offline). I fixed it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    4. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740) Doesn't send cell tower data (called MCC, MNC, LAC and CID). **NOT FIXED**
    5. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. [IMAGE](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png) **NOT FIXED**
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740). Doesn't send cell tower data (called MCC, MNC, LAC and CID). **NOT FIXED**
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sometimes sends 2 streams of locations. **NOT FIXED**
    10. Had no support for sending ignition status (ON/OFF). **FIXED** [Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d). Sidenote, the default `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.0V.then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    10. Freematics had had no support for sending ignition status (ON/OFF). **FIXED** [Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d). Sidenote, the default `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.0V.then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. Low battery alarm was not sent. [**FIXED**](https://github.com/soshial/Freematics/commit/ff6ca8ae4c584f92cc6a338c29667bbae5a8ebe8). Added `LOW_BATTERY_VOLTAGE` config parameter.
    12. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    13. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
  10. soshial revised this gist Sep 10, 2021. 1 changed file with 17 additions and 14 deletions.
    31 changes: 17 additions & 14 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,15 @@
    ### How does Freematics work? (`firmware_v5/telelogger.ino` sketch)
    1. Doesn't work at all with no external power. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
    2. It has 2 types of requests, the first sends only events and alarms (without location) and the other sends only key-value data payload (location, ODB data, etc.).
    3. Device gathers data every X milliseconds (see the `DATA_INTERVAL_TABLE` parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (`#define STORAGE STORAGE_SD`), since internal SPIFFS memory is very small and will cyclically rewrite itself.
    4. Freematics goes into _standby mode_ after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
    5. It is not possible to switch between WiFi and SIM connections. If you want to switch between 2 networks or change WiFi password - you need to open your bloody Windows and recompile everything :)
    ### How does Freematics work? (tracking logic of `firmware_v5/telelogger.ino` sketch)
    1. It has 2 types of requests, the first sends only events and alarms (without location) and the other sends only key-value data payload (location, ODB data, etc.).
    2. Device gathers data every X milliseconds (see the `DATA_INTERVAL_TABLE` parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (`#define STORAGE STORAGE_SD`), since internal SPIFFS memory is very small and will cyclically rewrite itself.
    3. Freematics goes into _standby mode_ after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
    4. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. **NOT FIXED** This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A. I will fix so that it will ping server and also transmit latest location. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)

    ### What are the pitfalls of Freematics?
    1. It is not possible to switch between WiFi and SIM connections. If you want to switch between 2 networks or change WiFi password - you need to open your bloody Windows and recompile everything :)
    2. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. [IMAGE](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png)
    3. Doesn't work at all without external power, has no battery. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
    4. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.

    ### What hardware to buy?
    1. **OBD**. If you have a car manufactured before 2000s, it probably will not support the OBD specification. I've also seen many complaints that Freematics has numerous problems with electric vehicles. In my case, Freematics DIDN'T work with my Renault's OBD-II port. I tested to figure out the perpetrator: an expensive OBD-reader from another manufacturer could read my ODB data, and Freematics was able to read other car's data. But eventually I realized, that OBD data is not that really needed for my purposes of tracking vehicle's location and movement. The main advantage of Freematics is that tha hardware comes with fully libre software, that you may customize as you wish. Do not expect that Stanley Huang (the creator of Freematics) will help you with your problems - you're on your own.
    2. **External GNSS**. I didn't want to buy the GNSS receiver from Freematics store (costs $40 + $17 delivery; €33 + €13 delivery) - it is definitely overpriced, so I bought one from AliExpress for €10 (+ €1 delivery). Same functionality, but 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    @@ -13,20 +18,18 @@

    ### Problems with Freematics I encountered:
    1. ✘ GPS, ✓ Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
    2. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. **NOT FIXED** This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A. I will fix so that it will ping server and also transmit latest location. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    3. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    4. Originally, Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). This format prevents data to be easily re-uploaded later (if device was offline). I fixed it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    5. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    2. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    3. Originally, Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). This format prevents data to be easily re-uploaded later (if device was offline). I fixed it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    4. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740) Doesn't send cell tower data (called MCC, MNC, LAC and CID). **NOT FIXED**
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sent 2 streams of locations. **NOT FIXED**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    8. Freematics sometimes sends 2 streams of locations. **NOT FIXED**
    10. Had no support for sending ignition status (ON/OFF). **FIXED** [Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d). Sidenote, the default `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.0V.then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. Low battery alarm was not sent. [**FIXED**](https://github.com/soshial/Freematics/commit/ff6ca8ae4c584f92cc6a338c29667bbae5a8ebe8). Added `LOW_BATTERY_VOLTAGE` config parameter.
    12. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    13. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    14. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).
    15. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. [IMAGE](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png)


    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
    @@ -35,6 +38,6 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9
    2. Change frequency of checking of GNSS location data; it is regulated by motion adaptive data interval control: `STATIONARY_TIME_TABLE` and `DATA_INTERVAL_TABLE` ([setting](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L99) and [code](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/telelogger.ino#L826))
    3. choose protocol `#define SERVER_PORT 5170`: UDP (5170 port, sends a lot of data including ODB) or HTTP/S (port 5055, sends only location data)
    4. add settings needed for device networking: either WiFi or SIM (looks like simultanious usage is not possible)
    5.


    Please, send me a message or comment down below if I am wrong in some of my conclusions.
  11. soshial revised this gist Sep 10, 2021. 1 changed file with 8 additions and 7 deletions.
    15 changes: 8 additions & 7 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -15,17 +15,18 @@
    1. ✘ GPS, ✓ Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
    2. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. **NOT FIXED** This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A. I will fix so that it will ping server and also transmit latest location. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    3. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    4. On stocl Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). I will fix it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    4. Originally, Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). This format prevents data to be easily re-uploaded later (if device was offline). I fixed it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    5. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740) Doesn't send cell tower data (called MCC, MNC, LAC and CID). **NOT FIXED**
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sent 2 streams of locations. **NOT FIXED**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    10. Had no support for sending ignition ON/OFF. Also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.1V. So I [fixed Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [fixed Traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d), then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    12. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    13. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).
    14. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. [IMAGE](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png)
    10. Had no support for sending ignition status (ON/OFF). **FIXED** [Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d). Sidenote, the default `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.0V.then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. Low battery alarm was not sent. [**FIXED**](https://github.com/soshial/Freematics/commit/ff6ca8ae4c584f92cc6a338c29667bbae5a8ebe8). Added `LOW_BATTERY_VOLTAGE` config parameter.
    12. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    13. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    14. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).
    15. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. [IMAGE](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png)

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
  12. soshial revised this gist Sep 10, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -25,6 +25,7 @@
    11. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    12. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    13. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).
    14. Crossing national borders oftentimes renders Freematics offline (SIM card supports roaming). As a result: whole chunks of route do not get uploaded to traccar. [IMAGE](https://user-images.githubusercontent.com/100644/132844713-db482893-28dd-4841-a5db-8ee076dd0c01.png)

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
  13. soshial revised this gist Jul 16, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -13,13 +13,13 @@

    ### Problems with Freematics I encountered:
    1. ✘ GPS, ✓ Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
    2. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A. I will fix so that it will ping server and also transmit latest location.
    2. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. **NOT FIXED** This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A. I will fix so that it will ping server and also transmit latest location. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    3. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    4. On stocl Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). I will fix it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`.
    4. On stocl Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). I will fix it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`. [**FIXED**](https://github.com/soshial/Freematics/commit/f5c052c790073799485c560d8738793e54b37498)
    5. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sent 2 streams of locations. **TOFIX**
    8. Freematics sent 2 streams of locations. **NOT FIXED**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    10. Had no support for sending ignition ON/OFF. Also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.1V. So I [fixed Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [fixed Traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d), then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
  14. soshial revised this gist Jul 3, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ### How does Freematics work? (excerpt)
    ### How does Freematics work? (`firmware_v5/telelogger.ino` sketch)
    1. Doesn't work at all with no external power. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
    2. It has 2 types of requests, the first sends only events and alarms (without location) and the other sends only key-value data payload (location, ODB data, etc.).
    3. Device gathers data every X milliseconds (see the `DATA_INTERVAL_TABLE` parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (`#define STORAGE STORAGE_SD`), since internal SPIFFS memory is very small and will cyclically rewrite itself.
    @@ -13,9 +13,9 @@

    ### Problems with Freematics I encountered:
    1. ✘ GPS, ✓ Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
    2. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    2. ✓ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A. I will fix so that it will ping server and also transmit latest location.
    3. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    4. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    4. On stocl Freematics location and OBD data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP). I will fix it, so that it saves data in this format: `M0ZR4X0#0:204391,11:140221,10:8445000,A:49.215920,B:18.737755,C:410,D:0,E:208,24:1252,20:0;0;0,82:47*B5`.
    5. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
  15. soshial revised this gist Jul 3, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the flat fee of €0.01 per 1 MiB which is the in all supported countries, very extensive list of countries and free traffic for messengers (Telegram etc.)

    ### Problems with Freematics I encountered:
    1. ✘ GPS, Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
    2. GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    1. ✘ GPS, Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
    2. GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    3. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    4. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    5. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
  16. soshial revised this gist Jul 3, 2021. 1 changed file with 15 additions and 15 deletions.
    30 changes: 15 additions & 15 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    ### How does Freematics work? (excerpt)
    1. Doesn't work at all with no external power. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
    2. It has 2 types of requests, the first sends only events (without location) and the other sends key-value data payload (location, ODB data, etc.).
    2. It has 2 types of requests, the first sends only events and alarms (without location) and the other sends only key-value data payload (location, ODB data, etc.).
    3. Device gathers data every X milliseconds (see the `DATA_INTERVAL_TABLE` parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (`#define STORAGE STORAGE_SD`), since internal SPIFFS memory is very small and will cyclically rewrite itself.
    4. Freematics goes into _standby mode_ after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
    5. It is not possible to switch between WiFi and SIM connections. If you want to switch between 2 networks or change WiFi password - you need to open your bloody Windows and recompile everything :)
    @@ -9,22 +9,22 @@
    1. **OBD**. If you have a car manufactured before 2000s, it probably will not support the OBD specification. I've also seen many complaints that Freematics has numerous problems with electric vehicles. In my case, Freematics DIDN'T work with my Renault's OBD-II port. I tested to figure out the perpetrator: an expensive OBD-reader from another manufacturer could read my ODB data, and Freematics was able to read other car's data. But eventually I realized, that OBD data is not that really needed for my purposes of tracking vehicle's location and movement. The main advantage of Freematics is that tha hardware comes with fully libre software, that you may customize as you wish. Do not expect that Stanley Huang (the creator of Freematics) will help you with your problems - you're on your own.
    2. **External GNSS**. I didn't want to buy the GNSS receiver from Freematics store (costs $40 + $17 delivery; €33 + €13 delivery) - it is definitely overpriced, so I bought one from AliExpress for €10 (+ €1 delivery). Same functionality, but 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    3. **SIM module**. Choose SIM7600 module since it's the only one that supports 4G networks (along with 2g/3g). SIM7600E is for Europe and the whole world. SIM7600A if for US and Canada. On Freematics website SIM module costs $45 and you may buy an identical module for $35 on Aliexpress.
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the same flat fee of €0.01 per 1 MiB in all countries, good coverage and free traffic for messengers (Telegram etc.)
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the flat fee of €0.01 per 1 MiB which is the in all supported countries, very extensive list of countries and free traffic for messengers (Telegram etc.)

    ### Problems with Freematics I encountered:
    1. Since Freematics (as well as other protocols/devices) sends 2 types of data separately: location and events (alarms), it might happen that status is online, but device doesn't have good GPS reception. In this case Traccar shows outdated location as green.
    2. Freematics doesn't re-send any data collected while being offline, but only stores them. This approach has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    4. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    5. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    6. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    7. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    8. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    9. Freematics sent 2 streams of locations. **TOFIX**
    10. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    11. Had no support for sending ignition ON/OFF. Also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.1V. So I [fixed Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [fixed Traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d), then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    12. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    13. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    14. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).
    1. ✘ GPS, ✔ Internet. In this case Traccar shows device status as online and green, but the location is actually outdated. Be careful and look at the location timestamp.
    2. ✔ GPS, ✘ Internet. Freematics doesn't re-send any data collected while being offline, but only stores them on disk. This approach has many flaws: if you had a ride in the area with bad network coverage, your route there will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    3. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    4. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    5. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sent 2 streams of locations. **TOFIX**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    10. Had no support for sending ignition ON/OFF. Also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.1V. So I [fixed Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [fixed Traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d), then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    12. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    13. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
  17. soshial revised this gist Jul 3, 2021. 1 changed file with 21 additions and 18 deletions.
    39 changes: 21 additions & 18 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,30 @@
    ### How does Freematics work? (excerpt)
    1. Doesn't work at all with no external power. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
    2. It has 2 types of requests, one sends only events (without location) and the other sends location together with many data (as key-value).
    2. It has 2 types of requests, the first sends only events (without location) and the other sends key-value data payload (location, ODB data, etc.).
    3. Device gathers data every X milliseconds (see the `DATA_INTERVAL_TABLE` parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (`#define STORAGE STORAGE_SD`), since internal SPIFFS memory is very small and will cyclically rewrite itself.
    4. Freematics goes into **standby mode** after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
    5.
    4. Freematics goes into _standby mode_ after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
    5. It is not possible to switch between WiFi and SIM connections. If you want to switch between 2 networks or change WiFi password - you need to open your bloody Windows and recompile everything :)

    ### What hardware to buy?
    1. **OBD**. If you have a car manufactured before 2000s, it probably will not support the OBD specification. I've also seen many complaints that Freematics has numerous problems with electric vehicles. In my case, Freematics DIDN'T work with my Renault's OBD-II port. I tested to figure out the perpetrator: an expensive OBD-reader from another manufacturer could read my ODB data, and Freematics was able to read other car's data. But eventually I realized, that OBD data is not that really needed for my purposes of tracking vehicle's location and movement. The main advantage of Freematics is that tha hardware comes with fully libre software, that you may customize as you wish. Do not expect that Stanley Huang (the creator of Freematics) will help you with your problems - you're on your own.
    2. **External GNSS**. I didn't want to buy the GNSS receiver from Freematics store (costs $40 + $17 delivery; €33 + €13 delivery) - it is definitely overpriced, so I bought one from AliExpress for €10 (+ €1 delivery). Same functionality, but 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    3. **SIM module**. Choose SIM7600 module since it's the only one that supports 4G networks (along with 2g/3g). SIM7600E is for Europe and the whole world. SIM7600A if for US and Canada. On Freematics website SIM module costs $45 and you may buy an identical module for $35 on Aliexpress.
    4. **Mobile data**. Do not ever buy Hologram SIM (advertized all over Freematics website and even in the code). There are tons of different services that provide normal prices. I personally used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the same flat fee of €0.01 per 1 MiB in all countries, good coverage and free traffic for messengers (Telegram etc.)

    ### Problems with Freematics I encountered:
    1. Since Freematics (as well as other protocols/devices) sends 2 types of data separately: location and events (alarms), it might happen that status is online, but device doesn't have good GPS reception. In this case Traccar shows outdated location as green.
    2. Freematics doesn't re-send any data collected while being offline, but only stores them. This approach has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    3. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    4. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    5. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sent 2 streams of locations. **TOFIX**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    10. Had no support for sending ignition ON/OFF. Also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.1V. So I [fixed Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [fixed Traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d), then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    12. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    13. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?).
    4. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    5. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    6. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    7. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    8. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    9. Freematics sent 2 streams of locations. **TOFIX**
    10. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    11. Had no support for sending ignition ON/OFF. Also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.1V. So I [fixed Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [fixed Traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d), then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    12. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    13. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    14. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?, [does this work?](https://github.com/rfhigler/Freematics/commit/25cf781ca9fecc3e3082348ce9d28e4d69ff7764)).

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
    @@ -29,7 +35,4 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9
    4. add settings needed for device networking: either WiFi or SIM (looks like simultanious usage is not possible)
    5.

    ### General comments
    * **External GNSS receiver**. I didn't want to buy expensive receiver from Freematics website (€32 + €13 delivery), so I bought one from AliExpress for €10 (+ €1 delivery), which was 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    * For connectivity I used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the same flat fee of €0.01 per 1 MiB in all countries, good coverage and free traffic for messengers (Telegram etc.).
    * It is impossible to switch between WiFi and SIM connections. If you want to switch between 2 networks or change WiFi password - one needs to open bloody Windows and recompile everything :)
    Please, send me a message or comment down below if I am wrong in some of my conclusions.
  18. soshial revised this gist Jul 2, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -15,7 +15,7 @@
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sent 2 streams of locations. **TOFIX**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    10. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    10. Had no support for sending ignition ON/OFF. Also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4V, sometimes as low as 13.1V. So I [fixed Freematics](https://github.com/soshial/Freematics/commit/36dba09b45e80da01d86e211b638c825f112fd4c) and [fixed Traccar](https://github.com/soshial/traccar/commit/79b6266a6079256028cb80e7b1ea5bf1e976a56d), then I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    12. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    13. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?).
  19. soshial revised this gist Jul 2, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,7 @@
    10. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    12. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.
    13. As far as I understood, there is _no support for HTTPS_: I don't think it is possible due to the size and complexity of the SSL Library, because the Arduino would most likely be underpowered. I tried using `WiFiClientSecure` library, but it didn't compile. Ways to circumvent it: A) make the requests to a regular server, that redirects/proxies it to the HTTPS server or B) use packet mirroring via WiFi router (any ideas how to do it?).

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
    @@ -30,4 +31,5 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9

    ### General comments
    * **External GNSS receiver**. I didn't want to buy expensive receiver from Freematics website (€32 + €13 delivery), so I bought one from AliExpress for €10 (+ €1 delivery), which was 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    * For connectivity I used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the same flat fee of €0.01 per 1 MiB in all countries, good coverage and free traffic for messengers (Telegram etc.).
    * For connectivity I used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the same flat fee of €0.01 per 1 MiB in all countries, good coverage and free traffic for messengers (Telegram etc.).
    * It is impossible to switch between WiFi and SIM connections. If you want to switch between 2 networks or change WiFi password - one needs to open bloody Windows and recompile everything :)
  20. soshial revised this gist Jul 1, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,8 @@
    8. Freematics sent 2 streams of locations. **TOFIX**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    10. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    11. NMEA receivers don't send _location accuracy_ radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**
    12. _Overheating_ is determined by the temperature reported by the MEMS chip which reflect the device internal temperature. Try reducing data rate. This happens when cellular signal is weak and the cellular module increases its power consumption. Alternatively, this can be improved by having an external cellular antenna or sending data to server via WiFi.

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
  21. soshial revised this gist Jul 1, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -29,4 +29,4 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9

    ### General comments
    * **External GNSS receiver**. I didn't want to buy expensive receiver from Freematics website (€32 + €13 delivery), so I bought one from AliExpress for €10 (+ €1 delivery), which was 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    * For connectivity I used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: flat fee per MiB, good coverage and free messenger traffic (Telegram).
    * For connectivity I used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: the same flat fee of €0.01 per 1 MiB in all countries, good coverage and free traffic for messengers (Telegram etc.).
  22. soshial revised this gist Jul 1, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -29,4 +29,4 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9

    ### General comments
    * **External GNSS receiver**. I didn't want to buy expensive receiver from Freematics website (€32 + €13 delivery), so I bought one from AliExpress for €10 (+ €1 delivery), which was 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    * For connectivity I used [MTX Connect](https://www.mtxc.eu/en/pricing.html) SIM for 3 reasons: flat fee per MiB, good coverage and free messenger traffic (Telegram).
    * For connectivity I used [MTX Connect](https://www.mtxc.eu/en/?referral=2x2206) SIM for 3 reasons: flat fee per MiB, good coverage and free messenger traffic (Telegram).
  23. soshial revised this gist Jun 30, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@
    8. Freematics sent 2 streams of locations. **TOFIX**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    10. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky.
    11. NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky. **UNFIXABLE**

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
    @@ -29,4 +29,4 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9

    ### General comments
    * **External GNSS receiver**. I didn't want to buy expensive receiver from Freematics website (€32 + €13 delivery), so I bought one from AliExpress for €10 (+ €1 delivery), which was 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    *
    * For connectivity I used [MTX Connect](https://www.mtxc.eu/en/pricing.html) SIM for 3 reasons: flat fee per MiB, good coverage and free messenger traffic (Telegram).
  24. soshial revised this gist Jun 30, 2021. 1 changed file with 13 additions and 14 deletions.
    27 changes: 13 additions & 14 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -6,15 +6,17 @@
    5.

    ### Problems with Freematics I encountered:
    1. Freematics doesn't re-send any data collected while being offline, but only stores them. This approach has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    2. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    3. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    4. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    5. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    6. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    7. Freematics sent 2 streams of locations. **TOFIX**
    8. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    9. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    1. Since Freematics (as well as other protocols/devices) sends 2 types of data separately: location and events (alarms), it might happen that status is online, but device doesn't have good GPS reception. In this case Traccar shows outdated location as green.
    2. Freematics doesn't re-send any data collected while being offline, but only stores them. This approach has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    3. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    4. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    5. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    6. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    7. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Freematics sent 2 streams of locations. **TOFIX**
    9. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    10. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    11. NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky.

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
    @@ -26,8 +28,5 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9
    5.

    ### General comments
    * Freematics (as well as other protocols/devices) sends 2 types of data: location and events (alarms). So it might happen that status is online, but device doesn't have good GPS reception, hence Traccar shows outdated location as green.
    * NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky.

    ### GNSS receiver
    I didn't want to buy expensive receiver from Freematics website (€32 + €13 delivery), so I bought one from AliExpress for €10 (+ €1 delivery), which was 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    * **External GNSS receiver**. I didn't want to buy expensive receiver from Freematics website (€32 + €13 delivery), so I bought one from AliExpress for €10 (+ €1 delivery), which was 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
    *
  25. soshial revised this gist Jun 30, 2021. 1 changed file with 13 additions and 9 deletions.
    22 changes: 13 additions & 9 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,20 @@
    ### How does Freematics work? (excerpt)
    1. Doesn't work at all with no external power. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
    2. It has 2 types of requests, one sends only events (without location) and the other sends location together with many data (as key-value).
    3. Freematics pings the server every 15 minutes and if there is no connection, then it just waits for the next 15 min.
    4. Freematics doesn't send any historical location data (collected while being offline). It has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    3. Device gathers data every X milliseconds (see the `DATA_INTERVAL_TABLE` parameter). The data gets immediately written to file storage as CSV files (but flushed incrementally with each 1 KiB, equal to approximately 6 records). Always choose SD card as a storage (`#define STORAGE STORAGE_SD`), since internal SPIFFS memory is very small and will cyclically rewrite itself.
    4. Freematics goes into **standby mode** after 180 seconds (the third value of `STATIONARY_TIME_TABLE` parameter). Wakes up after the accelerator sensor wakes it up. When in standby, Freematics pings the server every `PING_BACK_INTERVAL` seconds (15 min by default) and if there is no connection, then it just waits for the next 15 min.
    5.

    ### Problems with Freematics:
    1. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. **TOFIX**
    2. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data.
    3. Doesn't send RSSI data. **TOFIX**
    4. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    5. Freematics sent 2 streams of locations. **TOFIX**
    6. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    ### Problems with Freematics I encountered:
    1. Freematics doesn't re-send any data collected while being offline, but only stores them. This approach has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    2. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. [**FIXED**](https://github.com/soshial/Freematics/commit/ad300ec784360803811b69284093fd14a12f661e)
    3. Location data is saved to CSV files in a very weird format (completely different from format send via UDP or HTTP).
    4. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data. [**FIXED**](https://github.com/soshial/Freematics/commit/95fdefeb5d549e4a5945b2fbdb3b3306e204eec6)
    5. Doesn't send RSSI data. [**FIXED**](https://github.com/soshial/Freematics/commit/0b9411550a35b83d0275095aee22679bc346b740)
    6. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    7. Freematics sent 2 streams of locations. **TOFIX**
    8. ONE+ Model B (as well as Traccar edition) has an internal GPS receiver. Due to the antenna being in the enclosure, sometimes the location of the OBD port may prevent the antenna from getting a good GPS signal from the sky. You can use an external GPS receiver (costs around $10), but that is more suitable to be used with model A which has no internal GPS. Another approach is to use OBD port extender.
    9. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
  26. soshial revised this gist Jun 29, 2021. 1 changed file with 6 additions and 4 deletions.
    10 changes: 6 additions & 4 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,10 @@
    ### Problems with Freematics:
    1. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. **TOFIX**
    2. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data.
    3. Doesn't send RSSI data.
    3. Doesn't send RSSI data. **TOFIX**
    4. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    5. Freematics sent 2 streams of locations. **TOFIX**
    6. Had no support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
    @@ -16,12 +19,11 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9
    2. Change frequency of checking of GNSS location data; it is regulated by motion adaptive data interval control: `STATIONARY_TIME_TABLE` and `DATA_INTERVAL_TABLE` ([setting](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L99) and [code](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/telelogger.ino#L826))
    3. choose protocol `#define SERVER_PORT 5170`: UDP (5170 port, sends a lot of data including ODB) or HTTP/S (port 5055, sends only location data)
    4. add settings needed for device networking: either WiFi or SIM (looks like simultanious usage is not possible)
    5. NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky.
    6. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    8. Add support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.
    5.

    ### General comments
    * Freematics (as well as other protocols/devices) sends 2 types of data: location and events (alarms). So it might happen that status is online, but device doesn't have good GPS reception, hence Traccar shows outdated location as green.
    * NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky.

    ### GNSS receiver
    I didn't want to buy expensive receiver from Freematics website (€32 + €13 delivery), so I bought one from AliExpress for €10 (+ €1 delivery), which was 4 times cheaper. Be careful to choose GNSS receiver (and not just GNSS antenna). Make sure that it uses R-232 and NMEA-0183 protocol. Is has 4 colourful wires coming out of it. As of June 2021 I couldn't find dual-band GNSS with L1/L5 precision.
  27. soshial revised this gist Jun 28, 2021. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,13 @@
    ### How does Freematics work? (excerpt)
    1. It has 2 types of requests, one sends only events (without location) and the other sends location together with many data (as key-value).
    2. Freematics pings the server every 15 minutes and if there is no connection, then it just waits for the next 15 min.
    3. Freematics doesn't send any historical location data (collected while being offline). It has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.
    1. Doesn't work at all with no external power. Works only when connected to USB (3.7V), OBD-II (12V), or SAE J1939 (24V).
    2. It has 2 types of requests, one sends only events (without location) and the other sends location together with many data (as key-value).
    3. Freematics pings the server every 15 minutes and if there is no connection, then it just waits for the next 15 min.
    4. Freematics doesn't send any historical location data (collected while being offline). It has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.

    ### Problems with Freematics:
    1. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. **TOFIX**
    2. Freematics temperature sensor (key 0x82: CPU temperature) is wrong and sends 4-6°C all the time, even though it's like 15-30°C. Hardware fault? Stanley answered: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data.

    2. Freematics should send both temperature sensors' data (key 0x23: MEMS temperature and key 0x82: CPU temperature). Also, the values sent violate its own documentation (should send 12.3°C as integer `123`). Also, as Stanley stated: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data.
    3. Doesn't send RSSI data.

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:
  28. soshial revised this gist Jun 28, 2021. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion freematics.md
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,11 @@
    2. Freematics pings the server every 15 minutes and if there is no connection, then it just waits for the next 15 min.
    3. Freematics doesn't send any historical location data (collected while being offline). It has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.

    ### Problems with Freematics:
    1. Freematics should add checksum, according to [its documentation](https://freematics.com/pages/hub/api/) as 2 characters (1 byte), but it doesn't start with leading zero when checksum is: 0 < checksum <= F. **TOFIX**
    2. Freematics temperature sensor (key 0x82: CPU temperature) is wrong and sends 4-6°C all the time, even though it's like 15-30°C. Hardware fault? Stanley answered: CPU temperature is not from any type of thermometer. It is recommended to use MEMS motion sensor’s temperature data.


    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:

    @@ -12,7 +17,6 @@ I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9
    4. add settings needed for device networking: either WiFi or SIM (looks like simultanious usage is not possible)
    5. NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky.
    6. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    7. Freematics temperature sensor is wrong and sends 4-6°C all the time, even though it's like 15-30°C. Hardware fault?
    8. Add support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.

    ### General comments
  29. soshial revised this gist Jun 27, 2021. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,9 @@
    ### How does Freematics work? (excerpt)
    1. It has 2 types of requests, one sends only events (without location) and the other sends location together with many data (as key-value).
    2. Freematics pings the server every 15 minutes and if there is no connection, then it just waits for the next 15 min.
    3. Freematics doesn't send any historical location data (collected while being offline). It has many flaws: if you had a ride in the area with bad network coverage in the mountain valley, your route will have significat gaps; or if you stopped your car in place A with internet, then moved to place B while being offline and then internet appeared in place B, then Freematics will send just ping events (not location data), and Traccar will show that your are still in place A.

    ### How to pair Traccar with Freematics?
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:

    1. I updated telelogger.ino to get the device to send over fuel level data by adding `{PID_FUEL_LEVEL, 1},` on line 53. You can add other OBDs if you want, they're all defined in the [OBD.h file](https://github.com/stanleyhuangyc/Freematics/blob/master/libraries/FreematicsPlus/utility/OBD.h).
  30. soshial revised this gist Jun 20, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions freematics.md
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,13 @@
    I used this [reddit post](https://www.reddit.com/r/homeassistant/comments/gsubr9/vehicle_device_tracker_or_how_the_death_of/) as a foundation for my custom setup:

    1. I updated telelogger.ino to get the device to send over fuel level data by adding `{PID_FUEL_LEVEL, 1}`, on line 53. You can add other OBDs if you want, they're all defined in the [OBD.h file](https://github.com/stanleyhuangyc/Freematics/blob/master/libraries/FreematicsPlus/utility/OBD.h).
    1. I updated telelogger.ino to get the device to send over fuel level data by adding `{PID_FUEL_LEVEL, 1},` on line 53. You can add other OBDs if you want, they're all defined in the [OBD.h file](https://github.com/stanleyhuangyc/Freematics/blob/master/libraries/FreematicsPlus/utility/OBD.h).
    2. Change frequency of checking of GNSS location data; it is regulated by motion adaptive data interval control: `STATIONARY_TIME_TABLE` and `DATA_INTERVAL_TABLE` ([setting](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L99) and [code](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/telelogger.ino#L826))
    3. choose protocol `#define SERVER_PORT 5170`: UDP (5170 port, sends a lot of data including ODB) or HTTP/S (port 5055, sends only location data)
    4. add settings needed for device networking: either WiFI or SIM (looks like simultanious usage is not possible)
    4. add settings needed for device networking: either WiFi or SIM (looks like simultanious usage is not possible)
    5. NMEA receivers don't send location accuracy radius in meters (that we are accustomed to with using smartphones), but receivers send [HDOP](https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)) data (dilution of precision), which is [not enough](https://stackoverflow.com/a/42221336/231590) to calculate corresponding accuracy. The radius might be [calculated](https://gis.stackexchange.com/q/97774/143372) based on receiver's HDOP accuracy and your desired degree of confidence, but it is not very reliable. I put Freematics under steering wheel, so it doesn't have access to clear sky, but the location accuracy is still quite good. Average HDOP I get is 70-100 which is considered bad, but comparing roads drewn on OSM and my drewn route the accuracy is ±2 meters. I guess we just have to relax about accuracy and try to put GNSS antenna with the best access to open sky.
    6. Freematics' built-in internal GNSS receiver sent tons of zero locations (0, 0) for some unknown reason. Very often locations alternated each 2-3 seconds between accurate location and (0, 0). Thankfully, Traccar has filtering options `<entry key='filter.zero'>true</entry>` in configuration file `default.xml`.
    7. Freematics temperature sensor is wrong and sends 4-6°C all the time, even though it's like 15-30°C. Hardware fault?
    8. Add support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147)
    8. Add support for sending ignition ON/OFF: see my [pull request](https://github.com/stanleyhuangyc/Freematics/pull/147); also `JUMPSTART_VOLTAGE` being 14V was too high threshold for my vehicle, since my car voltage when driving varied between 13.4-14.4. So I [put threshold to 13V](https://github.com/stanleyhuangyc/Freematics/blob/master/firmware_v5/telelogger/config.h#L134) and it worked perfectly.

    ### General comments
    * Freematics (as well as other protocols/devices) sends 2 types of data: location and events (alarms). So it might happen that status is online, but device doesn't have good GPS reception, hence Traccar shows outdated location as green.