Giter Site home page Giter Site logo

dgatf / msrc Goto Github PK

View Code? Open in Web Editor NEW
161.0 27.0 39.0 2.25 MB

Multi Sensor for RC with RP2040 - FrSky D, SmartPort, XBUS, SRXL, IBUS, SBUS, Multiplex Sensor Bus, Jeti Ex Bus, Hitec

License: GNU General Public License v3.0

C++ 6.92% Lua 3.84% C 88.10% QMake 0.14% CMake 1.01%

msrc's Introduction

Remark: This is the new version for the RP2040 board

For previous versions see repository msrc_arduino

  • More powerful board for less price: Cortex M0+ 32bits, 133MHz, 2MB flash, 256kB RAM, 3xUARTS, 2xI2C, PIO
  • Same board for all configurations
  • Easier to upload firmware: drag and drop
  • Config through USB
  • Rewritten in C with FreeRTOS (Not C++ and Arduino framework)
  • No bit bang libraries like softserial

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

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:

  • Frsky Smartport
  • FrSky D, Spektrum XBUS
  • Spektrum SRXL V5
  • Flysky IBUS
  • Futaba SBUS2
  • Multiplex Sensor Bus (MSB)
  • Jeti Ex Bus

Compatible ESCs: Hobbywing V3/V4/V5, 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:

  • ESC
    • ESCs with serial telemetry (Hobbywing V3/V4/V5(1), Kontronik(2)), APD F/HV/UHV
    • ESC with PWM signal or phase sensor
    • ESC Castle Link
  • GPS serial (NMEA)
  • I2C sensors: 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.

(1) HW V5 = HW FlyFun. 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.

1. 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
Smartport, SBUS, SRXL, IBUS, SB, Jeti Ex 0(1) & 1
Frsky D 0
Hitec, XBUS SDA 2(2)
Hitec, XBUS SCL 3(2)
ESC serial 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
Voltage 26
Current 27
NTC 28
Airspeed 29

(1) with 1k resistor
(2) with 1k-3.3k pull up resistor
(3) Optional

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


RP2040 Zero pinout

2. Power source

All receivers provide 3.3V at the telemetry port. Connect Vcc at telemetry port to RP2040 V5/VSYS pin. Alternatively you can feed the RP2040 from the BEC or receiver if the voltage is less than 5.5V

3. Flash firmware to RP2040

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

4. Configuration

4.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
  • 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

4.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

5. Receiver protocol

The following Rx protocols are supported:

  • Frsky Smartport: inverted serial, 57600 bps
  • Frsky D: inverted serial, 9200 bps
  • Spektrum SRXL V5: serial, 115200 bps
  • Spektrum XBUS: I2C
  • 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

XBUS

Auto-config may be used to detect the new sensors.

If no telemetry is shown, may be MSRC is booting too slow and the first poll from the receiver is not answered. There are several ways to fix this:

  1. Power on the receiver after MSRC has started
  2. I2C clock stretch. Pull down the SCL line until MSRC has started, then open the switch. You can use a manual switch or a NPN transistor (e.g. PN2222ABU). If using a transistor you need to enable XBUS Clock Stretch to open the transistor switch after boot. If using manual switch, open the switch after boot, to finish the clock stretch


XBUS port


Clock stretch XBUS with manual switch

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

Multiplex Sensor Bus (MSB)

Connect to Sensor port


Sensor bus port

Jeti Ex Bus

Configure receiver pin (E1 or E2) as Ex Bus

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

Spektrum SRXL

Spektrum SRXL is bidirectional with telemetry, other SRXL are unidirectional. See SRXL.


Spektrum SRXL

6. Sensors

6.1. ESC

6.1.1. Serial telemetry

Compatible ESC serial protocols:

  • Hobbywing V3/V4/V5. Serial 19200
  • Kontronik Kosmic/Kolibri/JivePro. Serial 115200, even parity
  • APD F/HV/UHV. Serial 115200

Optionally, for Hobbywing Flyfun (V5) and APD F-series, a PWM signal can be generated from the RPM telemetry value

Hobbywing Platinum V3

Telemetry port is the program port. It is a servo male plug on the ESC

