The Rawpter 9 Open-Source Drone

by SeanMiller in Circuits > Sensors

434 Views, 1 Favorites, 0 Comments

The Rawpter 9 Open-Source Drone

RawpterRender.png
RawpterDark2.png

The Rawpter 9 Drone is a quadcopter that can fly in First Person Mode (angular rate control), fly in Angle Control Mode, and can autonomously return to its original location. It can be further coded to fly from waypoint to waypoint and with canned acrobatic maneuvers such as serpentine travel and barrel rolls. Building this project will take a beginner from zero to hero in the Maker space - cutting through years of research and tinkering to give you the chops to build ANY mechatronics project. Much of what you will find surpasses senior university engineering final projects, but it is well within the reach of a teenage maker. It has been an amazing Father-Son project for us. However, it is a project that takes patience and dedication as you will build your own PCB with a lot of awesome features.

Rawpter 9 has three layers of failsafe logic and hardware to prevent drone flyaway. It is designed to take some tumbles without expensive damage and allow a quick turnaround to the skies after a crash. In fact, tweaking code, piloting it to its limits, and crashing spectacularly is the fun part! All flight configuration is tweaked simply with your phone.

It makes full use of the popular microcontroller ESP32-S3 hardware and dual core design so that it can have a fast, uninterrupted inner attitude loop and multiple sensor and autonomous control outer loops. The code makes use of all hardware features that offload tasks from the cores such as LEDC, RMTCtl, MCPWM.

In this build, you will learn how to code for the following sensors and RF modules:

  1. UBLOX Max-10S (Global Positioning)
  2. IMU 40609 (Attitude from its Accelerometer and Gyro)
  3. IST8310 Magnetometer (Compass Heading)
  4. BMP 581 Pressure Sensor (Altitude)
  5. Flyski Receiver (2.4GHZ Control)
  6. ESP32-S3 Wifi (2.4GHZ WebUI)

The flight controller PCB can be completely modified and annotated to become your own creation! The files are included so that you can simply have the board fabricated as-is, or you can put your personal touch on it before sending for fab. This board is not just a shield for a consumer bought microcontroller. Rather, it is a scratch custom build that leverages the Arduino IDE for easy programming.

Supplies

supplies.png
boardTop.png
boardBottom.png
Rawpter 9 PCB Components.png

Below are the full part and tool listings to fully enable this project. Many items you may already have.

  1. Frame and large electronics: https://amzn.to/4b1OtLs (affiliate links)
  2. PCB (Flight Controller) Specific Components: Mouser Shared Project (Same as attached image)
  3. IST8310 Magnetometer from DigiKey (optional, but needed for GPS autonomous navigation)
  4. Optional: PCB (Flight Controller) Board: Rawpter 9 Quadcopter Flight Controller - Share Project - PCBWay
  5. Optional - Maker Gear & Tools: https://amzn.to/40saOvx (affiliate links)

SAFETY FIRST

  1. PARENTAL GUIDANCE REQUIRED
  2. ALWAYS DISCONNECT THE DRONE BATTERY WHEN TOUCHING THE DRONE WITH PROPS INSTALLED
  3. ALWAYS STAND AT LEAST 15 FEET AWAY FROM THE DRONE WHEN TAKING OFF AND FLYING
  4. ALWAYS STAY WITHIN VISIBLE RANGE OF THE DRONE SUCH THAT YOU CAN SEE ITS ORIENTATION
  5. ALWAYS FLY WELL WITHIN TRANSMITTER RANGE
  6. NEVER FLY IN A CONGESTED AREA - A WIDE-OPEN FIELD IS BEST
  7. NEVER FLY AT OR DIRECTLY ABOVE OTHER PEOPLE OR OBJECTS THAT MAY BE DAMAGED
  8. NEVER FLY HIGHER THAN 10 FEET UNTIL YOU CAN SIMPLY HOVER WITH EASE
  9. ALWAYS OBTAIN APPROPRIATE FCC LICENSING PER YOUR COUNTRY/STATE REQUIREMENTS
  10. NEVER CONNECT THE USB AND DRONE AT THE SAME TIME WITH PROPS INSTALLED - THIS WILL PREVENT REBOOTS AND CODING ERRORS FROM LIFTING OFF INSIDE YOUR HOME
  11. NEVER FLY INDOORS UNLESS SIGNIFICANTLY DOWNSIZING THE FRAME, MOTORS, AND PROPS
  12. NEVER USE THIS FLIGHT CONTROLLER OTHER THAN FOR FUN HOBBY AND EDUCATION APPLICATIONS

Skill Prerequisites

