Introduction: The Drone Pi

Picture of The Drone Pi

NOTE: THIS INSTRUCTABLE IS BEING WRITTEN

This project is a quadcopter powered by a Multiwii and controlled with a Raspberry Pi 2 B. This quadcopter has a particularity because he's using 2 differents controller and he could be pilot with 2 differents devices : a remote control or a smartphone.

The Multiwii controller look after the 4 motors and distribute the power to supply them whereas the Raspberry Pi collect the informations who came from the smartphone and relay them to the Multiwii. You can also take pictures and Full HD video too !!! A Pi camera is places on the frontground of the Drone Pi. It ca recording or just take a picture to a USB key.

The frame of this quadcopter is constituating with different recycled elements and it was another challenge : create a quadcopter with sometimes heavy elements... But we did it !

We are some young french students and it was our first creation. We were helping during this project with some internet website whose Instructables and now we want to share with you our Drone Pi. Enjoy !

Step 1: Parts

Picture of Parts

To build our quadcopter you will need the following parts :

  • A frame - You can buy it on the internet or you can make it like us. It's not difficult to create your frame, you just have to make a X of approximately 0,45m of diameter (for a stable quadcopter) and you put different levels on the center to put your Raspberry, Multiwii, battery, ESCs, etc...
  • 4 motors (16€) - For a quadcopter you need 4 motors but if you want to make a octocopter you will need 8 motors as well. We are using Turnigy brushless motors. (we will come back to the motors in the step 2) http://goo.gl/G9oE1c
  • 4 ESCs(10€) - The electronic speed controller is using to delivery the power to the motor with the informations of the Multiwii. We're using Hobbyking 30A ESC. http://goo.gl/2txm0b
  • Battery (27,5€) - Of course if you want to fly you must to supply your motors so you need a Battery. We're using a Turnigy 3S 3300mAh. http://goo.gl/4GHr01
  • Battery monitor(4€) - It ring when your battery is down. We're using a Hobbyking battery monitor 3S.
  • Power distribution board(4€) - This board is using to connect your ESCs to the Battery.We're using a Hobbyking quadcopter power distribution board for quadcopter. http://goo.gl/0WCvB3
  • Propellers(5€) - A quadcopter with some motors but whithout propellers it isn't a quadcopter so choose your props according with your frame. For our frame of 40cm you need some props with lenght=10 and pitch=4,5. We're using 10x4,5 SF props. http://goo.gl/4taM8k
  • Multiwii (49€) - This controller is using to command the motors and share the power. We're using a CRIUS AIO PRO Multiwii.
  • Mounting pad(2€) - Because the motors create a lot of vibration you have to buy some mounting pad to reduce them under the multiwii. http://goo.gl/aifflj
  • Raspberry pi 2 B(35€) - It could also run with another model of Raspberry pi but we have just tested with this Raspi and it's more powerful than the previous version.
  • Pi camera(19€) - To capture video and take photo. It can be only run with a Raspberry pi
  • Wifi key(9€) - It connect to the Raspi and create a wifi network to relay the informations from the smartphone app to the Raspi.
  • USB key - To save the video
  • Remote control + rc receiver - If you want to control your drone with this. You will connect the rc receiver to the Multiwii.

You have to weld the connectors to the ESC wire, to the motors wire and to the distribution board wire.

Step 2: How It Works ?

Picture of How It Works ?

The multiwii

Multiwii is a open source french project who was based on a arduino. The project is open source so we can find many kind of multiwii. We use a similare version of CRIUS AIO PRO V2. This is a flight controller: Its role is to send speed signals to the esc to hold the quadcopter in the air. We use the mutlwii project beacause its a known project used by many users with a great community but mostly because programs like this is too complicated for us.

The Raspberry

