What you will need

  • A base station computer with a Chrome-based browser

  • The Flight Controller stacked on the PDB, with the four motors soldered to the PDB, as built up to step 8 of the assembly instructions

  • USB-A-to-USB-C cable

  • A charged LiPo battery

What you will get

  • Four ESCs running the Bluejay firmware

Initializing the ESCs#

The four Electronic Speed Controllers (ESCs) translate the Flight Controller’s commands into the currents that drive the motors. On the Duckiedrone DD24-B, each ESC is built into its motor. This page describes how to flash the Bluejay firmware onto the four ESCs using the esc-configurator.com web tool.

Bluejay is required because the stock BLHeli_S firmware on the ESCs ignores the DShot commands that PX4 uses to reverse a motor. Without Bluejay, the spin directions cannot be corrected in Motor configuration.

Danger

Remove the propellers and keep them off for the entire procedure.

1. (skip if not necessary) Flash Betaflight onto the Flight Controller (FC)#

The ESC configuration tool does not talk to the ESCs directly, but reaches them through the Flight Controller. For this to work, Betaflight (target firmware BTFL 4.3.2) needs to be running on the Flight Controller.

Start by installing Betaflight Configurator v10.9.0 on the base station and opening it.

Note

On Ubuntu 24.04 and later, the .deb package fails to install because its libgconf-2-4 dependency is no longer in the Ubuntu archive. Download betaflight-configurator_10.9.0_linux64-portable.zip from the same release page instead, extract it, and run the betaflight-configurator file in the extracted Betaflight Configurator folder.

Checking the Flight Controller firmware#

The Duckiedrone DD24-B ships with Betaflight BTFL 4.3.2 for the MAMBAF405_2022B target already installed on the Flight Controller. To check the firmware on the board:

Test

Without pressing the BOOT button, connect the Flight Controller to the base station with the USB-A-to-USB-C cable. In Betaflight Configurator, select the Flight Controller port in the top toolbar and click Connect.

Expected Result

The top-left corner of Betaflight Configurator reports BTFL 4.3.2 and MAMBAF405_2022B.

  • If the board reports BTFL 4.3.2 and MAMBAF405_2022B, click Disconnect and skip to section 2.

  • If Betaflight Configurator cannot connect, or reports a different firmware, follow the rest of this section.

Next, open the Firmware Flasher tab from the left sidebar and set the options to match the board, as shown below. The Duckiedrone uses the Mamba F405 MK2 V2, so select the MAMBAF405_2022B target and the BTFL 4.3.2 firmware version.

Betaflight Configurator Firmware Flasher settings with MAMBAF405_2022B selected and firmware version 4.3.2

Fig. 50 Firmware Flasher settings for the Mamba F405 MK2 V2 (BTFL 4.3.2).#

Connecting the Flight Controller and loading it into bootloader mode#

Before new firmware can be written, the Flight Controller has to be in bootloader mode (also called DFU mode). When the board is plugged in normally it boots straight into its regular firmware and will not accept a flash, so it has to be held in bootloader mode while it powers up.

The small BOOT button on the Flight Controller puts the board into bootloader mode. Locate it first:

Mamba F405 MK2 V2 Flight Controller with the BOOT button outlined in red

Fig. 51 BOOT button location on the Mamba F405 MK2 V2 Flight Controller.#

Disconnect the LiPo battery if it is connected, and unplug the USB cable from the base station.

Note

On a fully assembled Duckiedrone, the Flight Controller USB cable is plugged into the Raspberry Pi. Unplug it at the Raspberry Pi end and use it to connect the Flight Controller to the base station.

With the board still disconnected, press and hold the BOOT button while connecting the USB-A cable to the base station, and then release the button. The board is now waiting in bootloader mode.

Test

With the Flight Controller connected in bootloader mode, look at the port/target dropdown in the top toolbar of Betaflight Configurator.

Expected Result

