The Pi Quadcopter
by Mars_OrBust in Circuits > Remote Control
78848 Views, 424 Favorites, 0 Comments
The Pi Quadcopter
![PiCover copy.png](/proxy/?url=https://content.instructables.com/FJP/QPMS/IR3ZP4G9/FJPQPMSIR3ZP4G9.png&filename=PiCover copy.png)
![The Pi Quadcopter](/proxy/?url=https://content.instructables.com/F93/7XQJ/IR9E9D6R/F937XQJIR9E9D6R.jpg&filename=The Pi Quadcopter)
![pi7.jpg](/proxy/?url=https://content.instructables.com/FLS/YFF2/IR3ZOCXB/FLSYFF2IR3ZOCXB.jpg&filename=pi7.jpg)
![pi5.jpg](/proxy/?url=https://content.instructables.com/FTU/U4BR/IR3ZOCZE/FTUU4BRIR3ZOCZE.jpg&filename=pi5.jpg)
![pi4.jpg](/proxy/?url=https://content.instructables.com/FMC/4DQL/IR3ZOD1R/FMC4DQLIR3ZOD1R.jpg&filename=pi4.jpg)
![pi3.jpg](/proxy/?url=https://content.instructables.com/FN7/BP1F/IR3ZOD3R/FN7BP1FIR3ZOD3R.jpg&filename=pi3.jpg)
![pi2.jpg](/proxy/?url=https://content.instructables.com/FDD/JGQ3/IR3ZOD3V/FDDJGQ3IR3ZOD3V.jpg&filename=pi2.jpg)
![IMG_4105.JPG](/proxy/?url=https://content.instructables.com/FD9/8WRJ/IR3ZODAH/FD98WRJIR3ZODAH.jpg&filename=IMG_4105.JPG)
![IMG_4106.JPG](/proxy/?url=https://content.instructables.com/FPA/4TWC/IR3ZODD4/FPA4TWCIR3ZODD4.jpg&filename=IMG_4106.JPG)
![IMG_4107.JPG](/proxy/?url=https://content.instructables.com/F0X/BIDK/IR3ZODFP/F0XBIDKIR3ZODFP.jpg&filename=IMG_4107.JPG)
![IMG_4108.JPG](/proxy/?url=https://content.instructables.com/FP4/2FEA/IR3ZODID/FP42FEAIR3ZODID.jpg&filename=IMG_4108.JPG)
![IMG_4109.JPG](/proxy/?url=https://content.instructables.com/FNE/JVIX/IR3ZODLL/FNEJVIXIR3ZODLL.jpg&filename=IMG_4109.JPG)
![5798134b50e1b6aca4000112.jpeg](/proxy/?url=https://content.instructables.com/FI2/WCPM/IR3ZOUTJ/FI2WCPMIR3ZOUTJ.jpg&filename=5798134b50e1b6aca4000112.jpeg)
![Screenshot_2016-07-22-11-24-37.png](/proxy/?url=https://content.instructables.com/FV6/3LOM/IR3ZP2EF/FV63LOMIR3ZP2EF.png&filename=Screenshot_2016-07-22-11-24-37.png)
Ever since hobbyist multi/quadcopters have become easily available, I have wanted to fly one. However, I did not want to simply buy an off-the-shelf model with a plug-n-play experience. I wanted to built a quadcopter myself. I wanted to own it. I imagine that is why you are here too. Buying a quadcopter is simply too easy.
Over my winter break I finally had the time to start planning and building a quadcopter of my own. I will walk you through my experience of making it, a quadcopter controlled over Wi-Fi by a Raspberry Pi B+ (instead of a traditional radio controller/ transmitter ), with a MultiWii flight controller.
Requirements:
- Around $200 total. Depends on what you already have
- An Android phone (No Apple support yet)
- Time! Planning/ ordering/ build/ testing all takes a lot more time then you think
I would like to thank reglisse44 for his tutorial that inspired this one.
The Raspberry Pi's Role
![photo_2016-01-30_20-19-20.jpg](/proxy/?url=https://content.instructables.com/FVT/QBLB/IJYUTVGE/FVTQBLBIJYUTVGE.jpg&filename=photo_2016-01-30_20-19-20.jpg)
![raspberryPi.jpg](/proxy/?url=https://content.instructables.com/FU2/Q5H4/IR3ZNROV/FU2Q5H4IR3ZNROV.jpg&filename=raspberryPi.jpg)
A high-level explanation of how the Pi is being used:
I had a Raspberry Pi on hand, so I decided to use it in place of a traditional radio controller. This setup accomplishes the same thing as a traditional radio transmitter/ receiver would. If I give an input to increase the throttle, then the Raspberry Pi reads that, and tells the flight controller the same thing that the traditional radio receiver would.
Just to clarify, the Pi is not the flight controller. The Pi acts as the radio transmitter/ receiver would - transmitting flight instructions to the flight controller.
Here's what happens when everything is powered: The Raspberry Pi turns on, creates an open Wi-Fi network, and connects to the MultiWii Flight Controller. A companion app on your Android phone (no iPhone support currently exists), connects to the network created by the Pi, and is able to control the quadcopter through the same controller layout on a regular radio controller.
Some Basic Information and Definitions
When I started to build, I had no idea how anything was supposed to work or what the terms being tossed around meant. So I'll describe some basics along with definitions and links.
- Flight Controller: This is a small board whose function is to direct the RPM of each motor. It is too complicated to control each motor of a multicopter individually. So, a flight controller responds accordingly to (roll, pitch, yaw, throttle) input from the pilot, calculating how to direct the motors. It contains at least an accelerometer and a gyroscope, and potentially a barometer and even GPS. The flight controller is capable of self-leveling, and has different modes of flight if desired.
- MultiWii: The specific brand of flight controller being used. The original model was based on the accelerometer and gyroscope found in a Wii Motion Plus, hence the name. More info about MultiWii.
- RC / Radio Control: The system used by the pilot to control the throttle, roll, pitch, and yaw of the quadcopter. A radio receiver is usually connected to the flight controller through pinouts on the flight controller board. In this instance, a mobile app is is connected over Wi-Fi to the Raspberry Pi to instruct the flight controller, which is connected over a FTDI (Mini USB -> pinout) serial connection.
- Motors and Props: Depending on the type of quadcopter you are aiming for - Faster/Maneuverable (smaller) or Stable/Sturdy (larger) - the type of motors/props that you need will vary dramatically. Motors have a Kv rating, which determines their RPM with zero load at 1 volt. The general rule is for racing copters, a higher Kv rating and shorter props, while for a more stable copter a lower Kv with longer props is recommended.
- CW and CCW: Due to the physics involved, two props spin clock-wise and two spin counter-clock-wise. Check out Step 6 for a good graphic.
- "Brushless" DC motor: These are the most common type of motors used in RC applications. As compared to "Brushed" DC motors, they do not wear out as fast. However, they do need ESCs (as described below) in order to operate them since they are much more complicated to control
- Power: The power system starts with a battery, which is connected to an appropriate power distribution board, splitting the voltage in parallel. From there, the power flows to the ESCs and then to the motors.
- ESCs: A Electronic Speed Controller converts a digital signal into analog for a motor. It connects to the flight controller via pinouts, which is how the flight controller directs each motor. This is also how the flight controller is powered (as there is no other power source connecting it).
- Tom's Hardware link. Great source covering this in more detail
- For Li-Po battery information
- ESC information
- MultiWii software setup 1
- MultiWii software setup 2 (Radio Transmitter details also)
For those who have done this before, the above is obvious. If this can help explain some of the vague details to someone, I'm happy.
Parts
![IMG_4097.JPG](/proxy/?url=https://content.instructables.com/FYQ/RKOL/IR3ZO8WZ/FYQRKOLIR3ZO8WZ.jpg&filename=IMG_4097.JPG)
![56ada9cb4fbadef83c000709.jpeg](/proxy/?url=https://content.instructables.com/F3C/8RTP/IJYUUX1G/F3C8RTPIJYUUX1G.jpg&filename=56ada9cb4fbadef83c000709.jpeg)
![56adab0667400cfcaa000fe9.jpeg](/proxy/?url=https://content.instructables.com/FUT/XEIK/IJYUUX8D/FUTXEIKIJYUUX8D.jpg&filename=56adab0667400cfcaa000fe9.jpeg)
![56adb0c350e1b6fdce000352.jpeg](/proxy/?url=https://content.instructables.com/FKD/YXFM/IJYUUY0A/FKDYXFMIJYUUY0A.jpg&filename=56adb0c350e1b6fdce000352.jpeg)
![56adacb750e1b6e09600098b.jpeg](/proxy/?url=https://content.instructables.com/FUD/RZN3/IJYUUXDX/FUDRZN3IJYUUXDX.jpg&filename=56adacb750e1b6e09600098b.jpeg)
![56ada9fd45bceb4f86000085.jpeg](/proxy/?url=https://content.instructables.com/F6P/48KJ/IJYUUX2C/F6P48KJIJYUUX2C.jpg&filename=56ada9fd45bceb4f86000085.jpeg)
![56ada83b937ddbfd28000cca.jpeg](/proxy/?url=https://content.instructables.com/FXK/22JM/IJYUUWUD/FXK22JMIJYUUWUD.jpg&filename=56ada83b937ddbfd28000cca.jpeg)
![56adb25950e1b6e09600099d.jpeg](/proxy/?url=https://content.instructables.com/FN1/82W4/IJYUUY4N/FN182W4IJYUUY4N.jpg&filename=56adb25950e1b6e09600099d.jpeg)
![56b1556267400c2b91000dd9.jpeg](/proxy/?url=https://content.instructables.com/FSR/E55N/IK5S0EDD/FSRE55NIK5S0EDD.jpg&filename=56b1556267400c2b91000dd9.jpeg)
![56ada95967400cfcaa000fe8.jpeg](/proxy/?url=https://content.instructables.com/FCT/KKPK/IJYUUWZV/FCTKKPKIJYUUWZV.jpg&filename=56ada95967400cfcaa000fe8.jpeg)
![56ad973650e1b6e096000943.jpeg](/proxy/?url=https://content.instructables.com/FKS/7D0Y/IJYUUTJM/FKS7D0YIJYUUTJM.jpg&filename=56ad973650e1b6e096000943.jpeg)
![56ada72650e1b6e096000977.jpeg](/proxy/?url=https://content.instructables.com/FYZ/XPCU/IJYUUW77/FYZXPCUIJYUUW77.jpg&filename=56ada72650e1b6e096000977.jpeg)
Propulsion:
- (4) Turnigy D2836/8 1100KV Brushless Motor: HobbyKing Link
- (1) HobbyKing Slowfly Propeller (Pack of 4): HobbyKing Link
- Large (10 inch) propellers that will work well with our 1100KV motors.
- Includes 2 clockwise and 2 counter-clockwise
- I suggest buying more than one pack. They're cheap and you can easily break them!
Electronics:
- (1) Raspberry Pi B+:
- I have a B+ model running Raspbian, and it works fine.
- I put my Pi in a case, which I would highly recommend doing.
- (1) ZMR MultiWii Lite: Amazon Link, Different Vendor and more information, Forum discussing setup
- I believe any MultiWii board would work. This one is cheaper than others, it doesn't have as many fancy features, but works just as well.
- When bought from Amazon, an FTDI adapter and extra jumpers are included.
- The name/picture is different on Amazon than what I received. "ZMR MultiWii Lite" is the name on my board, although Amazon's listing reads differently. I purchased through the link I have provided.
- (4) Hobby King 30A ESC: HobbyKing Link
- The amp rating for an ESC must exceed the max draw of its motor, otherwise it will burn out.
- These are rated for 30A, which exceeds the max draw of our motors, 18A.
- (1) USB Wi-Fi adapter: Amazon Link to get you started
- I used an ALFA AWUS036NH because I already owned it, and it works well with the Pi. Other adapters would probably work well, but this adapter (as compared to a small USB model) has an antenna which I judged as necessary.
Power:
- (1) Turnigy 3S 3300mAh: HobbyKing Link
- This battery falls within the specs of the motors and works with the ESCs.
- (1) Power Distribution Board: HobbyKing Link
- No processing here, just distributes electricity. Connect with 3.5 mm bullet plugs.
- (1) 5V Battery Pack: EasyAcc 10000mAh Power Bank
- Unfortunately, we must use an additional battery pack to power the Pi (you could technically power it through GPIO pins, but those don't have any voltage protection). I am using the EasyAcc 10000mAh Power Bank, and yes that sounds like overkill. Look below and test it out yourself!
- Note: Not all battery packs are made the same! The Pi requires a good consistent voltage to start up. If the voltage is fluctuating too much (with a cheap power supply) it may not start.
- (1) Battery Monitor: HobbyKing Link
- Will ring and flash when your battery is low.
- This also helps to keep the life of your battery. For a longer Li-Po battery life, keep each Li-Po cell above 3.0 V.
- Since our battery has 3 cells (3S), that means we need to keep the battery above 9.0V. This monitor will warn us when we go below that threshold.
- (1) Battery Charger: HobyKing Link
- You need to charge your Li-Po battery!
- Of course, you only need this if this is your first time working with Li-Po batteries
- (1) 12V DC power supply for Battery Charger: Amazon Link
- This power supply is used to power the battery charger. The charger takes a 12V DC connection, so you don't need to have a power supply if you have a car adapter/ 12V battery.
Connectors:
- (2) USB to Mini USB Cables:
- One cable to connect the Pi to the MultiWii
- One cable to connect the Pi to the Wi-Fi adapter. The ALFA Wi-Fi adapter uses Mini USB and should come with one. Shorter is better.
- (1) USB to Micro USB Cable:
- One cable to connect the 5V battery pack to the Pi. The EasyAcc battery pack comes with a short cable.
- (2) 3.5mm Spring Connectors (Pack of 10 male/10 female): HobbyKing Link
- 12 3.5mm female connectors to solder onto the ESCs for the motor connections.
- 8 3.5mm male connectors to solder onto the ESCs for the power distribution board.
- (1) XT60 Female To 4mm Bullet Connector: Amazon Link
- The listed battery and power distribution board have different connectors.
- The battery has a 4mm Bullet Connector
- The power distribution board has a Male XT60 Connector
- You can order 4mm Bullet Connectors and replace the power distribution board's XT60 connector if you are feeling adventurous, or you can order the adapter.
- 4mm Bullet Connectors HobbyKing Link
Support:
- (1) Frame:
- Frame is 0.5 cm plywood.
- Diameter: 55cm - A good width for a "stable" quadcopter.
- Arm Width: 6.5cm - Wide enough for the motors plus a little extra. Felt stable.
- Center Square width: 12cm - Wide enough to fit the Pi and MultiWii securely on top.
- Stacked center square is 4cm above the base, supported by ~3cm square balsa wood of 4cm height.
- Screws to attach the arms to the center square. I used 4 screws per arm.
- Wood Glue to attach the risers to the center square.
- Get creative! I had a lot of fun building my own frame.
- (4) Feet:
- I used ~2.5cm wide and ~7cm tall plastic cutouts from an old 9mm ammo container.
- Place where appropriate - I put mine in the middle of my arms.
- Make them simple, sturdy, but most importantly - easy to replace. They will (and should) break on harder landings.
- (Many) Zip Ties:
- In order to tie off cables, and to secure battery packs.
- Use liberally.
- (1) Mounting Pads: HobbyKing link
- Necessary to use for the flight controller - they reduce vibration that would otherwise interfere with gyroscope and accelerometer readings.
- Also good to mount the Pi with.
- (Several) Velcro Strips:
- Attach battery packs
- Attach Wi-Fi adapter
- Mount Pi (I used mounting pads, but you could velcro the case)
- Use with Zip Ties
- (A lot of) Tape - Electrical and Masking:
- Electrical tape to insulate the ESC/Motor connections
- Masking tape to hold wires/ESCs down
You will have to solder the ESC's wires to the 3.5mm bullet connectors! If you have never soldered before, I suggest watching: https://www.youtube.com/watch?v=nS0bEuYPJoA
Building the Frame
![56adb5b04936d46f35000490.jpeg](/proxy/?url=https://content.instructables.com/FH4/DPO9/IJYUUYHC/FH4DPO9IJYUUYHC.jpg&filename=56adb5b04936d46f35000490.jpeg)
![56ad96c115be4d97d9000dc5.jpeg](/proxy/?url=https://content.instructables.com/FJC/JB2H/IJYUUTIS/FJCJB2HIJYUUTIS.jpg&filename=56ad96c115be4d97d9000dc5.jpeg)
![DSCN0115.JPG](/proxy/?url=https://content.instructables.com/FYP/5OZ7/IJYUJ9AS/FYP5OZ7IJYUJ9AS.jpg&filename=DSCN0115.JPG)
![56adb51067400cfcaa001000.jpeg](/proxy/?url=https://content.instructables.com/FZN/RMHT/IJYUUYFH/FZNRMHTIJYUUYFH.jpg&filename=56adb51067400cfcaa001000.jpeg)
![DSCN0119.JPG](/proxy/?url=https://content.instructables.com/FHQ/JVLM/IJYUJ8MS/FHQJVLMIJYUJ8MS.jpg&filename=DSCN0119.JPG)
![DSCN0120.JPG](/proxy/?url=https://content.instructables.com/FLF/VF98/IJYUJ8RX/FLFVF98IJYUJ8RX.jpg&filename=DSCN0120.JPG)
I decided to make my own frame instead of buying one. I suggest that you do the same!
My plan was for an overall diameter of 55 cm. I knew that for a "stable" quadcopter this was a good bet. An arbitrary choice, but it works.
- Cut 2 x 12 cm squares
- Cut 4 x 21.5 + 4 cm arms. 21.5 + 21.5 + 12 = 55 cm. The extra 4 cm is to allow the arms to be attached to the center square
- Attach arms to center square with screws
- Attach power distribution board (or anything going on the first layer)
- Cut appropriate height risers
- Glue risers to center square
- Level top square with small shims as necessary
- Glue top square onto risers
- Attach feet as necessary
- Drill 4 holes for each motor base at end of arms (I left about 1 cm from the end of the arm to each motor)
Done!
Power
![56b1706245bcebb67f00096f.jpeg](/proxy/?url=https://content.instructables.com/FR8/2CFE/IK5S0YAA/FR82CFEIK5S0YAA.jpg&filename=56b1706245bcebb67f00096f.jpeg)
![photo_2016-02-02_20-57-55.jpg](/proxy/?url=https://content.instructables.com/FD1/ZO2Q/IK5S0XXS/FD1ZO2QIK5S0XXS.jpg&filename=photo_2016-02-02_20-57-55.jpg)
![5778491e4fbadedefc001097.jpeg](/proxy/?url=https://content.instructables.com/FRS/QSVQ/IQ2KO2F5/FRSQSVQIQ2KO2F5.jpg&filename=5778491e4fbadedefc001097.jpeg)
![photo_2016-02-02_20-57-58.jpg](/proxy/?url=https://content.instructables.com/FO5/IYQG/IK5S0XZ0/FO5IYQGIK5S0XZ0.jpg&filename=photo_2016-02-02_20-57-58.jpg)
![56b15f8115be4da0d40008c2.jpeg](/proxy/?url=https://content.instructables.com/F4J/0SF2/IK5S0LAX/F4J0SF2IK5S0LAX.jpg&filename=56b15f8115be4da0d40008c2.jpeg)
Time to place your battery packs.
- Battery packs usually go underneath the quadcopter, attached with Velcro.
- Velcro works well alone in static conditions, but I also used zip-ties in order to prevent the packs from flying off mid-flight.
- Make sure that all wires will reach their destinations! Try it out before placing the Velcro.
- ESCs should be stacked/placed in a way to minimize slack in their wires.
- Respect the colors! When connecting to the power distribution board, the ESC should be connected to the appropriate red and black ports. To flip the direction of the motors, swap the output red and black wires.
Propulsion
![Controlling the Quadrotor.jpg](/proxy/?url=https://content.instructables.com/F9H/UT49/IK5S0K3S/F9HUT49IK5S0K3S.jpg&filename=Controlling the Quadrotor.jpg)
![basic-quad.png](/proxy/?url=https://content.instructables.com/FSU/OGVT/IK5S0JJW/FSUOGVTIK5S0JJW.png&filename=basic-quad.png)
![5778511450e1b6182a0006a0.jpeg](/proxy/?url=https://content.instructables.com/FE8/XU1U/IQ2KO3PV/FE8XU1UIQ2KO3PV.jpg&filename=5778511450e1b6182a0006a0.jpeg)
![56b1754767400c2b91000e6e.jpeg](/proxy/?url=https://content.instructables.com/F0J/PED8/IK5S11E1/F0JPED8IK5S11E1.jpg&filename=56b1754767400c2b91000e6e.jpeg)
![photo_2016-02-02_20-57-08.jpg](/proxy/?url=https://content.instructables.com/FHG/ABWX/IK5S0XND/FHGABWXIK5S0XND.jpg&filename=photo_2016-02-02_20-57-08.jpg)
![photo_2016-02-02_20-57-23.jpg](/proxy/?url=https://content.instructables.com/FLS/CW41/IK5S0XSU/FLSCW41IK5S0XSU.jpg&filename=photo_2016-02-02_20-57-23.jpg)
![photo_2016-02-02_20-57-02.jpg](/proxy/?url=https://content.instructables.com/FWC/28GE/IK5S0XN0/FWC28GEIK5S0XN0.jpg&filename=photo_2016-02-02_20-57-02.jpg)
![photo_2016-02-02_20-57-05.jpg](/proxy/?url=https://content.instructables.com/FFD/X7CD/IK5S0XN4/FFDX7CDIK5S0XN4.jpg&filename=photo_2016-02-02_20-57-05.jpg)
![photo_2016-02-02_20-57-13.jpg](/proxy/?url=https://content.instructables.com/FKD/BT0K/IK5S0XOO/FKDBT0KIK5S0XOO.jpg&filename=photo_2016-02-02_20-57-13.jpg)
![photo_2016-02-02_20-56-51.jpg](/proxy/?url=https://content.instructables.com/FSM/0L8D/IK5S0XMY/FSM0L8DIK5S0XMY.jpg&filename=photo_2016-02-02_20-56-51.jpg)
![photo_2016-02-02_20-56-56.jpg](/proxy/?url=https://content.instructables.com/FTN/395Z/IK5S0XZ2/FTN395ZIK5S0XZ2.jpg&filename=photo_2016-02-02_20-56-56.jpg)
Time to attach your motors!
- Attach your motors securely to your frame, but do not attach props yet.
- Two of your motors will spin clock-wise (CW) and the other two counterclockwise (CCW)
- You must test which direction your motors spin before attaching any props!
- Do not put your props on until you are ready to fly
- Follow the pictures above on how to attach your props when ready!
NOTE: Make sure all props are approximately the same height off the motors. Push outlying props lower if necessary.
Setting Up the MultiWii
![Screenshot 2016-02-02 20.06.19.png](/proxy/?url=https://content.instructables.com/F3X/BW2O/IK5S0MQ0/F3XBW2OIK5S0MQ0.png&filename=Screenshot 2016-02-02 20.06.19.png)
![photo_2016-01-30_20-19-32.jpg](/proxy/?url=https://content.instructables.com/F6U/NF3W/IK5S155B/F6UNF3WIK5S155B.jpg&filename=photo_2016-01-30_20-19-32.jpg)
There are tutorials online to do just this, so I will list my steps without much explanation.
A few good links:
- HobbyKing setup guide (also explains MultiWii configuration software)
- MultiWii wiki guide
- MultiWii code repository
- Google!
Configuring the MultiWii
- Download MultiWii 2.4 (or greater) firmware from the Google Code Archive
- Download the Arduino Software IDE
- Open the Arduino project file in the MultiWii folder
- Plug in your MultiWii
- Select "Tools"->"Port"-> Select your board
- The board/ processor steps apply only if you have the same board that I do
- Select "Tools"->"Board"->"Arduino Pro or Pro mini"
- Select "Tools"->"Processor"->"ATMega328 (5V, 16 MHz)"
- Navigate to config.h
- Uncomment (remove the "//"): #define QUADX
- Uncomment: #define CRIUS_LITE
- Uncomment: #define FAILSAFE (Shutdown after 10 seconds of no activity)
- Choose value for FAILSAFE options based on the MultiWii wiki.
- I only changed FAILSAFE_OFF_DELAY to 0.
- Save the file.
- Run "Verify/Compile". "Sketch"->"Verify/Compile"
- Run "Upload". "Sketch"->"Upload"
- Exit the Arduino IDE
- Open the appropriate MultiWii conf application (For me, the 64-bit Windows did not work. 32-bit did work)
- Select the appropriate COM port for your board
- Hit "Start" to begin reading data from your board
- If you rotate your board, you should see the picture in the bottom right update
- Hit "Read" to read in the preset values.
- If you make any changes, just be sure to "Write" the data back to board.
- Set the Horizon flight mode. Info about flight modes
- Select the boxes next to Horizon. Essentially, these will activate the Horizon flight mode when the appropriate AUX radio channel has a specific value (Low, Med, or High).
- The default AUX radio value (that way no need to change during flight) is 1500. I selected all the boxes to be safe.
- To save settings back to the board (after you select any boxes or change any values), hit "Write".
- For example, if you select AUX1 Mid, then when you "Write", you should see the Horizon box turn green. This is good.
- Be sure to set Horizion as a flight mode. Otherwise by default you are flying in Acro mode. As a beginner, you will crash if you are in Acro.
- Wire your ESCs to the appropriate pinouts on the MultiWii. The conf program will show what pinout numbers to connect each ESC too.
- The white ESC wire should be on the inside of the MultiWii. It is the "Signal" wire, which corresponds to the printed "S" on the MultiWii
- When mounting the MultiWii, be sure to use mounting pads. These will decrease the vibration, increasing your control over the quadcopter.
- When everything is ready, connect the quadcopter to the Raspberry Pi
Setting Up the Pi
There is a lot of setup involved, and you can follow the guide here, or I suggest following it on GitHub. The following guide is the same on the GitHub page just linked
Download/Clone my PiQuadcopter repository: https://github.com/rgw3d/PiQuadcopter.git
- clone https://github.com/rgw3d/PiQuadcopter.git piquadcopter
Overview of all the tech
- The first thing to do is to create a hosted Wi-Fi network. To accomplish this we use isc-dhcp-server and hostapd
- isc-dhcp-server serves as the DHCP server for our Wi-Fi network
- hostapd serves as access point management, essentially making a Wi-Fi card into a router
- Now for communication with our MultiWii device. I have a C library with the MSP protocol, and I use a backbone library libserialport
- libserialport is downloaded from their git repository, and installed
- cMultiWii, my MSP implementation is downloaded from the git repository. This will be compiled later
- Websocket communication is needed next. I use the websocketpp library.
- websocketpp is not installed. It is a header-only library (.hpp), and is compiled each time (with the intention of improving performance)
- Compiling websocket.cpp in this repo will build the executable that will receive commands from a remote control, and then relay them to the MultiWii. It compiles the websocketpp library which takes along time, and the cMultiWii library which is quick to compile.
Instructions to set up your Pi with all of the software it needs:
- Download/clone this repo
- Run `setup_pi_software.sh`, which will install `libserialport`, `isc-dhcp-server`, `hostapd`, and download `cMultiWii`, `websocketpp`. It will also compile the websocket server. This script is just a convenience to help install all of the necessary software.
- You need to check to see if your MultiWii is `/dev/ttyUSB0`. Check the troubleshooting section for more information
- Since your network configuration might be different, your `/etc/network/interfaces`, `/etc/default/isc-dhcp-server`, and `/etc/dhcp/dhcpd.conf` files are not automatically modified
- Add the following configuration to your `/etc/network/interfaces` file in order for `hostapd` to work. Also, remove any reference to `wpa_supplicant` as it causes issues with hostapd
allow-hotplug wlan0 iface wlan0 inet static address 192.168.10.1 netmask 255.255.255.0 gateway 192.168.10.1
- Add the following configuration to your `/etc/default/isc-dhcp-server` file in order for isc-dhcp-server to know what device to use
INTERFACES="wlan0"
- Add the following configuration to your `/etc/dhcp/dhcpd.conf` file in order for `isc-dhcp-server` to know what subnet to use
subnet 192.168.10.0 netmask 255.255.255.0 { range 192.168.10.1 192.168.10.30; }
- You need to ensure `wlan0` and `hostapd.conf` are correct. check the troubleshooting section for more information
Running the program and automatic startup
- I would suggest a reboot after all of the installation process
- To start up the hosted network and the websocket, run sudo ./piquadcopter.sh
- To schedule everything to start up automatically on boot, edit /etc/rc.local with something like.../home/path/to/piquadcopter.sh.
- rc.local is called automatically on startup.
- Check troubleshooting for more help
Troubleshooting
- To find your wireless interface, run `ifconfig`
- To find your USB device, run `dmesg | grep ttyUSB` and look for what number it is
- Once you find your device, you will need to edit line 4 of `configure_port.c` within `cMultiWii` to reflect the proper device.
- If your wireless interface is not `wlan0`, then you will have to change it in your `interfaces` file, and in `hostapd.conf`
- Check `/etc/hostapd/hostapd.conf` for hostapd configurations, and make sure they match your `interfaces` configuration
- If hostapd is throwing errors similar to: `n180211: Could not configure driver mode` ... then you probably need to kill the instance of hostapd already running.
- Run `ps -A` to view all active processes
- Find the process ID number for hostapd
- `sudo kill ` will kill hostapd and hopefully resolve the issue
-
If there are any problems with isc-dhcp-server, try running `sudo journalctl -u isc-dhcp-server.service` to look for errors
-
If you need to recompile at any time, just run `make` at the top level of this repository
Download Android App
![Screenshot_2016-07-22-11-24-37.png](/proxy/?url=https://content.instructables.com/F2T/DM2T/IR3ZP1NV/F2TDM2TIR3ZP1NV.png&filename=Screenshot_2016-07-22-11-24-37.png)
You can either download the entire repository and build the app yourself, or you can download the APK directly from here. The APK is within the app/ folder.
Once you have installed the APK, your controller is ready.
Caveats:
- It does not tell you if you are connected (Not yet, anyway)
- The RC data sent (Range: 1000-2000) is rounded to every 10's place. This way, not every tiny change is recorded and sent, potentially flooding the Pi and slowing it down.
- Maybe this not necessary, but I figured better safe then sorry.
- When flying the app only sends RC information when the position of the sticks change. MSP works by essentially overriding the normal radio input. However, the override does not last long (about a second) before more RC data needs to be sent. Without input, the flight controller will default to 1500 (value of centered sticks) for all inputs. This is the cause for the sudden audible jumps in motor speed you can hear in my video. However, while I am slowly increasing the throttle, there are no sudden jumps.
- I realize only updating on stick change is the naive way of doing things, but on the first implementation of the app it works. I did not want the Pi to continually send the same RC command to the flight controller, because if the App looses connection I want the failsafe to kick-in
Power on Sequence
At this point, your quadcopter should be ready to fly! Here is how you should power on the system
- Start with everything turned off. That means the entire quadcopter is off, and the Android app is closed.
- Plug in the Pi and wait for it to start up (Setting up the auto-startup sequence is most convenient, otherwise you will have to manually start it each time)
- Connect to the Wi-Fi network hosted by the Pi with your phone
- Connect main power to the quadcopter, and listen for the ESC startup beeps. The motors will not spin until you arm your motors
- Turn on your controller app on your phone
- Arm your motors and you are off!
Important notes before flying:
- Be sure to test it out without any propellers on. Be sure to see if the quadcopter tries to self-balance - you can hear the motors spinning at different speeds when you tilt it. You can do the same thing with testing the failsafe. Also test to see how responsive the motors are to your controller inputs.
- Only once you are sure of the setup process involved should you try to fly. The failsafe is important if something becomes unplugged and control is lost.
- Check out this video on how to arm and disarm your motors.
Thank You!
I hoped you enjoyed this Instructable!