Měsíční archiv: Leden 2017

ESP2866 D1 mini as remote switch

I made simple remote power switch over Wi-Fi. The heart of this box is D1 mini board based on ESP2866 MCU. Board is powered by 5V power supply extracted from old mobile charger. The relay border contain relay power by 5V and switch up-to 230V and 10A. Simple Arduino code contains connection to Wi-Fi AP, simple TCP server listening on port 80 and receiving GET HTTP requests. The box can only switch on-off the 230V power or return status of relay and Wi-Fi connection. I used it for controlling outdoor Christmas LED lights.

I also plane add light sensor and add some schedule for switching. Next idea is to rebuild this to 12V, connect to solar panel with battery and power the LED lights directly…

Linksys AE6700 booting problem with AdvancedTomato fw

The original Cisco/Linksys firmware of EA6700 is not bad, but alternative firmwares offers more functionality, settings and in my case also more stability. The router itself has powerful hardware with fast CPU and 256MB of memory at can handle a lot of additional services. I missed simple Web server with MySQL, bridge mode and also struggle with „Cut Through Forwarding“ which hang-up whole Wi-Fi.

I choose AdvancedTomato and upload to router. It works nice until i have some difficulty with electricity. The EA6700 and other new Linksys routers has two firmwares and if router doesn’t successfully start three times in sequence then second-backup firmware is loaded. My router started with backup original firmware and i wasn’t able to load AdvancedTomato again. I find some solutions with resetting the router, loading older original firmware two or three times in sequence or connect to router over serial link and clean NVRAM. In short, only erasing NVRAM over serial link helps in my case.

There problem is in CFE (the ‚BIOS‘ of the router) which manages NVRAM (the partition where all volatile configuration is stored). There is a 32Kb limit on NVRAM usage, but CFE enable use more and after restart some variables get deleted at random. The original firmware never overlap 32Kb limit and doesn’t have this problem.

Serial link on service connector

You will need the USB to TTL-level serial port adapter to connect into router over serial link. First step is opening up the device. Find the screws (they are hidden under the rubber legs…) and unscrew all of them. Depress the 12 clips along the edge into the router. For opening the device I have used the plastic credit card and go around the edge.

Next step is to connect the adapter to the device. In the middle of board is plastic 6-pin connector.

EA6700 service connector

Pins connection on board(from left to right):
1 – Serial GND
2 – Serial RX
3 – N/A
4 – Serial TX
5 – N/A
6 – N/A

EA6700 connector with connected USB-Serial adapter

Using Putty serial mode at 115200 BAUD gives us a text console of router. I used CTRL+C to abort the boot process and looked at the contents of NVRAM. Press Enter to get the console prompt.

nvram show | grep =$ | wc -l

The problem is usually with NVRAM bigger then 32Kb. I solved my problem by deleting the NVRAM and rebooting the router:

nvram erase
nvram commit

The AdvancedTomato has possibility to add commands into init script over GUI. I add following lines to avoid NVRAM overload and rebooting to backup original firmware:

for line in `nvram show | grep =$ `; do var=${line%*=}; nvram unset $var; done
nvram set partialboots=1
nvram commit

Finally the router has stable AdvancedTomato firmware.

Useful links