How to Add a Loudspeaker to LiteWing ESP32 Drone for Wireless Audio Announcement

Submitted by Vishnu S on

In this project, we upgraded LiteWing, an ESP32-based development drone by adding a lightweight Bluetooth speaker system to extend its capabilities beyond flight. By adding a simple Bluetooth audio setup, the drone can now deliver real-time announcements, voice messages, or music directly from the air without requiring any additional coding. The entire system works through a standard Bluetooth connection, making it easy to set up, practical for demonstrations, events, and experimental applications while also being fun.
If you want to learn how to make a DIY Bluetooth speaker, check out the article titled “Build a Compact and Portable DIY Bluetooth Speaker.” By combining wireless communication and lightweight audio hardware, this setup makes it possible to use the drone announcements, campus activities, safety alerts, and creative applications. Our collection of DIY drone projects focuses on building programmable and sensor-equipped drones using microcontrollers such as ESP32 and related technologies.

Drone with Loudspeaker: Add a Bluetooth Speaker System to the LiteWing ESP32 Drone

A beginner-friendly, step-by-step guide to build a loudspeaker drone for real-time aerial announcements, voice alerts, and Bluetooth audio streaming powered by the LiteWing ESP32 platform.

  • Pair the JDY-62 Bluetooth module as a Bluetooth audio receiver.
  • Feed the audio signal into the PAM8403 amplifier.
  • Drive the 2W 8Ω speaker for audible aerial playback.
  • Power everything via a 3.7V–5V boost converter from the drone's VBUS pin.
  • Pair your smartphone → stream audio → fly and announce. No code needed.

LiteWing ESP32 Drone Bluetooth Speaker Explanation and Demo Video

Overview of Drones with added Loudspeaker Systems

The drone is an unmanned aerial vehicle integrated with a loudspeaker system, allowing it to transmit live voice announcements, music, and various audio alerts during flight operations. 

A drone that has an integrated wireless sound system has all of these components built right into the frame of the craft itself, providing a mobile public address system from any location within the drone’s flight range. This technology can easily be used in areas where traditional ground-level sound systems may not be able to reach their intended audience effectively.

Components Required for the Bluetooth Speaker Drone

To add a drone speaker system to the LiteWing drone, a few basic hardware components are needed. These parts help in receiving wireless audio, amplifying the sound, and supplying proper power to the system. The list below shows all the components used in this project and their purpose.

ComponentFunction
LiteWing DroneReceives wireless audio data via Bluetooth from a mobile device
PAM8403 Audio AmplifierAmplifies low-power audio signals to drive the external speaker
2-Watt 8Ω SpeakerOutputs audio for real-time announcements and voice playback
3.7V to 5V Boost ConverterSteps up battery voltage to provide stable power supply for the audio system components
Wires Used to connect the Bluetooth module, amplifier, boost converter, and speaker together

Hardware Setup and Wiring Guide

The hardware setup involves connecting the drone with a Bluetooth speaker, audio amplifier, speaker, and boost converter to the LiteWing drone. Proper wiring and power connections are important to ensure stable audio output and safe operation during flight. In this section, we will explain how each component is connected and how the overall system is assembled, as shown in the image below.

LiteWing ESP32 drone with loudspeaker hardware wiring diagram — JDY-62 Bluetooth module connected to PAM8403 amplifier, 2W 8-ohm speaker, boost converter, and drone VBUS and GND pins

The image shows the hardware connections for integrating a BLE speaker system with the LiteWing drone.

Key Wiring Points at a Glance

  • The JDY-62 Bluetooth module connects to the PAM8403 amplifier, which then drives the 2W speaker. In this connection, the red and black wires are used for the power supply, while the yellow wire carries the audio signal and is connected to the right audio input of the amplifier.
  • A 3.7V to 5V boost converter powers the amplifier and speaker to ensure a stable voltage.
  • All components are connected to the LiteWing ESP32 drone through the GND and VBUS pins for power.

This setup allows the drone to receive audio via Bluetooth and play it through the speaker while flying.

How the LiteWing Bluetooth Speaker Drone System Works

The LiteWing drone with Bluetooth speaker system works by combining wireless communication, audio processing, and flight control to create an interactive aerial platform. Here’s how it functions step by step:

Wireless Audio Reception

The JDY-62 Bluetooth module acts as the audio receiver. When paired with a mobile device, it receives audio signals wirelessly using Bluetooth. This allows you to stream drone announcements, music, or voice messages directly to the drone while it is flying.

JDY-62 Bluetooth module paired with mobile smartphone for wireless audio streaming to LiteWing drone speaker system

Audio Amplification

The low-power audio signal received from the JDY-62 module is not strong enough to drive a speaker directly. The PAM8403 audio amplifier boosts this signal, ensuring that the output sound is loud and clear for real-time announcements.

Power Supply Management

The drone’s battery voltage (typically 3.7V) is stepped up to a stable 5V using the boost converter. The VIN+ of the boost converter is connected to the VBUS of the drone, ensuring that both the Bluetooth module and the amplifier receive consistent power for uninterrupted operation, even while the drone is flying.

Audio Output

The amplified signal is sent to the 2-Watt 8Ω speaker mounted on the drone. The speaker plays the received audio clearly, allowing the drone to deliver announcements, alerts, or interactive messages from the air. In real-world testing, the drone speaker is clearly audible at typical low-altitude flight heights, making this an effective solution for short-range aerial drone announcement applications such as event broadcasts and safety alerts.

Integration with the Drone

The entire audio system is lightweight and carefully integrated with the LiteWing drone with a loudspeaker. Wires connect the Bluetooth module, amplifier, and speaker, while the ESP32 flight controller continues to manage drone navigation. This ensures that the drone can fly normally while also functioning as a flying audio communication platform.

Working Demonstration

In the working video, you can see the LiteWing drone flying while playing audio in real time through the Bluetooth speaker system. It clearly shows how the drone connects to a mobile phone via Bluetooth and broadcasts voice messages from the air. This video gives a practical view of the setup in action and helps you understand how the system performs.

In our article DIY Gesture Control Drone using Python with LiteWing and ESP32,  we built a gesture-controlled system ourselves using an ESP32 and MPU6050 sensor to wirelessly control a LiteWing drone via Bluetooth and Python, and you can try it yourself if you're passionate about innovative DIY tech projects.

Real-World Applications of a Loudspeaker Drone

The ability to broadcast audio from the air makes a loudspeaker drone uniquely versatile across a wide range of industries and use cases. Here are the primary applications of this drone announcement platform:

  • Event announcements and public messaging
  • Safety alerts and emergency notifications
  • Tour guidance and interactive experiences
  • Advertising and promotional campaigns
  • Search and rescue communication
  • Educational demonstrations
  • Creative content and entertainment

Troubleshooting Drone Restarting Issue

Connect the VIN+ of the boost converter to the drone’s VBUS pin instead of the 3.3V pin to prevent restarting problems. This is necessary because the 3.3V power line cannot supply enough current for the boost converter and audio components, which causes the drone to reboot. The VBUS pin provides a more stable and higher current power supply, allowing the system to operate smoothly.

SymptomLikely CauseSolution
Drone resets on power-upInsufficient current from 3.3V pinMove boost converter VIN+ to VBUS pin
No audio outputJDY-62 not paired / wrong audio channelRe-pair device; confirm yellow wire is on R+ input of PAM8403
Drone unstable or driftingAdded weight unbalanced on frameRedistribute speaker and module mass symmetrically; keep total added weight under 25 g

Frequently Asked Questions: Drone with Loudspeaker

⇥ 1. How much weight can the LiteWing drone lift?
The LiteWing drone can typically lift around 20 to 30 grams of additional payload, depending on battery and motor performance. For stable flight, it is recommended to keep the added weight as low as possible.

⇥ 2. Is a boost converter mandatory for this setup?
Yes, a boost converter is recommended because the drone battery provides around 3.7V, while the Bluetooth module and amplifier require a stable 5V supply for reliable operation.

⇥ 3. Can I use a different Bluetooth module instead of JDY-62?
Yes, you can use other Bluetooth audio receiver modules, but make sure they support audio output, work on low power, and are lightweight to avoid affecting the drone’s flight performance.

⇥ 4. Do I need to write any code to use the Bluetooth speaker system
No, coding is not required. The system works directly through Bluetooth pairing, allowing audio to be streamed from a mobile device without any programming.

⇥ 5. What precautions should be taken while adding extra hardware?
Keep the added components lightweight, use proper soldering to make strong and reliable connections, ensure a stable power supply, and avoid blocking the propellers or airflow to maintain safe and stable flight.

