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

  • Admin

    @Crady,

    How about using the R/C receiver input to the APM that is used to send the change mode commands?

    All you need to do is split off that pwm signal and use an Arduino Pro Mini to decode the pwm signal into whatever commands are being sent to the APM.

    Regards,

    TCIII ArduRover2 Developer

    • Hi Thomas.

      I like that idea! There must be a way to get an Arduino to listen and decode the commands being sent.

      I was hoping to be able listen to the APM for a mode change because it 'sounds' simplest but you may be on to something.  I'll look around and see if I can find an example to work from.

      Thanks!

      • Admin

        Hi Crady,

        I am glad that you like my idea and that it might be useful to you.

        I had a situation where I had to combine two mode inputs into one mode output and I used some Arduino code and a Pro Mini to do the conversion.

        I believe that the Arduino code Library has a PWM value to a 0 to 180 scale converter function that would give you a numerical value that could be tested with a range of values equivalent to each APM Mode and then provide a Mode output indication.

        Regards,

        TCIII ArduRover2 Developer

        • Unfortunately that won't work. If there is a loss of signal the APM will go into a failsafe and the Arduino won't be able to see it if it's only looking at the Rx outputs.

          What I really need is a method for an Arduino board to connect directly to the APM or Pixhawk and listen for mode changes.

          Thanks anyway.

        • Thank for the tip, Thomas.  Much appreciated. =)

  • if you find something out i would love to learn from you ...

    • If I ever learn anything I'll be happy to pass it along.

  • Hi Crady, What you want to do can be done and has. You need the mavlink libraries, and decode the heart beat msg, I believe that has the mode info. As for a code example look here.

    • Hi Greg. Those file weren't of any help.  I must be missing something.  Do you know of any explicit tutorials that give not just code examples, but how to physically connect and Arduino board to the APM?  Thanks!

    • Thanks, Greg.  I'll see if I can make any sense of those files.

This reply was deleted.

Activity

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