🔴 How to reset router? AUTOMATIC ROUTER REBOOTER in Arduino ESP8266 / Sonoff S20

Welcome to my new post for my video on YouTube. In this video I will show you how to make a very cheap router reseter. In all these years I have always had problems with hangups of my routers which were supplied by internet providers. In all cases a simple power off and on of the router solved the problem. If you experience the same problem, I have a simple solution for you. All costs are around 10€. Coming up!

See the video about it on YouTube!

SOME INTRO
I decided to tell you a bit more about this device and explain what you can do with it. You can skip this section, but as always, your support is welcome in a way of hitting LIKE button, SHAREing, asking me questions in the COMMENTs below, SUBSCRIBing to my channel. As I drink buckets of coffee I have even included a link in the description below, if you want to buy me one. Support makes this channel go on. Well, let’s start!
I will not go into details. Firstly you will have to get the parts. Here we have two options. The easiest way is to buy a Sonoff S20 with the correct power plug for your country. The hardest way is to buy: wifi enabled ESP8266 module, relay, power transformer, enclosure and wires. I chose S20 for less money and required time.

SONOFF S20
Inside is a small circuit with mentioned ESP8266 processor and a relay.
This device acts like a mains switch. Its basic feature with stock firmware is to switch any mains powered device from your phone. There are even some other firmwares like ESPeasy and Tasmota which are very good for home automation systems. You can even use the device as a slow wifi repeater.
My source code will be explained in the next part, but the code basically checks for internet connection and when there is none, it resets the router.
At the moment of recording this video I have found the best price for the Sonoff S20 on the link in the description below. For this project you will only have to setup Arduino environment and download my sources from github. All the links are below. If you are new to microcontrollers, you can watch my tutorial on how to get started with ESP8266 in Arduino. Just click the link. Don’t be afraid! No spooky things.

CURRENT VERSION
I wrote a basic sketch. All you have to do is to enter your wifi name into SSID variable, a password for it into PASS variable and your network addresses. You can leave all other things untouched. The code loops and checks for the response from a predefined internet site every 5 minutes. If there is no connection the next check will be after a half minute. If there is no connection for 15 minutes, the relay will go off and it will restart the router, wait few minutes for the router to initiate wifi and lastly reset the Sonoff device and reconnect. The button on the enclosure functions as a reset button for your router.
If you are a programmer and develop a better solution just make a merge request on github.

CAUTION AND PROGRAMMING PREPARATION
Mains power can be lethal. The Sonoffs can only be programmed through serial, if they are disconnected from mains.
To put the unit into a programming mode, you have to press the button on PCB while connecting the 3.3V from serial port.
In arduino program be sure to select the right device under the tools-board menu. For Sonoff S20 it should be Generic ESP8266 module, flash size of 1M. SPIFFS size does not matter as we do not use it. Here I have to mention the correct choice of Flash Mode. Every description on the net shows you have to set it to “DIO”. I found out mine works by selecting it as “DOUT”. Interchanging these two makes programming feasible, but the unit will not work. Leave other options unchanged.
On the PCB there are four unsoldered pins. The nearest to transformer is ground. Connect your RX wire next to it. TX follows below. The furthest is VCC. Be sure to use a correct USB to serial converter. The ESPs are 3.3V, so use 3.3V power supply and logic levels on converter. 5V power supply will kill your chip. 5V logic levels won’t. But the programming might fail.

WIFI FIRMWARE UPDATE
After first serial programming described in the previous section you are now able to upload new firmware via wifi. You have to find device IP address. The IP address may not be identical as the one set in the code. DHCP may alter it if it is enabled. I implemented service discovery alias SSDP. If it does not work on your computer, I recommend you to use an IP address scanner. For windows users I recommend Advanced IP scanner and for android users Fing. Both are free. See the links in the description below. After finding the IP, use a browser and enter the address. Select Firmware update and then select .bin file and click Update. Nice and fast!

DEMO AND OUTRO
I will not torture you with all the waiting in my code. I will only show you the manual reset by pressing the key. The light represents the router. Little work, but it surely makes all the router disconnection problems go away. Thank you for watching and see you next time!

ABOUT
FREE SOURCE CODE!!! I will show you how to make a cheap smart switch in Arduino. It will automatically do a router reset when it hangs up or there is no internet in your home. It does not matter which router it resets: Netgear, Linksys, Asus… No more questions how to reset router, how to reboot router… I will use ESP8266 and Arduino. More specific – Sonoff S20 smart switch, a wifi smart plug, but you can use Nodemcu or other ESP8266 or even ESP32 module. Free code, sources for Arduino on my GitHub page. A simple DIY project and a cheap wifi solution with a smart switch.
ESP8266 programmed in Arduino will check for your wifi internet accessibility and where there is none after a certain time, it will reset router or any device you connect to it. The Sonoff S20 has a button which we will use for manual reset.

Support my work. Ask below if you have questions or software upgrade requests.

Cheap Sonoff S20:
Banggood: http://bit.ly/SonoffS20
Aliexpress: http://bit.ly/AliSonoffS20

Free IP address scanners:
Windows: http://www.advanced-ip-scanner.com
Android: Google Play – Fing


Do you like my work or want to support me?
1. Hit LIKE.
2. Hit SUBSCRIBE and be updated when new videos are published.
3. COMMENT below.
4. SHARE video with your friends.
5. Support my work on Patreon: https://www.patreon.com/GreenEyedExplorer
6. You can also buy me a coffee via: http://paypal.me/rokrodic
7. Buying through my affiliate links makes you no additional cost, but gives me a small headstart in getting new things for my explorations.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.