⇥ 6. What module is best for a Drone Speaker?
The excellent Bluetooth audio modules available make them ideal choices for drone speakers, as they typically offer wireless audio streaming, very low power draw (3.3 to 5V) and very lightweight (important for maintaining flight performance). All Bluetooth audio modules provide standard analogue audio outputs, allow for Bluetooth pairing, and draw less than 100mA in their operating mode, so any one of these will work with your Bluetooth speaker build.

⇥ 7. What amplifier ahould be used for a Drone Speaker?
The PAM8403 Class D stereo amplifier would be the best option to power a drone speaker. It will operate on 5V power, has excellent power efficiency (Class D), has a weight of only a few grams, and provides 3W per channel (more than enough to power a two watt 8Ω speaker at outdoor listening levels). It also has a low idle current; therefore, this will help reduce the overall impact of the amplifier on a drone's flight time.

Related Tutorial: Similar to LiteWing ESP32 Drone

This series shows how to set up the LiteWing ESP32 DIY drone with Betaflight, control it using Python, and enable height hold for stable hovering, perfect for beginners and makers.

 How to Connect the LiteWing ESP32 Drone to Betaflight

How to Connect the LiteWing ESP32 Drone to Betaflight

This project shows how to connect and configure the LiteWing ESP32 drone with Betaflight firmware. By flashing Betaflight on the ESP32 and setting up motors, IMU, receiver, and flight modes, you can convert a small DIY drone into a fully tunable FPV-style flight controller for stable and customizable flight performance.

 How to Program LiteWing Drone using Python with Crazyflie Cflib Python SDK

How to Program the LiteWing Drone using Python with Crazyflie Cflib Python SDK

This guide shows how to program the LiteWing ESP32 DIY Drone Kit for Makers and Developers Q20 C2 using Python with the Crazyflie cflib SDK over Wi-Fi. It explains how to install the Python SDK, connect to the drone via UDP, and write a simple script to arm the drone and spin the motors using Python commands.

 How to Use Height Hold Mode in LiteWing ESP32 Drone?

How to Use Height Hold Mode in LiteWing ESP32 Drone?

This guide explains how to add and use height hold mode on the LiteWing ESP32 drone using a VL53L1X Time-of-Flight (ToF) distance sensor. It shows how attaching the sensor and activating height hold lets the drone automatically maintain a set altitude for stable hovering and easier flight control.

Have any question related to this Article?

Reverse Polarity Protection Circuit Using P-Channel MOSFET

Submitted by Vishnu S on

You’ve just finished assembling an electronic project and are ready to power it up, only to realize the battery might be connected backwards. In an instant, a simple mistake can destroy hours of work. Reverse polarity is one of the most common causes of circuit failure, from hobby projects to industrial systems. The good news is that a well-designed reverse polarity protection using MOSFET technique can guard every circuit you build, with near-zero efficiency penalty.

A common way to protect a circuit from incorrect power connections is to use a diode, but it wastes energy and generates heat even when connected correctly. This can be a problem for low-voltage devices like battery-powered gadgets. A smarter solution is reverse polarity protection using a MOSFET, which acts as a small electronic switch that only lets power flow the right way, wastes very little energy, and helps the battery last longer. If you want to learn more about MOSFETs, how they’re constructed, their types, and how they work, check out this article: “What is MOSFET: Its Construction, Types and Working.”

Want to learn more about  Electronic Circuits and practical project designs? Visit our page for easy tutorials and real-world applications. Start building smarter and safer electronics today!. A smarter solution is reverse polarity protection using a P-channel MOSFET, which acts as an electronically-controlled switch that conducts only under correct polarity, introduces a voltage drop of less than 0.1 V, and helps the battery last longer.

What you will learn: How to design a reverse polarity protection circuit using a MOSFET, why a P-channel MOSFET outperforms a series diode, how to add Zener gate protection for high-voltage environments, and how to select the right MOSFET for your supply voltage.

Understanding Reverse Polarity and Why Protection Matters

Reverse polarity occurs when the positive and negative terminals of a power supply are connected incorrectly to a circuit. This can happen due to:

  • Incorrect battery installation
  • Miswired connectors
  • Accidental connection of the wrong polarity power adapters
  • Human error during prototyping or field installation
    Without protection, reverse polarity can cause immediate component failure, permanent damage to ICs, or even thermal runaway leading to fire hazards.

Components Required for Reverse Polarity Protection Circuit Using MOSFET

The following components are needed to build the MOSFET-based reverse polarity protection circuit.

Components NameQtyPurpose
P-Channel MOSFET
(IRF9710)
1Main switching element for reverse polarity protection
Diode
(IN4007)
1Blocks current when power is connected in reverse.
Gate Resistor
(1k ohms)
1Limits gate current and stabilizes MOSFET switching
DC Power Supply / Battery1Provides input power to the circuit
Load (LED / Microcontroller / Motor)1Used to test circuit operation
Breadboard1Used for circuit assembly
Connecting WiresAs requiredUsed for making electrical connections

Traditional Diode-Based Reverse Polarity Protection

The simplest method of reverse polarity protection uses a diode connected in series with the positive supply line. When the power supply is connected with the correct polarity, the diode becomes forward-biased and allows current to flow, with a typical forward voltage drop of around 0.7V. When the supply is connected in reverse polarity, the diode becomes reverse-biased and blocks the current flow, preventing current from reaching the circuit and protecting the connected components from damage.

 Diode Based Reverse Polarity Protection Circuit Diagram

Although this method provides basic protection, it is not energy efficient. The forward voltage drop across the diode results in continuous power dissipation and reduced available voltage at the load.

Diode Method — Efficiency Calculation

For a 12V system operating at 500mA load current:

Power Loss = 0.7V × 0.5A = 0.35W
Efficiency Impact = (0.7 / 12) × 100% = 5.8% voltage loss

This power loss is converted into heat, which can affect thermal performance and battery life in portable systems.
Because diode-based protection wastes power and produces heat, a reverse polarity protection circuit using MOSFET is a better choice. It offers much lower voltage drop, higher efficiency, and improved overall power performance, making it ideal for battery-powered and high-current applications.

Reverse Polarity Protection Circuit Using MOSFET (P-Channel)

A P-channel MOSFET connected in series with the positive power line, with its gate connected to ground through a pull-down resistor, provides efficient reverse polarity protection with very low voltage loss. When the power supply is connected correctly, the gate to source voltage becomes negative, which turns the MOSFET ON and allows current to flow with very low resistance. When the supply polarity is reversed, the gate to source voltage becomes positive, keeping the MOSFET OFF and blocking the current flow. The internal body diode is oriented to prevent current flow during reverse connection, providing additional protection and ensuring reliable circuit operation.

P-channel MOSFET reverse polarity protection circuit — IRF9710 with gate pull-down resistor and 1N4007 blocking diode. VGS controls turn-on automatically based on supply polarity.

Step-by-Step Circuit Assembly

  • Place the IRF9710 P-Channel MOSFET on the breadboard and find, using the datasheet pin-out, where the Source (S), Gate (G) and Drain (D) are located.
  • At the same time, connect a resistor of 1k ohm from the Gate to the Ground this is the pull-down that allows the Gate Voltage to be lower in value relative to Drain (assuming power is being applied to Drain).
  • If you connect a 1N4007 diode in the Gate Bias path with the cathode connected to the Gate and the anode connected to Gnd, this will prevent there being reverse Gate Voltage when the power supply is reversed in polarity.
  • Now connect the load (for example: LED + 470-ohm resistor, or an Arduino board using a similar circuit) between the Drain rail and GND.
  • So when the power is applied with the correct polarity, the load (whether it be an LED or another load) will run as it should. If the power's polarity isn't correct, the load will not work.

MOSFET Method - Efficiency Calculation

To understand the efficiency advantage of MOSFET-based reverse polarity protection, consider the same 12V system operating at a load current of 500mA. Compared to diode-based protection, the MOSFET introduces significantly lower resistance in the current path, resulting in much smaller voltage drop and reduced power dissipation. This directly improves overall system efficiency and minimizes thermal losses, as shown in the following calculation.

Voltage drop = 0.5A × 0.1Ω = 0.05V
Power loss = 0.5A × 0.05V = 0.025W
Efficiency impact = (0.05/12) × 100% = 0.4% loss

Comparison: Diode vs MOSFET Reverse Polarity Protection

To clearly see the difference between diode protection and MOSFET protection, we can compare how both methods perform in real circuits. Even though both protect against wrong power connections, they differ in power loss, heat generation, and efficiency. The table below shows these main differences.

FeaturesDiode MethodMOSFET Method
Voltage DropHigh (~0.6–0.8 V)Very Low (~0.05–0.15 V)
EfficiencyLowHigh
Heat LossHigh Very Low
CostCheapModerate
Current HandlingLimitedHigh
ReliabilityBasic protectionMore reliable protection