Hobbywing Platinum V4 / FlyFun V5

  • The telemetry port is a wired servo female plug. Don't confuse with RPM PWM signal connector or the program port
  • Check firmware installed is NOT VBAR version
  • 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 6
FlyFun 80A 12.4
100A 9(1)
Platinum V4 120A 10
130A 11.3(1)
150A 12.9(1)
160A 13.7(1)
Platinum V4 200A 16.9

(1) Extrapolated from confirmed models. If you find discrepancy adjust gain parameter and send gain and ESC model to update the table

APD F series

Telemetry port: 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

APD UHV/HV series

Serial telemetry with RPMs, voltage, current and temperature.

6.1.2. 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

6.1.3. Castle Link

The telemetry is send over the ESC signal. Castle Link has to be enabled in the ESC config

6.1.4. Available ESC telemetry

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) ✔️ ✔️ ✔️

(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

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

6.1.5. 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

6.2. Serial GPS

Serial GPS (NMEA protocol) is supported

6.3. Analog sensors

The following analog sensors are supported:

6.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

6.3.2 Temperature sensors (NTC thermistors)

No need to calibrate. For fine tuning adjust in ntc.h: NTC_R_REF, NTC_R1, NTC_BETA

6.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Ω))

6.3.4. Airspeed sensor (MPXV7002)

No need to calibrate. For fine tuning adjust in airspeed.h: TRANSFER_SLOPE,TRANSFER_VCC

6.4. I2C sensors

The following I2C sensors are suported:

  • Barometer: BMP180, BMP280, MS5611

7. OpenTx sensors (Smartport)

The default sensor id is 10. This can be changed with 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

7.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

7.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.

7.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

7.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

8. Images

9. Annex

9.1. ESC protocol specifications Hobbywing

Serial parameters:

  • 19200 bps
  • 1 packet every 20 ms
  • Big endian

9.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)

9.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

9.3. ESC protocol specifications Kontronik

Supported models: Kosmic, Kolibri, JivePro. Protocol specs

Note that there is another protocol used by Kontronik Jive at 9600 that it is not supported. Info here

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

Hall effect

Hall effect sensors. Induced magnetic field is transformed into voltage. They are caracterized by their sensitivity

Shunt resistor

The voltage drop in the shunt resistor is amplified by a differential amplifier to obtain Vo

9.9. Air Speed

Air speed is measured with a differential pressure sensor

Presssure is calculated with the sensor's transfer formula:

And the air speed using the Bernouilli formula:

After 2 seconds the sensor is calibrated to zero

Adjust constants in pressure.h:

  • TRANSFER_SLOPE (B) as per sensor datasheet
  • For fine tuning measure the Vcc on the sensor and adjust TRANSFER_VCC

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

v0.10

  • Ported to RP2040

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

  • 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

  • Added analog airspeed sensor (MPXV7002)
  • Fixed Castle Link bug
  • Removed BMP180
  • Fixed flickering in color lcd displays

v0.6

  • Added GPS serial (BN220, BN880, NEO-M8N,...)

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

  • Fix Horus display

v0.4

  • Changed R3 resistor to 3.3k
  • Support for change_id_frsky to change the sensor id
  • Support for I2C sensors
  • Improved code quality and performance
  • Smartport_library improved performance and abstract from the smartport protocol

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

  • 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

For questions use the forums:

RCGroups

Helifreak

Openrcforums

If you want to add support for new receiver protocol or new sensor, ask for it

msrc's People

Contributors

dgatf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

msrc's Issues

Lua Script

HI,
My radio is Radiomaster, receiver X8R Fr sky.
Board Arduino Pro Mini Atmega 328P
I have problem. I run lua script and all time is connecting on screen.
What I do wrong?

Robert

Add support for old frsky telemetry protocol

Hi,

I've got back into the hobby after letting it sit for 10 years.
I've got old frsky receivers with the pre-sbus telemetry protocol.
Any chance to get support for that?

BR,
Markus

Not Working with castle ESC

I am trying to use it on a Talon 90, Horus X12 Express, I have some issues with the sensors not reading correctly, using with a 6s setup Voltage varies between 24,23,22v. When the motor is running i get values jumping all over the place like, 13, 18, 16 ,25,23, all at the same throttle input. I am somewhat new to Opentx so i dont know what i can do to fix this issue.Also i am using an arduino nano is what i had on hand for this project. I can try to help solve this issue