This build requires the following base skills not covered in this Instructable:

  1. Basic Arduino Application: Arduino IDE Board Selection, Arduino IDE Library Installation, Arduino IDE sketch uploading
  2. Soldering Iron Use
  3. Hot Air Station Use
  4. Use of Allen Wrenches
  5. Wire Splicing (removal of wire insulation)
  6. 3D Printing (Fused Filament)

Edit the PCB Design and Send to Fabrication

3D_PCB.png
psb.png
Schematic.png
Schematic2.png

Option 1: The PCB (Flight Controller) can be fabricated per the original design at PCBWay from this Link: Rawpter 9 Quadcopter Flight Controller - Share Project - PCBWay

Option 2: Edit the design to your liking and send to your own fab shop. Examples are Oshpark.com, PCBWay.com, and jlcpcb.com. KiCAD 9 Project


The PCB is a 4 Layer Board. It has the signal traces for I2C, SPI, Serial, and USB on the top of the board and the power lines on the bottom. In between are a ground and power plane. Each component is judiciously placed to minimize any interference from another component to allow for error-free communication to the onboard microcontroller (ESP32-S3). The USB signal traces are designed to meet the high-speed specs of a differential pair allowing for clean USB communication. The USB port will also power the board for bench testing or from an easy chair. Last, the USB has Electrostatic Discharge Protection to prevent zapping it with static on hookup.

This PCB can be used in many other mechatronics projects that use up to four motors/servos as well as external Serial and I2C bus driven devices.

Since it is a 4 Layer board, we unfortunately cannot use Autodesk Fusion 360 to edit the board with just a hobby license. In turn, it is a KiCAD 9 file. After installing KiCAD 9, you can add your own personal touches as shown in the following:

  1. Download the Kickad 9 Project files to your local PC.
  2. Open the KiCAD project file.
  3. Double-click on the Board File listing in the left navigation pane.
  4. Select the Top Silk Screen.
  5. Click the Text icon and click the board to place text. Enter your custom text.
  6. Save the File.
  7. Click File-->Export-->Gerbers.
  8. Locate the Gerbers on your machine and zip the directory to a single file.
  9. Provide the zip file to your favorite Fab Shop.

Purchase the Components

Based on where you live, the PCB fabrication will likely take the longest to arrive. So, I'd order it first. Also, it's very inexpensive, you typically get a minimum of 5, and it is an awesome conversational piece on your desk at work.

NOTE: For a simpler and more affordable build, you actually do not need to purchase the following Components: BMP 581, GPS, and Magnetometer. The code will detect missing sensors and put you in the appropriate manual control mode accordingly. Flying manually is actually the most fun of it all and you can add the other components at any time later.

Resistors and Capacitors are much cheaper and better organized if buy them in bulk. So, I have them listed in the Rawpter General Gear. The rest of the core components are in the Mouser Shared Project List.

The Raising Awesome Gear list is just the basic tools required for the build - which you may already possess.

3d Print Components

So that the drone can be crashed a thousand times over, there are certain parts that are always good to have pre-printed ready to go. They are all below. You will need four (4) of the Short Drone Arms, two (2) of the Battery Holder_Wire Ends, and two (2) of the Vibration Mounts.

Assemble the PCB

IMG_1860.JPG
PCB_Labeled.png
Schematic.png
SMD Soldering Tutorial for the Beginning Maker

If you haven't yet received your fabricated PCB, you can move to the next step. If you do have it, the assembly of the PCB requires soldering both with an iron and a hot air station. The values of capacitors and resistors and component names are annotated directly on the board. Refer to the Schematics for further understanding.


This is the order of component assembly that allows you to test as you go:

  1. Hot air solder the ESP32-S3 to the top of the board.
  2. Hot air solder the 3.3V regulator and surrounding diodes to the board.
  3. Solder the USB adapter to the board.
  4. Connect a usb cable, open the Arduino IDE, and see if it can connect to the USB port of the board. If not, troubleshoot using the schematic to ensure voltage is getting to the ESP32-S3. The chip will most likely cycle its USB connection since it does not have a program on it yet.
  5. Add the surrounding capacitors to all installed components thus far.
  6. Add all remaining surface mounted components.
  7. Add all remaining components.

Assemble the Drone

IMG_1858.JPG
Rawpter 9 - Our most comprehensive design

Here is a video covering Assembly and Crash Repair of the Rawpter 9: YouTube