Working Demonstration

In this video, both the diode-based protection circuit and the MOSFET-based protection circuit are tested to show their real-time behavior. When the power supply is connected correctly, both circuits allow current to flow and power the load. However, when the polarity is reversed, both circuits block the current and protect the connected components. The key difference can be observed in performance: the diode circuit shows a noticeable voltage drop and slight heating, while the MOSFET circuit delivers almost full supply voltage with very low power loss. This practical demonstration clearly shows why MOSFET-based reverse polarity protection is more efficient and reliable for modern electronic applications.

Enhanced P-MOSFET Reverse Polarity Protection with Zener Gate Clamping

The enhanced P-MOSFET reverse polarity protection circuit improves on the basic design by adding a Zener diode to protect the MOSFET gate from excessive voltage. In the simple MOSFET circuit, the gate voltage directly depends on the input supply. When higher input voltages or sudden spikes occur, the gate-to-source voltage can exceed safe limits and damage the MOSFET. The basic P-channel MOSFET reverse polarity protection circuit works well for supplies below ~20 V.

 MOSFET Reverse Polarity Protection with Gate Zener

How the Zener Diode Protects the Gate

By adding a Zener diode, the gate voltage is clamped to a safe level, preventing overvoltage stress on the MOSFET. This makes the circuit more stable and reliable, especially in high-voltage or automotive and industrial applications. While the enhanced circuit uses one extra component, it provides better protection, improved durability, and safer long-term operation compared to the basic MOSFET-based reverse polarity protection circuit.

FeatureSimple CircuitZener Protected Circuit
Reverse Polarity ProtectionYesYes
Gate Voltage ProtectionNoYes
Suitable for High VoltageNoYes
Component CountLowSlightly Higher
ReliabilityMediumHigh


If you want to learn more about this enhanced circuit with the zener diode  and see a detailed explanation, take a look at this article, “Reverse Polarity Protection Circuit”

How to Choose the Right MOSFET for Reverse Polarity Protection

Selecting the correct MOSFET for reverse polarity protection is critical for reliable and efficient operation. The following parameters should be checked from the datasheet before committing to a device:

ParameterWhat to CheckRecommended Value
VDS(max)Must be greater than maximum supply voltage plus transient spikes≥ 1.5 × Vsupply
VGS(th) (threshold)Must turn ON fully at your supply voltage; choose logic-level MOSFETs for 3.3 V/5 V< Vsupply / 2
RDS(on)Lower is better — directly sets power loss and voltage drop< 0.1 Ω for ≤5 A; < 0.01 Ω for ≥20 A
ID(max)Must exceed peak load current with margin≥ 2 × maximum load current
VGS(max)Determines whether a Zener gate clamp is neededTypically ±20 V; add Zener if Vsupply > 15 V

Real-World Applications of MOSFET Reverse Polarity Protection

The reverse polarity protection MOSFET circuit is a universal building block. The following applications benefit directly from the near-zero voltage loss it provides:

  • Battery-powered devices
    Protects gadgets when batteries are connected the wrong way.
  • Microcontroller projects
    Keeps boards like ESP32 and Arduino safe during testing and development.
  • IoT and smart devices
    Prevents damage in smart home sensors and automation systems.
  • Car electronics
    Protects circuits in vehicles from accidental reverse battery connection.
  • Power supply inputs
    Keeps adapters and power modules safe from wrong polarity connections.
  • Motor circuits
    Protects motor drivers and controllers from wiring mistakes.

Conclusion

In conclusion, protecting circuits from wrong power connections is essential. While diode-based solutions work, they waste energy and generate heat. Reverse polarity protection circuit using a MOSFET provides a low-loss, efficient alternative that blocks reverse current, reduces heat, and extends battery life, making it ideal for both hobby and commercial projects. A well-designed reverse polarity protection circuit using a MOSFET resolves both issues: it conducts with a voltage drop of less than 0.1 V, generates negligible heat, handles high currents with the right device selection, and adds only two or three low-cost components to any design. Whether you are building a hobby project, a commercial IoT device, or an automotive accessory, P-channel MOSFET reverse polarity protection is the engineering best practice that every power input stage should include. Therefore,  P-channel MOSFET reverse polarity protection should be considered a best practice in all power input stage designs, regardless of whether they are for a hobby project, commercial IoT device, or automotive accessory.

Frequently Asked Questions on Reverse Polarity Protection using MOSFET

⇥ 1. Can this circuit be used with batteries?
Yes, it is ideal for battery-powered devices because it reduces power loss and heat generation.
⇥ 2. Is MOSFET-based protection safe for high current circuits?
Yes, if the correct MOSFET is selected, it can safely handle high current loads.
⇥ 3. Can I use an N-channel MOSFET for reverse polarity protection?
Yes, you can use an N-channel MOSFET, but the circuit is more complex. It is usually placed on the ground side, and using it on the positive side requires extra control circuitry. For simple designs, a P-channel MOSFET is easier to use.
⇥ 4. Is it better to use a MOSFET instead of a diode for reverse polarity protection?
A MOSFET provides more efficient reverse polarity protection than a diode because its voltage drop is much lower (typically 0.05–0.15 V versus 0.6–0.8 V). This greatly reduces power dissipation and heat generation, especially in high-current applications.
Therefore, a MOSFET is preferable in battery-powered systems where efficiency and maximum available voltage are important.
⇥ 5. How can a P-Channel MOSFET be used to provide reverse polarity protection?
A P-channel MOSFET is placed in series with the positive supply rail for reverse polarity protection. With correct polarity, a negative VGS turns it on and allows current to flow. If polarity is reversed, VGS becomes positive, turning it off and blocking reverse current.
⇥ 6. Can this Protection Circuit Work with Arduino or ESP32 Boards?
Yes! Use a logic level P-MOSFET  (e.g., AO3401, VGS(th) ≈ −1 V) on the 5 V or 3.3 V rail that powers the microcontroller board's VIN pin. The MOSFET will fully turn ON at these low voltages, provide only approximately 1-5mV of voltage drop, and completely protect the board from reverse power connection without any effect on the normal operation of the board.
⇥ 7. Why do some circuits include a Zener diode on the gate of a P-MOSFET?
MOSFET gates are typically limited to about ±20 V VGS, and voltage transients can exceed this rating. A Zener diode between gate and source clamps VGS to a safe value. This protects the MOSFET from overvoltage damage.

Practical tutorials demonstrating how MOSFETs are used as efficient electronic switches for logic-level conversion, power control, and DC motor driving in embedded and general electronics circuits.

 Simple MOSFET Switching Circuit – How to turn on / turn off N-Channel and P-channel MOSFETs

Simple MOSFET Switching Circuit – How to turn on / turn off N-Channel and P-channel MOSFETs

Discover how to use MOSFETs for switching circuits. Learn about N-channel and P-channel MOSFET behaviour, gate control, key parameters, and practical tips for reliable operation.

 Simple H-Bridge Motor Driver Circuit using MOSFET

Simple H-Bridge Motor Driver Circuit using MOSFET

In this circuit tutorial, we will discuss one of the most commonly used and efficient ways to drive DC motors -the  H Bridge circuit.

 Arduino DC Motor Speed Control using MOSFET Transistor

Arduino DC Motor Speed Control using MOSFET Transistor

Learn how to control the speed of a DC motor using Arduino and a MOSFET. This guide covers component selection, circuit setup, coding, and practical demonstrations for building an efficient motor controller.

 Bi-Directional Logic Level converter using MOSFET

Bi-Directional Logic Level Converter using MOSFET

Learn how to build a bi-directional logic level converter using MOSFETs to safely interface devices operating at different voltage levels, with step-by-step instructions and circuit explanation.

Have any question related to this Article?

LogicTronix Stepping In Where FPGAs Beat CPUs, GPUs, and ASICs

Submitted by Abhishek on

FPGAs have become a recurring subject in recent CircuitDigest features, appearing in themes of education and accessibility. In our interaction with Krishna Gaihre, CEO & Founder at LogicTronix, an "AMD-Xilinx’s Selected Partner (ACP) for FPGA Design and ML Acceleration," we explored the practical side of things.

Voice Activated LED Controller with Touch Interface Using ESP32S3 Box 3

Voice control has become an integral part of modern smart home automation. In this tutorial, we build a voice-controlled LED system using the ESP32-S3-BOX-3 development board, combining wake word detection, speech recognition, touch interface, and audio feedback to create an intelligent control system. The code will be based on the factory example provided by Espressif and we will do the needed modifications to make it apt for our project.

The ESP32-S3-BOX-3 is a powerful development platform from Espressif that integrates a 320×240 touchscreen display, dual microphones for voice input, stereo speakers, and WiFi/Bluetooth connectivity. This project demonstrates how to leverage these features using the ESP-IDF (Espressif IoT Development Framework) and ESP-SR (Speech Recognition) library.