Syntax error if #define CONFIG_ESC_PROTOCOL PROTOCOL_CASTLE

Arduino: 1.8.13 (Windows Store 1.8.42.0) (Windows 10), Board: "Pololu A-Star 328PB, 5V, 16MHz"

sketch\srxl.cpp: In member function 'void Srxl::send()':

srxl.cpp:78:40: error: 'xbusEsc' was not declared in this scope

     memcpy(buffer + 3, (uint8_t *)&xbusEsc, sizeof(xbusEsc));

                                    ^~~~~~~

sketch\srxl.cpp:78:40: note: suggested alternative: 'Xbus_Esc'

     memcpy(buffer + 3, (uint8_t *)&xbusEsc, sizeof(xbusEsc));

                                    ^~~~~~~

                                    Xbus_Esc

xbus.cpp:4:16: error: 'Xbus_Esc Xbus::xbusEsc' is not a static data member of 'class Xbus'

Xbus_Esc Xbus::xbusEsc;

            ^~~~~~~

sketch\xbus.cpp: In static member function 'static void Xbus::i2c_request_handler()':

xbus.cpp:56:36: error: 'xbusEsc' was not declared in this scope

     memcpy(buffer, (uint8_t *)&xbusEsc, sizeof(xbusEsc));

                                ^~~~~~~

sketch\xbus.cpp:56:36: note: suggested alternative: 'Xbus_Esc'

     memcpy(buffer, (uint8_t *)&xbusEsc, sizeof(xbusEsc));

                                ^~~~~~~

                                Xbus_Esc

sketch\xbus.cpp: In member function 'void Xbus::update()':

xbus.cpp:128:5: error: 'xbusEsc' was not declared in this scope

 xbusEsc.RPM = __builtin_bswap16(esc.read(CASTLE_RPM));

 ^~~~~~~

sketch\xbus.cpp:128:5: note: suggested alternative: 'Xbus_Esc'

 xbusEsc.RPM = __builtin_bswap16(esc.read(CASTLE_RPM));

 ^~~~~~~

 Xbus_Esc

exit status 1

'xbusEsc' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

No data Kontronik Jive

Issue: No telemetry data Kontronik Jive.

TX: Frsky X10S Express
RX: X4R (Smartport)

I have Smartport running, configured it with the lua script to use the Kontronik Protocol.
That works.. got all sensors discovered.

Connected the Jive to RX0 of my Nano.

I see there is data coming in.. but not passed thru to smartport..

I know the telemetry port works, because I use a Jlog S32 logger to read out it's telemetry.

Am I missing something?

I also tried a Pro Mini 328 @ 3.3v 8Mhz as suggested but nothing..
Smartport YES - Kontronik readings NO

No GPS fix and output

I have connected a BN220 to an Arduino Pro Mini (3.3V).
The TX pin of the BN220 is connected to pin RX0 of the arduino. VCC is connected to VCC and GND to GND.
I enabled debug in MSRC.
My output is continuously:
14:17:26.886 -> 14:17:26.886 -> 3 RMC: 14:17:26.886 -> 4 VTG: 14:17:26.886 -> 1 GGA: 7(6)00, 14:17:26.886 -> 2 GLL: 14:17:26.886 -> 3 RMC: 14:17:26.886 -> 4 VTG: 14:17:26.886 -> 1 GGA: 14:17:27.123 -> 3 RMC: 14:17:27.161 -> 4 VTG: 14:17:27.198 -> 1 GGA: 7(6)00, 14:17:27.375 -> 2 GLL: 14:17:28.128 -> 3 RMC: 14:17:28.166 -> 4 VTG: 14:17:28.204 -> 1 GGA: 7(6)00, 14:17:28.349 -> 2 GLL: 14:17:29.166 -> 3 RMC: 14:17:29.166 -> 4 VTG:
Watching the GPS leds, I do not notice a GPS fix.
Can I troubleshoot somehow the Arduino Pro Mini has the correct code and whether GPS to Arduino connectivity is all ok?

