Raspberry Pi 3 connecting to Pixhawk

With the Pi3 you need to make sure that you’ve disabled bluetooth and are using the real ttyAMA0 device - the docs on the ardupilot wiki need updating. Make sure you have ‘dtoverlay=pi3-disable-bt’ set in /boot/config.txt and reboot.

@fnoop can you explain a little bit about why we would enable/disable RTS/CTS? I’m running some Pi3’s and having some mission syncing issues. I’m thinking disabling that would fix the issue?

@Kevin_K raspberry doesn’t have flow control pins, so you only connect gnd,rx,tx to the telemetry port. Ardupilot should detect if flow control is present or not, but it often gets it wrong so better to turn it off explicitly in the parameters. If you don’t, it’s known to cause problems.
If you’re using ttyS0 instead of ttyAMA0 then you may see intermittent data issues depending on the current clock/core speed of the cpu.

1 Like

@fnoop Thank you as well for chiming in. I still seem to be having issues on making the serial work. Is there a recent and step by step source that gears more for the RPI3? Also, how were you able to accomplish the wiring from telemetry 2 to your RPI3? I basically am using a similar telemetry cable that I’m also using with my RFD telemetry radio. I’m only connecting the rx, tx and gnd. See attached img. I’m hoping my issues is not related to how I’m wiring to the Pi3. I’ve decided to do a fresh install of Pi since I’ve done so many tweaks. Lastly, is there a specific Pi OS I need to be using? I’m on the most recent. How about Ardupilot firmware? Plane, copter?

BTW here is a pretty god blog explaining how BlueTooth has "stolen’’ the ttyAMA0 and methods for getting it back on GPIO

P.S. I dont recommend getting the latest Raspian Stretch https://www.raspberrypi.org/blog/raspbian-stretch/
I has implemented the new debian 9 method for naming interfaces… https://www.debian.org/releases/stable/amd64/release-notes/ch-whats-new.en.html#new-interface-names
@fnoop , I think that will be the next big support issue :wink:

which distro release should I be using?

Would stick with Jessie for the moment

http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05/

Thank you again for your help on this! I’m downloading it now and will install. What are your thoughts on the cable setup I sent earlier? Do you see any issues on establishing a serial connection on how I have it?

No easy to trace cables, but if it correspond to the diagram showned on beginning of discussion, it should work OK

1 Like

Thanks, lets hope this works.

@ppoirier Just an update. I re-flashed to the R Pi3 with the Jesse OS distro. Followed the steps in the ArduPilot wiki with the exception of specifying ‘serial0’ instead of ‘ttyAMA0’. Second, be sure to include in the boot/config.txt file the following: ‘dtoverlay=pi3-disable-bt’.

With careful rechecks of my wiring setup I was able to successfully connect!! Thank you every for your help and input. This interaction is what makes ArduPilot an amazing community.

https://discuss.ardupilot.org/t/raspberrypi3-and-apm2-6-via-mavproxy/17341/16?u=cyclops

@ppoirier Sigh, yes… I turn all this off in Maverick, it’s a real headache with usb devices:
https://github.com/fnoop/maverick/blob/stable/manifests/maverick-modules/maverick_network/manifests/init.pp#L91

Check your Connections and PINs with Pixhawk and RPi.
I got heartbeat from pixhawk to raspberry pi.

Disable your serial port in Configuration->Interfaces.

enable_uart=1 in config.txt. sudo nano /boot/config.txt

then try this command for plane.

mavproxy.py --master=/dev/serial0 --baudrate 57600 --aircraft plane

Remember that you can only connect with 57600 baud.

1 Like

Hello All,

I am trying to connect the Pix-hawk & Raspberry Pi3. I have followed the instructions under the below links and able to connect both the boards.

https://discuss.ardupilot.org/t/raspberry-pi-3-connecting-to-pixhawk/9524

I could see the logs as below:

STABILIZE> Mode STABILIZE
APM: APM:Copter V3.5.2 (4322ffda)
APM: PX4: 1d6bf64c NuttX: 1a99ba58
APM: Frame: QUAD
APM: PX4v3 00410021 3136510E 34313630
Received 772 parameters
Saved 772 parameters to plane/logs/2018-04-21/flight3/mav.parm

STABILIZE>
STABILIZE> mode
STABILIZE> ('Available modes: ', [‘RTL’, ‘POSHOLD’, ‘LAND’, ‘OF_LOITER’, ‘STABILIZE’, ‘AUTO’, ‘GUIDED’, ‘THROW’, ‘DRIFT’, ‘FLIP’, ‘AUTOTUNE’, ‘SMART_RTL’, ‘ALT_HOLD’, ‘BRAKE’, ‘GUIDED_NOGPS’, ‘LOITER’, ‘AVOID_ADSB’, ‘POSITION’, ‘CIRCLE’, ‘SPORT’, ‘ACRO’])

Now i want to control the Pix-hawk using my Raspberry Pi3. e.x. I want to stop/start the drone, by sending the command to the Pix-hawk over the Mavlink protocol.

Can someone give me the idea on how can i achieve that?

Thanks for the help in advance.

hello Rahul,

I am working on very similar project as yours. But I am one step behind. I am yet to establish communication between flight controller and rpi3. I am following

http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html

I am stuck at point where I need to install package on rpi3. When I try “sudo pip install pymavlink” the console of Rpi3 was getting stuck. I am totally unaware of what can be done. Any suggestions or solutions for this please?

Or could you let me know the procedure you did to have connection between flight controller and rpi?
Thanks in advance

Hello Akshay,

I just followed these 2 links and was able to connect both the
boards.http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.html
http://ardupilot.org/dev/docs/raspberry-pi-via-mavlink.htmlhttps://www.youtube.com/watch?v=DGAB34fJQFc
https://www.youtube.com/watch?v=DGAB34fJQFc

Thanks & Regards,
Rahul ARORA

Hi, I would like to know if it possible to connect the Raspberry Pi 3 to the Pixhawk 2.1 cube ? If yes, can I use the above procedures?

Thanks.

Hi Rahul,

Thanks for reply. I am following the same webpage as yours, but I am using APSync image and not Raspbian OS (since Jesse is not available now I think. Correct me if I am wrong). That’s because I had issues downloading pymavlink package as shown below.

  • sudo pip install pymavlink

Did you face any issues while downloading that? If yes let me know how you overcame it. Thanks

Hello everyone,

Very new to these stuffs and also to this forum.
I want to control my drone with raspberry pi 3 (with a matlab/ simulink code).Still not sure if its possible from Matlab/ Simulink.

Anyway, I am abiding by the link given in Raspberry Pi 3 connecting to Pixhawk for connecting rpi3 and flight controller.

I have used APSync image. I connected to rpi3 on its wifi access point and did ssh on 10.0.1.128.

Then I followed whats given on webpage. That is disabled OS control of serial output. Then executed

  • sudo -s
  • mavproxy.py --master=/dev/ttyAMA0 --baudrate 57600 --aircraft MyCopter

It requires some time to receive heartbeats, then shows “STABILIZE> mode STABILIZE”.

Does this mean that the raspberry and flight controller are communicating as required? If yes, why is that there are no parameters received and saved to log?

Thanks for your help.