Voice Activated LED Controller

For a detailed hands-on review and getting-started walkthrough of the ESP32-S3-BOX-3 board, check out our previous articles on the same
Getting Started with ESP32-S3-BOX-3 - CircuitDigest Review
Programming ESP32-S3-BOX-3 with Arduino IDE - RGB LED Control

What You'll Learn

  • Implementing wake word detection using WakeNet
  • Building command recognition with MultiNet
  • Creating a touch-based GUI using the LVGL library
  • Playing audio feedback through the I2S interface
  • Controlling hardware (LED) through GPIO

Components Required

S.NoComponentQuantity
1ESP32-S3-BOX-3 Development Board1
2RGB LED Module 1
3Jumper WiresAs needed
4USB-C Cable (for programming and power)1

Software Requirements

  • ESP-IDF v5.5.2 - Espressif IoT Development Framework
  • Python 3.12+ - Required for ESP-IDF tools

Circuit Diagram and Connections

The circuit connection is straightforward. We connect an external LED to GPIO 40 of the ESP32-S3-BOX-3 board through a current-limiting resistor. For the ease of demonstration, we have used the RGB LED module that came with the ESP32-S3-BOX-3. We will be using the DOCK accessory to connect the LED. Insert the ESP32S3-Box-3 into the dock. Connect the GND pin of the RGB Module to any of the ground points in the dock and any one of the anode pins to the G40 port in the dock. As already mentioned, if you are using a single external LED,  connect the cathode of the LED to ground and the anode to the G40 through a current-limiting resistor. The image below shows the connection.

Voice Activated LED Controller with Touch Interface Using ESP32S3 Box 3 Circuit Diagram

Here is the ESP32S3-Box-3 with the LED attached.

 

ESP32 S3 Box Hardware Setup

Project Setup Beginner's Guide

ESP-IDF Installation

This project requires ESP-IDF v5.5.2. For full installation and configuration instructions, refer to the official Espressif Getting Started Guide:
ESP-IDF Getting Started Guide (Official)
Then make sure to get our project file from our repo using git clone or manually downloading and extracting it to your preferred location.

git clone https://github.com/Circuit-Digest/Voice-Activated-LED-Controller-with-Touch-Interface-Using-ESP32S3-Box-3

Project Configuration

1. Set up the ESP-IDF environment: Once you have properly installed and set up the ESP-IDF following Espressif's guide, on Mac or Linux systems, open a terminal and run the following command to set up the ESP-IDF environment. Make sure not to close the terminal once done, and any upcoming idf command has to be executed through the same terminal or command prompt. If you ever close the terminal, or when opening the project later, run this command first to set up the environment. This has to be done in each new section. 

. $HOME/esp/esp-idf/export.sh

On Windows PCs, you can directly run the ESP-IDF command prompt shortcut in the Start menu, created by the ESP-IDF installer.

2. Navigate to the project directory. The path you provide must be to the root folder of your project directory.

cd /path_to_your_project_directory

3. Configure the project: The menu config option is used to change or reconfigure the project parameters. It is completely optional since all required properties are already configured. But if you need, you can use the following command to access the menuconfig options.

idf.py menuconfig

4. Build the project: You can use the following script to build the project. When it's executed,  the IDF will copy any required managed components to the project folder and build the project. If any error occurs, other than related to code, it is highly recommended to do a full clean and then build.

idf.py build

5. Flash and monitor: the following command is used to flash the code to the ESp32S3-Box-3 and monitor the serial log. Make sure to connect the board to the computer before running the command. If the board is not detected, even after connecting to the computer, Press and hold the boot button and then press the reset button. Later, release the boot button and try to upload the code. Once uploaded with this method, make sure to reset the board manually once the code is uploaded.

idf.py flash monitor

Project Structure Overview

For your reference, this is the file structure of our project. The Main folder contains all the source code, while the components folder contains unmanaged component libraries, and the spiffs folder contains all the image or audio files.

Voice Activated LED Controller with Touch Interface Using ESP32S3 Box 3 File Structure

How Wake Word Detection Works

Wake word detection uses ESP-SR WakeNet, a low-power neural network engine that runs continuously in the background. The Audio Front-End (AFE), preprocesses audio from the microphone array. Sample rate: 16 kHz, 16-bit signed, 2 channels (stereo). Then the WakeNet Engine does the CNN-based wake word detection. The Wakenet framework continuously monitors the audio stream with low power consumption. It supports up to 5 wake words simultaneously. The wake word detection flow is as given below.

Microphone   ->  I2S   ->  AFE   ->  WakeNet   ->  Wake Detection Event
Wake Word Detection Flow

Detection Events

  • WAKENET_DETECTED - Wake word detected; start listening for commands.
  • WAKENET_CHANNEL_VERIFIED - Channel verified; ready for command recognition.

The following key functions are used for the wakeword detection and are called from main/app/app_sr.c.

  • audio_feed_task() - Reads audio from I2S and feeds it to AFE
  • audio_detect_task() - Processes AFE output and detects wake words
  • app_sr_start() - Initialises AFE and WakeNet models

Available Wake Words

The project supports multiple pre-trained wake words. Configure them via idf.py menuconfig.
Navigation: idf.py menuconfig  -> ESP Speech Recognition  -> Load Multiple Wake Words

Wake WordLanguageConfig Key
Hi ESP 

English

CONFIG_SR_WN_WN9_HIESP_MULTI=y
Hi LexinChinese
CONFIG_SR_WN_WN9_HILEXIN_MULTI=y
AlexaEnglish
CONFIG_SR_WN_WN9_ALEXA_MULTI=y
Xiao Ai Tong XueChinese
CONFIG_SR_WN_WN9_XIAOAITONGXUE_MULTI=y
Ni Hao Xiao ZhiChinese
CONFIG_SR_WN_WN9_NIHAOXIAOZHI_MULTI=y

How to Change Wake Words

Method 1 - Using menuconfig
1.Run idf.py menuconfig
2.Navigate to: ESP Speech Recognition -> Load Multiple Wake Words
3.Enable or disable desired wake words.
4.Save and rebuild: idf.py build flash

Method 2 - Modify Code

Wake word selection happens in app_sr.c:

// In app_sr_set_language() function (line ~235)
char *wn_name = esp_srmodel_filter(models, ESP_WN_PREFIX,
   (SR_LANG_EN == g_sr_data->lang ? "hiesp" : "hilexin"));

To switch the English wake word to "Alexa":

char *wn_name = esp_srmodel_filter(models, ESP_WN_PREFIX,
   (SR_LANG_EN == g_sr_data->lang ? "alexa" : "hilexin"));

Using Custom Wake Words

Requirements: A custom wake word model trained with ESP-SR tools, in ESP-SR compatible format, with sufficient model partition space.
1. Train a custom wake word using ESP-SR training tools (see ESP-SR documentation).

2. Place the generated model file (.bin) in spiffs/ or the model partition.

3. Enable the custom word in menuconfig: For eg, ESP Speech Recognition -> CONFIG_SR_WN_WN9_CUSTOMWORD

4 .Update code in app_sr.c:

char *wn_name = esp_srmodel_filter(models, ESP_WN_PREFIX, "customword");

5. Rebuild and flash: idf.py build flash

How Speech Recognition Works

Speech recognition uses ESP-SR MultiNet, an offline command recognition engine that supports up to 200 commands without requiring cloud connectivity. Both English and Chinese are supported in the ESP-SR engine.

Wake Word Detected   ->  AFE Processing   ->  MultiNet   ->  Command ID   ->  Handler Action
Command Recognition Flow

Recognition States

  • ESP_MN_STATE_DETECTING  - Listening for a command
  • ESP_MN_STATE_DETECTED   - Command recognised
  • ESP_MN_STATE_TIMEOUT    - No command detected within timeout

Key Components

  • Command Definition (app_sr.c) - defines the text and phoneme for each command
  • Command Structure (app_sr.h) - struct holding cmd ID, language, text, and phoneme
  • Recognition Process (audio_detect_task) - AFE processes audio, MultiNet analyses chunks, returns command ID via queue to handler
// Command definition array  (app_sr.c)
static const sr_cmd_t g_default_cmd_info[] = {
   {SR_CMD_LIGHT_ON,  SR_LANG_EN, 0, "turn on light",  "TkN nN LiT", {NULL}},
   {SR_CMD_LIGHT_OFF, SR_LANG_EN, 0, "turn off light", "TkN eF LiT", {NULL}},
};

How to Modify Commands

⇒ Step 1 - Add Command Enum (app_sr.h)