APD ESC and Jeti telemetry

I have an APD F120X ESC and Jeti radio and ATmega328. I want to decode the telem using PWM over a single wire. Can you help me with this diagram? I'm not sure about 5V and ground lines. Thanks kindly!

APD ATmega2

Problem when read RPM from the tachometer socket of a CDI petrol engine

Hello,

I tried to read the signal from the tachometer socket of the CDI of an RC petrol engine.
On the oscilloscope, It is normal square wave signal with 35% duty cycle and 5vpp signal.
The useful frequency range goes from 7 hz to 370 hz approximately (420 rpm to 22,200 rpm).
From 250hz upwards msrc sends the right value in telemetry, below 250hz (15.000rpm) approximately the value always drop to 0 rpm.
Why?

Settings: Multipl: 1, Blade: 1

Is the system set up for a higher frequency range produced by the ESCs?

Is a hw fequency multiplier necessary?

Thank you
Rosario

XBus won't work with Teensy fix

In xbus.h etc use i2c_t3.h in place of wire.h tested with Teensy LC and 3.2 and AR8020T

#if defined(__MKL26Z64__) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
#include <i2c_t3.h>
#else
#include <Wire.h>
#endif

In xbus.cpp line 125 change to this

#if defined(__MKL26Z64__) || defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
#if CONFIG_ESC_PROTOCOL != PROTOCOL_NONE && CONFIG_ESC_PROTOCOL != PROTOCOL_PWM && CONFIG_ESC_PROTOCOL != PROTOCOL_CASTLE
    ESC_SERIAL.begin(19200);
    ESC_SERIAL.setTimeout(ESCSERIAL_TIMEOUT);
#endif
    Wire.begin(I2C_SLAVE, XBUS_AIRSPEED, XBUS_BATTERY,I2C_PINS_18_19, I2C_PULLUP_EXT, 400000);//Begin mask XBUS_AIRSPEED  end mask XBUS_BATTERY 
    Wire.onRequest(i2c_request_handler);
    I2C0_RA = XBUS_RPM_VOLT_TEMP << 1;
#endif

bad quantization of analog "Curr" sensor ?

Hi, when i try to use "Curr" with an analog signal on ADC pin20 (on my TeensyLC) i get really bad quantization setps, like only a few steps for 0-100%..
BUT when i simply swap the pins in the MSRC code at constants.h (pin20 and 26 in my case) to use the current sensor on the Airspeed-input instead of the Current-input it is quantisizing fine like it should.

I mean without any hardware change.

any idea if that could be a bug beside the hardware which is working good with [email protected] Smartport, HobbyWing ESCv4, BMP280, 2xTemp analog.
For the current - since the Hobbywing 40A ESC has no built in shunt - I now use 1mOhm shunt resisor with a LM358N as diff-amp placed in the GND Cable, 0-40A equals 0-1.6V and it is working good, no bad noise with 1u and 220n caps, nice level shifing on a scope. Shunt is ok i guess.
btw: my ACS711EX hall current sensor was not usable because of far to heavy noise on the signal line on my try

AND: Great project!! everything is working superb after dealing with many many issues but that was perhaps all my fault and mainly Pololu 5V related

regards

No data via XBUS on AR8020T

The final goal is to use a HW V4 120A LV with the AR8020T, everything with the latest firmware.

I use an ATmega328P Arduino Pro Mini 3.3V.

#define RX_PROTOCOL RX_XBUS
/* Sensors */
#define CONFIG_ESC_PROTOCOL PROTOCOL_HW_V4_LV

I tried with

/* Use library I2C_T3 for Teensy LC/3.X */
//#define I2C_T3_TEENSY

or without, but nothing works.

So I tried without the ESC connected and

#define SIM_SENSORS

but I still receive no ESC data at my transmitter. The AR8020T internal altitude, BEC voltage and Flight Log are working.

current scale

I want to connect a current sensor to A6.
The current scale of the sensor is 19.1A/V.
I have entered a scale of 19.1 in OpenTX.
Then I tested msrc by applying voltage to pin A6.

These were the measurements:
1V 0.7A (expected 19.1A)
2V 1.4A (expected 38.2A)

