Commit edf655e571b5c916c05b0e63117604813972719b

Authored by yessine kammoun
1 parent e8023166

getting started wiki

FreematicsOBD/README.md deleted
1 -Directories  
2 -===========  
3 -  
4 -firmware_v4 - Arduino sketches and libraries for ATmega328p based [Freematics ONE](https://freematics.com/products/freematics-one)  
5 -  
6 -firmware_v5 - Arduino sketches for ESP32 based [Freematics ONE+](https://freematics.com/products/freematics-one-plus)  
7 -  
8 -ESPRIT - Arduino library and example sketches for ESP32 development board [Freematics Esprit](https://freematics.com/products/freematics-esprit) and [devkits based on it](https://freematics.com/products/#kits)  
9 -  
10 -libraries - Arduino libraries for ESP32 based Freematics ONE+ and Esprit  
11 -  
12 -server - [Freematics Hub](https://freematics.com/hub/) server source code  
FreematicsOBD/datalogger/README.md deleted
1 -This Arduino sketch is designed for running on [Freematics ONE+](https://freematics.com/products/freematics-one-plus/) to collect vehicle telemetry data from OBD-II, GPS and motion sensor and transmit the collected data to a remote server running [Freematics Hub](https://freematics.com/hub) software in realtime. It also has a mechansim for executing and responding to commands sent from serverside.  
2 -  
3 -Data Collection  
4 ----------------  
5 -  
6 -The sketch collects following data.  
7 -  
8 -* Vehicle OBD-II PIDs data (from OBD port)  
9 -* Battery voltage (from OBD port)  
10 -* Geolocation data (from cellular module's internal GNSS or external GNSS receiver)  
11 -* Acceleration data (from built-in MEMS sensor)  
12 -* Orientation data (computed from motion sensor data)  
13 -* Device temperature (from MEMS sensor or ESP32 built-in sensor)  
14 -  
15 -Data Transmissions  
16 -------------------  
17 -  
18 -Data transmission over UDP and HTTP protocols are implemented with following hardware.  
19 -  
20 -* WiFi (ESP32 built-in)  
21 -* WiFi Mesh (ESP-MDF for ESP32)  
22 -* GSM/GPRS (SIM800)  
23 -* 3G WCDMA (SIM5360)  
24 -* 4G LTE (SIM7600)  
25 -  
26 -UDP mode implements a client for [Freematics Hub](https://freematics.com/hub/). HTTP mode implements a client for [Traccar](https://www.traccar.org) under [OsmAnd](https://www.traccar.org/osmand/) protocol.  
27 -  
28 -Data Storage  
29 -------------  
30 -  
31 -Following types of data storage are supported.  
32 -  
33 -* MicroSD card storage  
34 -* ESP32 built-in Flash memory storage (SPIFFS)  
35 -  
36 -Remote Commands  
37 ----------------  
38 -  
39 -Commands can be sent to Freematics ONE+ for execution with results obtained, through serial terminal or by [Freematics Hub API](https://freematics.com/hub/api/) (remotely). Currently following commands are implemented.  
40 -  
41 -* LED [0/1/2] - setting device LED status (0:auto 1:always off 2:always on)  
42 -* REBOOT - performing a reboot immediately  
43 -* STANDBY - entering standby mode immediately  
44 -* WAKEUP - waking up the device from standby mode  
45 -* SET SYNC [interval in ms] - setting server sync checking interval  
46 -* STATS - returning some stats  
47 -* OBD [PID] - querying and returning specified OBD-II PID value (raw data)  
48 -  
49 -Viewing Trip Data  
50 ------------------  
51 -  
52 -Once the sketch is running and data is being submitted to hub.freematics.com, you can open https://hub.freematics.com from any of your devices and enter your device ID (displayed in serial output) to view real-time data and history trip data.  
53 -  
54 -![Freematics Hub Dashboard](https://freematics.com/pages/wp-content/uploads/2019/01/freematics_hub_dash-1024x576.png)  
55 -  
56 -Prerequisites  
57 --------------  
58 -  
59 -* [Freematics ONE+](https://freematics.com/products/freematics-one-plus/) or [Freematics ONE+ Model B](https://freematics.com/products/freematics-one-plus-model-b/)  
60 -* A micro SIM card if cellular network required  
61 -* [PlatformIO](http://platformio.org/), [Arduino IDE](https://github.com/espressif/arduino-esp32#installation-instructions) or [Freematics Arduino Builder](https://freematics.com/software/arduino-builder) for compiling and uploading code  
FreematicsOBD/datalogger/pids.txt deleted
1 -PID_POLLING_INFO obdData[]= {  
2 - {PID_SPEED,1},  
3 - {PID_AMBIENT_TEMP,1},  
4 - {PID_RPM,1},  
5 - {PID_ENGINE_REF_TORQUE,1},  
6 - {PID_RUNTIME,1},  
7 - {PID_BAROMETRIC,1},  
8 - {PID_FUEL_LEVEL,1},  
9 - {PID_HYBRID_BATTERY_PERCENTAGE,1}  
10 -};  
11 \ No newline at end of file 0 \ No newline at end of file
FreematicsOBD/datalogger/simple_obd_test.ino
@@ -70,16 +70,16 @@ void setup(){ @@ -70,16 +70,16 @@ void setup(){
70 //initialize MEMS device 70 //initialize MEMS device
71 init_MEMS_dev(); 71 init_MEMS_dev();
72 72
73 - 73 + //initialize OBD device
74 init_OBD_dev(); 74 init_OBD_dev();
75 75
76 - // turn on buzzer at 2000Hz frequency 76 + //turn on buzzer at 2000Hz frequency
77 sys.buzzer(2000); 77 sys.buzzer(2000);
78 delay(300); 78 delay(300);
79 - // turn off buzzer 79 + //turn off buzzer
80 sys.buzzer(0); 80 sys.buzzer(0);
81 81
82 - //creating queue with a size (15*sizeof(Irp*)) 82 + //creating queue with a size (25*sizeof(Irp*))
83 xQueue_print = xQueueCreate(25,sizeof(Irp*)); 83 xQueue_print = xQueueCreate(25,sizeof(Irp*));
84 84
85 //f=fmax 85 //f=fmax
@@ -105,7 +105,6 @@ void write_task_1(void* parameter) @@ -105,7 +105,6 @@ void write_task_1(void* parameter)
105 sleep_tme=OBD_looping(PIDs,nbr_elem,1); 105 sleep_tme=OBD_looping(PIDs,nbr_elem,1);
106 taskYIELD(); 106 taskYIELD();
107 ErrorOBDCheck(); 107 ErrorOBDCheck();
108 - Serial.println("OBD signal lost !");  
109 vTaskDelay(pdMS_TO_TICKS(sleep_tme)); 108 vTaskDelay(pdMS_TO_TICKS(sleep_tme));
110 } 109 }
111 vTaskDelete(NULL); 110 vTaskDelete(NULL);
PID_SPEED.png 0 โ†’ 100644

35.2 KB

  1 +# Carrying out a vehicle datalogger
  2 +
  3 +## Introduction
  4 + The goal of this project is to develop a kind of datalogger collecting different peaces of information from OBD-II (On-board diagnostics), GPS, and IMU (Inertial measurement unit) and to store them into a CSV file in an SD card.
  5 +The developped datalogger has to meet certain requirements to operate. These are:
  6 +
  7 +* [Freematics ONE+](https://freematics.com/products/freematics-one-plus/) board.
  8 +* [Freematics Arduino Builder](https://freematics.com/software/arduino-builder) for compiling and uploading code.
  9 +* [Freematics ONE+ Driver](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers).
  10 +* SD card.
  11 +
  12 +## How to run the project ?
  13 + Once you fullfil all the needs above, you clone the depository then you load the `./FreematicsOBD/datalogger/simple_obd_test.ino` using
  14 +the Freematics Arduino Builder. You choose the appropirate target board. Tick `Rebuild Core` and `Rebuild Llibs`. Finally, connect your board to the computer, click on refresh then click on the last added serial port to upload the project.
  15 + Now, you can connect the device to the OBD port of the vehicle. Turn on the engine and wait until you hear a bip from the board buzzer. At this time, the board is ready to collect information. If the buzzer does not work, you just reconnect the board and wait again.
  16 + If you want to see the data wriiten in SD card in real time and visualize them on your screen. You may need a longer USB wire. However,
  17 +you need to set `USE_SERIAL` to 1 (otherwise 0) which exists in the `./FreematicsOBD/datalogger/simple_obd_test.h`.
  18 + If you want to collect just GPS and IMU data while cycling you can power the board with a power bank. You will need to set `USE_OBD` to 1 (otherwise 0) which exists in the same header file.
  19 + In order to avoid collecting data during traffic jumps you can set `SLEEP_STOP` to 1 (otherwise 0). This make the board go in deep sleep for 5s.
  20 +
  21 +## How to visualize the collected data ?
  22 + To plot some magnitudes or the path you can use the python script. This script needs two arguments. The first one is the name of the CSV file. The second one is html file which can be opened with a navigator and see the journey path. You can also reduce the number of points
  23 +drawn on the map by uncommenting the call of rdp function. This one has a parameter called epsilon. The bigger epsilon is the lesser points you get.
  24 + To plot a magnitude you can follow the examples given in the script file.
  25 + Example of launching the python script: `python3 script_gps.py 27.CSV Trajet.html`.
  26 + ![Example of visualized GPS points](path.png)
  27 +
  28 + ![Example of plotting OBD Speed](PID_SPEED.png)
  29 +
  30 +
  31 +
path.png 0 โ†’ 100644

416 KB

rapport to52.pdf deleted
No preview for this file type