Connecting APM 2.0 and Raspberry Pi

Hey guys, I am currently working on a university project and I was wondering if there is a way to interface the apm 2.0 board with the raspberry pi. Is a straight usb connection possible? The goal is to send APM GPS data to the raspberry pi board to be used in conjunction with image processing with openCV. Thanks for the help!

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

Join diydrones

Email me when people reply –

Replies

  • Developer

    I've attempted to attach a Raspberry Pi to a Pixhawk today with some mixed results. I was able to get serial bytes passing back and forth between the RPi and the Pixhawk but I wasn't able to issue commands (like "arm") from the RPi and have them executed on the Pixhawk.

    My plan by the way is to use MavProxy on the RaspberryPi to interpret the mavlink stream and send commands to the Pixhawk.

    The wiki page is here and hopefully I'll clear up the details to get it working with Tridge tomorrow.

    • Hi Randy, I made good result following the document " Communicating with Raspberry Pi via Mavlink " and one more question. What I understand is that it is MavProxy on Rpi  which decides who can receive mavLink data telling "--out 192.168.137.1:14550". It means Mission Planner has to have public IP  over LTE. The reason it cause a slight issue is that Rpi has to have public IP too in order for Mission Planner to get video stream from Rpi. Is it right? Thanks in advance Randy ^^

  • Here is my current setup anyway:

    -----------
    sudo apt-get install ser2net

    sudo nano /etc/ser2net.conf

    % change last lines to
    2000:raw:600:/dev/ttyAMA0:57600 8DATABITS NONE
    1STOPBIT banner

    sudo /etc/init.d/ser2net restart

    sudo nano /etc/inittab
    % add hash to this line
    #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

    sudo nano /boot/cmdline.txt
    % delete references to ttyAMA0
    % "console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"

    sudo shutdown -r now

  • Couple of things to consider.

    Using an ftdi cable can you connect to exactly the same port using a computer that you are trying to connect to with Pi? If no then there is a problem APM side (ensure you are connected rx/tx correctly and the port is enabled in apm using mission planners advanced parameters). If yes then the Pi is to blame (try using mavproxy).

  • ok, this is my 3rd post.... new info though.... I've tried to connect to APM2.6 attached to raspi via serial from CLI on MP via TCP... apparently connection to the port works as I see my ser2net banner message! however, apm doesn't respond with heartbeat packets.... I am able to connect to the same apm over USB though....  had anyone encountered this behavior? 

  • I've been working on a similiar project. I am connecting a Gumstix Overo to the ArduPilot and streaming GPS coordinates, Altitude, and Attitude information between the devices. I have successful gotten the stream the work (Or so it appears). If you want to share information I'd love to.

  • I have just done the main chunk of this. Plugged the APM telemetry port (UART) into the serial GPIO pins on raspi, via a level shift board.

    I then installed the ser2net package which allows network connections to the APM for mavlink. I don't see why you couldnt then make a C/C++/python etc script which listened to this stream and picked out the GPS data. Would be a neat setup!

    Attached photo shows my setup at the moment...I haven't connected APM to the serial port because I've not got a cable made up, but have tested this with an FTDI cable.

    3692652835?profile=original

    sudo apt-get install ser2net

    sudo nano /etc/ser2net.conf

    % change last lines to
    2000:telnet:600:/dev/ttyAMA0:57600 8DATABITS NONE 1STOPBIT banner

    sudo /etc/init.d/ser2net restart

    sudo nano /etc/inittab
    % add hash to this line
    #T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

    sudo nano /boot/cmdline.txt
    % delete references to ttyAMA0:
    % "console=ttyAMA0,115200 kgdboc=ttyAMA0,115200"

    sudo shutdown -r now

  • Developer

    I would actually instead make the raspberry pi listen on the APM->groundstation telemetry message.  the GPS location is in those messages.

This reply was deleted.

Activity