Arduino + Mavlink : sending custom sensor values

Hi there.

I’m implementing motor temperature monitoring on a bimotor running Arduplane. I’m using an arduino to read a 10k NTC on each motor. I want to send the highest temp value to the flight controller, so I can display it on the OSD.

I can see a lot of examples fetching data from AP, but I don’t know enough about it to send data :

  • What kind of value am I supposed to “set” on the AP ? knowing that this data should end up on the OSD.
  • How can I set it ?
  • How can I display it on the OSD ?
  • Bonus point : can I set an alert if when motor_temp > some_threshold ?

Thanks for the help, I think this could help other people as well :slight_smile:

1 Like

I know nothing about OSD, but regarding the rest of your needs, LUA Scripts can do all of it.

Check these two links:

https://ardupilot.org/copter/docs/common-lua-scripts.html

@Yuri_Rage any thoughts about LUA Scripts + OSD application?

I’m not particularly familiar with the OSD methods implemented in ArduPilot, but I think this level of customization would require either additional Lua bindings or C++ implementation on a custom branch.

1 Like

I guess you basically want to have a mavlink-based ESC_Telemetry backend?
Then you could also add a Motor temperature failsafe to the ESC_Telemetry motor temperature data.

Once you do that, the motor temperature data will be “automagically” displayed in Mission Planner and logged into the .bin files.

2 Likes

@amilcarlucas You are correct, this sounds like exactly what I need to do.

However this is less straightforward than I expected (need write a new telem backend with access to MavLink traffic) so I think i’ll put this on the “todo” list rather than do it right now.

I’m wondering though, what will happen if i leave all telem fields (voltage, current, rpm…) to 0 except for temperature ? since that’s all I measure :slight_smile:

Nothing bad will happen if the values are 0.

1 Like

Thanks to sharing this @amilcarlucas!