Turning an old TP-Link access point into an OpenWrt lab router for ESP32s
I needed a small, separate Wi-Fi network for my ESP32 and Raspberry Pi 5 bench: something the boards could join without touching the building network, with its own DHCP, and with one uplink to the outside. I had two old TP-Link boxes in a drawer, a TL-WR940N router and a TL-WA801ND access point. Here's how I picked one, flashed it with OpenWrt, and set it up as a one-port lab router. I hit a few snags along the way, and I've written those up too.
Pick the right box: check flash and RAM first
The router looks like the obvious choice, but the TL-WR940N v6 has 4 MB of flash and 32 MB of RAM. OpenWrt calls these "4/32" devices and stopped building for them after 19.07, so you'd be stuck on old firmware with no security updates.
The TL-WA801ND v5 is a MediaTek MT7628N with 8 MB of flash and 64 MB of RAM. It's still supported, and it runs the current 25.12 release. It has one Ethernet port and 2.4 GHz only, which is fine, because ESP32s only use 2.4 GHz anyway.
Read the hardware version on the label. The TL-WA801N v6 looks like the ND v5, and flashing the ND v5 image onto it bricks it.
No factory image? Use TFTP recovery
On the OpenWrt Firmware Selector, the WA801ND v5 offers only three images: sysupgrade, kernel and tftp-recovery. There's no factory image for the stock web page.
Don't upload the sysupgrade image through TP-Link's firmware upgrade page. People have bricked this exact model that way. The bootloader's TFTP recovery is the way in:
- Download the tftp-recovery image and check its SHA256 against the one the selector shows (
certutil -hashfile <file> SHA256on Windows). - Rename it to exactly
tp_recovery.bin. In Explorer, turn on file name extensions first, so you don't end up withtp_recovery.bin.bin. - Cable the PC straight to the AP. Give the PC's Ethernet adapter a static address of 192.168.0.66/24, with no gateway.
- Start a TFTP server (I used Tftpd64) pointing at the folder with the file, and open its log viewer.
- With the AP powered off, hold reset, power it on, and keep holding for about 10 seconds.
My first try failed, and the log showed why. The bootloader (at 192.168.0.2) asked for tp_recovery.bin every three seconds, and Tftpd64 answered "cannot find the file", because I hadn't renamed it yet. I renamed the file while the AP was still asking, and the next request transferred the whole 8 MB image in 4 seconds. Leave it alone for three to five minutes while it writes to flash and reboots.
If nothing shows up in the log at all, try 192.168.0.225 as the server address, allow Tftpd64 through Windows Firewall, or put a small switch between the PC and the AP.
Snag: my PC lost the internet
After the flash I set the PC's Ethernet adapter back to DHCP so I could reach OpenWrt at 192.168.1.1, and my laptop's internet died. OpenWrt's DHCP gives out a default gateway, Windows prefers the wired adapter, and the AP had no uplink yet.
The fix: give the Ethernet adapter a static 192.168.1.10/24 with no gateway. Then only 192.168.1.x traffic goes over the cable, and everything else stays on Wi-Fi.
netsh interface ip set address "Ethernet" static 192.168.1.10 255.255.255.0
Wi-Fi first, then the routed layout
Log in to LuCI as root (no password the first time) and set one under System → Administration right away.
Wireless: Network → Wireless → Edit. Set the country code, the SSID and WPA2-PSK with a key, then enable it. OpenWrt ships with Wi-Fi off.
Routed one-port setup: I wanted the single Ethernet port to be the uplink (WAN) and the Wi-Fi to be the lab LAN, with NAT between them. That way the lab is its own subnet, and the building network only ever sees one device.
- Network → Interfaces → Devices → br-lan → Configure. Untick eth0 under Bridge ports and tick Bring up empty bridge, then Save. The LAN bridge now carries only the Wi-Fi.
- Interfaces → Add new interface: name it
wan, protocol DHCP client, device eth0. On Firewall Settings, pick the wan zone, then Save. - Apply it with the little arrow next to Save & Apply → Apply unchecked, and then click that button.
That last step matters. The change cuts your own wired path to LuCI, so a normal Save & Apply loses contact and rolls everything back after 90 seconds. "Apply unchecked" skips the rollback. If you lock yourself out, holding reset for 10 seconds puts OpenWrt back to defaults.
Choosing Apply unchecked from the menu only changes what the button does. You still have to click the button.
Then power it off, move it, plug its port into the wall jack, and join the new SSID. The config is already saved to flash.
Result
Status → Overview showed exactly what I wanted:
- WAN: a DHCP lease from the building network
- LAN: 192.168.1.1/24, Wi-Fi only, WPA2-PSK (CCMP)
- My laptop on the lab Wi-Fi at -38 dBm and 144 Mbit/s each way
The Pi and the boards
On current Raspberry Pi OS, Wi-Fi is NetworkManager, so joining the lab network is four commands:
sudo raspi-config nonint do_wifi_country US
sudo nmcli radio wifi on
sudo nmcli dev wifi list
sudo nmcli dev wifi connect "YOUR_SSID" password "YOUR_KEY"
Use your own country code. The radio stays blocked until one is set. Then reserve the Pi's address in LuCI (Status → Overview → DHCP leases → Reserve IP), so the ESP32s always find their MQTT broker in the same place.
One more lesson: I installed Mosquitto with apt on the Pi, and it wouldn't start. sudo ss -ltnp | grep 1883 showed docker-proxy already holding the port. My PanelWorks test server already runs a Mosquitto container with logins, ACLs and TLS. I removed the apt package and added a lab login to the broker I already had, limited to lab/# topics, so a test sketch can't touch anything else. If a service won't start, check the port before you check the config.
What I'd tell myself next time
- Check flash and RAM before you buy or flash anything. 8/64 is the minimum.
- Read the label, and match the exact hardware version to the image.
- If there's no factory image, the TFTP log tells you exactly what the bootloader wants.
- On a one-port device, set up Wi-Fi before you move the Ethernet port, and use Apply unchecked.
- Keep keys and passwords in
secrets.hor.env, never in a sketch you commit.
The boards are on their own subnet now, and the next posts will be about what's running on it.
Reply to this post
A question, a correction, or your own results? Send it here. Replies come to me by email and aren't published. Your address is only used to answer you.