3
$\begingroup$

Readily available flight controllers have pins/pads available usually for UART ports where you can attach various modules like ESC, RX, VTX, OSD etc.

I wanted to know if it is similarly possible to attach I2C as well as USB based sensors to the flight controller? For I2C sensor (like a I2C temperature sensor) I'd like to have it relay back its reading in the OSD telemetry.

For the USB sensor, since OTG USB is not present on any FC that I know of, can I attach the D+ and D- lines to UART/USB bus on the FC and also receive that data via OSD telemetry or from the analog VTX back to me?

The most important part of this inquiry is that, is it readily configurable in the configuration softwares to attach external modules like this and have them working? Are there any examples of this in action on the popular projects like Ardupilot, iNAV, Betaflight, Emuflight etc?

$\endgroup$

1 Answer 1

2
$\begingroup$

i2c

Yes. This is how flight controllers talk to the already available sensors on board*. The addition of barometer and magnetometer sensors (and any other sensors that these flight control softwares support natively) is, and should be, done via the i2c bus. Save some sensors like GPS which is generally UART (though i2c/SPI GPS chips may exist).

USB

Short answer - no.

USB-otg is a complex software stack that probably wouldn't even fit on the stm32 flash. It requires pretty intensive processing and handling of a wide range of devices. While this support may be possible, it certainly isn't natively supported. Especially on chips where the USB port actually passes to a USB->serial converter to talk to the main MCU on the FC.

*Modern flight controllers talk to the primary MPU (motion processing unit) over SPI as opposed to i2c because it is faster, lower latency, and allows for higher frequencies. Peripheral sensors are still UART or i2c in this case.

$\endgroup$
6
  • $\begingroup$ What about Tiny USB though? I read that many M0 controllers support that. Modern FCs are generally M4 and many have USB as a hardware peripheral inbuilt $\endgroup$
    – jar
    Aug 3, 2021 at 14:04
  • $\begingroup$ That's something I was not aware of. AFAIK it's not present in betaflight. What sensors in particular do you want to add? It's quite likely the sensor itself outputs to a chip that converts i2c or serial to USB $\endgroup$ Aug 3, 2021 at 17:04
  • $\begingroup$ I want to add some environmental sensors like BME680 or CCS811 which work on I2C. The USB based sensor that I want to add is a thermal camera like this one - Pure Thermal Mini. $\endgroup$
    – jar
    Aug 3, 2021 at 18:38
  • $\begingroup$ There won't be native support for these in betaflight/inav. You'll have to write your own drivers in their environment to parse the data and be able to make mixer inputs. Unless you're planning on making flight path adjustments based on the input of a thermal camera (in which case this seems like a serious candidate for custom flight control), why does the flight controller care what the camera sees? $\endgroup$ Aug 3, 2021 at 19:21
  • $\begingroup$ Yeah I mean I don't want to make flight adjustments for custom flight control....just replace a formal FPV with thermal feed. The issue is that, that thermal module acts as a usb camera. That's why I am having a hard time figuring out if it is compatible, or if it is possible at all to work with it. $\endgroup$
    – jar
    Aug 3, 2021 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.