The dropdown reads DFU - STM32 BOOTLOADER, and the Connect button is grayed out, since the board is not reachable over the normal serial link while in DFU mode.

Betaflight Configurator toolbar with the port dropdown set to DFU - STM32 BOOTLOADER

Fig. 52 The Flight Controller is correctly in bootloader mode, as shown by DFU - STM32 BOOTLOADER in Betaflight Configurator.#

If the dropdown does not show DFU - STM32 BOOTLOADER, see Troubleshooting.

Attention

Do not press the Connect button in Betaflight Configurator during flashing. Betaflight talks to the board over the flashing interface, not the normal serial connection.

Loading and flashing the firmware#

Now that the board is in bootloader mode, download the firmware and write it:

  1. Click Load Firmware [Online] in the bottom-right corner. Betaflight Configurator fetches the BTFL 4.3.2 firmware for the selected target and confirms it is ready to flash.

  2. Click Flash Firmware, also in the bottom-right corner, and watch the progress bar as it works through the write.

    Test

    Watch the progress bar while the firmware is written.

    Expected Result

    The progress bar moves through Flashing…, then Verifying…, and finally Programming SUCCESSFUL.

Once the flash finishes, the board reboots on its own into the new firmware, so there is no need to unplug it. To confirm that it worked, click Connect: the top-left of the interface reports BTFL 4.3.2.

Loading the Duckiedrone board configuration#

A freshly flashed board comes up with the stock Betaflight defaults, which do not match the Duckiedrone wiring. In particular, the motor outputs and the serial port assignments have to be remapped before the ESC tool can reach the four ESCs. Duckietown provides these settings as a Betaflight CLI configuration file that is applied in one paste.

  1. With the Flight Controller connected in Betaflight Configurator (click Connect if it is not connected already), open the CLI tab from the left sidebar.

  2. Open MAMBAF405MK2V2.conf and copy its entire contents.

  3. Paste the contents into the CLI command box and press Enter. The commands run as a batch, and the file ends with save, so the board writes the settings and reboots on its own.

    Attention

    Do not disconnect the USB cable while the batch is running.

    Test

    Read the CLI output once the batch has run.

    Expected Result

    The CLI output ends without reporting any command errors, and Betaflight Configurator drops the connection as the board reboots.

When the configuration is in place, click Disconnect so the serial port is free for the ESC tool in the next step.

2. Connect to the ESCs#

Note

Use a Chrome-based browser (Google Chrome, Microsoft Edge, and so on).

  1. Make sure the motors do not have propellers attached.

  2. Check that the PDB is wired to the Flight Controller. The ESC tool reaches the ESCs inside the motors only through this connection, so the ribbon connector between the PDB and the Flight Controller has to be fully seated at both ends, with all four motors soldered to the PDB.

  3. Disconnect Betaflight (if connected), or any other programs that might be using the serial port connected to the Flight Controller.

  4. In the browser, go to the ESC Configurator web tool.

  5. Click Select Serial Port in the top-right corner. In the prompt that appears, select the serial port that belongs to the Flight Controller. Its name varies by operating system and board. If multiple USB serial devices are connected, unplug the Flight Controller and observe which port disappears, then reconnect it and select the port that reappears.

  6. Once the port is identified, select it and click Connect.

    Browser serial-port picker listing the SpeedyBee F405 V3 port as ttyACM0

    Fig. 53 Serial port selection prompt.#

  7. Verify that the message Unique device ID received appears. This confirms that the ESC Configurator is connected to the Flight Controller.

    ESC Configurator status bar showing Unique device ID received after connecting to the Flight Controller

    Fig. 54 The ESC Configurator has received the unique device ID of the Flight Controller.#

  8. The ESCs cannot draw power from the Flight Controller over USB: the LiPo battery must be connected for them to power up and accept programming.

    If this is the first time the battery is plugged in, check the solder joints for a short circuit first, with the battery disconnected and the boards on a non-conductive surface:

    Test

    Set the multimeter to continuity mode, as described in Continuity Check, and touch the probes to the positive (+) and negative (-) battery pads on the PDB.

    Expected Result

    The multimeter does not beep continuously. A short beep that stops at once is the capacitor charging. A continuous beep means a short circuit: do not connect the battery, and check the solder joints.

    Also check that the red wire of the XT60 lead is soldered to the positive (+) pad of the PDB, and the black wire to the negative (-) pad.

    Attention

    If this is the first time the battery is plugged in, watch for anything that becomes hot, and be ready to unplug the battery if so.

    Connect the LiPo battery to the XT60 lead of the PDB. The ESCs are now powered and ready to be read:

    ESC Configurator after the LiPo battery is connected to power the ESCs

    Fig. 55 The LiPo battery powers the ESCs for the following configuration steps.#