typedef enum {
   SR_CMD_LIGHT_ON,
   SR_CMD_LIGHT_OFF,
   SR_CMD_MY_NEW_CMD,    //  Add your command enum
   SR_CMD_MAX,
} sr_user_cmd_t;

⇒ Step 2 - Add Command Definition (app_sr.c)

static const sr_cmd_t g_default_cmd_info[] = {
   {SR_CMD_LIGHT_ON,     SR_LANG_EN, 0, "turn on light",  "TkN nN LiT", {NULL}},
   {SR_CMD_LIGHT_OFF,    SR_LANG_EN, 0, "turn off light", "TkN eF LiT", {NULL}},
   {SR_CMD_MY_NEW_CMD,   SR_LANG_EN, 2, "my new command", "mI nU kMnd", {NULL}},  //   Add
};

⇒ Step 3 - Add Handler Action (app_sr_handler.c)

case SR_CMD_MY_NEW_CMD:        //   Add your handler
   ESP_LOGI(TAG, "My new command executed!");
   // Your action here
   break;

⇒ Step 4 - Rebuild and Flash

idf.py build flash monitor

Adding Multiple Commands

// app_sr.h - enum
SR_CMD_FAN_ON,
SR_CMD_FAN_OFF,
SR_CMD_SET_BRIGHTNESS_HIGH,
SR_CMD_SET_BRIGHTNESS_LOW,
// app_sr.c - command definitions
{SR_CMD_FAN_ON,                  SR_LANG_EN, 2, "turn on fan",      "TkN nN fN",    {NULL}},
{SR_CMD_FAN_OFF,                 SR_LANG_EN, 3, "turn off fan",     "TkN eF fN",    {NULL}},
{SR_CMD_SET_BRIGHTNESS_HIGH,     SR_LANG_EN, 4, "brightness high",  "brItns hI",    {NULL}},
{SR_CMD_SET_BRIGHTNESS_LOW,      SR_LANG_EN, 5, "brightness low",   "brItns lO",    {NULL}},

Dynamic Command Addition (Runtime)

sr_cmd_t new_cmd = {
   .cmd     = SR_CMD_MY_NEW_CMD,
   .lang    = SR_LANG_EN,
   .id      = 10,
   .str     = "my command",
   .phoneme = "mI kMnd"
};
app_sr_add_cmd(&new_cmd);
app_sr_update_cmds();   // Update MultiNet command list

API Functions (app_sr.h)

  • app_sr_add_cmd()    - Add a new command
  • app_sr_modify_cmd() - Modify an existing command
  • app_sr_remove_cmd() - Remove a command
  • app_sr_remove_all_cmd() - Clear all commands
  • app_sr_update_cmds()    - Update MultiNet with the current command list

How Display and Touch Work

The project uses LVGL (Light and Versatile Graphics Library) for GUI rendering and touch input.

  • Display Driver - ILI9341 LCD controller (320×240), SPI interface, RGB565 colour format, hardware-accelerated rendering.
  • Touch Driver - GT911 capacitive touch controller via I2C, with multi-touch support (single touch used in this project).
  • LVGL Integration - LVGL runs in a dedicated task with double buffering for smooth rendering. Touch events are handled via the LVGL input driver.

Initialisation (main.c)

bsp_display_cfg_t cfg = {
   .lvgl_port_cfg  = ESP_LVGL_PORT_INIT_CONFIG(),
   .buffer_size    = BSP_LCD_H_RES * CONFIG_BSP_LCD_DRAW_BUF_HEIGHT,
   .double_buffer  = 0,
   .flags          = { .buff_dma = true }
};
bsp_display_start_with_config(&cfg);
bsp_board_init();

Creating GUI Elements

#include "lvgl.h"
#include "bsp/esp-bsp.h"
bsp_display_lock(0);            // Lock for thread safety
lv_obj_t *scr  = lv_scr_act();  // Get current screen
// Create a button
lv_obj_t *btn  = lv_btn_create(scr);
lv_obj_set_size(btn, 100, 50);
lv_obj_align(btn, LV_ALIGN_CENTER, 0, 0);
// Add label
lv_obj_t *label = lv_label_create(btn);
lv_label_set_text(label, "Click Me");
// Add click callback
lv_obj_add_event_cb(btn, on_button_click, LV_EVENT_CLICKED, NULL);
bsp_display_unlock();

Touch Event Handling

static void on_touch_event(lv_event_t *e)
{
   lv_event_code_t code = lv_event_get_code(e);
   lv_obj_t       *obj  = lv_event_get_target(e);
   switch (code) {
   case LV_EVENT_PRESSED:
       lv_obj_set_style_bg_color(obj, lv_color_hex(0x0000FF), 0);
       break;
   case LV_EVENT_RELEASED:
       lv_obj_set_style_bg_color(obj, lv_color_hex(0x00FF00), 0);
       break;
   case LV_EVENT_CLICKED:
       light_ctrl_toggle();   // Perform action
       break;
   default: break;
   }
}

Supported Event Types

  • LV_EVENT_CLICKED      - Touch released after press
  • LV_EVENT_PRESSED      - Touch pressed
  • LV_EVENT_RELEASED     - Touch released
  • LV_EVENT_LONG_PRESSED - Long press detected

Using Images in the GUI

The project converts BMP from images stored in an array using the image_to_c tool by bitbank2, to LVGL-compatible RGB565 format at runtime using bmp_to_lv_img() in light_ui.c. If you wan you can also use the LVGL image converter tool to convert the images to c array. One other option is to store the image files in the file system and load them from there.

lv_img_set_src(img_obj, "/spiffs/image.bin");

Creating Custom GUI Screens

Here is an example code snippet showing how to create a new screen for the GUI. The LV object creation macro is used to create or define each screen.

// Screen 1: Main
lv_obj_t *main_screen = lv_obj_create(NULL);
// ... add widgets ...
// Screen 2: Settings
lv_obj_t *settings_screen = lv_obj_create(NULL);
// ... add widgets ...
// Navigate
void goto_settings(lv_event_t *e) { lv_scr_load(settings_screen); }
void goto_main(lv_event_t *e)     { lv_scr_load(main_screen);     }

Warning: Each RGB565 pixel = 2 bytes. A 320×240 screen buffer = ~150 KB. Double buffering doubles that. Consider using PSRAM for large buffers.
For more details on how to use the LVGL library, please check out the official LVGL documentation.

How Audio Output Works

Audio output uses the I2S interface with an ES8311 codec chip for digital-to-analog conversion. The I2S Driver handles audio data transfer. Sample rate: 16 kHz default for SR feedback, 16-bit, stereo (2 channels). The ES8311 codec with I2S input provides analog output to the speaker and volume and mute control.

Audio Playback Flow

WAV File   ->  Memory Buffer   ->  I2S Write   ->  Codec   ->  Speaker

Key Functions (app_sr_handler.c)

  • sr_echo_init()  - Loads WAV files from SPIFFS to memory
  • sr_echo_play()  - Plays an audio segment via I2S
  • bsp_i2s_write() - Writes audio data to I2S (BSP function)

Audio Playback Implementation

typedef enum {
   AUDIO_WAKE,   // Wake word detected tone
   AUDIO_OK,     // Command recognised tone
   AUDIO_END,    // Timeout / end tone
   AUDIO_MAX,
} audio_segment_t;
// Load WAV from SPIFFS  -> PSRAM
static esp_err_t load_wav_to_mem(audio_segment_t seg, const char *path)
{
   FILE *fp = fopen(path, "rb");
   if (!fp) return ESP_ERR_NOT_FOUND;
   fseek(fp, 0, SEEK_END);
   long sz = ftell(fp);
   fseek(fp, 0, SEEK_SET);
   s_audio[seg].buf = heap_caps_malloc(sz, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);
   s_audio[seg].len = (size_t)sz;
   fread(s_audio[seg].buf, 1, sz, fp);
   fclose(fp);
   return ESP_OK;
}

Adding More Audio Playbacks

⇒ Step 1 - Add Audio Segment Enum

typedef enum {
   AUDIO_WAKE,
   AUDIO_OK,
   AUDIO_END,
   AUDIO_CUSTOM_1,   //   Add your segment
   AUDIO_CUSTOM_2,
   AUDIO_MAX,
} audio_segment_t;

⇒ Step 2 - Add WAV File to SPIFFS
Place your WAV file in the spiffs/ directory. WAV requirements: uncompressed PCM, 16 kHz recommended, 16-bit, mono or stereo.

spiffs/
├── echo_en_wake.wav
├── echo_en_ok.wav
├── echo_en_end.wav
├── custom_sound_1.wav     Add here
└── custom_sound_2.wav

⇒ Step 3 - Load in Initialisation

