Need help for serial comunication

Hello, i have to try something.

I have an Raspberry Pi witch sends variables over serial ( ttyUSB0) over the usb cable.

I want to read this serial bytes with the Ardupilot over usb or other serial input, may some one help me to save those bytes in variables on the Ardupilot?

I dont realy understand if this is working, because i dont realy understand if i have to use mavlink, or if i can read those bytes directly.



You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • Dear sir,

    Can you please explain what will this code do?I need to establish communication between APM and odroid-U3 and send mavlink messages using UDP protocol to GCS so that telemetry link can be established and seen at Qground Control.

  • Dear Tommy Larsen,

    What will the above code do? I want to get telemetry data from APM to RPi using mavlink protocol and send it to ground control using UDP or TCP.How can I do that?

  • From where does mavlink.h file comes

    • Hi

      you can download it from here

      MAVLink Micro Air Vehicle Protocol
      The standard communication protocol for drones. MAVLink Micro Air Vehicle Protocol has 27 repositories available. Follow their code on GitHub.
      • Dear sir ,

        I am trying to have communication between autopilot and odroid-U3 over mavlink protocol to get the telmetry link and send it using UDP/TCP protocol to the Qground control.How should I use the above code to do the same? 

        • They are libraries. You should write your own code for your communication these libraries are for encode and decode the mavlink package. First it is hard to understand but you can find explanation for packages in code as comments they are very helpful.

  • I am using Atom board with APM 2.5 onboard on a Hexacopter. I am using USB port to communicate between them. I have also used the 3DR radio for their communication but the baud-rate is slow (57600) as compare to wire USB connection (115200). The python code which is used for communication is available at (I am logging all the APM data in ROS-framework).

    Hope this helps!

    • Hey Usman,

      Through you code I can communicate between APM and some computer say ordoid-U3. Now I need to send the mavlink message to GCS using TCP/UDP protocol.Can you help me in that?

  • Hey i use Linux (debian) in the Pi. I only want to send Commands from the pi to the copter. The pi is plugged in via USB to the apm. I can't fin a good documentation, how I can send an receive commands. I found a nice API where all commands are in, but I can't find anything to send them to the apm.
    What I want is that the pi can set the apm to arm, disarm. Position hold and loiter.
    Thx for helping
    Btw I use c code
  • You can do both, it is possible to read the bytes you want straight from the port, but this might be a bit complicated since there is some mavlink stuff going on usually so you would need to know what kind of messages you want to pick from the stream, and essentially you will be doing same sort of things that the mavlink does allready.

    Easier is to just use the mavlink package, which is available on c++ and python. It is fairly straightforward to even implement your own messages if needed.

This reply was deleted.


sam liked Jimmy Oliver's profile
Aug 25
Mike Whitney liked Mike Whitney's profile
Jul 19
Abdulatif Tlaib liked Ryan's profile
Jun 24