In our project the raspberry made the main role. First at the startup it create a private wifi network with a DHCP server (to give IP address), this wifi network has no internet access and this only to communicate with the smartphone. Secondly it stat a python program (created by us) who start a websocket. A websocket is a permanent connexion between the server (raspberry) and the client (the smartphone app), it will serv to received command from the app. Then the same progam connects to the multiwii via USB. It will serve to send commands informations who come from the smartphone to the multiwii ( see schema for understand). Sources are available on github (https://github.com/reglisse44/Multiwii-raspberry-drone-server)

The Application

The application is made in html/css/javascript with cordova. Cordova is a technology who permit to create an application with web technology compatible with android, ios and more ... The user think it is a standard android app but in fact this is a web view :), it's easy to develop applications like this for web devellopers ... Sources are availlable in github (https://github.com/reglisse44/quadcopterControl)

Step 3: The Frame

Picture of The Frame

To make a good frame you need to use the lightest elements as you can. For our Drone Pi, we had to build it with recycling elements so our frame is a bit heavy but anyway it doesn't matter for our motors.

The diameter of the frame is 0,45m because we wanted a "stable quadcopter" for the camera and not a "racing quadcopter". On the center of the X they are 3 levels (maybe 4 in the futur) to put the controllers, the ESCs and our battery (you have all quotations in the pictures on the top of the page).

We've created a platform to the multiwii on the top of the quadcopter(picture 2) and another to the battery(picture 7 and 8) on the underneath of the quadcopter. For the Multiwii's platform, we wanted to put the raspberry under the multiwii because there are some connections between them. For the battery's platform, we wanted to take on or take off the battery to charge it. All picture are in next step...

Finally, we put 4 feet to the quadcopter to be able to land it but they are not pretty and bad.

Step 4: Propulsion

Picture of Propulsion

For the propulsion you need your 4 motors, your 4 ESCs (to adapt the voltage to the motors), your battery and finally your Multiwii.

  1. Connect your motors to your ESCs. You can invert the wire to invert the rotation of your propellers (see schema to know rotation direction).To begin, DON'T put your props on the motors to don't have any accident, the props are fragile and they could be break.
  2. Connect the ESC to the distribution board (respect the color).
  3. If all is ok you can install the components on the frame
  4. The screw we had with the motor was too large for the propellers so we needed to enlarge them (see pictures)

Step 5: Flight Controller and Raspberry

Picture of Flight Controller and Raspberry

Now we will install the multiwii ans the raspberry pi. For install the two component at the same place we build a support who came on the top of the raspberry to place the multiwii (see picture).

  1. Install the raspberry with his support
  2. Put the multwii on the support with anti-vibration pad
  3. Conect the ESCs to the multiwii with the dedicated pins

Next we will compile multiwii firmware into the board. To begin connect the multiwii board to your computer via USB

To configure the multiwii:

  1. Download multiwii firmware from https://code.google.com/p/multiwii/
  2. Download arduino software from https://www.arduino.cc/en/Main/Software
  3. Open arduino project "Multiwii.ino"
  4. Change arduino board in "Tools">"Board">"Arduino Mega 2560 or Mega ADK"
  5. Select the port in "Tools">"Serial Port"> And select the multiwii port.
  6. Next, open file "config.h"
  7. Search at the begining of the file the line: "//#define QUADX" and uncomment it (remove the "//")
  8. Search again the line "//#define CRIUS_AIO_PRO" and uncomment it.
  9. All is ready, save the file and run compilation
  10. Next you will need to calibrate all sensor with MultiwiiConf, I let you search tutorial on internet.

At this moment, we don't connect the Multiwii to the Raspi so if you want to look your motors in action before configure you raspberry pi put them on your frame, you'll need a remote control with a rc reciever and connect the rc reciever to the Multiwii. We'll don't explain to you how to do this but Google is your friend ;) and it's not difficult to do this. (DONT use motor with their propellers)

Step 6: Raspberry Pi

Picture of Raspberry Pi

Debian installation:

Install raspbian with noobs by following this tutorial: www.raspberrypi.org/help/noobs-setup/

Launch raspi-config and enable pi-camera

IP configuration

sudo nano /etc/network/interfaces 

remove all wlan0 configuration and edit to this:

allow-hotplug wlan0
iface wlan0 inet static
	address 192.168.10.1
        netmask 255.255.255.0
        gateway 192.168.10.1

Hostapd installation:

Before begin make all update:

sudo apt-get update && sudo apt-get upgrade

Install hostapd:

sudo apt-get install hostapd

