Drone: from Uno to stand-alone ATMEGA328P - powering?

I am attempting to make the YMFC-AL drone project by Brokking.

Instead of using an Arduino Uno, I'd like to just use the ATMEGA328P stand-alone, by adding a 16 MHz XTAL and two 22pF caps. I just have to switch some wires around (mapping).

The MPU-650 gyro/acc. and the remote control receiver require 5V, and I can no longer rely on the 5V Vout of Arduino. The ATMEGA328P chip then also requires 5V.

1/ About the power source

  • Do I use the BEC on my ESCs?
    These are the ESCs I got, which mentions: "BEC: 2A / 5V (Linear mode)."

  • Do I use a step-down regulator?

  • Do I use a separate 9V battery and a 7805 voltage regulator with a 47uF cap? If the battery runs out, the quadcopter, with the motors still running, will fly into something without controls or being able to level itself.

  • Do I use a regulator, perhaps a LM317, to get the 11.1V LiPo down to 5V? Seems wasteful but that may not be a big deal since the power wasted as heat may be small compared to what the motors use (Source: StackExchange).

2/ About the output pins of the ATMEGA328P

The amount of current which a digital pin is able to source or sink is very limited. Will the switch from Arduino to the ATMEGA chip cause issues for this application? It seems to me that the motors get their power directly from the LiPo battery, and the digital pins going to the ESCs act as Mosfet switching that power ON and OFF.

So that should be OK, or do you see any issues?

3/ A changed diagram

Is it correct to say that all the thin red/black wires would be on the 5V circuit and all the thick red/black wires would be on the 11.1V circuit?

Meaning, if I use my ESC BEC circuit, the VCC and GND wires of one of my ESCs is the input voltage for the ATMEGA328P, MPU-6050 and receiver? All of my ESCs? I don't get how that would work.

Hi Nils345,

1/ About the power source

It's perfectly acceptable to source your Atmega328P's 5V from one of the ESC's BEC, although it will definitely be worth adding some additional decoupling capacitors. The linear BEC on an ESC is just a +5V voltage regulator (or two) like the popular 7805. Most of the earlier flight controllers, such as the KK2 board and Naze32 worked in this way.

Using a linear regulator to step-down from 11V to 5V might seem wasteful, but will be negligible compared to the amount of current your motors will be consuming during flight.

The slight disadvantage is that your flight controller's ground return goes back through the ESC rather directly back to the LiPo battery, but usually this isn't too much of an issue.

2/ About the output pins of the ATMEGA328P

Your stand-alone Atmega328P microcontroller pin-wise will operate in exactly the same way as the Arduino Uno.

The ESCs have their own on-board microcontroller that controls the motor MOSFETs, usually another Atmega, Silab or ARM device. The PWM control signals from your flight controller go directly to the high impedance inputs of the ESCs' microcontrollers and therefore only a small amount current is drawn.

3/ A changed diagram

Is it correct to say that all the thin red/black wires would be on the 5V circuit and all the thick red/black wires would be on the 11.1V circuit?

Meaning, if I use my ESC BEC circuit, the VCC and GND wires of one of my ESCs is the input voltage for the ATMEGA328P, MPU-6050 and receiver? All of my ESCs? I don't get how that would work.

The 3S Lipo should only be connected directly to the ESCs' positive and negative terminals, and if you're including a battery monitor, to the Arduino's analog input pin through a resistive divider. The resistor values chosen to ensure that the highest battery voltage won't exceed 5V.

Use a single ESC BEC to power your flight controller, gyro and receiver, plus any LEDs or battery low buzzer. This will amount to around 100mA, so a single 2A BEC can provide more than enough current.

Many thanks, MartinL, for your reply!
I really appreciate you having taken the time to answer the questions.

If I understood correctly, I place a 10uF electrolytic cap between the Vcc and GND wires of one of the ESCs of which I'm using the BEC, and add a 0.1uF ceramic cap close to the ICs between the Vcc and GND wires of the ATMEGA328P, MPU-6050 but not necessarily the receiver, as per this schematic (Source: Autodesk.com):

The Vcc wires of the three other ESCs I leave unconnected, and the GND wires of the other ESCs I connect to the GND wire of the ESC of which I'm using the BEC.

Does this all sound about right? Then I'll go and finish the project and post some pictures.

Hi Nils345,

Decoupling looks good. As you mention, is good practice to keep the 0.1uF bypass capacitors close to the IC Vcc and Gnd it's supporting as possible.

Yes, just connect the grounds other ESC BECs to your flight controller's ground, as this provides a ground reference for each of your PWM output signals.