ESP_RETURN_ON_ERROR(
   load_wav_to_mem(AUDIO_CUSTOM_1, "/spiffs/custom_sound_1.wav"),
   TAG, "load custom1 wav failed");

⇒ Step 4 - Play When Needed

sr_echo_play(AUDIO_CUSTOM_1);

⇒ Step 5 - Rebuild

idf.py build flash

The SPIFFS partition is automatically rebuilt with files from the spiffs/ directory.

Audio Format Requirements

ParameterValue
Sample Rates8, 16, 22.05, 44.1, 48 kHz
Bit Depth16-bit (recommended)
ChannelsMono or Stereo
FormatUncompressed PCM WAV

Converting Audio with FFmpeg

# Convert to 16 kHz, 16-bit, mono WAV
ffmpeg -i input.mp3 -ar 16000 -acodec pcm_s16le -ac 1 output.wav
# Convert to 16 kHz, 16-bit, stereo WAV
ffmpeg -i input.mp3 -ar 16000 -acodec pcm_s16le -ac 2 output.wav

BSP Audio API Reference

The following BSP functions (bsp_board.h) control the audio codec:

FunctionDescription
bsp_codec_set_fs()
Set codec sample rate, bit depth, and channel mode
bsp_codec_volume_set()
Set volume level (0-100)
bsp_codec_mute_set()
Mute or unmute the audio codec
bsp_i2s_write()
Write audio data buffer to I2S output
bsp_codec_dev_stop()
Stop the codec device
bsp_codec_dev_resume()
Resume the codec device

Memory Considerations

  • 16 kHz, 16-bit, mono   ->  ~32 KB per second
  • 16 kHz, 16-bit, stereo  -> ~64 KB per second
  • 44.1 kHz, 16-bit, stereo  -> ~176 KB per second

Recommendations

  • Use PSRAM for audio buffers (MALLOC_CAP_SPIRAM)
  • Pre-load frequently used sounds into memory
  • Stream long audio files from SPIFFS in 4 KB chunks

Streaming Long Audio

void play_long_audio_stream(const char *wav_path)
{
   FILE *fp = fopen(wav_path, "rb");
   if (!fp) return;
   fseek(fp, 44, SEEK_SET);     // Skip WAV header
   uint8_t chunk[4096];
   size_t  bytes_read;
   while ((bytes_read = fread(chunk, 1, sizeof(chunk), fp)) > 0) {
       size_t bytes_written = 0;
       bsp_i2s_write((char *)chunk, bytes_read, &bytes_written, portMAX_DELAY);
   }
   fclose(fp);
}

Changing the LED Pin

1. Open the file: main/app/app_led.c

2. Find this line (around line 15):

#define SINGLE_LED_GPIO  GPIO_NUM_40

3. Change it to a different pin (e.g. GPIO 38):

#define SINGLE_LED_GPIO  GPIO_NUM_38

4. Save the file.

5. Rebuild and flash:

idf.py build flash monitor

6. Test: Connect your LED to GPIO 38 instead of GPIO 40.

Building & Flashing

Once the hardware is connected and the software is set up, follow these steps to compile and upload the code.
Step 1 - Navigate to the Project Directory

cd /path/to/esp32-box3-voice-led-project

⇒ Step 2 - Activate ESP-IDF Environment

. $HOME/esp/esp-idf/export.sh

⇒ Step 3 - Configure (Optional)

idf.py menuconfig

⇒ Step 4 - Build

idf.py build

This compiles all source files and creates the firmware binary. The first build may take several minutes as dependencies are downloaded.
Step 5 - Flash and Monitor

idf.py flash monitor

*Tip: Press Ctrl+] to exit the serial monitor.

Final Result

After successfully flashing the firmware, the ESP32-S3-BOX-3 boots and displays the light control screen. Now we can control the LED with two different methods.
The first method is to use the voice commands. To use it:

1. Say the wake word: "Hi ESP" (speak clearly, about 1 metre from the device).

2. Wait for audio feedback - you'll hear a confirmation sound.

3. Speak the command: "Turn on light" or "Turn off light".

4. Observe: the LED changes state, the screen updates, and audio feedback plays.

5. Once the wake word is detected, you can continuously give commands without using the wake word. If you haven't provided any commands for a certain time(a few seconds), the ESP-SR engine will time out. To use it again, all you have to do is say the wake word again to trigger the wake word detection.

The second method is to use the touch screen. For that:
1. Touch the on-screen toggle button.
2. Observe: the LED toggles and the button image changes.
Here is the final result:

Troubleshooting

Wake Word Not Detected

  • Speak louder and clearer, at 0.5-1 metre from the device.
  • Reduce background noise.
  • Check the serial monitor for AFE initialisation errors.

LED Doesn't Light Up

  • Verify LED polarity 
  • Verify the GPIO 40 connection.
  • Test with a multimeter: GPIO should read 3.3 V when ON.

Build Errors

  • Ensure ESP-IDF v5.5.2 is correctly installed.
  • Run . $HOME/esp/esp-idf/export.sh before building.
  • Do a full clean rebuild: idf.py fullclean  && idf.py build.

Touch Screen Not Responding

  • Check the serial monitor for LVGL initialisation messages.

No Audio Feedback

  • Ensure WAV files are in the spiffs/ directory before building.
  • Check speaker volume (may need physical adjustment).
  • Verify I2S initialisation in serial logs.

GitHub Link

Find the project’s codebase and documentation here. Explore, fork, and contribute on GitHub.

Voice Activated LED Controller with Touch Interface Using ESP32S3 Box 3 FileVoice Activated LED Controller with Touch Interface Using ESP32S3 Box 3 File

Have any question related to this Article?

Engineer's Personal Project Turned FPGA-Based Company | tinyVision

Submitted by Abhishek on

Years ago, if you had opened the door to the hostel room of Venkat Rangan, you would have been greeted by music. One could say tinkering was something he always latched on to, because the door’s latch triggered the music from a system he built himself. "He's always been a tinkerer," recalled Vishal Srivastava, who studied alongside Venkat and now leads Marketing and Business Development at the company.

DTDS Shows 25% Cost Savings on Automotive Lighting at electronica India 2025

Submitted by Abhishek on

DTDS’s booth at electronica India 2025 highlighted a cost-effective approach to vehicle lighting systems. The company stated that its Light Control Module offers a competitive advantage, being 25% lighter on the pocket when compared to other market options. Chand Hanif, Senior FAE at the company, walked us through a live demo of the module at the booth. He explained, "We have put that complete setup as a PCB on outside also," giving visitors "more clarity on LED brightness and all."

Sahara Group Claims First-of-Its-Kind TFT Display Integration in India

Submitted by Abhishek on

With 18 years of experience, Bangalore and Chennai-based Sahara Group of Industries has been involved in numerous sectors, including healthcare, aviation, and automobile. Now the company has stepped into thin-film transistor (TFT) LCD display production, which was put on display at electronica India 2025.

Thorlabs Featured C-Band Lasers and Raman Spectrometry at Laser World of Photonics India 2025

Submitted by Abhishek on

At the Laser World of Photonics India 2025, Thorlabs, a photonics company, showcased optics, lasers, modulators, and detectors. Instruments like spectrometers and power meters were scattered across the booth. Stephan Hallwig, Head of Business Development and Marketing Communication EMEA, explained that the industry’s applications extend to semiconductor, medical, and telecommunication. 

How to Connect the LiteWing ESP32 Drone to Betaflight

Submitted by Vishnu S on

LiteWing is an open-source ESP32-S3 based drone that offers a flexible platform for experimentation and learning. By default, LiteWing operates using the modified Crazyflie firmware. LiteWing can also be configured using Betaflight, a powerful and widely adopted flight control software used in FPV and racing drones.

In this ESP32 Betaflight tutorial, we will go through the process of configuring the LiteWing drone Betaflight and turning it into a fully tunable drone. LiteWing drone Betaflight integration unlocks a rich set of features such as PID tuning, motor configuration, receiver setup, flight modes, and real-time diagnostics, making it an excellent choice for users who want deeper control over their drone’s behavior.

This ESP32 Betaflight configurator guide is for beginners as well as experienced developers who want to explore how open-source hardware like LiteWing can be integrated with standard flight software. By the end of this ESP32 Betaflight tutorial, you will have a properly configured LiteWing drone and a clear understanding of how ESP32 Betaflight firmware can be used to unlock its full potential. If you want to learn more about the LiteWing drone, its hardware, and other features, make sure to check out the official documentation and resources.

What You'll Learn in This ESP32 Drone Betaflight Tutorial:

  • Flashing the ESP32 Betaflight firmware to your LiteWing drone.
  • Setting up and optimising your ESP32 Betaflight Configurator.
  • Pin configuration for the correct communication between compatible hardware.
  • Integrating your ExpressLRS receiver with Betaflight.
  • PID tuning of the brushed motor drone.
  • Configuring your flight modes and enabling your Blackbox Data Log.