And test with minimal configuration

sudo hostapd hostapd.conf

If you can see your network from you smartphone it work BUT DONT TRY TO CONNECT ( it will failed with ip error because we haven't got any DHCP server)

DHCP server installation:

Now we need yo install a DHCP server to give IP address to wifi clients.

sudo apt-get install isc-dhcp-server

Run this command to edit the file:

sudo nano /etc/dhcp/dhcpd.conf

Find the lines that say

option domain-name "example.org";

option domain-name-servers ns1.example.org, ns2.example.org;

and add "#" before them to comment them

Install usbmount

We need usbmount to mount the USB key. This is to save the video on the USB key.

sudo apt-get install usbmount

Now all usb keys must be mounted on the folder "/media/"

Install Python quadcopter program:

First install dependencies:

sudo apt-get install python-pip build-essential python-dev
sudo pip install tornado

and clone the git project

git clone https://github.com/reglisse44/Multiwii-raspberry-drone-server.git multiwiiControll

You can test the programm by launching like this:

Test this !!:

Warning: For the moment if you want to start the python program you need:

  • The pi-camera connected and activated in raspi-config
  • The multiwii board connected to a raspberry USB port as the name "ttyUSB0" (you can check with the command "dmesg | grep tty", if your multiwii is connected with a other name change it at the begining of the file "main.py")

Before begin reboot your pi to apply all previous installation.

Next follow these commands:

sudo hostapd -B /etc/hostapd/hostapd.conf
sudo ifconfig wlan0 192.168.10.1
sudo service isc-dhcp-server restart
sudo python multiwiiControll/main.py

Explaination:

  1. "-B" is to launch hostapd in background
  2. After starting hostapd, the ip change (I dont know why). So we need to set it manually
  3. Restart dhcp server to init it with the new wlan0 network
  4. And start python script

Automations this at boot:

To launch all these command at boot we use cronjob and a sh script.

sudo crontab -e

This command open the nano editor. Write this at the end of the file:

@reboot /home/pi/multiwiiControll/autostart.sh
@reboot sudo python /home/pi/multiwiiControll/main.py &

Exit and reboot, if all is fine, all must be start on boot !

Step 7: This Is the End !!!

If you have any questions you can post a comment and Thank you to read our instructables :)

Comments

blusurfox made it! (author)2017-10-16

Great little project, built it with my son and have learnt a lot. Need to add that when doing arduino and multiwii configuration, must run as sudo or don't see the flight controller (ttyUSB0).

Also had to change some permissions and I learnt how to edit apk file on phone to change language. Also how to recharge Lipo battery when you don't read instructions and leave it connected overnight so it discharges too much...

Used an old raspberry pi model B. Currently trying to put on new pi3 as I wasn't very good with the controls and crashed and broke propellers, usb aerial and ESC. Now using onboard wifi and faster CPU so will see what happens.

I only used the code from the page and it all worked, but putting it together took a bit of swearing and a lot of googling (or vice versa).

Thanks for the inspiration. Yes I could have walked into a shop and spent far less money, but wouldn't be the same....

edisonmoreno (author)blusurfox2017-11-01

I could not find the multiwii "CRIUS AIO PRO V2" can anyone tell me to use or pass the hobbyking.com link?

What multiwii did you use?

blusurfox (author)edisonmoreno2017-11-02

I used (Multiwii and Megapirate AIO Flight Controller w/FTDI (ATmega 2560) V2.0) from hobbyking but these are currently showing out of stock. On googling this came up:

https://www.gearbest.com/development-boards/pp_694...

but depends on your location. I think the hobbyking ones came from Europe.

edisonmoreno (author)blusurfox2017-11-03

Yes, they are running out and there are no available units.

Is it possible to change it for another flight controller?

blusurfox (author)edisonmoreno2017-11-05

The code that you download is specifically set up for Multiwii. I think it would work with another multiwii flight controller but NOT any other make of flight controller (without rewriting all the code - which is way beyond me).

basicodemine (author)2016-09-24

Move your left joystick to the bottom right corner! Lol that was my solution. Read comments too. Project is finished thank you!

EduardoL49 (author)basicodemine2017-06-16

