07. Sensors - dgatf/msrc GitHub Wiki
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 Link.
Model | RPM | Throttle | Motor PWM | Voltage | Current | Voltage BEC | Current BEC | Temperature 1 | Temperature 2 | Ripple Volt |
---|---|---|---|---|---|---|---|---|---|---|
Hobbywing V3 | ✔️ | ✔️(1) | ✔️(1) | |||||||
Hobbywing V4/V5(4)(5) | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️(2) | ✔️ FET | ✔️ BEC | |||
Castle Link | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️ | ✔️(3) | ✔️(3) | ✔️ | ✔️ | |
Kontronik | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ Power amp | ✔️ BEC | |
APD F | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️ | ✔️ | ||||
APD HV/UHV | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️ | ✔️ | ||||
Smart ESC&Bat(6) | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️ | ✔️(3) | ✔️(3) | ✔️ | ||
ZTW | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️ | ✔️ | ✔️ | |||
OMP M4 | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️ | ✔️ | ✔️ | |||
ZTW | ✔️ | ✔️(1) | ✔️(1) | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
(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
(5) Upgrade to latest firmware version. But note VBAR versions of firmware are not compatible. Install a non VBAR version of the ESC firmware
(6) See Smart ESC and Battery for battery telemetry
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
Adjust RPMs in MSRC Link:
- 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
Serial protocol: 19200 baud.
Telemetry port is the program port. It is a servo male plug on the ESC
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.
Note it is feasible to use Align BLE ESCs with Howbbywing firmare (v4). In this case is complatible with MSRC ESC Hobbywin v4 protocol.
Serial protocol: 115200 baud.
Serial protocol: 115200 baud, even parity.
Supported models: Kosmic, Kolibri, JivePro. Not supported: Jive.
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
-
PWM telemetry. For this type of telemetry you need to flash beta 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.
Serial telemetry with RPMs, voltage, current and temperature.
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
The telemetry is send over the ESC signal. Castle Link has to be enabled in the ESC config.
Spektrum Smart ESC & Battery uses SRXL2 protocol.
Connections:
- Smart ESC signal -> GPIOs 4 & 5
- Throttle PWM -> GPIO 12
- Reverse PWM -> GPIO 13 (optional)
Smart Battery sends telemetry for: current, consumption, cells voltage and temperature.
Serial telemetry with RPMs, voltage, current, ESC temperature and motor temperature.
Serial telemetry with RPMs, voltage, current, ESC temperature, motor temperature and BEC voltage.
Protocols suported: NMEA and UBLOX.
If compatible, select UBLOX to allow auto config for baudrate and rate.
With ELRS use UBLOX to get all the telemetry data suported by the protocol.
GPS rate and baudrate are updated at boot as defined in MSRC.
Connect GPS Rx to GPIO 13.
The GPS baudrate must be one of the following (otherwise change it with UBLOX): 115200, 57600, 38400, 9600.
Changes are persistent after first MSRC reboot. Then GPIO13 can be disconnected.
If there is no data from the GPS, set a lower baudrate. 9600 and 38400 are standard for NMEA GPS.
Sensors:
- Latitude
- Longitude
- Time
- Date
- Altitude
- Speed
- COG
- HDOP
- Satellites
- Vspeed
- Fix
- velN
- velE
- velD
- Speed accuracy
- Track accuracy
- Altitude over ellipsoid
- Horizontal accuracy
- Vertical accuracy
- PDOP
Depending on the receiver protocol some of them may not be present.
The baudrate must match the GPS baudrate. In this case the GPS Rx at GPIO 13 is not needed.
Sensors:
- Latitude
- Longitude
- Time
- Date
- Altitude
- Speed
- COG
- HDOP
- Satellites
Depending on the receiver protocol some of them may not be present.
Calibrate voltage analog sensors with Voltage multiplier. Or from opentx, but it is recommended in order to increase sensor resolution
Multiplier = (R1+R2)/ R2
Use NTC thermistors. No need to calibrate. For fine tuning adjust in ntc.h: NTC_R_REF, NTC_R1, NTC_BETA
If using a hall effect sensor, select one with Vcc = 3.3v to use the full sensor range. E.g. ACS773, ACS756
Set sensor type:
-
Hall effect (ACS773, ACS756, 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Ω))
Use differential pressure analog sensor MPXV7002. 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)
The following I2C barometer sensors are suported:
- Barometer: BMP180, BMP280, MS5611
Vspeed is calculated from air pressure and temperature.
This sensor is available for: XBUS, Smartport and JetiEx.
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 Link
- 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 Link 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
Use XGZP68XXD. Set K parameter with sensor maximum pressure, depending on the model.
Available for: XBUS, SRXL, SRXL2 and Jeti Ex.
Enable GPIOs 17 to 22 to read the pin state (high or low). It is recommended to use the RP2040-zero as this has those pin with a hole.
Available for Smartport with dataId 0x51nn, where nn is the GPIO number.
If using Ethos firmware, you have to create a DIY sensor. Set Physical ID as Sensor Id. And set Application Id to 51nn. Repeat for ech enabled GPIO.
Ethos DIY Sensor