From edf655e571b5c916c05b0e63117604813972719b Mon Sep 17 00:00:00 2001 From: yessine kammoun Date: Thu, 28 Jan 2021 16:47:38 +0100 Subject: [PATCH] getting started wiki --- FreematicsOBD/README.md | 12 ------------ FreematicsOBD/datalogger/README.md | 61 ------------------------------------------------------------- FreematicsOBD/datalogger/pids.txt | 10 ---------- FreematicsOBD/datalogger/simple_obd_test.ino | 9 ++++----- PID_SPEED.png | Bin 0 -> 36031 bytes README.md | 31 +++++++++++++++++++++++++++++++ path.png | Bin 0 -> 426019 bytes rapport to52.pdf | Bin 1013738 -> 0 bytes 8 files changed, 35 insertions(+), 88 deletions(-) delete mode 100644 FreematicsOBD/README.md delete mode 100644 FreematicsOBD/datalogger/README.md delete mode 100644 FreematicsOBD/datalogger/pids.txt create mode 100644 PID_SPEED.png create mode 100644 path.png delete mode 100644 rapport to52.pdf diff --git a/FreematicsOBD/README.md b/FreematicsOBD/README.md deleted file mode 100644 index 4d0bd54..0000000 --- a/FreematicsOBD/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Directories -=========== - -firmware_v4 - Arduino sketches and libraries for ATmega328p based [Freematics ONE](https://freematics.com/products/freematics-one) - -firmware_v5 - Arduino sketches for ESP32 based [Freematics ONE+](https://freematics.com/products/freematics-one-plus) - -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) - -libraries - Arduino libraries for ESP32 based Freematics ONE+ and Esprit - -server - [Freematics Hub](https://freematics.com/hub/) server source code diff --git a/FreematicsOBD/datalogger/README.md b/FreematicsOBD/datalogger/README.md deleted file mode 100644 index 11c3c56..0000000 --- a/FreematicsOBD/datalogger/README.md +++ /dev/null @@ -1,61 +0,0 @@ -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. - -Data Collection ---------------- - -The sketch collects following data. - -* Vehicle OBD-II PIDs data (from OBD port) -* Battery voltage (from OBD port) -* Geolocation data (from cellular module's internal GNSS or external GNSS receiver) -* Acceleration data (from built-in MEMS sensor) -* Orientation data (computed from motion sensor data) -* Device temperature (from MEMS sensor or ESP32 built-in sensor) - -Data Transmissions ------------------- - -Data transmission over UDP and HTTP protocols are implemented with following hardware. - -* WiFi (ESP32 built-in) -* WiFi Mesh (ESP-MDF for ESP32) -* GSM/GPRS (SIM800) -* 3G WCDMA (SIM5360) -* 4G LTE (SIM7600) - -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. - -Data Storage ------------- - -Following types of data storage are supported. - -* MicroSD card storage -* ESP32 built-in Flash memory storage (SPIFFS) - -Remote Commands ---------------- - -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. - -* LED [0/1/2] - setting device LED status (0:auto 1:always off 2:always on) -* REBOOT - performing a reboot immediately -* STANDBY - entering standby mode immediately -* WAKEUP - waking up the device from standby mode -* SET SYNC [interval in ms] - setting server sync checking interval -* STATS - returning some stats -* OBD [PID] - querying and returning specified OBD-II PID value (raw data) - -Viewing Trip Data ------------------ - -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. - -![Freematics Hub Dashboard](https://freematics.com/pages/wp-content/uploads/2019/01/freematics_hub_dash-1024x576.png) - -Prerequisites -------------- - -* [Freematics ONE+](https://freematics.com/products/freematics-one-plus/) or [Freematics ONE+ Model B](https://freematics.com/products/freematics-one-plus-model-b/) -* A micro SIM card if cellular network required -* [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 diff --git a/FreematicsOBD/datalogger/pids.txt b/FreematicsOBD/datalogger/pids.txt deleted file mode 100644 index 7e1cdd1..0000000 --- a/FreematicsOBD/datalogger/pids.txt +++ /dev/null @@ -1,10 +0,0 @@ -PID_POLLING_INFO obdData[]= { - {PID_SPEED,1}, - {PID_AMBIENT_TEMP,1}, - {PID_RPM,1}, - {PID_ENGINE_REF_TORQUE,1}, - {PID_RUNTIME,1}, - {PID_BAROMETRIC,1}, - {PID_FUEL_LEVEL,1}, - {PID_HYBRID_BATTERY_PERCENTAGE,1} -}; \ No newline at end of file diff --git a/FreematicsOBD/datalogger/simple_obd_test.ino b/FreematicsOBD/datalogger/simple_obd_test.ino index 31840f7..6803c60 100644 --- a/FreematicsOBD/datalogger/simple_obd_test.ino +++ b/FreematicsOBD/datalogger/simple_obd_test.ino @@ -70,16 +70,16 @@ void setup(){ //initialize MEMS device init_MEMS_dev(); - + //initialize OBD device init_OBD_dev(); - // turn on buzzer at 2000Hz frequency + //turn on buzzer at 2000Hz frequency sys.buzzer(2000); delay(300); - // turn off buzzer + //turn off buzzer sys.buzzer(0); - //creating queue with a size (15*sizeof(Irp*)) + //creating queue with a size (25*sizeof(Irp*)) xQueue_print = xQueueCreate(25,sizeof(Irp*)); //f=fmax @@ -105,7 +105,6 @@ void write_task_1(void* parameter) sleep_tme=OBD_looping(PIDs,nbr_elem,1); taskYIELD(); ErrorOBDCheck(); - Serial.println("OBD signal lost !"); vTaskDelay(pdMS_TO_TICKS(sleep_tme)); } vTaskDelete(NULL); diff --git a/PID_SPEED.png b/PID_SPEED.png new file mode 100644 index 0000000..10cfa11 Binary files /dev/null and b/PID_SPEED.png differ diff --git a/README.md b/README.md index e69de29..41382de 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,31 @@ +# Carrying out a vehicle datalogger + +## Introduction + 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. +The developped datalogger has to meet certain requirements to operate. These are: + +* [Freematics ONE+](https://freematics.com/products/freematics-one-plus/) board. +* [Freematics Arduino Builder](https://freematics.com/software/arduino-builder) for compiling and uploading code. +* [Freematics ONE+ Driver](https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers). +* SD card. + +## How to run the project ? + Once you fullfil all the needs above, you clone the depository then you load the `./FreematicsOBD/datalogger/simple_obd_test.ino` using +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. + 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. + 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, +you need to set `USE_SERIAL` to 1 (otherwise 0) which exists in the `./FreematicsOBD/datalogger/simple_obd_test.h`. + 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. + 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. + +## How to visualize the collected data ? + 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 +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. + To plot a magnitude you can follow the examples given in the script file. + Example of launching the python script: `python3 script_gps.py 27.CSV Trajet.html`. + ![Example of visualized GPS points](path.png) + + ![Example of plotting OBD Speed](PID_SPEED.png) + + + diff --git a/path.png b/path.png new file mode 100644 index 0000000..a369b50 Binary files /dev/null and b/path.png differ diff --git a/rapport to52.pdf b/rapport to52.pdf deleted file mode 100644 index 3b8bf41..0000000 Binary files a/rapport to52.pdf and /dev/null differ -- libgit2 0.21.4