Pre-Requirements for LiteWing Betaflight Configuration

To follow this tutorial, you will need a LiteWing drone, an ExpressLRS (ELRS) receiver, and a compatible ELRS transmitter to control the drone. The receiver and transmitter should already be bound before connecting to the drone. A computer with Betaflight Configurator installed is also required for configuration and tuning. This ESP32 Betaflight configurator setup requires proper hardware connections.

Hardware Requirements:

» LiteWing ESP32-S3 drone with all components assembled
» ExpressLRS (ELRS) receiver for low-latency radio communication
» Compatible ELRS transmitter (pre-bound to receiver)
» USB data cable for computer connection
» LiPo battery suitable for LiteWing drone

Software Requirements:

» Betaflight Configurator v10.10.0 is installed on your computer
» Web browser (Chrome or Edge) for ESP flashing tool
» ESP32 Betaflight firmware binary file for ESP32-S3

Step 1⇒Uploading ESP32 Betaflight Firmware to LiteWing Drone

Before configuring the LiteWing ESP32 drone Betaflight firmware must be programmed manually using the ESP flashing tool. LiteWing uses an ESP32-S3 based ESP-FC, so the correct binary file must be flashed before proceeding.

Downloading the ESP32 Betaflight Firmware

First, open the ESP-FC open-source GitHub repository using the link below. This firmware is developed and maintained by rtlopez, and his work is highly appreciated for contributing to the open-source community.
GitHub Repository: https://github.com/rtlopez/esp-fc
Once the repository page opens, navigate to the Releases section. The releases page contains precompiled firmware binaries for different ESP based flight controllers. From there, download the firmware .zip  file specifically built for the ESP32-S3 microcontroller since LiteWing is based on the ESP32-S3 platform.

ESP32-S3 Firmware Download

To flash the firmware onto the LiteWing drone, open the Espressif ESP Tool (Web-based flasher) in a supported browser. Connect the LiteWing drone to your computer using a USB data cable, ensuring the drone is powered on and detected by your system. On the ESP Tool web page, click Select Port, choose the COM port corresponding to the LiteWing drone from the pop-up list and confirm the selection. Then click Connect to establish communication between the tool and the drone. Once connected successfully, the tool will be ready for firmware upload.

 Firmware Flash Setup in ESP Tool

Upload the downloaded firmware file (firmware_0x00.bin) and set the flash address to 0x0000, verifying that both the correct file and address are selected. Click the Program button to begin flashing and wait until the process completes successfully, making sure not to disconnect the drone during programming. Once finished, the firmware will be successfully uploaded to the LiteWing drone, and you can now proceed to configure settings and tune the drone using Betaflight. Once the ESP32 Betaflight firmware upload completes successfully, your LiteWing drone is ready for configuration in Betaflight Configurator.

Flashing ESP32 Betaflight Firmware Using a Web-Based Tool

Step

  Action

              Details

1

Open ESP Tool

Navigate to  Espressif ESP Tool in Chrome or Edge browser

2

Connect Drone

Connect LiteWing to computer via USB data cable, ensure drone is powered on

3

Select Port

Click "Select Port" and choose the COM port for LiteWing from the list

4

Establish Connection

Click "Connect" to establish communication with the ESP32-S3

5

Upload Firmware

Select firmware_0x00.bin file and set flash address to 0x0000

6

Program Device

Click "Program" and wait for completion (do not disconnect during flashing)

Step 2⇒ Installing Betaflight Configurator for ESP32 Configuration

To configure and tune the LiteWing ESP32 Betaflight drone, you need the Betaflight Configurator installed on your computer. This software allows you to connect to the drone and adjust flight settings.

Downloading and Installing Betaflight Configurator

Visit the official GitHub release page for Betaflight Configurator Releases and download version 10.10.0 is recommended for easy setup. Choose the version compatible with your operating system: Windows, macOS, or Linux.

Configuring Betaflight Configurator Options

Download Betaflight Configurator v10.10.0

After installing and opening the ESP32 Betaflight configurator.

Before connecting the LiteWing ESP32 drone to Betaflight, you should adjust some settings in the Options tab as shown in the reference image. Make sure to enable “Show All Serial Devices” this ensures that the software can detect the drone even if it doesn’t appear by default.

These changes help the Betaflight Configurator communicate properly with the drone.

Betaflight Options Tab Configuration

Once the settings are updated, manually select the COM port in the software and click the Connect button to establish communication between the software and the drone.

Step 3⇒ Configuring Hardware Pins via Betaflight CLI

When you first connect the LiteWing ESP32 drone to Betaflight, you may notice that the real-time updates and the 3D model in the setup tab do not respond correctly when the drone is moved. This happens because the default pin assignments in Betaflight do not match the LiteWing hardware. To fix this, you can update the pin assignments using the CLI tab in Betaflight Configurator. By entering the correct commands, you can map the pins according to LiteWing’s configuration, ensuring that all motors and sensors respond accurately during real-time updates.

Configuring Pins via Betaflight CLI

ESP32 Betaflight CLI Pin Configuration Commands

Navigate to the CLI tab in Betaflight Configurator and enter the following commands. These commands configure all necessary GPIO pins for the LiteWing ESP32 drone:

set pin_input_rx -1
set pin_output_0 6
set pin_output_1 5
set pin_output_2 3
set pin_output_3 4
set pin_buzzer 8
set pin_serial_0_tx 43
set pin_serial_0_rx 44
set pin_serial_1_tx 17
set pin_serial_1_rx 18
set pin_serial_2_tx -1
set pin_serial_2_rx -1
set pin_i2c_scl 10
set pin_i2c_sda 11
set pin_input_adc_0 2
set pin_input_adc_1 -1
set pin_spi_0_sck 12
set pin_spi_0_mosi 35
set pin_spi_0_miso 37
set pin_spi_cs_0 -1
set pin_spi_cs_1 7
set pin_spi_cs_2 -1
set pin_buzzer_invert -1

After pasting the commands, simply press Enter, then type save and press Enter again to save the changes. And then type reboot and press Enter again to apply the changes. This will update the pin configuration automatically, making the setup quick and easy without manually changing each assignment.

After the CLI commands are executed, simply disconnect and reconnect the LiteWing drone. This will allow the ESP32 drone to connect with  Betaflight Configurator and to display real-time updates, reflecting the drone’s movements accurately.

Pin Configuration Changes Applied 

The following pin configuration changes are implemented to match the LiteWing hardware setup.

Pin Type          GPIO AssignmentFunction
Motor Output 1GPIO 6Front-right motor PWM control
Motor Output 2GPIO 5Rear-right motor PWM control
Motor Output 3GPIO 3Rear-left motor PWM control
Motor Output 4GPIO 4Front-left motor PWM control
UART1 TX/RXGPIO 17/18ExpressLRS receiver communication
I2C SCL/SDAGPIO 10/11IMU sensor communication (MPU6050)
ADC InputGPIO 2Battery voltage monitoring

Step 4⇒Correcting IMU Orientation in LiteWing Betaflight Drone

After configuring the GPIO pins in your ESP32 Betaflight configurator, you may notice that the 3D model moves when the LiteWing drone is tilted or rotated, but the movements don't exactly match the actual drone orientation. The 3D model in Betaflight moves when the drone is tilted or rotated, but you may notice that its movements do not exactly match the actual drone. This happens because the IMU (Inertial Measurement Unit) on the LiteWing is placed in a different orientation. To correct this, go to the Configuration tab in Betaflight, scroll to Board and Sensor Alignment, and change the First Gyro setting from Default to CW 270°. This aligns the 3D model accurately with the real movements of the drone.

Correcting IMU Orientation in Betaflight

 

Step 5⇒ Battery Voltage Monitoring Configuration

To monitor the battery voltage in the software, make the necessary changes as shown in the reference image below, select Onboard ADC as the voltage meter source and then set the minimum and maximum cell voltage values, and adjust the warning cell voltage according to your requirements.

Configuring Battery Indicator in Betaflight

In the voltage meter settings, set the scale to 10, the divider value to 1, and the multiplier value to 2, as these values are calculated based on the voltage divider used in the LiteWing.

Voltage Divider Calibration for LiteWing ESP32 Drone

ParameterValuePurpose
Voltage Scale10ADC reading multiplier for voltage calculation
Voltage Divider1Hardware divider ratio (pre-calculated in scale)
Voltage Multiplier2Correction factor for LiteWing's voltage divider circuit

After entering these values, click Save and Reboot to apply the battery monitoring configuration to your ESP32 Betaflight firmware.

Step 6⇒Configuring Motor Protocol for Brushed DC Motors