Assemble in this order:

  1. Using a soldering iron as shown in the linked video above, carefully place an m3 insert on the iron's tip at 300C. Gently press it into the holes of the arms.
  2. Attach the arms to the metal frame plates with the short M3 bolts.
  3. Attach the Battery Holder Wire End 3D printed parts and battery with the long M4 bolts.
  4. Wire the ESC power in parallel (red to red and black to black). Make a wire that jumpers to the battery.
  5. Install the motors to the arms. Leave the propellers off until after calibrations are performed.
  6. Install the vibration mounts and dampeners.
  7. Install the PCB to the dampeners. Tweezers help me stuff it through the PCB holes.
  8. Connect the 3-wire connector of the ESCs to the appropriately labeled 3-pin terminals on the PCB.
  9. Strap on the Cage_Bottom with hook-and-loop straps. Glue the TippyTop to it.
  10. Strap any loose wires cleanly to the arms with the hook-and-loop straps.
  11. It is recommended to put a bright white or orange tape on the front arms to help the pilot see the orientation of the drone from a distance.
  12. NOTE: LEAVE THE PROPS OFF FOR NOW

Calibrate the Motor ESCs

benchTesting.png
setup.png

Motor ESCs take PWM (Pulse Width Modulation) from the microcontroller and translate it to high power voltage. The longer the Pulse Width, the faster the propellers spin. The Motor ESCs need to be calibrated one time to the PWM range the code pumps out.

SAFETY FIRST: I learned the hard way that you don't want this to be a field feature - if the system reboots and the calibration runs, one can get hurt badly since the ESCs would have been previously armed for flight. After I nearly chopped my pinky off, I decided to make it impossible to do it in the field. Instead, you want the props removed and on a bench. You only have to do it this one time.


Here is the procedure:

  1. Ensure the battery is unplugged. NEVER PROGRAM THE MICROCONTROLLER WITH THE MAIN BATTERY CONNTECTED AND PROPS INSTALLED AS IT MAY DRIVE THE MOTORS UNEXPECTANTLY.
  2. If the props are installed, remove them all.
  3. Download the github repository to a directory of your choice: RaisingAwesome/RawpterESP32S3
  4. Open the latest Arduino IDE.
  5. Add the ESP32 boards repository location to the Arduino IDE. You do this by going to File-->Preferences-->Additional Boards Manager URLS and paste this in: https://espressif.github.io/arduino-esp32/package_esp32_index.json
  6. Hook up a USB cable.
  7. The board to select is ESP32-->ESP32S3 Dev Module
  8. Edit the .ino file to allow the calibration logic: constexpr bool CALIBRATE_ESCS = true;
  9. Upload to the sketch to the board.
  10. Disconnect the USB cable.
  11. With the props removed and the USB cable disconnected, connect the main battery.
  12. You will hear a Dee-Dee-Deet. Dah-Dah Deeeeeee. It is over in seconds.
  13. Remove the battery
  14. Connect the USB
  15. Reverse the .ino file change: constexpr bool CALIBRATE_ESCS = false;
  16. Upload the sketch to the board.

Your flight controller and ESCs are now ready for operation. However, there is further calibration of the sensors required in the next steps.

Calibrate the IMU

The Inertial Measurement Unit (IMU) measures the acceleration felt on the device in a given direction (including gravity), and the angular speed it senses if the Rawpter is rotating on one or more axes. IMU's being so tiny always have a variance in their readings. In addition, your installation may be a little crooked. So, you need to do a calibration to get the offsets needed for it to know when its level in reference to gravity and offset any inherent noise on the gyro. You can always use your trim settings on your remote to compensate for the accelerometer offsets, but this is the only way to address inherent gyro noise.

Here is the procedure:

  1. Place the drone on a flat surface. Look at the tops of the motors ensure they are level as best as they can be. Shim underneath if needed for the procedure.
  2. Hook up the battery. It will beep at you since you don't have the radio on, but you don't need it.
  3. Using your phone, connect to the WiFi Network named _Rawpter. Its password is 12345678.
  4. Once connected, use your browser to go to 192.168.2.4.
  5. Click the button that states Calibrate IMU. It will prompt you from there.
  6. Unhook the battery.

The IMU offsets will be automatically stored to memory.

Calibrate the Magnetometer

The Magnetometer is basically the Rawpter's compass. It gives the logic your current flight heading which it needs when it does autonomous flight with the GPS such as Return to Home. They are super sensitive to magnetic fields. In turn, any iron near the magnetometer will cause the field to obscure. By calibrating, you are basically getting the maximum value it reads for any given direction. After calibration, the code stores offsets that are used after a power cycle.

To calibrate, you do a bit of a dance. You hold the drone and pretend you are painting the inside of a sphere - tilting the drone in every direction as you turn in a circle. I do one full turn, rotate the drone in my hands by 90 degrees, and then I repeat. You get 60 seconds which is plenty of time.