Help me please

I have an error when running /multiwiiControll/main.py

it showed;

{ ' record ' : False, ' main_controller ' : False, ' usb ' : [ ' /media/usb0 ' ] }

What's my error?

ArthurL53 (author)EduardoL492017-11-02

Did you figure it out?

HaziqA6 (author)basicodemine2017-04-05

any pictures of videos u have to show ur completion of this project? are u using RPi 3?

basicodemine (author)HaziqA62017-04-05

Yes ofc ive. But i cant upload here. I will send link asap.

HaziqA6 (author)basicodemine2017-04-05

ok thank you! cause im having some problems with the interface..

edisonmoreno (author)2017-11-01

1.I could not find the multiwii "CRIUS AIO PRO V2" can anyone tell me to use or pass the hobbyking.com link?

TariqulI4 (author)2017-10-30

Can i talk with you...if you have time

benrue (author)2017-10-10

Hi, is it possible to get the code from you per pm? This would be very nice.

rmartinez47 (author)2017-09-16

was this lighter than if you had used plywood as your frame?

Muhammad OsamaB (author)2017-09-07

Sir will u plz give me the complete source code of this project ..? I desperately need of it ..

FritzenB (author)2017-05-15

Hi everyone,i do the same project with friends but i need help, can someone help me ? ( I'm french/indian and my Skype is FrOoTzii )

SohamH3 (author)FritzenB2017-05-26

Hello FritzenB! Idlf you can explain what help do you need, I'm ready to explain the solution. Pm me.:)

DiwakarP1 (author)SohamH32017-08-29

I'm having problem in writing code.. i dont know from where i have to start..?

if u have code share it to me..

FritzenB (author)SohamH32017-06-02

I send you a message, reply me. Thank you for your help

vittorioc9 (author)2017-07-04

Please, can someone how built the drone help me? I made it as a project for an exam at school, but I can't get it to fly... The Pi works and I can connect with my phone, but I can't get the engines to start, they won't even arm.

I hope someone will be able to help me.

DiwakarP1 (author)vittorioc92017-08-29

what about coding part..? Can u share it to me

DiwakarP1 (author)2017-08-29

Where can i get the code..?? I'm little bit confused in writing code.. I don't know from where to start.. If someone have written code.. reply me :|

jackm0920 (author)2017-07-26

what is the range with the wifi key?

jackm0920 (author)2017-07-25

Do you know the range on the wifi key?

NoaCohen (author)2017-07-23

I have a Crius MultiWii SE v2.6, so what I need to change in the MultiWii configuring? (Board etc..)

ramesh rkv (author)2017-07-20

Hello any one send the connection diagram or circuit diagram

ramesh rkv (author)ramesh rkv2017-07-20

Any one send to me fast

FranciscoV81 (author)2017-06-27

How are you supplying power to the RPi?

Ridhulp (author)2017-06-19

r u using an arduino ? ...... is it possible to control it with arduino without a flight controller?..... or is there cheap multiwiis available?..

payam.shopping (author)2017-02-23

Hi,

I know it's a silly question, but need to know about the connection between Battery, ESC and Multiwii/Raspberry Pi. I saw you connection diagram but it doesn't say anything about the connection between Battery and Multiwii/Raspberry pi.

Thanks in Advance.

UmutK6 (author)payam.shopping2017-03-06

I found this one in older comments from the author; they said

"the esc (who control the speed of the motors) have a UBEC. A ubec is low output power. You can see on the cable connected to the multiwii, there is a red cable: this is a 5v 3A power Who came from the esc.And this is how the multiwii is powered. And on the multiwii there is also an output 5v, we just plug 2 cables from the multiwii to the raspberry.? Finaly this is energy chain:
Batterry-11.1V->ESC-5V->multiwii-5V->Raspberry"

shubhrad (author)UmutK62017-04-08

can someone please share the connection diagram? as i am still confused about connections

SohamH3 (author)shubhrad2017-05-30

Please take a look at my answer above. If you still feel you need help regarding this, just drop a message. :)

SohamH3 (author)payam.shopping2017-05-26

