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

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…