Servers by jDrones

Please help: trying to use Mavlink for MinimOSD via Arduino without APM/Pixhawk

(Jon Allen) #1

Hello, I have built an ROV largely based on http://techmonkeybusiness.com/rov-control-sketches-fourth-edition.html - It uses 2 Arduino nanos to communicate via EasyTransfer.h and currently it receives sensor data and prints it on a LCD.

I am now trying to use the minimosd to show this sensor data on my FPV goggles - I have searched a ton of forums and tried several complicated examples based on ArduPilots from github but I am really struggling to decode Mavlinks protocols to display simple data from my sensors [ IMU (MPU9250), Temperature/Pressure sensor (MS5803), RTC (DS3231) and external PSI/Depth sensor (A6), voltage (A7) ].

Can you please help me understand:

  1. If it is possible to do this without APM/Pixhawk?
  2. Is there a simpler way to do this?
  3. If not, does anyone have some simple Mavlink code to send voltage to minimosd that I could learn from?

Here is some of my existing code:

void setup(){
const int Voltpin = A7;
const float RefVolts = 5.0; // 5-Volt board reference voltage on Nano
const float ResistFactor = 319.68; //Calculated from 1023.0*(R2/(R1 + R2) - where R1 = 2200 ohms and R2 = 1000 ohms for a 15V max voltage.
}

void loop(){
volts = ((analogRead(Voltpin) / ResistFactor * RefVolts) * 10); //Read the voltage
//from the battery through the voltage divider. Factor of 10 used
//to help achieve an integer with 0.1V accuracy.
txdata.BattVolt = volts; //Send back the onboard battery voltage.

lcd.setCursor(0,2);
lcd.print("ROV Volts: ");
lcd.print(float(rxdata.BattVolt)/10,2);

Thanks!

(Dpsoftware) #2

Hello , minimosd request some stream messages to the flight controller and decode a lot messages. Basically you need to emulate the flight controller . First ,the data that you want to send must to be in one of the message decoded by minimosd. For example voltage battery is extract from MAVLINK_MSG_ID_SYS_STATUS , temperature from MAVLINK_MSG_ID_SCALED_PRESSURE. Basically it’s possible to write the code to send heartbeat data and the messages like above to send your data. Minimosd open the serial and wait the messages , so if you send one message or more messages it’s not important.
Try to follow this example https://github.com/dpsoftware/POC/blob/master/MAVLINK-POC.ino
In this code the software send a message for distance sensor. You can try to send MAVLINK_MSG_ID_SYS_STATUS with the voltage field instead of distance sensor. Remove the code of sensors VLx… only commandheartbeat and write your function inside command_distance_1

(Dpsoftware) #3

I wrote the code to send the message sys status as a proof of concept . Copy the folder GCS_Mavllink in the libraries folder of arduino. I didn’t tested but the files was compiled ok.
MavlinkController

(Jon Allen) #4

Domenico, Thank you for all of your help!

I followed your first recommendation and thought I had things moving in the right direction - in-between blinking “waiting for heartbeats” occassionally the IMU sensors would get read once or twice, then reset the OSD and then they would not be read again. Not sure what I’m doing wrong.

After reading several other forums and posts, some folks seemed to have good luck flashing the MinimOSD to MWOSD firmware and using the GUI. So I followed suit and now none of my data is being shown on the screen ever.

  • What firmware would you suggest installing on the OSD?

Also, I just downloaded your file and then followed your instructions, but when I went to compile I got a ton of error messages (copied to github) not sure if I’m using the wrong version of Arduino IDE (v1.8.5) or what?

I just uploaded my code to github ->ROV_OSD - it works printing the data through the serial monitor but it won’t display it on the screen - If you wouldn’t mind taking a look I’d really appreciate it.

Thanks!

(Dpsoftware) #5

Hi John , about minimosd i used for long time this version:


Under released folder there is the osd_config.exe
Under Fw & char tty MinimOsd_Extra_Copter_R800.hex
Of course I assume that your connections are ok and you know how to download the firmware

In your code Mavlink.ino the serial communication is done with an external library “SendOnlySoftwareSerial.h” . Where you found it ? I can’t not test your code without this library.
Can you try to use “serial” instead of “softwareserial” ? Anyway the mavlink.ino seems is the right way to comunicate with the OSD. About my code i think there is a problem with the version of GCS_Mavlink, probably your are using the version with betterstream.h instead of stream.h . In this case try to backup your version and then copy my version in arduino/libraries…

Sorry for my bad english :smile:

(Jon Allen) #6

Hey Domenico, hope you had a great weekend!

So, I have tried to revert the OSD from MWOSD to MINIMOSD using a similar file (unfortunately I am using a mac, and the minimosd config.exe that I tried before using wine.app (windows emulator) would open and I could configure settings but it couldn’t find the “COM” (usb) port to read/write OSD. I will download this version and load it on an old PC and maybe that will work.

I just uploaded the sendonlysoftwareserial library into github SendOnlySoftwareSerial - I took it from github - Bagaosd- when I was searching for mavlink example code - seemed to work with their code.

I will try to revert to MINIMOSD and back-up my version of GCS_Mavlink and let you know how it goes.

Please let me know how the testing of my code goes on your end.

Haha - your english is great! - Definitely a million times better than my Italian

(Jon Allen) #7

THANK YOU DOMENICO!!!

Finally got some success! - Given your advice, I was able to get the MinimOSD up and running on the MinimOSD_Extra_Copter_R800.hex firmware and it started immediately receiving and displaying data (albeit very incorrect data :rofl:) mainly due to the MinimOSD post-processing the data.

[Still not sure why the MWOSD firmware wasn’t receiving or comprehending the Mavlink signals at all.]

After some trial and error, I was able to get Roll and Pitch to display correctly by removing the code within MPU9250BasicAHRS.ino which converted Roll and Pitch from Radians to Degrees as I determined that MinimOSD is also doing this conversion on the backend.

I’m still trying to get the temperature from the SparkFun MS5803 to display correctly, basically due to the same issues - MS5803 is processing the temp data and converting it to Celcius or Fahrenheit before sending over Mavlink and the MinimOSD is processing the received temp data (as if it was coming from a TMP36 providing an analog value 0-1024) then converting that to Celsius or Fahrenheit before displaying.

I’ve uploaded my current files to Github MAVLINK_ROV_OSD_WIP_v1.0 and will update this post with my progress.

Thank you again Domenico for all of your help!

(Dpsoftware) #8

Ohh great Jon! I am happy and I hope you will reach your goal very soon!
Yes minimOSD performs some conversions because not all osd values ​​have the same unit of measurement (mavlink format). MinimOSD is a very nice tool, not very complicated, may be possible to adapt it to your project.
I will follow your progress