Engineer's Asylum

How to connect a Raspberry Pi to an Ardupilot drone controller?

I’m trying to make a Follow me! Drone with an OpenMV Cam supported by a Raspberry Pi and send orders to the drone. I think that I should use an Ardupilot Pixhawk as the controller. Any help is great!

1 Like

Could you be more specific what is the exact issue you are facing? If you are yet to start the project, I suggest you start designing a drone first, once it is successfully completed you may add additional payloads like camera, sensors and so on. So, lets design a drone first! Do you have an inital design for a drone??

I wonder, are you using a pre-built drone or are you building one yourself? Since if you’re building it from scratch it might be easier to implement your own features and code it to your desire. If you’re using existing ones, however, it might be harder to do that. If you have a DJI, for example, you won’t be able to fly it with your own software unless you spend some significant time hacking the drone’s connection with the controller.
If you choose to build your own drone you have to consider many aspects. Starting with design, as mentioned by @Administrator . To start designing your drone you might want to use some CAD program to design your own parts and you might want to 3D print them yourself to accommodate for your requirements (Where the camera will be, where the flight controller will go and where you’ll put your PI). We are having a discussion of The best low budget 3D printer which would work perfect for your project.
To start designing your drone, you also must consider what parts exactly will go in it, what motors you plan to put in (you’d need 2 at a bare minimum), how you plan to do the wiring, what camera you plan to use (if you’ll put a GoPro or something heavier, or something lighter) because that greatly affects the ability of flight and maneuver. You have to plan for the propellers you will use, if you’ll buy some or 3D print your own, and you’ll have to consider how to props actually behave under high speeds and pressure of handling the air.
Take into the account that physics plays a massive part in how you design and fly the drone.
Also, you have to make sure that whatever drone you make complies with the local drone laws you have. If the weight is too great, or if the speed goes over the limit, so you’d have to register it.
Also the laws about flying it over buildings, roads, sites and most important over people.
You must do a considerable amount of testing of the software you plan to run on that drone. Most countries around the world, and most states in the USA do not allow for drones to be left uncontrolled (You putting the controller in your pocket and letting it fly itself).
Your software itself must account the local laws, it also needs a lot of features, most important one obstacle avoidance. Then it needs GPS or some other tracking as it might go out of LOS.
You must as well consider the local Radio Frequency laws, that is, at what frequency are you allowed to control your drone. How high you may fly the drone etc…
There is many things to take into consideration when making the drone, I named a few that popped into my mind right now. If you plan on making the drone however, we’ll try and help you as much as possible. Essentially you can create a post here on the website in the “new ideas” section where you can start off the drone and then whenever you get stuck, someone else from the group can land a hand and help. We have a lot of experts in the group, I am sure we can make it work in no time, with the right tools :stuck_out_tongue_winking_eye:

Tell us what you think and what you will do.

1 Like

Hi! Thank u for help me. First, I’m designing a racing drone and I know the laws for flying but, the following project is to design a Drone Lantern, that works following you or staying in front of…
My idea was to use the Ardupilot Pixhawk because it has some inputs for telemetry or gps and it’s the most flexible controller that I know… I was thinking about mount the PI out of the drone because of the weight and consuming battery. One of my biggest problems is how to send the decision that make the PI to the drone controller… I’m an electronics student and I would like to learn Python for AI programming and communications, so it’s wonderful for me if u are interested in help me and participate.
Thanks u guys!!

So you are trying to build a radio telemetry system which send data from your Raspberry Pi to Pixhawk. I think you may use two RF transceiver like the nRF24L01. This module use SPI protocol for communication.

I hope @Cisco can suggest you a better solution.

1 Like

Alright, that’s a bit clearer.

For the following I will assume PI will sit in your pocket, or hooked to your laptop.
If your goal is short distance radius for the drone, you might want to use something simple as ESP module for WiFi, hook your PI to it and then just parse the data on the controller that’s sitting on the drone. As suggested by @Administrator you could go with RF transceiver but that has certain limitations in terms of bandwidth and amount of data you might want to send/receive, thus I would not recommend it for a close proximity drone.

So, now that you have your WiFi module, you’ll want to make it into a “server” that will send and receive data concurrently. Depending on the props and motors you will be using, you can opt out to use 2 modules and have those actions run independent of each other (each on individual module). You will as well have to use a frequency range extender (Antenna) so you can connect to it from a distance, say 20-30 meters, without interruptions.
On PI Side, you might want to use Antenna likewise, or not, your choice, but all you will have to do is simply query the server for the data that you require and wait for response. On a peer-to-peer connection it should be very fast. You can then do your thing and send the data back.
The simplest REST service should actually work for this purpose, unless you implement something more efficient.

Now, if you plan on having the drone following you from a much further range, 100-200 meters, you might want to consider an RF relay if you aren’t planning on spending BIG money on long range WiFi modules.

Now for my suggestion, I wouldn’t go with Pixhawk as the main controller as it’s too bulky (If you take it with Dev. Board), unless you have designed space for it already in in your drone. Regarding Telemetry data, you could go with custom sensors.

Also, you could opt out and use a regular laptop with a WiFi antenna to do you ML stuff likewise. Or even and Android phone (Cause Apple is just plain bad for this type of things).

Sorry if I missed anything or miss typed something, or something is out of context, I wrote it over phone.

@joan_carrio Feel free to ask me anything about this project and I’ll try my best to give you the best suiting advice. I think the project is really cool, but could use some more brainstorming on the equipment side. We can help you with that too when you get to the part of ordering the parts for it :wink:


Thank you so much. Honestly, I was a bit confused because of how to focus the project. It’s true that there are some head breakers with the logistics but I think that it’s a tech challenge for me because I’m studying electronics and started a racing drones design academy with my team at UPV ( Valencia, Spain ). I have one more question, instead of the Pixhawk can I use an standard typical Betaflight F7 or similar?? When I get clear this, I’ll start choosing the other components like battery and sensors.
Thanks you again!

1 Like

Okay, that’s a cool academy, I’d attend :smile:
I managed to dig out one more problem with Pix, is that it’s lost the support, and is generally looked down upon by FPV drone builders, so I would advise against it, also, if you’re looking for high quality products, in MOST cases, avoid stuff that have “Ardu” in their names, since Arduinos stand for the cheapest MCs on the market that are sort of out-of-the-box MCs, plug ‘n’ play. Easy to program, easy to install. Doesn’t mean they are quality.
You could go for Betaflight F7 for your first project, shouldn’t be that hard to install, plus it’s way more adapted to the standard of the modern FPV drones. You can even pick a Chinese knock-off as a test MC to see how your design works.
If I am not mistaken, Beta comes with 2 Gyros in it and accelerometer, barometer maybe, but you’ll have to check.

All you would need now would be a WiFi or RF module to connect to it, and to connect to your PI.
And most important of all, of course, to know how to program it :stuck_out_tongue_winking_eye:

No need to thank, feel free to post every time you have a doubt!

1 Like