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
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
- Connectors 3.5mm(4,5€) - To weld the esc and the motors. http://goo.gl/byW6rg
- Connectors 4.5mm (4,33€) - To remove the old distribution board connector and weld this new. http://goo.gl/KSahYJ
- 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 ?
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.
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)
Step 3: 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
For the propulsion you need your 4 motors, your 4 ESCs (to adapt the voltage to the motors), your battery and finally your Multiwii.
- 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.
- Connect the ESC to the distribution board (respect the color).
- If all is ok you can install the components on the frame
- 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
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).
- Install the raspberry with his support
- Put the multwii on the support with anti-vibration pad
- 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:
- Download multiwii firmware from https://code.google.com/p/multiwii/
- Download arduino software from https://www.arduino.cc/en/Main/Software
- Open arduino project "Multiwii.ino"
- Change arduino board in "Tools">"Board">"Arduino Mega 2560 or Mega ADK"
- Select the port in "Tools">"Serial Port"> And select the multiwii port.
- Next, open file "config.h"
- Search at the begining of the file the line: "//#define QUADX" and uncomment it (remove the "//")
- Search again the line "//#define CRIUS_AIO_PRO" and uncomment it.
- All is ready, save the file and run compilation
- 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
Install raspbian with noobs by following this tutorial: www.raspberrypi.org/help/noobs-setup/
Launch raspi-config and enable pi-camera
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
Before begin make all update:
sudo apt-get update && sudo apt-get upgrade
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
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
- "-B" is to launch hostapd in background
- After starting hostapd, the ip change (I dont know why). So we need to set it manually
- Restart dhcp server to init it with the new wlan0 network
- 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 :)