3. Flash Bluejay#

  1. Click Read Setup. The tool passes through the Flight Controller and reads all four ESCs. Each one comes up as a BLHeli_S ESC on layout J-H-15.

    Duckiedrone ESC default factory configuration as read by Bluejay

    Fig. 56 The Duckiedrone DD24-B ESCs ship with BLHeli_S on J-H-15 layout.#

  2. In the firmware selection, set:

    • Firmware: Bluejay

    • Version: 0.21.0

    • PWM frequency: 48 kHz

    Flashing the Duckiedrone ESCs with Bluejay

    Fig. 57 Upgrading the ESC firmware with specific Bluejay parameters.#

  3. Click Flash All and wait for all four ESCs to finish.

    Attention

    Do not disconnect the battery or the USB cable while an ESC is being flashed.

Checkpoint ✅#

To verify that the four ESCs run Bluejay:

Test

When the flashing completes, click Read Setup once more.

Expected Result

All four ESCs report Bluejay 0.21.0, as in the figure below.

Confirming Bluejay on the Duckiedrone DD24-B ESCs

Fig. 58 Validate that the correct firmware has been successfully flashed.#

4. (Optional) Disable the beacon#

By default the ESCs give off a beep after a while without commands, which quickly gets annoying. To turn it off, while the ESC Configurator is still connected:

  1. In the Beacon Delay drop-down menu, select Infinite.

    ESC Configurator showing the Beacon Delay setting outlined in red

    Fig. 59 Set Beacon Delay to Infinite to disable the beacon sound.#

  2. Click Write Settings in the bottom-right corner to save.

5. Disconnect the battery#

Disconnect the LiPo battery from the XT60 lead of the PDB.

The ESCs are now running Bluejay. Next, continue to Initializing the Flight Controller to flash the PX4 firmware.

Troubleshooting#

Troubleshooting

SYMPTOM

The ESC Configurator does not detect any ESCs after Read Setup.

RESOLUTION

The ESCs are not powered. Check that the LiPo battery is connected to the XT60 lead of the PDB, since the Flight Controller’s USB power is not enough to run the ESCs, and then click Read Setup again.

Troubleshooting

SYMPTOM

On Linux, the ESC Configurator cannot open the serial port (Failed to open serial port).

RESOLUTION

This is a serial-port permission issue. On Ubuntu, add the current user to the dialout group by running sudo usermod -a -G dialout "$USER", then sign out and sign back in (or reboot) for the change to take effect. If that does not help, inspect the group that owns the device with ls -l /dev/ttyACM0 (substituting the port in use) and add the current user to that group instead of changing the device permissions for every user.

Troubleshooting

SYMPTOM

The port/target dropdown in Betaflight Configurator does not show DFU - STM32 BOOTLOADER.

RESOLUTION

The board booted into its regular firmware instead of the bootloader. Unplug the USB-A end of the cable from the base station, press and hold the BOOT button again, reconnect the cable while still holding the button, and only release it once the cable is fully seated. If it still does not show up, try a different USB cable or port, since some cables are power-only and cannot carry data.

Troubleshooting

SYMPTOM

Other issues.

RESOLUTION

Contact the Duckietown hardware team via email: hardware@duckietown.com