I had to enter a scale of 484 to get the correct current displayed.

Arduino Pro Mini 3,3V/8MHz
Sensors HW3, current
Radiomaster TX16S
OpenTX 2.3.11

Airspeed Bug

Found a small bug in Xbus.cpp.
Airspeed should look like this, speed written in lower case and a semicolon was missing at the end.

#if CONFIG_AIRSPEED
    static uint16_t maxAirspeed = 0;
    airspeed.update();
    uint16_t airSpeed = round(*airspeed.valueP());
    xbusAirspeed.airspeed = __builtin_bswap16(airSpeed);
    if (airSpeed > maxAirspeed) 
    {
        maxAirspeed = airSpeed;
        xbusAirspeed.maxAirspeed = __builtin_bswap16(airSpeed);
    }

FPort support

Any chance to get FPort2 protocol supported ? That being bidirectional would allow to use a single board both for telemetry and ppm demux (obviously with limitations related to available pins)

Smartport, GPS, voltage and BMP280

I just tested this configuration. There are several remarks:

  • Gspd to KTS

  • Vspd inconsistent value

  • Absence of BMP280 vario

  • Absence of ALT BMP280

  • GPS coordinates ok

  • Voltage ok

  • Galt ok

  • hdg ok
    1644686957973

msrc_gui_win.exe bug

When using msrc_gui_win.exe to select the altimeter to generate Config, the "I2C_" field is missing, which will cause a compilation error.

English is not good, hope you can understand

Jeti Ex, no telemetry

Hello Daniel,
came across a link to your sensor on RC Network.
Since I fly Jeti, I wanted to build a sensor with 2 voltage measurements as a start.
So Arduino Pro Mini 3.3V, 8MHz flashed with the configured SW and plugged into the RX.
The sensor does not appear in the telemetry selection of the transmitter.
To exclude a defect on the Arduino board, I have then aud the board a sketch of RCT
which works. Do you have a tip that the sensor works?
Actually I wanted to use the sensor with an ESC. But I am not yet so far.
I am still relatively inexperienced in Arduino history.

Jürgen

Spektrum X-bus -- Hobbywing HV V4 issue

Hello,

I uploaded the firmware and the arduino is pafaitement recognized in the telemetry in "auto-config".

In config.h I have activated "#define CONFIG_ESC_PROTOCOL PROTOCOL_HW_V4_HV".

however, when I plug the "hobbywing rpm" wire into my Arduino, I have no data going back.

cordially

HW V4 EscC always 0

EscC is always 0.

image

Hobbywing Platinum V4 80A
Arduino Mini 3.3V/8MHz
RadioMaster TX16S
OpenTX 2.3.14

FSIA6B and LAT / LON

It's not really important but with the IA6B receiver, the GPS LAT and LON telemetry is at 0.
With the FSiA10B everything is ok.

1644829786052

S-port over a single GPIO

Just thought I'd mention that you can get MSRC's S-port working over a single GPIO if you set PIN_SMARTPORT_RX and PIN_SMARTPORT_TX to the same pin. Works great and simplifies the circuit just a bit.

Hope this helps.

rpm limited ?

I am using an Arduino Pro Mini 3.3V/8Mhz with voltage1 and rpm sensors configured.
Rpm signal goes from a HW phase sensor to pin 8.
Rpm telemertry works up to about 2000 rpm, above 2000 rpm it drops to zero.
The signal on pin 8 is still there (about 1700 Hz).

I am running the same configuration with an 5V/16Mhz Arduino Pro Mini without problems.
Is the 3.3V/8Mhz too slow (I cannot believe that) ?

How I can add a third Voltage Sensor

Hi,
I want use 3 voltage sensor.
May I add a new sensor (how) on A4 or A5 or A6 input on Arduino Pro Mini with a resistive partitor?

if it is not possible in the current configuration, is it possible to replace it in place of T2?

I hope this is the right place to ask the question

Thank for your attention
Rosario

Project won't fit on arduino pro mini.

Hi,
I tried to compile your project and arduino says, that project won't fit... it's 106% of capacity. Arduino Mini Pro here 5V 16MHz 328P. I don't need so many fancy features (specific temperature sensors), so can I shrink it down easily without heavy modifications?
Thanks in advance,
Vit