The black and red wires of the battery are ground (-) and positive (+)respectively. They'll connect to the ESCs black and red wires respectively. The Esc will have outputs on the other side where 3 wires of same colour are present. Connect these to the 3 pins of the brushless motor. If your motor rotates the other way round, interchange any of the two wires out of three. REMEMBER:: DON'T CHANGE THE BLACK AND RED WIRES CONNECTED TO BATTERY. THE POLARITY MUST REMAIN AS THE COLOUR INDICATES.
Next on the input side of the Esc, there will be another pair of wires. This will be the signal input.if three wires are on the signal input line, then black or brown colour wire will be ground, middle wire will always be (+5) if it has a BEC, and the other extreme wire will be signal (usually white or Orange ). Connect the signal pin to the flight controller signal out pin.
Repeat this for the four ESCs. For the connection to pi, use a normal micro usb cable, and open terminal in the pi. Type "dmesg | grep tty" without the quotes and press enter. See the port this fc is connected to, and note it down. Generally it will be ttyACM0. Add this port name in the beginning of the main.py. If you have any more problems, feel free to message me.:)

SohamH3 (author)2017-05-26

If anyone is having problems regarding this project up until the android portion, feel free to contact me. (I.e. send a message.) :)

NoaCohen (author)2017-05-06

Can I replace the flight controller to KK Flight Control F450? How it will connect the raspberry pi and get the information?

NoaCohen (author)NoaCohen2017-05-19

or even use the Crius MWC MultiWii? how it will all connect?

SohamH3 (author)NoaCohen2017-05-26

Hello NoaCohen,
This is Soham here.
You won't be able to use the kk fc due to the fact that kk boards don't communicate using the MSP. Only multiwii based boards will communicate with MSP. So as for your next comment, MWC canbe used for this project. :). Feel free to pm me in case of any queries. (Clock on my name and then "Send Message" in the page that appears.
Soham

EduardoL49 (author)2017-05-18

I have an error when running /multiwiiControll/main.py

it showed;

{ ' record ' : False, ' main_controller ' : False, ' usb ' : [ ' /media/usb0 ' ] }

What's my error?

haziqadam (author)2017-04-05

I had an error when running /multiwiiControll/main.py

After calibrating success of my multiwii, it showed;

{'record': False, 'main_controller': False, 'usb': [ ] }

EduardoL49 (author)haziqadam2017-05-12

It happened to me, did you solve it?

haziqadam (author)haziqadam2017-04-05

I have my multiwii, keyboard and mouse connected to my Pi3. All are connected to ttyusb0

robbieb34 (author)2017-05-10

how much does it cost all togather

정우이4 (author)2017-05-10

sudo hostapd -B /etc/hostapd/hostapd.conf ?

Configuration file: /etc/hostapd/hostapd.conf

drv->ifindex=3

l2_sock_recv==l2_sock_xmit=0x0x1524638

ioctl[SIOCSIWMODE]: Invalid argument

Could not set interface to mode(3)!

Could not set interface to master mode!

rtl871xdrv driver initialization failed.

sudo service isc-dhcp-server restart ?

Job for isc-dhcp-server.service failed. See 'systemctl status isc-dhcp-server.service' and 'journalctl -xn' for details.

why?

Aizaz UllahK (author)2017-05-07

Sir where is the full & final source code for this project.?

I have seen alot of codes in (Python Quardcopter Program) & in (Cell Phone App)?

modsfabio (author)2017-04-25

Which wires do I have to invert? Red? Black? Blue?

sandrao32 (author)2017-04-17

hi,

amazing project,was looking at the code what if you don't have a camera? what happens to the code

HaziqA6 (author)2017-03-29

Hi, I'm using a RPi3 and I have followed the steps until I key in the command;

"sudo hostapd hostapd.conf" ,

it says,

"Configuration file: hostapd.conf

Could not open configuration file 'hostapd.conf' for reading.

Failed to set up interface with hostapd.conf

Failed to initialize interface"

Any help with this would be much appreciated. Thank you!

BharatiS3 (author)HaziqA62017-03-29

Follow these commands . https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software

About This Instructable

401,970views

1,242favorites

License:

More by reglisse44:The Drone Pi
Add instructable to: