Logger.S

From MS4X Wiki
Jump to: navigation, search

Logger.S is development board made for interfacing K-line (ISO 9141) / CAN (ISO15765-4) data signals.

It’s based on ESP32 dual-core MCU featuring Bluetooth and WiFi and can be programmed the same way as any ESP32-dev-board with Esp-idf or Arduino IDE.

If you want to see how device works and looks please refer to this video <==

DISCLAIMER: Note we do not take any responsibility for using firmware and files as they are given only for hobbyist/development use. All configuration files need to be created and checked by the user before usage to prevent potential damage to the car, driver or others.

It’s licensed on MIT license so both commercial and non-commercial use are permitted. Device features:

  • 2.8” TFT touch screen with 65k colours,
  • OBDII port,
  • CAN and K-line (ISO 9141) interface,
  • SD card up to 32GB FAT32 (used logging, firmware updates and configuration files),
  • 4 analog ADCs for 0-5V inputs (for eg. Wideband AFR),
  • USB-C,
  • Options to swap TFT/SD card and make use of different screen or reusing GPIOs used for the screen,
  • Bluetooth, Wi-fi and 2 serial ports – one for connecting over K-line, second for communication with USB, (3rd one can be used without screen).


Firmware

Firmware that device comes with is made by sorek.uk and is sole property of such. The code won’t be released public, although all firmware updates will be available on files.logger.sorek.uk


Firmware features v0.4:

  • Fully configurable commands by JSON file format (read more in section 4. Programming),
  • Standard and telegram type logging over K-line,
  • CAN retransmission of data from K-line/analog sensors (eg. for telemetry devices),
  • 4 graphs, 4 gauges for data we want to display,
  • Baud change commands for faster logging,
  • SD card logging of all defined values,
  • Pausing graphs, min/max values showing and resetting,
  • Bluetooth and USB handle (recommended ALDLdroid for Android and RomRaider for PC – they work both with Bluetooth AND USB),
  • Auto-sleep mode after 30s of inactivity,
  • Initially made for MS41, MS41.2, MS42, MS43 Siemens ECUs but can be used for anything (not only ECUs!) provided right configuration.

Firmware can be updated easily copying update.bin to SD card and turning on the device.

Hardware

Logger.S v2.0 features:

  • USB type C (that can be used both for communicating with car or for programming the device),
  • SD card slot (for big sized SD cards up to 32GB formatted in FAT32),
  • 3-position switch (program – on - off),
  • 7-pin connector (see fig. 1 below),
  • Standard OBDII connector (see fig. 2 below).

Fig 1. (1 is from left when looking at the connector on device, K is K-line)

Fig.1.jpg


Fig 2.

Fig.2.jpg

Configuration files

Configuration (definitions) by default file named ecus.json is read from SD card, copied to internal memory and read from it each time new ECU at start up is spotted. It reads from it all commands that match ECU id. Currently ID request is only one command but it will be changeable in newer revisions of firmware.

config.json

This file lets you configure your device and point to which .json file for car definitions shall it use.

{
	"definitionFile": "/ecus2.json", // Start with '''/''' and name file you wish to use from SD card
	"rotation": 1, // Rotation for device, 3 is landscape inverted, every other is not guaranteed to work (for now at least)
	"forceLog": false, // You can force log to SD card when available, pressing SD card button will make new file
	"logFromStart": false, // if device was logging and went to sleep, it will start logging automatically once it wakes up, here you can force it to always start logging when device boots up
	"sleepTime": 30 // you can customize time device will go to sleep after X seconds, 0 for disabling sleep time, default is 30
}

Modes

Configuration (definition) file (ecus.json) is JSON document that contains main JSON-array to store rest of the data, it starts with [ and ends with ] and then every entity is listed starting with { and ending with }. Field “config” must be defined (otherwise it will default to null), below is current list of config options:

CONFIG_NORMAL 0
CONFIG_ANALOG 1
CONFIG_TELEGRAM 2
CONFIG_CHANGE_BAUD 3
CONFIG_CAN 4
.
.
.
CONFIG_NULL 255 // telegram message will be skipped (good if we 
				just want to turn it off without deleting data in 
				the file

CONFIG_NORMAL 0

Normal data config that lets you request data from the engine and then filter data by the offset.

Example:

[{
	"id": 42, // Id of the definition, iterated automatically, but best if predefined, especially for CONFIG_NORMAL 

	"ecus": ["1429764", "1430844", "7526753", "7500255"], // List of ECUs that definition applies to

	"config": 0, // MOST IMPORTANT - our config mode

	"address": "0x12050B031F", // Address of the commmand that is send to ECU to request data, up to length of 5 it's easier to use it like this
	// Alternatively reccomended use is always: "address": ["0x12", "0x05", "0x0B", "0x03", "0x1F"]

	"ecuparam": [ // We define what type of data we want to retrieve from our command
	{
		"header": "Battery Voltage", // String name used both for buttons and for SD card logging
		"unit": "V", // Unit string

		"offset": 20, // Offset at which data can be found; defaults to 0

		"length": 1, // Length of data 1 for 8-bit byte, 2 for 16-bit word (uint16_t or unsinged int); defaults to 1 always

		"max": 20, // Max value to display on a graph; defaults to 5

		"min": 5, // Min value to display on a graph; defaults to 0

		"mul": 0.1015625, // data (byte or word depending on length) is multiplied by this value; defaults to 1

		"add": 0, // then data is being offseted (by simple adding) this value; defaults to 0

		"canOn": true, // if we want to use can retransmition we need to make it true; defaults to false

		"can": { // can message for retransmition
				"messageId": 790, // messageID is the ID of message we want to retransmit it on CAN

			"payload": 8, // if <=8 it will use STD Can frame, otherwise it's extended; defaults to 8

			"length": 2, // wheather we want to send 1 byte or 2 byte value; defaults to 1

			"offset": 0, // offset where we want our byte/word to be placed in CAN message

			"canMul": 0.1015625 // If we want, we can normalize data, for example if we already use device that expects it in certain format; defaults to 1

			"canAdd": 0, // if you want to send original data that came from ECU just use same values you used for param above;
				the formula is: 
				(data_calculated_from_param - canAdd)/canMul
				defaults to 0
			"canRepeat": true, // Defaults to false, needs to be only called once, forces CAN to re-transmit message at faster rate if duplicates aren't issue;
			"canSpeed": 500 // can speed, usually 500 or 1000 that we want to use; defaults to 500
			}
		},
		{
			"header": "Engine Speed",
			"unit": "RPM",
			"offset": 0,
			"length": 2,
			"max": 8000,
			"dec": 0, // number of decimal places to show/store on SD; defaults to 2
			"canOn": true,
			"can": {
				"messageId": 790,
				"offset": 2,
				"length": 2,
				"canMul": 1
			}
		}
}]

CONFIG_ANALOG 1

[{
	"config": 1, // lack of “ecus” will make this definition to be added to every ECU
	"address": "36", // address here is in DEC and corresponds to our GPIO for analog read,
	"ecuparam": [{
		"header": "Analog 3",
		"unit": "V",
		"max": 6,
		"mul": 0.001221
	}]
}]

CONFIG_ TELEGRAM 2

[{
	"ecus": ["1405854", "1429373", "1429861", "1432401", "1437806", "1440176", "1406464", "SHINDE1"],

	"config": 2, // telegram mode, offset and other things will be calculated automaticaly
			so you can skip them

	"address": "0x010000E8E4", // for simplicity 5 byte address is made to take it in
						fromat like this, avoid using it everywhere else

	"ecuparam": [{
		"paramEcus": ["1406464", "SHINDE1"], // you can separate messages for different
							telegrams or ommit it if all telegrams for
							those ECUs are the same
		"header": "Engine Load",
		"unit": "mg/str",
		"max": 1024,
		"mul": 0.021
	},
	{
		"paramEcus": ["1429861"],
		"address": "0x010000FAFC", // if for specific ECU address is different you can
							change it there,
		"header": "Engine Load",
		"unit": "mg/str",
		"max": 1024,
		"mul": 0.021
	},
	{
		"paramEcus": ["1437806"],
		"address": "0x010000FC52",
		"header": "Engine Load",
		"unit": "mg/str",
		"max": 1024,
		"mul": 0.021
	}]
}]

CONFIG_ BAUD 3

[{
	"config": 3, // It’s reccomdended only one of those are defineduse 255 (CONFIG_NULL) otherwise
	"ecus": ["1429764", "1430844", "7526753", "7500255", "7511570", "7519308", "7545150", "7551615"],
	"address": ["0x12", "0x08", "0x91", "0x00", "0x96", "0x00", "0x00", "0x1D"],
	"ecuparam": [{
		"value": 38400 // uint32_t value for target baud
	}]
}]

CONFIG_ CAN 4

Pending creation.  

Programming

Logger.S is development board made for interfacing K-line (ISO 9141) / CAN (ISO15765-4) data signals.

It’s based on ESP32 dual-core MCU featuring Bluetooth and Wi-fi and can be programmed the same way as any ESP32-dev-board with eg. Esp-idf or Arduino IDE.

To program we need to set our device into programming mode (left position on the switch).

Please refer to official DS2 library for more examples of code: https://github.com/handmade0octopus/ds2

NOTE: Some devices v2.0 have protection diode and need to be connected to +12V and won’t be able to start on just USB power without de-soldering this diode.