Inclusion of number of Sats locked onto please

Hi Daniel - any chance that you could add in the number of satelites fixed onto into the data stream either transmitted as SATS or as TMP2 please. The GPS widget that I was hoping to try using uses the number of satelites to start GPS logging etc.

Cheers,
Mike

Can the GPS speed be converted from KTS to KM/H

Can the GPS speed be converted from KTS to KM/H, and what is the current GPS refresh rate? Is it possible to increase the refresh rate to 10HZ per second!
Greetings from eastern countries, best wishes!
Thanks !

Lua script doesn't work on Horus

Fails on line 307 "lcd.drawText(410, 220, config.i2c1Address, getFlags(17))" with error "bad argument #3 to 'drawText' (string expected)" (and other couple of lines)...

BST (TBS Crossfire)

Hello, please do you plan to add also a BST (TBS Crossfire) telemetry protocol? It would be very helpful for me and probably also for other FPV fans not using FC.

Example code for xbus

Hi, I need to convert an analog signal from a temperature sensor to the xbus port of my spektrum receiver. I will use a little Trinket 3v as arduino board.
Do you have an example code in order to understand how to use functions from xbus.h?
I'm a liitle bit lost at the moment ^^

Thank you

HobbyWing V4 120A LV gives not date when motor off

You are right, only when the motor is is running the ESC is transferring data.

ESC-XBus.txt

That is not right, but the format is different when the motor is stopped.
I took your sniffer and as you can see in the logfile there are two different data lines if the motor is not runnig and only one if the motor is running.

HW_120A_V4.txt

Maybe you could optimize the data processing?

Teensy 3.2 Castle / Smartport

Hello,
on teensy 3.2 (master branch) after enabling Castle Smartport isn't working anymore, and for example the current sensor activated before is also lost.. So you also can't change it back via lua script.

Thanks
Christian

328P, Ibus protocol and GPS

I am on NANO 328p in USB, GPS BN220 and flysky receiver.
I noticed 2 problems with the GPS.
As soon as I define "GPS true" in config.h, all the sensors are at zero in my telemetry. (In ibus.cpp, when I put // in front of the LAT, LON and ALT lines, the other sensors work again) Could the problem come from the "IBUS_TYPE_S32" format?
Moreover when I connect the Tx GPS on the PIND7, my card is blocked. Do you think of a solution?
Merci

BMP280 and Ibus

I quickly tested the "BMP280 module 3.3V (6 pins, I2C/SPI)" with GPS and voltage.
I have 3 additional sensors which appear TEMP1, 00Gp and Vspd).
Temp1 displays 40° and the others are at 0.
GPS and voltage are OK.
I connected the BMP280 to the arduino nano at 3.3v, GND, A4 and A5. Did I forget something?

Problem with "IBUS_TYPE_S32"?

Thank you for your work.
The last code is better (less latency) however the telemetry for LAT, LON and ALT blocks the feedback from all sensors. When I comment out the first 3 gps sensors in IBUS.cpp, the telemetry works again. A problem with "IBUS_TYPE_S32"?

Comment
GPS with comment
GPS without comment

HW Platinum/Flyfun, innacurate voltage and current

Next test:
Voltage and current values can be trimmed to a usable accuracy by adjusting the divisor and ampGain in escHW4.h useful accuracy by adjusting the divisor or ampGain. Remaining measurement deviations probably come from the ESC.
I can't measure RPM at the moment, but it could be correct. After further fine tuning of the coefficients
I will test the combination in flight.
Attached is a short LOG file.

jeti_log_1.txt

Get HW version info from ESC

I saw that for Hobbywing there is a start-up sequence of the data being sent for my HW v4 130A
I get the following sequence: 9B 3 E8 1 B 41 1E 92 0 21 21 B9

Is it possible to determine the ESC version based on the initial package load being send?

HW V4 EscA completely off.

Heli spooled up on the ground.
EscA shows around 133A.
Current clamp shows around 10A.
EscA is completely off.

Hobbywing Platinum V4 80A
Arduino Mini 3.3V/8MHz
RadioMaster TX16S
OpenTX 2.3.14

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.