Terms of service
Brokking
 
 
.net
Let's keep it simple
 

 
   Home
   Projects
 

   Articles
 

   Donation
         
 
 
 
 

 
Brokking.net - Video: How to build the YMFC-32 GPS hold quadcopter

How to build the YMFC-32 GPS hold quadcopter

Hello and welcome to this build video of the YMFC-32 autonomous flying quadcopter. After many videos it's finally time to publish the Arduino code. In this video I will go through the basic steps that will help you to build this flight controller that you can further develop and improve yourself.

But first I want to make something very clear. The YMFC-32 is not a state of the art flight controller. And I'm not trying to. The main goal of this project is to provide a very simple, bare minimum and understandable Arduino code that can be used for autonomous flights.

You can use this code for developing your own flight controller with the use of the Arduino IDE and the STM32 microcontroller.

So, if programming and reading is not your thing, or if you are looking for something fun and easy please stop watching and go find another video.

On the other hand, if you want to learn something and looking for background information that can help you to program and develop your own flight controller you might find this video useful.

And it's not just this video. I made a whole set of videos that are related to this YMFC-32 project. You can find a link to the full playlist in the description. So make sure to watch them as they hold valuable information and you don't have to ask uneducated questions.

Ok, enough talking, let's start building. First you need some hardware. I made a hardware list that you can find on my website. The total cost for this project is under 200 euro's. This includes a transmitter, charger, battery, frame, motors, telemetry system, etcetera.

When you have the hardware available it's always a good idea to test it before you start soldering. From experience I know that it is a real pain to de-solder the STM32 from a circuit board.

With the flight controller test program you can also test the individual sensors on a bread board.

When you have the STM32 and a serial programmer you can watch this video that I will link in the description. Follow the simple steps in the video so you can program the STM32 with the Arduino IDE.

Next you need to download this software package from the download site.

Inside you will find some Arduino programs and two schematics. Use this schematic to build the YMFC-32. When you are done it might look something like this. As you can see, I made it from a single island prototype board. And please, never use a bread board on a quadcopter. It's just a perfect recipe for disaster.

Very important, the dot on the MPU-6050 needs to point to the left rear of the quadcopter. If you don't the quadcopter will flip up-side-down immediately.

In the media section you can find pictures of my own quadcopter that you can use as a reference.

Next thing is to build the telemetry receiver. The schematic can also be found in the software package.

After the build you can upload the telemetry program to the Arduino.

For uploading you need to disable the switch. Otherwise you get an error during upload. The LiquidCrystal library is part of the latest Arduino IDE and it should compile without errors.

Now you can upload the flight controller test program to the STM32. Open the serial monitor at 57.6kbps and work your way through the various tests. Don't connect the flight battery during these tests.

On my website you can find detailed information about the build and the setup program. As you can see here in step 5 there is a link to another page that holds valuable information about the test program and what the output should be. I also included some example outputs.

If you run into problems you might want to check out the Q and A page first. I will update this page with the most frequently asked questions.

This version of the YMFC-32 only accepts a PPM signal. Most FlySky receivers already have a PPM output. However, if you are using a Flysky T6 like I do you need to make a PWM to PPM converter. Detailed information and an Arduino program can be found here.

After finishing all the tests you can balance the propellers with the use of the setup program. The procedure for this can be found on my website. And please, don't neglect this step. Smooth running propellers will really increase the flight stability.

And finally it's time to calibrate the ESC's. This is needed because without calibration the standardized 1000 till 2000us pulse is not recognized correctly by the ESC's.

Calibration is also needed to get the motors to rotate at approximately the same rpm.

The calibration procedure can be found in the manual of the ESC and may vary from what I'm showing here. So make sure to check the manual of your own ESC on how to calibrate them.

First I turn the transmitter on and set the throttle in the highest position. With the test program uploaded to the STM32 and the boot jumper in the zero position I connect the flight battery.

After several beeps I lower the throttle and the ESC's are all calibrated.

You can check this by slowly increasing the throttle. The motors should start to spin at approximately the same throttle position.

If this is not the case, or the ESC's keep beeping because the pulse is not recognized, you need to check the calibration procedure in the manual of the ESC.

Now it is time to upload the flight controller program for the first flight.

After upload, turn on the telemetry system, turn on the transmitter and power the quadcopter via the USB cable.

The LED on the quadcopter should follow this startup blink sequence.

When this is not the case you can check step 9 that holds an overview of the errors. Or you can check question 13 on the Q&A page.

When the startup was normal it is time to calibrate the accelerometer. This will make sure that the quadcopter flies level during flight.

Place the quadcopter spirit level and move both sticks to the top left corner. The LED will blink and the roll and pitch angle on the telemetry system should be around 0 degrees.

When moving the left side up the roll angle should be positive. When you move the nose up the pitch angle should be positive. If this is not the case there is something wrong and you need to recheck everything. Most likely you have the MPU-6050 mounted in the wrong orientation and you should not try to fly the quadcopter.

When everything is working as expected, test the switches on the transmitter so you know the work. With my left switch I can change the flight modes from 1 till 3. With this right switch I can activate the heading lock function.

Now take the quadcopter outdoors and find a nice piece of grass that will help to minimize the damage if something goes wrong.

When the quadcopter is up and running you can start the quadcopter and increase the throttle up to the point that it starts to hover. The hover throttle should be around the center stick position.

Also check if the quadcopter flies stable without any oscillations or hiccups.

When the quadcopter is flying with the throttle stick around the center position you can re-upload the flight controller software with the manual_takeoff_throttle variable set to 0.

Also set the correct declination for the compass.

The EEPROM of the STM32 is not a real EEPROM as it is part of the flash memory. This means that it is erased when you upload or re-upload the flight controller software. So, after every upload you need to calibrate the accelerometer and the compass.

The procedure for calibrating the compass is described on my website and is also explained in this video that I will link in the description.

After calibration always check the compass with the telemetry system to make sure that it works.

Take the quadcopter outdoors, find some grass and start the motors. Move the throttle to half way and the motors will automatically increase their RPM.

When the quadcopter takes off the motor speed is registered and set as a base throttle. This way the throttle stick should almost be in the center position. If this is not working check question 15 on the Q&A page.

After a couple of flights you can start testing the various functions.

Flight mode 2 is altitude hold only.

When you activate the altitude hold function for the first time it might sink or rise a little. When this happens you need to give the controller some time to regain altitude. The second time you activate the altitude hold function it will remember the previous settings and the transition will be much smoother.

Mode 3 is altitude and GPS hold and should result in an autonomous flight.

Depending on your hardware and the location of the barometer you might need to tune the PID settings. The YMFC-32 has an convenient feature that will help you to tune tree setting at a time. You can find details about tuning the settings on my website.

And with the heading lock feature you should be able to fly the quadcopter with the nose orientated in its take-off position.

Now, this project is pretty complex and a lot of things can go wrong. So again, if reading is not your thing or you want fast results this project is not for you. You really have to sit down and take your time to get it to work. Start at the top of my website and slowly work your way down and you will get it to work.

If you run into problems that are not described on my website or explained in other videos please leave a question in the comment section of this video and I will try to answer them.

Thank you for watching and see you next time.