Hi All,

I was recently fiddling around the code for a while and decided to create a tutorial out of it so that others may find it useful. If I would have known this knowledge long back, I am sure I would have saved a lot of time since then! I find lot of beginners getting swayed and lack of knowhow on MavLink with respect to APM/PX4. Information on internet is scattered and not much of use!! 

This will be "Step by Step" entertaining, PART - I of the series I plan to write.on:


What it Covers:

  1. MavLink, starting from scratch. What the hell is it and understand how it works with APM/ PX4
  2. Learn how developers think -> Arducopter communication with Mission Planner and vice-versa.
  3. Get a feel of 'How Stuffs works'.

Too much hype:) Well, this information has been collated from my experience and from internet. I know there is information on the new Wiki, it tells you what, I plan to tell you 'how'! :)

Please let me know if you found it interesting. If there is enough response, I will make another tutorial where I would add more 'Step by step' knowhow!!


- More on MavLink

- Learning Arducopter source code, Step by Step

- Making swarm (multiple) copters work with your 3DR Telemetry radio! I am working on it.

See attachment for [MAVLink Tutorial for Absolute Dummies (Part –I)]

Edit: Request you to post your queries over the forum directly, as it is not possible for me to address all queries I get by email!


Best regards,



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

Join diydrones

Email me when people reply –


  • thanks a lot for your post. Could you please maybe provide an example where you use multiple drones and where they are represented in a same map. Thanks in advance! :)

  • Hi Shyam,

    I am attempting to achieve indoor autonomous flight using only MAVLink messages (sent over 3DR Radio Telemetry) from a ground control station on my laptop that is written in JAVA.

    I am a newby to the MAVLink protocol and so am stuck on the very basics of forming the MAVLink message. (I have read your MAVLink dummies guide and am still stuck.)

    I have been using the MAVLink implementation classes from this repository on Github: https://github.com/jdye64/MAVLink-Java, but can't get the commands i am sending to the Pixhawk to be recognized.  

    For example; in attempting to send the ARM command (MAV CMD #400) with the COMMAND_LONG message (#76) this is my byte array (in integers) i am attempting to send to the com port: 

    254 33 0 255 190 76 0 0 128 63 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 144 1 100 1 0 136 31

    Is there anything obviously wrong with this message?

    I am not sure the sys IDs and component IDs for the sending and target either? How does one identify the correct sys ID, comp ID (of the SENDING SYSTEM).. and for the command_long messages the target system, and target component (of the TARGET)?

    I believe the Pixhawk is discarding the message as i have noticed the Radio telemetry LED light flash as i send the message.

    Any help with MAVLink message forming (or simple testing hints to make sure our Pixhawk is receiving the MAVLink commands we are sending) would be great!

    Thanks, Baden

    MAVLink Pixhawk Java implementation classes. Contribute to jdye64/MAVLink-Java development by creating an account on GitHub.
  • Hi Shyam, Will you be making a Part 2 for this?

  • Hello Shyam,
    Thanks for the tutorial, just what a "dummy" needed :). Currently I am trying to get live data from apm. I am using arduino uno with the apm. I need to get the updated parameters like IMU, attitude,battery staus etc. Can you suggest any simple way as I am new to all this stuff.
  • Hello Shyam,
    Thanks for the tutorial, just what a "dummy" needed :). Currently I am trying to get live data from apm telemetry. I just want the basic data imu, attitude,battery staus etc. Can you suggest any simple way as I am new to all this stuff.
  • Sorry I do not get, the link here say MAVLink command is 14 bytes and having different structure.Is this instruction for earlier version of MAVLink or I'm missing something?


  • Hi,Shyam nice contribution of yours. 

    I am new to the DIY drones.Currently I am trying to build a java application that can control MAV(drone) in air for that I came to know about Mavlink library. I read about it but, the thing which I am not getting is what should be my first step, How can I test my custom Mavlink messages ?. From where should I get ArduPilot Simulator that will test my custom Mavlink messages without use of any hardware.

    • Hi Murtaza,

      The ArduPilot already uses MavLink messages for communication between the drone and your laptop (PC/ tablet). You do not need additional hardware than there already is. You can start testing your MavLink messages between your PC and a Arduino Uno (or RPi) board by interfacing each other via a console (terminal) cable or a Telemetry (wireless). You can send messages to and from each other to test your case. Follow how MavLink sends messages via (C#) application called Mission Planner to the ArduPilot (look at the APM code files on how it receives and interprets the messages received via Mission Planner and how it sends it back). The code on both sides [ArduPilot and MissionPlanner] is more or less the same.

      There is a conversion tool (MavGen.py) which converts the XML file (your custom messages) to generate the required code files (C, C++, C#, not sure about Java) which you use on ArduPilot (drone) and Ground station (PC/ Laptop). To your question, the starting point should be something simple like between a PC and an external hardware (like Arduino).


    • Thanks for your reply Shyam. But, I am not having any drone(Hardware) so, Is there any simulator available which can simulate the environment of drone or is there any other way from which I can test my own custom Mavlink messages without using any hardware I mean is there any alternative to the real drone ??.

  • Wow thanks. This saved me a lot of time :)

This reply was deleted.