Hi,

I'm new to Arduino sketches and was wondering if it is possible to connect something like the Arduino Nano, Micro or even Trinket to an APM 2.x via USB (or the Telemetry output pins) and detect what mode the APM is in at any given time -- i.e Stabilize, RTL, Loiter, etc.  And, if it is possible, does anyone know where I could find codes samples.

Thanks!

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

Join diydrones

Email me when people reply –

Replies

  • Thanks!  I'll check it out. BTW,  James Overington helped me get the jD_IOBoard_FrSkyMAVLink.ino sketch and libraries to work with the UNO and I have a Nano on order.

    I haven't connected to the APM yet but if you're interesting in trying it James posted the following:

    To connect the Nano to the APM you need to connect TX-RX, RX-TX, GND-GND. These should be labelled on the 3DR Telemetry module end. I believe that the connections on the APM2.5 are 5V, TX, RX, NC, GND going from the inside of the board to the outside.

    The code looks really straightforward even for a total Arduino noob like me.

  • Hi James,

    Thanks for the instructions -- much appreciated.

    I'll re-download the files and place them where you said and try again. 

    Fingers crossed!

    • Huzzah!  That did it!  Thank you, James.  After moving the new libraries to the correct folder I was able to successfully upload the jD_IOBoard_FrSkyMAVLink.ino sketch to the UNO without errors.

      The next step is to get the same results with my Micro and eventually the Trinket but so far no success.  I had to reinstall the OS on this machine yesterday and I lost my Adafruit-optimized IDE files.  Can't even get 'blink' to load into the Trinket, Micro or Gemma boards.  =(

      Anyway, I'll chat with Adafruit support on Monday and get that sorted.

      In the meantime I need to find a schematic that illustrates how to tap into the APM's 'Tele' cable.

      Cheers!

      • Crady - glad you got it! I have no experience of the Micro or Trinket but make extensive use of the Nano from DX: http://goo.gl/xrhz4T You can't beat ~$8 including USB cable and shipping. They may take a few weeks to get to you but I've been through a few dozen now with no problems. I have been converting many to 3.3v these days as it is often easier than implementing dual voltage for a lot of sensors. I have not had any problems yet at 16MHz.

        To connect the Nano to the APM you need to connect TX-RX, RX-TX, GND-GND. These should be labelled on the 3DR Telemetry module end. I believe that the connections on the APM2.5 are 5V, TX, RX, NC, GND going from the inside of the board to the outside.

        Nano V3.0 for Arduino (Works with Official Arduino Boards)
        I like this from DX. Find the cool gadgets at a incredibly low price with worldwide free shipping here.
        • Hey James, IOBoard_Funcs.ino looks like what I need but I don't know how to read the outputs on the Nano.  Do you?

          • Hi Crady, I'm sorry but I am not sure what you mean... What 'outputs'  are you referring to? Are you talking about reading the Mavlink mode, setting an output pin state or reading the state of an input pin?

            • Sorry, I meant to ask was, looking at the IOBoard_Funcs.ino sketch, when there is a mode change on the APM, does that change appear as a word on the Nano's output pins? 

              Thanks!

              • Crady,

                The mode of the APM is in the heartbeat packet.  This is automatically decoded for you and available at any point in the code via the 'flMode' global variable. The possible values are defined in IOBoard.h as follows:

                // Flight mode defines
                #define STAB 0
                #define ACRO 1
                #define ALTH 2
                #define AUTO 3
                #define LOIT 4
                #define GUID 5
                #define RETL 6
                #define CIRC 7
                #define POSI 8
                #define LAND 9
                #define OFLO 10
                #define MANU 11
                #define FBWA 12
                #define FBWB 13

                Does this answer your question?

                • OK.  I tried the configuator but when I attempt to connect to the Nano I get an "unhandled exception" error.  Vlue of '8' is not valid for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'. Parameter name: Value.

                  Make any sense to you?

                  • Sorry - you need the latest version of the code to be compatible with the Configurator. I have this attached 

                    jD-IOBoard-v0.5.zip

This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…