dgatf / msrc

Multi Sensor for RC with RP2040 - FrSky D, SmartPort, XBUS, SRXL, IBUS, SBUS, Multiplex Sensor Bus, Jeti Ex Bus, Hitec, CRSF, Sanwa
GNU General Public License v3.0
176 stars 43 forks source link

MSRC - Multi Sensor for RC - RP2040 - Smartport, Frsky D, XBUS, SRXL, IBUS, SBUS2, Multiplex Sensor Bus, Jeti Ex Bus, Hitec, CRSF, Sanwa

Donate

This is a DIY project to send sensors telemetry for a fraction of the weight and cost of the stock sensors. It adds support for several ESC telemetry protocols.

Compatible RX protocols:

Compatible ESCs: Hobbywing V3/V4/V5/Flyfun, Kontronik Kosmic/Kolibri/JivePro, Castle Link, APD F/HV/UHV, phase sensor/PWM signal.

Compatible MCUs: RP2040. Any model is compatible. Recommended RP2040 Zero, for size and GPIO selection.

Implemented sensors:

All sensors are optional. Make the circuit with the desired sensors and enable them in the configuration. It can be configured from the PC with msrc_gui.

(1) If ESC doesn't arm, enable ESC Init Delay or connect MSRC after the ESC is armed
(2) Supported: Kosmic, Kolibri, JivePro. Not supported: Jive.

Summary

1.Binaries
2.Connections
3. Power source
4. Flash firmware to RP2040
5. Configuration
5.1 From PC - MSRC gui
5.2. From transmitter using lua script (only Smartport)
6. Receiver protocol
6.1 SMARTPORT
6.2 FRSKY D
6.3 Spektrum XBUS
6.4 Spektrum SRXL
6.5 Flysky IBUS
6.6 Futaba SBUS 2
6.7 Multiplex Sensor Bus (MSB)
6.8 Jeti Ex Bus
6.9 Hitec
6.10 Serial Monitor
6.11 CRSF
6.12 Sanwa
7. Sensors
7.1. ESC
  7.1.1 Hobbywing Platinum V3
  7.1.2 Hobbywing Platinum V4 / FlyFun
  7.1.3 Hobbywing Platinum V5
  7.1.4 Kontronik Kosmic/Kolibri/JivePro
  7.1.5 Kiss (APD F, blheli32, Summit X)
  7.1.6 APD UHV/HV series
  7.1.7. PWM signal
  7.1.8. Castle Link
  7.1.9. Available ESC telemetry
  7.1.10. RPM multipliers
7.2. Serial GPS
7.3. Analog sensors
  7.3.1. Voltage divider
  7.3.2. Temperature sensors (NTC thermistors)
  7.3.4. Airspeed sensor (MPXV7002)
7.4. Vario sensors (I2C sensors)
7.5. Fuel Flow sensor
8. OpenTx sensors (Smartport)
9. Annex
9.1. ESC protocol specifications Hobbywing
9.2. ESC protocol specifications Castle Link
9.3. ESC protocol specifications Kontronik
9.4. Output PWM signal for FBL
9.5. ADC voltage
9.6. Analog voltage sensors. Voltage divider circuit
9.7. Temperature sensors. Thermistors
9.8. Current
9.9. Air Speed
9.10. Altitude
10. Change log
11. Support

1. Binaries

File to flash to RP2040: MSRC-RP2040.uf2

PC application for configuration:

2. Connections

Connections to RP2040 in the table bellow are GPIO numbers, which are the same for all RP2040 boards. Pin numbers are different depending on the board.