Here is the procedure:

  1. Hook up the battery. It will beep at you since you don't have the radio on, but you don't need it.
  2. Using your phone, connect to the WiFi Network named _Rawpter. Its password is 12345678.
  3. Once connected, use your browser to go to 192.168.2.4.
  4. Click the button that states Calibrate IMU.
  5. It will prompt you from there.
  6. Unhook the battery.

Set the Radio Failsafe

IMG_1861.JPG

If you get out of range, you do not what the drone to fly away or simply drop out of the sky. Instead, if the right toggle switch on the radio is flipped up (or the receiver thinks it is), it will trigger a Return-to-Home routine and land. If it cannot return to home in time, it will attempt to safely land where it is. If it doesn't do that in time, it will throttle cut entirely and drop from the sky. This is to prevent catastrophic fly away.


To achieve this failsafe automation, you need to program your Radio Receiver for fail safe key settings. This is how you do it:

  1. With your drone battery unplugged, turn on your radio.
  2. On the radio, press and hold the Ok button.
  3. Press the Ok button again to enter the System menu.
  4. Hit the down button until you reach RX setup. Press Ok.
  5. Press ok with Channel 1 Selected. Press down to select ON. Press and HOLD Cancel to save (I know - this isn't intuitive, but its how they save).
  6. Repeat for Channels 2-3. Leave 5 off. This will failsafe it to the last good value. So, if you throttle cut just before it failsafed, it will still honor it.
  7. For Channel 6, turn it on as well, but set to -100%. The code recognizes this as Return-to-Home mode.

Test and Fly

drone1.png
flying.png

You are now ready to fly!

  1. Install the props. Note, props 1 & 2 rotate towards one another as per the diagram. So do 3 & 4. That's what gives it the ability to "yaw" (spin in a circle on it's Z axis).
  2. Go to a flight location that is free of anything that could get hurt. You will be very clumsy until you get muscle memory on the throttle, so a wide-open field is pretty much a must.
  3. Connect the battery.
  4. Stand at least 15 feet back.
  5. Turn on the Flysky Radio.
  6. Flip the toggle switch on the right (Auto Land) down first.
  7. Flip the toggle switch on the left (Throttle Cut) next to arm put it in flight mode. Flip Throttle Cut up when you land or in an emergency when you need the props killed.
  8. Your mission is solely to hover 5 feet in the air as long as you can and then land gently. This will build your hand-to-eye coordination. It's okay to throttle cut a foot off the ground - it'll take it.
  9. Use the trim of the remote if its spinning in a circle or traveling in one direction or the other without you steering it.
  10. Once you learn to fly, you can then play with the "Land" button. This is just started code on how you can explore autonomous flight with the GPS.

Note - it's like riding a bike. You will crash - A LOT. Wind will make you angry. You will be humbled - you will laugh - you will have a blast with a friend- You will not be distracted by a single other thought entering your mind. You'll think about flying at night when trying to sleep. The song Dangerzone will become an earworm.

Have a friend film all you can. Strap a Go Pro to it. Post it all online. Make funny memes.

Have a blast!!!

Troubleshoot

20260307_222248000_iOS.png

The most common issues are summarized here:

  1. The motors ramp up, but it won't lift off the ground: you have one or more props on backwards or one or more motors is spinning the wrong direction.
  2. A motor is spinning the wrong direction: first make sure the motors PWM cable is hooked to the correct flight controller pins. If so, swap two of the three leads at the motor to make it spin the other direction.
  3. It flies, but then it suddenly dips on one side and crashes: a prop is loose and slips.
  4. I hear a weird squeak: a prop is loose and slips.
  5. It is slow to respond to my stick moves: Use the WebUI to tune the PID parameters. Many view this as an art, but it is science. Start with the "P" settings and increase in 10% increments.
  6. It jittters: reduce the P. You can also lower the Gyro filter to take out gyro noise it may be responding to.
  7. When I change direction, it does a cobra move excessively: lower the integral limit or the Ki on angle.

Bench Testing:

  1. With the props off, you can see Serial output of telemetry in real time. To do so, in the code, set Bench_Testing = true and upload to the microcontroller.
  2. You can now see telemetry and move the drone around by hand and listen and watch the motor speed - watch out for the spinning motors.

Web UI:

  1. When the throttle is cut, you can talk to the drone over WiFi. You can see some telemetry and change it's flight configuration parameters.
  2. To access the WebUI (see attached picture), connect the battery to the drone. You don't need the radio on, but if it is, turn the throttle cut switch forward.
  3. On your phone, connect to the WiFi station titled _Rawpter. The password is 12345678.
  4. Go to your browser and search out 192.168.2.4. You should see the same interface as the image attached.