A Wi-Fi repeater for the Ai-Thinker BW16 (Realtek RTL8720DN), using Realtek's L2 bridge and MAC translation. Clients receive their network configuration from the upstream router through a DHCP relay.
Known issue: low throughput. In one 2.4 GHz test, the repeater achieved about 8 Mbps download and 10 Mbps upload, versus 37/41 Mbps directly. Results depend on the environment. WLAN buffer exhaustion and dropped frames were observed; the full cause is still under investigation.
- Board: Ai-Thinker BW16 (RTL8720DN)
- CPU: Realtek AmebaD (ARM Cortex-M4 @ 200 MHz, Cortex-M0 @ 20 MHz)
- Radio: Dual-band 2.4 GHz (802.11b/g/n) and 5 GHz (802.11a/n) 1T1R
- Flash the firmware or use the prebuilt binary in
bin/bw16_repeater_firmware.bin. - Power on the board.
- Connect your computer or phone to the open Wi-Fi network named
BW16-Repeater. - Open
http://192.168.4.1in your browser. - Select your home network from the scan list, enter the Wi-Fi password, and click Connect & Amplify.
- The repeater applies settings, restarts, connects to your router, and starts the extended network. Connect your devices to the new extended network name shown on the screen.
If the router is unavailable, connect to the repeater's network and open http://192.168.4.1 to access its local interface.
If the upstream connection fails, the repeater keeps its settings, retries in the background, and provides local DHCP for access to the device.
Open the device's web interface using its current IP address, then select Reset to Setup Portal.
Connect via serial monitor at 115200 baud and send the command reset.
The onboard RGB LED indicates the current state:
- Blinking red: setup mode active (
BW16-Repeaterat192.168.4.1). - Blinking blue: connecting to upstream Wi-Fi.
- Solid green: repeater bridge active, client traffic forwarding.
The firmware enables concurrent station and access point mode on the RTL8720DN radio. Once associated with the upstream router, the AmebaD kernel activates the IEEE 802.1D bridge (bridgeif) across wlan0 (station) and wlan1 (access point) and disables the internal DHCP server. A DHCP relay forwards client requests to the upstream router and returns its replies to clients.
Because the bridge operates at layer 2:
- Clients get their IP, default gateway, and DNS servers straight from your main router.
- Local network reachability and discovery depend on the router and its handling of broadcast and multicast traffic.
The RTL8720DN uses a single radio transceiver:
- The repeater AP operates on the exact same radio channel and band as the upstream router.
- 2.4 GHz (Channels 1–13): Recommended for general repeating (highest wall penetration and 100% device compatibility).
- 5 GHz (Channels 36, 40, 44, 48): Fully supported. If extending 5 GHz, configure your home router to use non-DFS channels 36–48. Channels 52–144 (DFS / radar) and channels > 48 (UNII-3) have SoftAP hardware/driver limits.
- System Architecture: Hardware, dual-core partitioning, and subsystem design.
- Layer 2 Bridge vs NAT: Why transparent bridging is used instead of double NAT.
- Building on macOS: Setting up Arduino CLI and compiling the AmebaD core.
- Flashing Guide: Wiring, bootloader mode, and UART flashing instructions.
- Hardware Limitations: Radio constraints, channel lock, and power requirements.
- Test Plan: Verification matrix and end-to-end testing procedures.
Install Arduino CLI and the AmebaD core:
arduino-cli config init
arduino-cli config set board_manager.additional_urls https://raw.githubusercontent.com/Ameba-AIoT/ameba-arduino-d/master/Arduino_package/package_realtek_amebad_index.json
arduino-cli core update-index
arduino-cli core install realtek:AmebaD@3.1.9The build requires AmebaD Core 3.1.9. scripts/build.sh enables CONFIG_EXAMPLE_WLAN_REPEATER, rebuilds the bridge-related LwIP objects with a consistent ABI, and verifies the three-interface xnetif symbol. Editing the header alone does not rebuild the precompiled core library.
The option is located in:
~/.arduino15/packages/realtek/hardware/AmebaD/3.1.9/system/project/realtek_amebaD_va0_example/inc/inc_hp/platform_opts.h
Run the build script:
bash scripts/build.shCompiled binaries are placed in build/ and bin/.
To flash the board over USB:
- Connect the BW16 to your computer with a USB-UART adapter.
- Put the board into download mode:
- Hold the BURN button.
- Press and release the RST button.
- Release the BURN button.
- Run the flasher:
python3 do_flash.pyThe script detects the serial port, uploads the image, and resets the board. Its default upload rate is 921600 baud on macOS and 1.5 Mbaud elsewhere.
MIT
