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

DIY Robocars via Twitter
RT @IMS: It’s only fitting that @BostonDynamics Spot is waving the green flag for today’s @IndyAChallenge! Watch LIVE 👉 https://t.co/NtKnO…
yesterday
DIY Robocars via Twitter
RT @IndyAChallenge: Congratulations to @TU_Muenchen the winners of the historic @IndyAChallenge and $1M. The first autonomous racecar comp…
yesterday
DIY Robocars via Twitter
RT @JoeSpeeds: 🏎@TU_Muenchen #ROS 2 @EclipseCyclone #DDS #Zenoh 137mph. Saturday 10am EDT @IndyAChallenge @Twitch http://indyautonomouschallenge.com/stream
yesterday
DIY Robocars via Twitter
RT @DAVGtech: Another incident: https://t.co/G1pTxQug6B
yesterday
DIY Robocars via Twitter
RT @DAVGtech: What a great way to connect why @diyrobocars community is so valuable and important! Have to start somewhere @IndyAChallenge…
yesterday
DIY Robocars via Twitter
RT @DAVGtech: https://t.co/GwkbSBjdGa
yesterday
DIY Robocars via Twitter
RT @DAVGtech: Good morning from @IndyAChallenge at @IMS. It was a late night, but worth it. Come see for yourself how the pass ended and ch…
yesterday
DIY Robocars via Twitter
RT @circuitlaunch: Robot fun this Saturday (23) at Circuit Launch! From 10am to 4pm. Lots of robots, autonomous car racing training, tech t…
Friday
DIY Robocars via Twitter
RT @chr1sa: 10 of these autonomous racecars will be competing tomorrow at the Indianapolis raceway
Friday
DIY Robocars via Twitter
RT @a1k0n: Sync'd @joshu's GoPro w/ my datalogging; video is 2.5X speed, Google imagery upper-right. Found out my track boundaries are WAY…
Oct 18
DIY Robocars via Twitter
RT @a1k0n: Also, at 45mph, the front tires literally blow up like a balloon and it doesn't have much front traction, so the car becomes fai…
Oct 18
DIY Robocars via Twitter
RT @a1k0n: Okay, some datalogs! Green dots are precalculated racing line (from my crummy optimizer -- it veers to the middle after 2 for Re…
Oct 18
DIY Robocars via Twitter
RT @a1k0n: Welp my @selfracingcars entry, hastily conceived heading filter and all, actually worked! Heading home, datalogs and videos to f…
Oct 18
DIY Robocars via Twitter
Oct 18
DIY Robocars via Twitter
Oct 15
DIY Robocars via Twitter
RT @f1tenth: What can we learn from autonomous racing? Actually, a lot! To get an idea what you can do in this field and where the research…
Oct 11
More…