| Sensor/Receiver | Board GPIO| | :---: | :---: | | 3.3-5v | 5v | | GND | GND | | Smartport, SBUS, SRXL, IBUS, SB, Jeti Ex, CRSF, Sanwa | 0(1) & 1 | | Frsky D | 0 | | Hitec, XBUS SDA | 2(2) | | Hitec, XBUS SCL | 3(2) | | ESC serial, Serial monitor | 5 | | Phase sensor (PWM in) | 5 | | Castle. Receiver signal | 4 | | Castle. ESC signal | 5(2) | | GPS | 6 | | XBUS. NPN clock stretch(3) | 7 | | Sensor SDA | 8(2) | | Sensor SCL | 9(2) | | PWM out | 10 | | Fuel meter PWM in | 11 | | Voltage | 26 | | Current | 27 | | NTC | 28 | | Airspeed | 29 |

(1) with 1k resistor
(2) for older receivers like TM1000 & TM110, 1k-3.3k pull up resistors are needed. For newer receivers with both XBUS and SRXL2 ports, no pull ups are needed. If incorrect choice, XBUS won't work. Try the other option if no telemetry is shown in transmitter
(3) Optional

Status led of the board blinks when sending telemetry. If it doesn't blink check connections and config.


RP2040 Zero pinout

3. Power source

RP2040 Zero has to be powered with 5v or less. For higher voltage, a voltage regulator is needed.

It can be powered from the telemetry port or from BEC. Some receivers deliver 5v or less at the telemetry port, even if BEC voltage is higher than 5v. Check that voltage supplied to RP2040 is not higer than 5v.

4. Flash firmware

Press BOOT button during startup and paste the binary file MSRC-RP2040.uf2 to RP2040 folder

If you want to build the firmware for the RP2040 yourself:

Install RP2040 SDK

git clone --recurse-submodules https://github.com/dgatf/msrc.git
cd board
mkdir build
cd build
cmake ..
make

File to flash: project/MSRC-RP2040.uf2

5. Configuration

5.1. From PC - MSRC gui

Connect RP2040 to USB and update config with msrc_gui. msrc_gui.AppImage for Linux and msrc_gui.exe for windows. After update reboot RP2040 manually.


Debug mode can be enabled and viewed with msrc_gui.