LiteWing ESP32 drone uses brushed DC motors, so the motor protocol must be configured accordingly in Betaflight. In the Configuration tab of Betaflight Configurator, set the Motor Protocol to Brushed. Then set the Motor PWM Frequency to 8000 Hz. Keep the remaining motor and ESC-related parameters set as shown in the reference image, as these values are configured for the LiteWing hardware.

Motor Protocol Setup in Betaflight

After making these changes, click Save and Reboot to apply the settings. Once completed, the motors will respond correctly and smoothly during operation.

Step 7⇒Connecting and Configuring ExpressLRS Receiver

In this setup, we are going to control the LiteWing drone using a radio transmitter and receiver. For this setup, we are using an ExpressLRS (ELRS) receiver due to its low-latency radio communication. ELRS is widely used due to its long range, fast response, and open-source support.

Connecting ELRS Receiver to LiteWing Drone

Connect the ELRS receiver to the LiteWing according to the UART wiring. Power the receiver using 3.3V and GND. Connect the receiver’s TX pin to the drone’s RX (GPIO18), and the receiver’s RX pin to the drone’s TX (GPIO17). Ensure all power, ground, and signal connections are properly made before proceeding.

Why Choose ExpressLRS for ESP32 Betaflight Drones?

Ideal for use within LiteWing Ctrl ESP32 Drone, ExpressLRS Receivers offer the following advantages:

∗ Ultra-low latency - Instantaneous feedback to commands and immediate changes to airframe attitude, with receipt of command inputs occurring at ultra-low latencies (as little as 5ms).

∗ Long distances - An excellent range of operation — several kilometres, assuming optimal use of antennas.

∗ Open Source Protocol - Firmware is open source; support from a community of users.

∗  CRSF Protocol - Fully compliant with the Betaflight CRSF Receiver Mode.

ELRS Receiver PinLiteWing GPIO PinConnection Purpose
VCC (3.3V)3.3V PowerReceiver power supply
GNDGNDCommon ground connection
TXGPIO 18 (RX)Receiver transmits data to drone
RXGPIO 17 (TX)Receiver receives data from drone

Next, open Betaflight Configurator and go to the Ports tab. Enable Serial RX on the UART 2, where the ELRS receiver is connected, and save the settings.

Enabling Serial RX for ELRS in Betaflight

Then go to the Receiver tab, set the Receiver Mode to Serial-based receiver, and select CRSF as the protocol. Save and reboot the drone. After this, power on the transmitter if everything is configured correctly, and you will see real-time channel movements in the Receiver tab when you move the transmitter sticks.

Configuring ELRS Receiver in Betaflight

Step 8⇒Configuring Flight Modes for LiteWing Betaflight Drone

Flight modes define how the LiteWing drone behaves during flight. In this setup, we will configure ARM, ANGLE, and BLACKBOX modes using Betaflight.

Configuring Flight Modes in Betaflight

Understanding Flight Modes for ESP32 Drones

Flight Mode

                 Purpose

Recommended For

ARM

Enables/disables motor output for safety

All flights (mandatory)

ANGLE

Self-leveling mode with automatic stabilization

Beginners, stable indoor flights

ACRO

Full manual control with no self-leveling

Advanced pilots, aerobatics

BLACKBOX

Records flight data for analysis and tuning

PID tuning, troubleshooting

Open the Modes tab in Betaflight Configurator. Assign a switch on your transmitter to the ARM mode to enable and disable the motors safely. Next, assign another switch or position to ANGLE mode, which provides self-levelling and is ideal for stable and beginner-friendly flight. Enable BLACKBOX mode to record flight data for tuning and troubleshooting.

Enabling ARM, ANGLE, and Blackbox Modes

After assigning the switches, make sure the activation ranges are set correctly and click Save. These modes will allow you to arm the drone and switch between stable and aggressive flight behavior as needed.

Step 9⇒PID Tuning for LiteWing Brushed Motor Drone

The default PID values in the ESP32 Betaflight firmware are not suitable for the LiteWing drone and can result in unstable flight performance. Since LiteWing is a lightweight drone using brushed DC motors, custom PID values are required to achieve stable and smooth flight.

In the PID Tuning tab of Betaflight Configurator, replace the default values with the recommended LiteWing PID values provided in the reference configuration. These values have been tested and optimized specifically for LiteWing and help eliminate oscillations while improving control and responsiveness.

Configuring Recommended PID Values

After entering the PID values, click Save and perform a short test flight. If required, minor adjustments can be made later, but the provided values should give a stable and reliable flying experience right away.

Why Custom PID Values for LiteWing ESP32 Drone?

The LiteWing drone requires custom PID tuning because:

∗ Low weight construction: The reduced weight necessitates changes to PID (proportional, integral and derivative) settings for the model.
∗ Brushed motor technology (coreless): Torque curves with different speed exponentials compared to the brushless motor.
∗ Small propellers: Lower inertia creates a need for different stabilization procedures than those required by larger props.
∗ Compact design: The shorter arm lengths between motors affect the rotational characteristics of the various components.

Step 10⇒ Blackbox Flight Data Recording and Analysis

Blackbox is a logging feature in Betaflight that records flight data such as gyro values, motor outputs, PID behavior, and receiver inputs. This data is useful for analyzing flight performance and troubleshooting issues like vibrations, oscillations, or unstable behavior.

Betaflight Blackbox Flight Data Logging

After enabling Blackbox in Betaflight, fly the LiteWing drone to record flight data. Once the flight is complete, connect the drone to Betaflight Configurator, go to the Blackbox tab, and download the log files. Open these logs in the Betaflight Blackbox Explorer to analyze gyro data, PID behavior, and vibrations, which help in improving stability and tuning performance.

After completing all the steps in this guide, your LiteWing drone configured with Betaflight is fully ready for flight. You can now safely test it, fine-tune settings if needed, and explore more advanced Betaflight features as you gain experience.

Troubleshooting Common ESP32 Betaflight Issues

Issue

Possible Cause

Solution

Motors not spinning

ARM mode not activated or motor protocol wrong

Verify ARM switch position and brushed motor protocol

Drone drifts in ANGLE mode

IMU not calibrated or accelerometer offset

Recalibrate accelerometer on level surface in Setup tab

No receiver signal

UART wiring incorrect or wrong protocol

Verify ELRS wiring and CRSF protocol selection

Battery voltage incorrect

ADC calibration values wrong

Verify scale=10, divider=1, multiplier=2

Frequently Asked Questions About ESP32 Betaflight Tutorial

⇥ 1. How to calibrate the IMU?
To calibrate the IMU (Inertial Measurement Unit) in Betaflight, place the LiteWing drone on a flat and stable surface. Open Betaflight Configurator and connect the drone. Go to the Setup tab and click the Calibrate Accelerometer button. Keep the drone completely still during the calibration process. Once finished, the IMU will be calibrated, ensuring accurate orientation and stable flight behavior.

⇥ 2. Why is my LiteWing not connecting to Betaflight Configurator?
After flashing or making configuration changes, disconnect and reconnect the drone, and ensure that no other applications (such as Arduino IDE, serial monitor, or ESP tools) are using the same COM port.

⇥ 3. Do I need to calibrate the accelerometer every time?
No, you do not need to calibrate the accelerometer every time you power on the LiteWing drone. Accelerometer calibration is usually required only once during the initial setup or after making major changes.

⇥ 4. How do I enable FPV (Acro) mode on the LiteWing drone?
Assign a switch for ARM and do not enable ANGLE mode.
When the angle mode is off, the LiteWing drone flies in FPV (Acro) mode.
 

Other LiteWing ESP32 Drone Projects

Beginner-friendly LiteWing drone projects that explore different ways to program, control, and experiment with ESP32 based drones, focusing on practical learning and real-world applications.

DIY Gesture Control Drone using Python with LiteWing and ESP32

DIY Gesture Control Drone using Python with LiteWing and ESP32

Build a gesture-controlled drone using ESP32 and LiteWing. This project explains how to track hand movements with MPU6050 and control the drone via Bluetooth and Python using UDP communication.

 How to Use Height Hold Mode in LiteWing ESP32 Drone?

How to Use Height Hold Mode in LiteWing ESP32 Drone?

Learn how to add height hold to the LiteWing ESP32 drone using the VL53L1X ToF sensor. This tutorial explains sensor setup, PID control, and app integration for smooth indoor flights.

 How to Program LiteWing Drone using Python with Crazyflie Cflib Python SDK

How to Program the LiteWing Drone using Python with Crazyflie Cflib Python SDK

Learn how to control the LiteWing drone using the Crazyflie cflib Python SDK. This guide covers installation, basic commands, and writing Python code to spin the drone's motors via Wi-Fi.

Have any question related to this Article?