
If you want to prototype drone controls, the Espressif ESP32 is a programmable chip that lets you turn button presses and knob movements into electronic commands. Its built-in hardware can keep an output switching while the processor handles other work, rather than waiting between pulses. Spencer Baum takes a closer look at these foundations for a DIY drone, including a button you must hold to arm the circuit and a knob that stands in for throttle. See how these controls work together while the motors and flight remain planned steps.
ESP32 Drone: From Breadboard to Flight Controller
TL;DR Key Takeaways :
- The planned four-motor drone will use an ESP32-S3 flight controller to adjust motor speeds hundreds of times per second.
- ESP32 pins use 3.3 V, and applying 5 V to a pin can damage the board.
- A pull-down resistor is intended to hold the planned motor switch off during startup or restart, preventing a floating signal from triggering the motor.
- The prototype’s arming switch requires a one-second hold to toggle the armed state, with an LED standing in for the motors.
- The project plans to use four hardware PWM channels, one per motor, with MOSFET drivers switching battery power rather than connecting motors directly to ESP32 pins.
A planned four-motor drone uses an Espressif ESP32 microcontroller to read inputs, make decisions and set outputs. To stay level and respond to commands, the drone must adjust motor speeds hundreds of times a second, too fast to manage by hand.
Plans call for a 3D-printed frame and an ESP32-S3 flight controller. You can start with an ESP32 development board and breadboard, using LEDs and switches before moving to motor drivers. This is the second episode of a beginner series on building the drone from scratch; the first covered circuits, resistors and diodes.
Set Up the Development Board
The free Arduino IDE runs on Windows, Mac and Linux, and lets you write, check and upload a program to the board. The ESP32 uses the same Arduino programming language and software as the Arduino Uno.
A development board includes a USB port, a USB-to-serial chip and a regulator that converts USB power to the 3.3 volts the ESP32 needs. Its EN button restarts the board, while Boot can help when an upload gets stuck. The board covers most holes on a standard breadboard, so you can place it beside the breadboard and connect it with female-to-male jumper wires.
- Install the Arduino IDE from the software section of arduino.cc.
- Open Boards Manager, search for ESP32 and install “esp32” by Espressif Systems.
- Connect the board by USB and install the appropriate USB-to-serial driver if needed.
- Under Tools → Board → ESP32, select ESP32 Dev Module for most dev kits.
- Under Tools → Port, select the port that appears when the board is connected.
The USB-to-serial chip near the port will most likely be marked CP2102 or CH340, with corresponding drivers CP210x from Silicon Labs and CH340 from WCH. On a Mac, a blocked system extension may need permission under System Settings → Privacy and Security, followed by a restart if requested.
If the board lights up but no port appears, try another USB cable: some carry power but not data. If an upload stays on “connecting,” hold the board’s Boot button until the progress percentages appear, then release it.
Here are additional guides from our expansive article library that you may find useful on ESP32 and Arduino projects.
- The $4 ESP32 S3 Super Mini Packs a 240 MHz Dual-Core Chip
- $5 ESP32-S3 Super Mini Packs Wi-Fi and Bluetooth
- 5 ESP32 Projects Worth Building in 2026: Such as an Apple HomeKit Controller
- Arduino IDE 2.3.3: New Features and Why You Should Upgrade Now
- How to build a drone tracking radar from scratch
Blink an LED and Check the Voltage
To build a first output circuit, connect pin 23 to a resistor, the resistor to the LED’s long leg, and the LED’s short leg to GND. Ground is the circuit’s voltage reference and return path, and components that need to interpret each other’s voltages must share a connected ground.
An Arduino sketch can set the LED pin as an output in setup, then use digitalWrite and delays in loop to turn it on and off. You can move a sketch first used on an Arduino Uno to the ESP32 by changing the LED pin number from 8 to 23. Naming the pin in the program makes the setting easier to find.
Check wiring and voltage before connecting power. An Arduino Uno output uses 5 V, but an ESP32 pin uses 3.3 V, and applying 5 V to an ESP32 pin can damage the board. Safety glasses are recommended for electronics work.
With the same red LED and 330-ohm resistor, the ESP32 circuit produces about 4 mA, compared with about 9 mA from the Uno, so the LED appears dimmer. A red LED takes roughly 2 V, leaving about 1.3 V across the resistor on the ESP32.
To check the circuit, turn the power off, remove the resistor and measure its resistance; a 330-ohm resistor with 5% tolerance can read about 314 to 346 ohms. Replace the resistor and turn the power on, then use a meter set to DC volts to measure the voltage across it. Divide that voltage by the measured resistance to calculate the current without rewiring the circuit.
Keep Button Inputs From Floating
A button lets the ESP32 respond to an input instead of merely blinking an output. Connect one button leg to pin 4 and the other to ground; when you press it, the input reads low.
When you release the button, the unconnected input can float, picking up stray electrical signals and switching unpredictably between high and low. Set the pin to INPUT_PULLUP to use the ESP32’s internal pull-up resistor. The released button then reads high, and pressing it pulls the reading low.
A pull-down works in the opposite direction: it gives an input a low default and a high reading when a button connects it to 3.3 V. For the planned motor driver, a pull-down on the MOSFET switch is intended to hold it off while the ESP32 starts or restarts. A floating motor-switch signal could otherwise make a motor twitch or spin.
Give the Arming Switch Memory
An arming switch adds a deliberate step before the planned motors can run. The prototype uses the button on pin 4 and an LED on pin 23, with the LED standing in for the motors.
The sketch stores the armed state in a Boolean variable that starts false. A short tap does nothing, but holding the button for one second changes the state and turns the LED solid on. Holding it again disarms the circuit, and while disarmed, the LED flashes for 50 milliseconds every half second.
After a state change, the program waits for you to release the button, preventing a continued hold from flipping the state repeatedly. The finished drone is planned to use arming as a motor safety feature.
Use a Knob as a Throttle Input
A 10 kΩ potentiometer provides a variable input in place of a controller stick. Connect its two outer legs to the ESP32’s 3.3 V supply and ground, and its middle leg to pin 34. Either outer leg can go to 3.3 V as long as the other goes to ground.
Turning the knob changes the middle-leg voltage between 0 and 3.3 V, and the sketch uses analogRead to convert that position into a setting for the LED on pin 23. The potentiometer draws about a third of a milliamp across its outer legs.
The knob stands in for throttle. On the planned drone, increasing throttle would speed up all four motors together, while lowering it would slow them; a handheld controller is planned for flight.
Let PWM Hardware Handle the Switching
Pulse Width Modulation, or PWM, controls average power by switching an output on and off. Its duty cycle is the percentage of each cycle spent on: at 25% in a one-second cycle, for example, the LED stays on for a quarter of a second.
At about 1,000 cycles per second, the LED appears to dim as the knob changes its duty cycle, although it still switches fully on and off. A delay-based sketch can produce that effect, but the processor spends its time waiting instead of attending to other drone tasks.
With analogWrite, the ESP32’s PWM hardware keeps switching the output while the processor does other work. The sketch maps the knob reading to the function’s 0 to 255 range, where 0 is off, 255 is on and about 128 is halfway. You can use Serial Plotter, set to 115,200, to display the changing value. Older examples using ledcSetup and ledcAttachPin can produce errors with the software used here.
The planned flight controller is the ESP32-S3, which has up to eight LED PWM channels and two motor-control PWM controllers. After moving from breadboard circuits to soldered prototypes and a custom board, the project plans to use four PWM channels, one per motor. Do not wire a motor directly to an ESP32 output pin: the planned MOSFET driver will switch power from a battery instead.
We recommend treating this as a series that builds on itself, rather than skipping ahead to the motors. The earlier lessons on voltage limits, floating inputs and arming underpin the later steps. In particular, the risk of a floating signal making a motor twitch gives the pull-down lesson a purpose beyond the button circuit. Skipping those basics will make later steps harder, so check that you are comfortable with them before wiring anything to a motor.
You can treat the breadboard prototype as a place to understand drone control before taking on the mechanics of flight. For anyone learning how code connects physical inputs to outputs, this ESP32 drone project is worth trying as a starting point toward building a flight controller.
Media Credit: Spencer Baum
Disclosure: Some of our articles include affiliate links. If you buy something through one of these links, Geeky Gadgets may earn an affiliate commission. Learn about our Disclosure Policy.