If you want to build msrc_gui: - Install [QT](https://www.qt.io/) - Install Qt serial port library (Use _Maintenance Tool_ or in Ubuntu *sudo apt install libqt5serialport5-dev*) - _cd msrc_gui_ - _mkdir build_ - _cd build_ - _qmake .._ - _make_ ### 5.2. From transmitter using lua script (only Smartport) It is recommended to update config with *msrc_gui* as not all parameters are implemented in lua script. The configuration is modified with a lua script (X7, X9, X-lite and Horus with openTx 2.2 or higher)

Copy the file msrc.lua to the SCRIPTS/TOOLS folder. (if using older openTx 2.2 copy to SCRIPTS folder and execute by long press) Options: - ESC protocol. HobbyWing Platinum V3, HobbyWing Platinum V4/Hobbywing Flyfun V5 or PWM signal - Voltage. Enable/disable analog voltage divider 1 - Ntc. Enable/disable analog thermistor 1 - Current. Enable/disable analog current - Airspeed. Enable/disable analog airspeed sensor - PWM out. Enable/disable analog a PWM signal from RPM values from ESC serial - GPS. Enable/disable serial GPS - Averaging queue size: 1 to 16 - Refresh rate (ms): 0 to 1600 - I2C. Sensor type and address ## 6. Receiver protocol The following Rx protocols are supported: - Frsky Smartport: inverted serial, 57600 bps - Frsky D: inverted serial, 9200 bps - Spektrum XBUS: I2C - Spektrum SRXL V5: serial, 115200 bps - Flysky IBUS: serial, 115200 bps - Futaba SBUS2: inverted serial, 100000 bps - Multiplex Sensor Bus: serial, 38400 bps - Jeti Ex Bus: serial 125000, 250000 bps - Hitec: I2C - Serial Monitor. This is not a Rx protocol, but a serial monitor on GPIO5 - CRSF: serial, 416666 bps - Sanwa: serial, 115200 bps ### 6.1 SMARTPORT Connect MSRC to Smartport. ### 6.2 FRSKY D Connect MSRC the telemetry port. ### 6.3 Spektrum XBUS Auto-config may be used to detect the new sensors. For older telemetry receivers with only XBUS port like TM1000 and TM1100, pull up resistors are needed. For newer receivers with both XBUS and SRXL2 ports, pull up resistors are not needed. In either case it has to be the correct option, otherwise XBUS won't work. So, if no telemetry shown in transmitter try the other option (with or without pull ups). One of the two posibilities will work. (Thanks RCG_KevinB & Kallend from RCGroups for solving this issue).


XBUS port

### 6.4 Spektrum SRXL Spektrum SRXL is bidirectional with telemetry, other SRXL are unidirectional. See [SRXL](https://wiki.beastx.com/index.php?title=SRXL_-_Serial_Receiver_Link_protocol/en).


Spektrum SRXL

### 6.5 Flysky IBUS Connect MSRC to sensor port. ### 6.6 Futaba SBUS 2 Slots sensor mapping for Futaba transmitters:
| Slot | Sensor | | :----: | :----------------------------------: | |0 | RX voltage (reserved) | |1 | Temperature 1 (SBS-01T/TE) | |2 | RPM (type magnet)(SBS-01RB/RM/RO) | |3-4 | Vario-F1672 | |6-7 | Voltage (SBS-01V) | |8-15 | GPS-F1675 (2) | |16 | Air speed (SBS-01TAS) | |17-23 | Unused | |24-26 | Current 1 (SBS-01C) | |27-29(2)| Current 2 (SBS-01C) | |30(2) | Temperature 2 (SBS-01T/TE) | |31 | Unused |
(1) Do not select default GPS (2) Non default slots Select protocol: FASSTest 18CH or T-FHSS Connect to SBUS2 port ### 6.7 Multiplex Sensor Bus (MSB) Connect to *Sensor* port


Sensor bus port

### 6.8 Jeti Ex Bus Configure receiver pin (E1 or E2) as Ex Bus. The maximum number of sensors (values) is 15. If more sensors are needed, use an another MSRC board and connect to E2 or to a *Jeti Telemetry Expander*. ### 6.9 Hitec If Vin is a regulated 5V source (e.g. receiver, BEC), pull ups can be connected to Vin/RAW instead Vcc. Use pull ups resistors 1k to 2.7k


Hitec Optima 7


Hitec Optima 9

### 6.10 Serial Monitor This is not a Rx protocol. No sensors are enabled. Enable a serial monitor on GPIO5 with the selected parameters. ### 6.11 CRSF Telemetry for CRSF does not cover all sensors in MSRC. Available sensors with CRSF are: GPS, vario and battery (voltage, current and consumption). ### 6.12 Sanwa Available sensors: - ESC temperature. - Motor temperature. In case the ESC provides BEC temperature, it is linked to this telemetry value. To measure motor temperature, enable analog temperature and use a ntc termistor attached to the motor. It overrides BEC temperature if available from the ESC. - Rpms. - Voltage. ## 7. Sensors Available sensors: - ESC - ESCs with serial telemetry: Hobbywing V3/V4/V5/Flyfun, Kontronik(2), Kiss (APD F, blheli32, Summit X), APD HV/UHV - ESC with PWM signal or phase sensor - ESC Castle Link - GPS serial (NMEA) - I2C sensors (vario): BMP180, BMP280, MS5611 - Analog sensors: voltage, temperature, current, air speed All sensors are optional. Make the circuit with the desired sensors and enable them in the configuration. It can be configured from the PC with msrc_gui. ### 7.1. ESC #### 7.1.1 Hobbywing Platinum V3 Serial protocol: 19200 baud. Telemetry port is the program port. It is a servo male plug on the ESC #### 7.1.2 Hobbywing Platinum V4 / FlyFun Serial protocol: 19200 baud. HW FlyFun. If ESC doesn't arm, enable _ESC Init Delay_ or connect MSRC after the ESC is armed. Optionally, for Hobbywing Flyfun and APD F-series, a PWM signal can be generated from the RPM telemetry value. Check your ESC firmware is not VBAR version. Telemetry port is the program port. It is a servo male plug on the ESC - Values for current when throttle is low (up to 25%, depending on model) may not be reliable. If getting high or noisy current values when throttle is low, adjust _Current_thresold_. Below this throttle percentage (0-100%), current values will be 0A - Set _Max Current_ to the peak current of the ESC (eg: 80A: _Max Current_ 100) - Adjust _Voltage Divisor__ and _Current Multiplier__, depending on model:
| Cells range | Voltage divisor | | :---: | :---: | | 3-6S (LV) | 11 | | 3-8S (LV v2) | 15.75 | | 5-12s (HV) | 21 | | 6-14s (HV v2) | unknown | | Amperage | Current multiplier | | :---: | :---: | | FlyFun 60A | 670 | | FlyFun 80A | 320 | | 100A | 440(1) | | Platinum V4 120A | 400 | | 130A | 350(1) | | 150A | 310(1) | | 160A | 290(1) | | Platinum V4 200A | 240 |
(1) Extrapolated from confirmed models. If you find discrepancy adjust gain parameter and send gain and ESC model to update the table #### 7.1.3 Hobbywing Platinum V5 Serial protocol: 115200 baud. #### 7.1.4 Kontronik Kosmic/Kolibri/JivePro Serial protocol: 115200 baud, even parity. Supported models: Kosmic, Kolibri, JivePro. Not supported: Jive. #### 7.1.5 Kiss (APD F, blheli32, Summit X) Any ESC with Kiss telemetry: APD F, blheli32, Summit X. __APD F__ Telemetry port for APD F: pin T Types of telemetry: - *RPM output* it is a PWM signal with the RPMs. Select PROTOCOL_PWM and connect to pin PWM in as noted in [connections table](#1-connections) - *PWM telemetry*. For this type of telemetry you need to flash [beta firmware](https://docs.powerdrives.net/products/firmware-installation/f_series-beta-configurable-firmware). It provides serial telemetry with RPMs, voltage, current and temperature. Select PROTOCOL_APD_F. Connect ESC pin T to pin Rx as defined in [connections table](#1-connections). #### 7.1.6 APD UHV/HV series Serial telemetry with RPMs, voltage, current and temperature. #### 7.1.7. PWM signal If the ESC have a PWM signal or a phase sensor is installed, RPMs can be measured. If ESC have both serial and PWM signal, like Hobbywing V4/V5, then PWM signal is not needed for telemetry #### 7.1.8. Castle Link The telemetry is send over the ESC signal. *Castle Link* has to be enabled in the ESC config #### 7.1.9. Available ESC telemetry | Model | RPM | Throttle | Motor PWM | Voltage | Current | Voltage BEC | Current BEC | Temperature 1 | Temperature 2 | Ripple Volt | | ------------------ | :---------: | :---------: | :---------: | :---------: | :-------: | :---------: | :---------: | :-----------: | :-----------: | :---------: | | Hobbywing V3 | :heavy_check_mark: | :heavy_check_mark:(1) | :heavy_check_mark:(1) | | | | | | | | | Hobbywing V4/V5(4)(5) | :heavy_check_mark: | :heavy_check_mark:(1) | :heavy_check_mark:(1) | :heavy_check_mark: | :heavy_check_mark:(2) | | | :heavy_check_mark: FET | :heavy_check_mark: BEC | | | Castle Link | :heavy_check_mark: | :heavy_check_mark:(1) | :heavy_check_mark:(1) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark:(3) | :heavy_check_mark:(3) | :heavy_check_mark: | | :heavy_check_mark: | | Kontronik | :heavy_check_mark: | :heavy_check_mark:(1) | :heavy_check_mark:(1) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: Power amp | :heavy_check_mark: BEC | | | APD F | :heavy_check_mark: | :heavy_check_mark:(1) | :heavy_check_mark:(1) | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | | | | APD HV/UHV | :heavy_check_mark: | :heavy_check_mark:(1) | :heavy_check_mark:(1) | :heavy_check_mark: | :heavy_check_mark: | | | :heavy_check_mark: | | | (1) Available but not forwarded to smartport (2) For 80A models and higher (3) Not available in all models (4) Sensors varies depending on model and firmware. See [annex](#Hobbywing-V4-V5) (5) Upgrade to latest firmware version. But note VBAR versions of firmware are not compatible. Install a non VBAR version of the ESC firmware If voltage is available the cell voltage average is calculated for 3S,4S,5S,6S,7S,8S,10S and 12S batteries. 10 seconds after power on the number of cells is autodetected. Average cell voltage to be >3.8v for correct cell count If current is available, battery consumption is calculated in mAh #### 7.1.10. RPM multipliers Adjust RPMs in *msrc_gui*: - Set the number of pair of poles of the motor, _Pair of poles_ - For helis also set the pinion and main gear teeth: _Pinion teeth_, _Main teeth_ Alternatively this can be done in the transmitter ### 7.2. Serial GPS Serial GPS (NMEA protocol) is supported. Select the same baudrate as the GPS module. ### 7.3. Analog sensors #### 7.3.1. Voltage divider Calibrate voltage analog sensors with _Voltage multiplier_. Or from opentx, but it is recommended in order to increase sensor resolution Multiplier = (R1+R2)/ R2 #### 7.3.2 Temperature sensors (NTC thermistors) No need to calibrate. For fine tuning adjust in ntc.h: NTC_R_REF, NTC_R1, NTC_BETA #### 7.3.3. Current sensor Calibrate current analog sensor from msrc_gui. Or from opentx, but it is recommended in order to increase sensor resolution Set sensor type: - Hall effect (ACS758, Amploc). Multiplier = 1000 / sensitivity(mV/A). Select auto-offset or set zero current output voltage (Viout), which us the voltage at current 0 - Shunt resistor sensor. Multiplier = 1000 / (ampgain * resistor(mΩ)) #### 7.3.4. Airspeed sensor Vcc for the airspeed sensor must be 5V. The maximum readable output the sensor is 3.3V due to the rp2040 ADC range : 0-3-3V The limits the maximum speed to about 120km/h. Over 3.3V output the reading is the same as for 3.3V. It won't damage the rp2040 as Vout current is 0.1mA. If higher speed measurement (up to 170km/h) is needed, an stepdown has to be added. But this is still not added to the code. Relation between Vout and delta pressure.


MPXV7002

If a barometer sensor is installed, you'll get more accurate airspeed values as air density is calculated with actual temperature and pressure. Otherwise following default values are used: 20ºC and 101325Pa. Parameters: slope = Vcc/5. Nominal value is 1 offset = ±6.25% VFSS = ±0.25. Nominal value is 0 Transformation formula: Transformation formula with MSRC parameters: Air density calculation: R -> dry air constant Airspeed calculation: TAS -> airspeed (m/s) ### 7.4. I2C sensors The following I2C sensors are suported: - Barometer: BMP180, BMP280, MS5611 ### 7.5. Fuel flow sensor Note: only XBUS for now Fuel flow sensor with PWM pulses are supported. It is neded to set the parameter ml/pulse. If this parameter is unknown, to calibrate: - Measure the weight of the tank or the model - Enable Fuel Flow sensor in msrc_gui - Then either: - Set the parameter ml/pulse to 1 and then the number of pulses will be the consumption in your transmitter - Enable log in msrc_gui and note the number of pulses - After a while, stop the engine. Note the last number for pulses - Weight the tank or model again and use the folloing formula to obtain the parameter: ρ -> fuel density (g/m3) ΔWeight -> g ## 8. OpenTx sensors (Smartport) The default sensor id is 10. This can be changed with [change_id_frsky](https://github.com/dgatf/change_id_frsky) Depending on your configuration some the following sensors will be available in Opentx. After configuration go to sensors screen and update with *Search new sensors* ESC: - ESC RPM: Erpm (0x0b60) - ESC voltage: EscV (0x0b50) - ESC cell average: Cells (0x300) - ESC current: EscA (0x0b50) - ESC consumption: EscC (0x0b60) - ESC temp FET (HW) or ESC temp linear (Castle): EscT (0x0b70) - ESC temp BEC (HW) or ESC temp NTC (Castle): EscT (0x0b71) - ESC ripple voltage: EscV (0x0b51) - ESC BEC voltage: BecV (0x0e50) - ESC BEC current: BecC (0x0e50) GPS: - GPS Lat/Lon: GPS (0x800) - GPS altitude: GAlt (0x820) - GPS speed: GSpd (0x820) - GPS compass: Hdg (0x840) - GPS date/time: Date (0x850) - GPS sats: 0x5103 Calculated: - Vario: 0x111 - Distance to home: 0x5104 Analog: - Voltage: A3 (0x0900) - Thermistor: Tmp1 (0x0400) - Current: Curr (0x020f) - AirSpeed: ASpd (0x0a00) I2C: - Altitude: Alt (0x0820) - Temperature: T1 (0x0401, 0x0402) Calculated: - Vario: 0x110 Some of the sensors have to be adusted in openTx ### 8.1. Adjust RPM sensor (Erpm) If not adjusted in MSRC config you can adjust in the sensor parameters in opentx: - Blades/poles: number of pair of poles * main gear teeth - Multiplier: pinion gear teeth ### 8.2. Adjust voltage sensors (A3, A4) Remark: Instead of adjusting the sensor in opentx, it is recommended to use _Voltage multiplier_ to increase the sensor resolution. Measure the voltage of the battery with a voltmeter and adjust *Ratio* in A3, A4 sensor. ### 8.3. Adjust analog current sensor (Curr) Remark: Instead of adjusting the sensor in opentx, it is recommended to use _Current multiplier_ to increase the sensor resolution If using a hall effect sensor, adjust the ratio: *25.5 x 1000 / output sensitivity (mV/A)* To calculate the battery consumption add a new sensor: - Type: Calculated - Formula: Consumption - Sensor: Curr ### 8.4. Calculate current consumption Battery consumption is calculatd since MSRC v0.9 Alternatively can be calculated by adding a calculated sensor in openTx: - Type: _Calculated_ - Formula: _Consumption_ - Sensor: _EscA_ or _Curr_ ## 9. Annex ### 9.1. ESC protocol specifications Hobbywing Serial parameters: - 19200 bps - 1 packet every 20 ms - Big endian #### 10.1.1. Hobbywing V3 | Byte | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | | ----- | :-----------------: | :--------------: | :--------------: | :--------------: | :-----------: | :------------: | :----------: | :----------: | :---------: | :---------: | | Value | Package Head (0x9B) | Package Number 1 | Package Number 2 | Package Number 3 | Rx Throttle 1 | Rx Throttle 2 | Output PWM 1 | Output PWM 2 | RPM Cycle 1 | RPM Cycle 2 | *RPM = 60000000 / RPM Cycle* thr, pwm: 0-255 (8bits) #### 10.1.2. Hobbywing V4 V5 | Byte | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | | --- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | Value | Package Head (0x9B) | Package Number 1 | Package Number 2 | Package Number 3 | Rx Throttle 1 | Rx Throttle 2 | Output PWM 1 | Output PWM 2 | RPM 1 | RPM 2 | RPM 3 | Voltage 1 | Voltage 2 | Current 1 | Current 2 | TempFET 1 | TempFET 2 | Temp 1 | Temp 2 thr, pwm: 0-1024 (10bits) Voltage, current and temperature are raw sensor data. Actual values requires transformation. Depending on the model, sensors are different Before throttle is raised from 0, signature packets are sent between telemetry packets. This is used to identify the hardware and firmware of the ESC Examples: | Model\Byte | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | | ---------- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | V4LV25/60/80A | 0x9B | 0x9B | 0x03 | 0xE8 | 0x01 | 0x08 | 0x5B | 0x00 | 0x01 | 0x00 | 0x21 | 0x21 | 0xB9 | | V4HV200A OPTO | 0x9B | 0x9B | 0x03 | 0xE8 | 0x01 | 0x02 | 0x0D | 0x0A | 0x3D | 0x05 | 0x1E | 0x21 | 0xB9 | | V5HV130A OPTO | 0x9B | 0x9B | 0x03 | 0xE8 | 0x01 | 0x0B | 0x41 | 0x21 | 0x44 | 0xB9 | 0x21 | 0x21 | 0xB9 | ### 9.2. ESC protocol specifications Castle Link For best accuracy RX pulse input is captured with a timer interrupt and ESC pulse output is produced by hardware PWM. Maximum latency is 20ms See [Castle Link Live](https://dzf8vqv24eqhg.cloudfront.net/userfiles/4671/6540/ckfinder/files/Product%20Manuals/Accessories%20and%20replacement%20parts/castle_link_live_2_0.pdf?dc=201606221536-537) ### 9.3. ESC protocol specifications Kontronik Supported models: Kosmic, Kolibri, JivePro. Protocol [specs](https://www.kontronik.com/fileadmin/kontronik-sobek/Public/Content/Images/Content/Downloads/Software/Kontronik_TelMe_V4.12_1.12_EN.pdf) Note that there is another protocol used by Kontronik Jive at 9600 that it is not supported. Info [here](https://www.helifreak.com/showthread.php?t=721180) ### 9.4. Output PWM signal for FBL For best accuracy PWM signal output for FBL is produced by hardware PWM from serial RPM values. Maximum latency is 40ms ### 9.5. ADC voltage To obtain the voltage at the analog pin it is required the ADC bits (b) and the Vref:
### 9.6. Analog voltage sensors. Voltage divider circuit Two battery voltages can be measured through the analog pins A2 and A3 Metal resistors are recommended as gives more accurate readings (0.1W or higher) Maximum voltage is 3.3V

To select R values apply formulas:
For 6S battery (or lower) and Pro Mini 3.3v: - R1 68k - R2 10k In this case ratio is 7.8 If more than 6S change R values or you may burn the board! ### 9.7. Temperature sensors. Thermistors Two temperature sensors can be installed through the analog pins A0 and A1 Temperature is measured with NTC thermistors (100k). Adjust thermistor Beta in ntc.h if needed (NTC_BETA, default is 4190). Sensor output in Celsius

To obtain the thermistor resistance: And temperature with Beta formula: Or with Steinhart and Hart Equation if data is available: ### 9.8. Current #### 10.8.1. Hall effect Hall effect sensors. Induced magnetic field is transformed into voltage. They are caracterized by their sensitivity #### 10.8.1. Shunt resistor The voltage drop in the shunt resistor is amplified by a differential amplifier to obtain Vo

### 9.9. Air Speed ### 9.10. Altitude Altitude is calculated using the barometric formula: *R = universal gas constant: 8.3144598 J/(mol·K) g = gravitational acceleration: 9.80665 m/s2 M = molar mass of Earth's air: 0.0289644 kg/mol L = temperature lapse rate (K/m): 6.5 C/km T = temperature at h (K) Po = pressure at ground (Pa)* 5 seconds after boot, pressure reference, Po, is set ## 10. Change log v1.1 - Fixed Xbus negative values and improve vspeed accuracy - Updated sdk and third party libraries to support new hardware - Fixed analog current - Added support for CRSF protocol - Added support for Sanwa protocol - Improved airspeed calculation and linked to barometer if installed to get more accurate aurspeed value - msrc_gui. Manage different config versions [v1.0](https://github.com/dgatf/msrc/tree/v1.0) - Ported to RP2040 [v0.9](https://github.com/dgatf/msrc/tree/v0.9) - HW V4/V5. Added throttle threshold and maximum current filters for current sensor. Values for current when throttle is low may not be reliable, depending on model - Added consumption calculation. Thanks MJ666 - Fixed Jeti Ex bug - HW V4/V5. Only one HW V4/V5 protocol. Voltage and current sensor parameters to be set manually - Added RPM multipliers. Motor poles and gears (for helis) - Changed serial drivers timeout to microseconds for fast protocols (e.g. Jeti Ex) - Allow additional Rx protocols & boards to be used with serial ESC and GPS. Use software serial only for Rx protocols, not sensors - GPS. Added HDOP, sats, vario and distance to home - IBUS. Fixed S32 type bug (GPS values) - XBUS. Added analog voltage2/ntc2 sensor - BMP280 and GPS. Added vertical speed calculation (vario) - Current analog. Added consumption - Added ESC support for APD F/HV/UHV - Added Hitec protocol - Fixed Futaba SBUS2 - Fixed Pololu compilation in Arduino IDE - Improved msrc_gui - Added support for MS5611 [v0.8](https://github.com/dgatf/msrc/tree/v0.8) - Added specific drivers for hardware serial and software serial - Added msrc_gui to create config.h (not all options are avaiable from gui) - Added Rx protocols: Frsky D, Spektrum XBUS, Spektrum SRXL V5, Flysky Ibus, Futaba SBUS2, Multiplex Sensor Bus, Jeti Ex Bus - Added support for ATmega328PB, ATmega2560, ATmega32U4, ARM Cortex M0+ and ARM Cortex M4 - Improved accuracy for PWM input (rpm) measurement - Added ESCs support for: Kontronik Kosmic/Kolibri/JivePro - Improved current calculation for HW V4/V5 [v0.7](https://github.com/dgatf/msrc/tree/v0.7) - Added analog airspeed sensor (MPXV7002) - Fixed Castle Link bug - Removed BMP180 - Fixed flickering in color lcd displays [v0.6](https://github.com/dgatf/msrc/tree/v0.6) - Added GPS serial (BN220, BN880, NEO-M8N,...) [v0.5](https://github.com/dgatf/msrc/tree/v0.5) - Added Castle Link Live protocol - Hobbywing V4/V5. Improved transformations for voltage and current depending on the model (thanks to Commodore8888) [v0.4.1](https://github.com/dgatf/msrc/tree/v0.4.1) - Fix Horus display [v0.4](https://github.com/dgatf/msrc/tree/v0.4) - Changed R3 resistor to 3.3k - Support for [change_id_frsky](https://github.com/dgatf/change_id_frsky) to change the sensor id - Support for I2C sensors - Improved code quality and performance - [Smartport_library](https://github.com/dgatf/smartport) improved performance and abstract from the smartport protocol [v0.3.1](https://github.com/dgatf/msrc/tree/v0.3.1) - Added cell voltage average (HW V4/V5, VFAS sensor) - Applied correct transformation for esc voltage, current and temperature (HW V4/V5) - Changed averaging type from SMA to EMA - Added esc protocol NONE - Smartport protocol. Minor improvements [v0.3](https://github.com/dgatf/msrc/tree/v0.3) - Esc current sensor (EscA) added (HW V4/V5, 80A or higher) - Averaging telemetry added - Voltage2 sensor changed from A3 to A4 - Ntc2 sensor changed from Tmp1 to Tmp2 - Averaging governor added - Refresh rate and averaging added to lua config script ## 11. Support For issues use github: [Issues](https://github.com/dgatf/msrc/issues) For questions use the forums: [RCGroups](https://www.rcgroups.com/forums/showthread.php?4088405-DIY-MSRC-Multi-sensor-telemetry-for-several-Rx-protocols#post48830585) [Helifreak](https://www.helifreak.com/showthread.php?t=908371) [Openrcforums](https://www.openrcforums.com/forum/viewtopic.php?f=84&t=11911) If you want to add support for new receiver protocol or new sensor, ask for it