So, what do you do when you have some old hardware lying around, and want to reuse that instead of buying the new ArduMegaPilot: Build you own ground station and modify parts of the code for the Ardupilot.

First of all I got tired of LabView, and the other standard parts, and found later versions of Ardupilot too messy to manipulate. Second, most of the available ground stations are written for Windows, not good at all on a Mac. Third, I needed some functions, that is not obviously available when using Ardupilot.

What I have done is to implement a simple ground station in Java, using standard components. It shows the basic information transmitted by the Ardupilot. It uses Google Earth to show the planes position on a map. Further more, it supports two way communication with the Ardupilot. This means that I am able to adjust gains, upload waypoints from a Google Earth .kml file and so on, while the UAV is in the air.

If anybody is interested I will make the sourcecode publicly available.

Best regards




EDIT: I have add'ed the source code for the ardupilot and the source for the Java groundstation. The code is not commented at all, and is highly customized for my setup. Feel free to use any parts you want. Any questions, hit me! The code also contains quite good examples of how to encode at decode binary GPS data. Enjoy.




E-mail me when people leave their comments –

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

Join diydrones


  • I will look into this in the evening. :)
  • Question: If I use thermopiles, should I just replace your sensor-file with the original one ?

    If yes, do you have the original version for me ?

  • Ok. But my issue now is, that I dont get a blue Led from the GPS. I used AP 2.7.1 and used the possibility there to switch THROTTLE_PIN from 13 to 11. I cant remember if I had to change the HW for that. And as far as I can see in 2.5 Pin 11 is used for GPS Status ?

    I need some time to check for that.

    thnx for your help !

  • I am using an accelerometer instead of thermopiles, so my sensor file is altered as well. You should be able to use thermopiles, just keep track of the roll (sensor_roll?) and pitch (sensor_pitch?) variables.


    The changes in the GPS code is only used the command parsing.

  • Ok, I changed the code, put int() in each line. The errors messages in eclipse are all gone.

    I can see data comin in, but still NO display in the GS window with regards of pitch/roll thermopiles.

    Will do some debugging later the day.

    Oops, did not check my GPS..there you did a lot of changes..

  • This is strange. I did not touch your code in that area (why should I). And yes, in the IDE Monitor I can

    exactly see, what I can see in eclipse: It does not say %%bla bla;55; it says %%bla bla;55.0000000;


    And in the code (I hope, this is the roght area)

    void printAdditionalInfo()
           Serial.print(battery_voltage,DEC);                      // 0
           Serial.print(servo_throttle,DEC);    // 1
     Serial.print(ch1_trim,DEC);   // 2
     Serial.print(ch2_trim,DEC);   // 3
     Serial.print(ch3_trim,DEC);   // 4
     Serial.print(ch3_fs,DEC);   // 5

            Serial.print(roll_p *100,DEC);   // 6
     Serial.print(roll_i *100,DEC);   // 7
     Serial.print(pitch_p *100,DEC);   // 8
     Serial.print(pitch_i *100,DEC);

    I am going to delete the DECs.

  • For some reason you received floats on your serial channel? Since a float can not be parsed by Integer.parseInt the code fails. I would look into the print functions in the ardupilot code.

    The received values should look something like this: %%524;0;950;1082;950;1044;55;10;55;10;71**. You can confirm that your AP code i correct by checking the communication in the Ardupilot IDE.

    Note that gains har displayed and input multiplied by 100.

    Best regards


  • It was easier for me to connect the AP.

    I did that and downloaded your code and did some adaptions to my hardware.

    The AP runs (hm, I can see, that the servos move if I use my RC). Connecting your GD I can see the servo values

    and the CtrlMode, but NOT roll/pitch from the thermopiles.

    I receive in eclipse the follorwing error message



    at java.lang.NumberFormatException.forInputString(Unknown Source)

    at java.lang.Integer.parseInt(Unknown Source)

    at java.lang.Integer.parseInt(Unknown Source)

    at SerialReader.parseAdditinalInfo(

    at SerialReader.processString(



    Line 185 in serialReader is:


    .roll_p = Integer.parseInt(in[ROLL_P]);

    : For input string: "55.0000000000"SerialReader.java:185)SerialReader.java:81)




  • Actually I think you could just use the GPS and print functions, if you have a working setup yourself.
  • Some quick comments:

    Donwloaded your code. I imported the Javacode to eclipse first (on Vista), could compile it. Had some minor problems with gnu.io :)

    I connected just an Arduino to get a hw connected to an usb port and changed only

    one line of code

    String portName =

    It seems that it works so far, because the GS Window opens.

    Next step will be to get the AP code running and connect the AP. The will be a task for tomorrow.

    Thnx for sharing knut

This reply was deleted.