{"id":6547,"date":"2017-06-26T16:46:36","date_gmt":"2017-06-26T06:46:36","guid":{"rendered":"https:\/\/freematics.com\/pages\/?page_id=6547"},"modified":"2022-12-10T20:19:14","modified_gmt":"2022-12-10T10:19:14","slug":"guide","status":"publish","type":"page","link":"https:\/\/freematics.com\/pages\/products\/freematics-one-plus\/guide\/","title":{"rendered":"Freematics ONE+ Developers Guide"},"content":{"rendered":"<p>Freematics ONE+ is based on ESP32 and can be programmed as an Arduino platform. We provide Arduino library and reference code for the hardware on which developers can evolve their own products with least efforts. If you are a pro, we highly recommend to use PlatformIO IDE or ESP-IDF as the development environment. For beginners, we provide a dedicated tool for configuring, compiling and uploading the code for a quick start.<\/p>\n<h1>Physical Interfaces<\/h1>\n<p>First of all, let&#8217;s get to know about the physical interfaces Freematics ONE+ has.<\/p>\n<ul>\n<li>OBD-II Male Connector (16-pin)<\/li>\n<li>GPIO Socket (4-pin)<\/li>\n<li>microSD card slot<\/li>\n<li>Micro SIM card slot (not used for units without cellular module)<\/li>\n<li>Micro USB Port<\/li>\n<li>LED Indicator<\/li>\n<\/ul>\n<p><strong>OBD-II Male Connector<\/strong><\/p>\n<p>OBD-II male connector allows Freematics ONE to be plugged directly into OBD-II female port which is available in most modern cars. The OBD-II port provides connection between Freematics ONE and car&#8217;s ECU computer as well as power supply from car battery.<\/p>\n<p><strong>GPIO Socket<br \/>\n<\/strong><\/p>\n<p>Freematics ONE+ has an external I\/O socket on its enclosure. The 4-pin socket contains of 2x GPIO (from ESP32), VCC and GND.\u00a0 A 2.54 Molex connector is used for wiring. The line definition of the connector is as following.<\/p>\n<ol>\n<li>GND<\/li>\n<li>GPIO26 (ESP32)<\/li>\n<li>VCC (5V)<\/li>\n<li>GPIO34 (ESP32)<a href=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2020\/03\/f3_gpio.jpg\" rel=\"shadowbox[sbpost-7091];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-7409 size-medium\" src=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2020\/03\/f3_gpio-300x300.jpg\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" srcset=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2020\/03\/f3_gpio-300x300.jpg 300w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2020\/03\/f3_gpio-150x150.jpg 150w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2020\/03\/f3_gpio-768x768.jpg 768w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2020\/03\/f3_gpio-66x66.jpg 66w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2020\/03\/f3_gpio.jpg 900w\" alt=\"\" width=\"300\" height=\"300\" \/><\/a><a href=\"https:\/\/freematics.com\/pages\/products\/freematics-one\/gpsconnector\/\" rel=\"attachment wp-att-5963\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-5963\" src=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2015\/12\/GPSConnector.png\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" srcset=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2015\/12\/GPSConnector.png 570w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2015\/12\/GPSConnector-300x53.png 300w\" alt=\"GPSConnector\" width=\"570\" height=\"101\" \/><\/a><\/li>\n<\/ol>\n<p>This socket allows connection of external GPS receivers which come as an optional accessory. The 4-pin connector is used for serial communication and also providing power for GPS receiver. Normally OBD-II port sits underneath dashboard where no good GPS signal reception is available. External GPS receiver with a cable led out from Freematics ONE can be easily placed on dashboard or somewhere else for better signal reception.<a href=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/12\/f1p_gps.jpg\" rel=\"shadowbox[sbpost-6547];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-6859\" src=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/12\/f1p_gps-1024x768.jpg\" alt=\"\" width=\"669\" height=\"502\" srcset=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/12\/f1p_gps-1024x768.jpg 1024w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/12\/f1p_gps-300x225.jpg 300w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/12\/f1p_gps-768x576.jpg 768w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/12\/f1p_gps.jpg 1200w\" sizes=\"auto, (max-width: 669px) 100vw, 669px\" \/><\/a><\/p>\n<p><strong>Card Slots<\/strong><\/p>\n<p>Freematics ONE has a microSD card slot and a micro SIM card slot under the plastic cover on one side of the enclosure. Both card seats are self-popping. Please avoid insert anything into SIM card slot if your Freematics ONE has no cellular module installed. Please make sure to insert microSD card and SIM card in the correct direction as shown below.<\/p>\n<p><a href=\"http:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-TF.jpg\" rel=\"shadowbox[sbpost-6547];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6115\" src=\"http:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-TF-300x300.jpg\" alt=\"F-ONE-TF\" width=\"300\" height=\"300\" srcset=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-TF-300x300.jpg 300w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-TF-150x150.jpg 150w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-TF-768x768.jpg 768w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-TF-66x66.jpg 66w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-TF.jpg 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/> <\/a><a href=\"http:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-SIM.jpg\" rel=\"shadowbox[sbpost-6547];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6114\" src=\"http:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-SIM-300x300.jpg\" alt=\"F-ONE-SIM\" width=\"300\" height=\"300\" srcset=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-SIM-300x300.jpg 300w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-SIM-150x150.jpg 150w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-SIM-768x768.jpg 768w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-SIM-66x66.jpg 66w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-SIM.jpg 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/> <\/a><a href=\"http:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-CARDS.jpg\" rel=\"shadowbox[sbpost-6547];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-6117\" src=\"http:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-CARDS-300x300.jpg\" alt=\"F-ONE-CARDS\" width=\"300\" height=\"300\" srcset=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-CARDS-300x300.jpg 300w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-CARDS-150x150.jpg 150w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-CARDS-768x768.jpg 768w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-CARDS-66x66.jpg 66w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2016\/02\/F-ONE-CARDS.jpg 900w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Micro USB Port<\/strong><\/p>\n<p>Micro USB port is for uploading Arduino sketch as well as serial communication. It can also be used for powering the device if the unit is not connected to OBD port. Please make sure enough current can be supplied. Using USB hub with external power supply is recommended.<\/p>\n<h1>Compiling and Uploading<\/h1>\n<p>Freematics ONE+ uses ESP32 as main controller. ESP32 has an actively developing <a href=\"https:\/\/github.com\/espressif\/arduino-esp32\" target=\"_blank\" rel=\"noopener noreferrer\">Arduino core<\/a>\u00a0which makes it programmable as Arduino. Most important Arduino libraries like SPI, Wire and WiFi are well ported. There are a couple of ways to compile Arduino sketch for ESP32 and upload to it. Arduino IDE might be the most popular choice (setup guide <a href=\"https:\/\/github.com\/espressif\/arduino-esp32\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>), however emerging modern IDEs are outperforming it in all aspects especially with better support for new Arduino variants.<\/p>\n<p><a href=\"https:\/\/github.com\/stanleyhuangyc\/Freematics\/tree\/master\/firmware_v5\/telelogger\">Telelogger<\/a> is one of the reference code for Freematics ONE+. It sets up peripherals and network, collects data from multiple sources including OBD, GNSS, motion sensor, and transmits the data to <a href=\"http:\/\/freematics.com\/hub\/\" target=\"_blank\" rel=\"noopener noreferrer\">Freematics Hub<\/a> or <a href=\"https:\/\/www.traccar.org\/\" target=\"_blank\" rel=\"noopener\">Traccar<\/a>, via WiFi or cellular network, in UDP or HTTP protocol. The sketch and library for Freematics ONE+ are hosted on <a href=\"https:\/\/github.com\/stanleyhuangyc\/Freematics\" target=\"_blank\" rel=\"noopener\">Github<\/a>.<\/p>\n<h2>PlatformIO<\/h2>\n<p>The code of Telelogger can be loaded as a PlatformIO project. You need to install <a href=\"http:\/\/platformio.org\/platformio-ide\" target=\"_blank\" rel=\"noopener noreferrer\">PlatformIO IDE<\/a> which is built on top of Microsoft <a href=\"https:\/\/code.visualstudio.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Visual Studio Code<\/a>.<\/p>\n<p>Once IDE installed, load the folder of telelogger and the project is ready for developing and compiling. The first loading may take a while as the ESP32 package is downloaded and installed on demand.<\/p>\n<p>While waiting for the IDE to get ready, use USB cable to connect Freematics ONE+ to your computer&#8217;s USB port. PlatformIO will automatically detect serial port and normally you don&#8217;t need to alter it to start uploading.<\/p>\n<p><a href=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_serial.png\" rel=\"shadowbox[sbpost-6547];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-6550\" src=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_serial-1024x752.png\" alt=\"\" width=\"669\" height=\"491\" srcset=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_serial-1024x752.png 1024w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_serial-300x220.png 300w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_serial-768x564.png 768w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_serial-220x161.png 220w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_serial.png 1441w\" sizes=\"auto, (max-width: 669px) 100vw, 669px\" \/><\/a><\/p>\n<p>PlatformIO has built-in serial monitor. Once the uploading is done, and if Freematics ONE+ is in your car&#8217;s OBD-II port or you have a <a href=\"https:\/\/freematics.com\/pages\/products\/freematics-obd-emulator-mk2\/\" target=\"_blank\" rel=\"noopener noreferrer\">Freematics OBD-II Emulator<\/a> which can be more convenient, you can open the serial terminal to monitor the working status from the serial output right away.<\/p>\n<p><a href=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_upload.png\" rel=\"shadowbox[sbpost-6547];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-6551\" src=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_upload-1024x752.png\" alt=\"\" width=\"669\" height=\"491\" srcset=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_upload-1024x752.png 1024w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_upload-300x220.png 300w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_upload-768x564.png 768w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_upload-220x161.png 220w, https:\/\/freematics.com\/pages\/wp-content\/uploads\/2017\/06\/pio_f1p_upload.png 1441w\" sizes=\"auto, (max-width: 669px) 100vw, 669px\" \/><\/a><\/p>\n<h2>ESP-IDF<\/h2>\n<div class=\"post-content\">\n<p><a href=\"https:\/\/github.com\/stanleyhuangyc\/Freematics\/releases\/tag\/telelogger\" target=\"_blank\" rel=\"noreferrer noopener\">Telelogger ESP-IDF package<\/a> integrates <a href=\"https:\/\/github.com\/stanleyhuangyc\/Freematics\/tree\/master\/firmware_v5\/telelogger\" target=\"_blank\" rel=\"noreferrer noopener\">telelogger<\/a>, <a href=\"https:\/\/github.com\/stanleyhuangyc\/Freematics\/tree\/master\/libraries\/FreematicsPlus\" target=\"_blank\" rel=\"noreferrer noopener\">Arduino library<\/a> and <a href=\"https:\/\/github.com\/espressif\/arduino-esp32\" target=\"_blank\" rel=\"noreferrer noopener\">ESP32 Arduino core<\/a> and can be configured and built within <a href=\"https:\/\/docs.espressif.com\/projects\/esp-idf\/en\/latest\/esp32\/get-started\/index.html\" target=\"_blank\" rel=\"noreferrer noopener\">ESP-IDF<\/a>, ESP32\u2019s software development environment, giving users full control over how firmware is built for Freematics ONE+.<\/p>\n<p>A configuration page dedicated to telelogger is inserted in the configuration system.<\/p>\n<p>To enter the configuration system, use following command from ESP-IDF command-line.<\/p>\n<pre class=\"wp-block-code\"><code>idf.py menuconfig<\/code><\/pre>\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-config.png\" rel=\"shadowbox[sbpost-6271];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6272\" src=\"https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-config.png\" sizes=\"auto, (max-width: 703px) 100vw, 703px\" srcset=\"https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-config.png 703w, https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-config-300x225.png 300w\" alt=\"\" width=\"703\" height=\"527\" \/><\/a><\/figure>\n<p>Once configured, complete firmware image can be built with following command.<\/p>\n<pre class=\"wp-block-code\"><code>idf.py build<\/code><\/pre>\n<p>If successful, firmware can be uploaded to Freematics ONE+, running and serial output monitored with following command.<\/p>\n<pre class=\"wp-block-code\"><code>idf.py -p [serial port] flash monitor<\/code><\/pre>\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-running.png\" rel=\"shadowbox[sbpost-6271];player=img;\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-6273\" src=\"https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-running.png\" sizes=\"auto, (max-width: 1016px) 100vw, 1016px\" srcset=\"https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-running.png 1016w, https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-running-300x211.png 300w, https:\/\/blog.freematics.com\/wp-content\/uploads\/2022\/12\/esp-idf-telelogger-running-768x541.png 768w\" alt=\"\" width=\"1016\" height=\"716\" \/><\/a><\/figure>\n<\/div>\n<h2>Freematics Builder<\/h2>\n<p><a href=\"https:\/\/freematics.com\/pages\/software\/arduino-builder\/\" target=\"_blank\" rel=\"noopener noreferrer\">Freematics Builder<\/a> is a self-contained utility for compiling and uploading Arduino sketch to Freematics products. It is especially handy for non-developers.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" id=\"sb-player\" class=\"aligncenter\" src=\"https:\/\/freematics.com\/pages\/wp-content\/uploads\/2022\/11\/builder_7070.png\" width=\"756\" height=\"758\" \/><\/p>\n<h1>Links<\/h1>\n<ul>\n<li><a href=\"https:\/\/freematics.com\/products\/freematics-one-plus-model-b\/\">Freematics ONE+ Product Page<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/stanleyhuangyc\/Freematics\/tree\/master\/libraries\/FreematicsONE\">Arduino Library<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/stanleyhuangyc\/Freematics\/tree\/master\/firmware_v5\">Arduino Sketches<\/a><\/li>\n<li><a href=\"http:\/\/freematics.com\/pages\/software\/freematics-data-logging-format\/\" target=\"_blank\" rel=\"noopener noreferrer\">Freematics Packed Data Format<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Freematics ONE+ is based on ESP32 and can be programmed as an Arduino platform. We provide Arduino library and reference code for the hardware on which developers can evolve their own products with least efforts. If you are a pro, we highly recommend to use PlatformIO IDE or ESP-IDF as the development environment. For beginners, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":6529,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-6547","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/pages\/6547","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/comments?post=6547"}],"version-history":[{"count":26,"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/pages\/6547\/revisions"}],"predecessor-version":[{"id":7837,"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/pages\/6547\/revisions\/7837"}],"up":[{"embeddable":true,"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/pages\/6529"}],"wp:attachment":[{"href":"https:\/\/freematics.com\/pages\/wp-json\/wp\/v2\/media?parent=6547"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}