SALES INQUIRIES: 1 (888) 767-9864

ESP8266 Auto Router Resetter :: Student Project

One of our customers, John Simister, had a problem.

Check out what John did in his own words (I have added emphasis and headings to break it up).

The Problem

“I have just completed a project that I have been working on for a couple of months.

As with most Routers they tend to go offline at different times, even when they are still powered up.

We live in Melbourne and regularly go and live on our boat in Queensland (1200 miles from home).

I normally access my IP cameras from the boat to see that all is ok at home.  

However, there has been occasion when the router has been offline and I have had no camera or home access.

To get around this I fitted a WEMO switch to restart the router in the event of it going offline. However, last time I was away that too failed and I still had no cameras.

Picture of esp8266 Router Auto Resetter in enclosure

ESP8266 to the rescue!

This project is not entirely my idea as I read in a magazine that it had been done before.  So I took the original idea and built on it – and here is what I finished up with.

The ESP8266 logs on to the local network and monitors access to every few seconds.  If it does not get a “connected” response it tries again for a total of 3 times.

After that period the ESP8266 illuminates the “Offline” LED.  It then logs on to another WiFi network that is available and sends an email to say the “Router is Offline”.

It then logs onto ThingSpeak and updates the data in my channel.  ThingSpeak then sends a tweet to state “Router Offline”.

So as you can see I have a lot of backup notification on the router status.

After all of this, the ESP8266 switches the relay off for five seconds and then back on again.  This allows the router to come back online with a fresh reboot.

It then logs onto the network, monitors and then updates Thingspeak with new data.  

I have also put in a line of code to reset the ESP8266 at the same time as the router reset.  This makes sure that it gets a fresh reboot each time for the same reason.

Also, I added an OLED display to be able to monitor at what point the program is at any time.

What if you don’t have 2 WiFi connections?

I am fortunate to have two WiFi connections at my home.  However, this could easily and cheaply still be done by anyone.

All that is needed is a cheap data sim card and an old Cell phone that could be used as a permanent hotspot.

Testing, Testing, Testing!

I have been switching the power off, the internet off and ESP8266 off all in different sequences for a couple of months to try and get it to fail.

I did have some early teething problems, however, it now seems bulletproof.

Also, there are no high voltages involved, because the relay breaks the line between the power pack and the router.

The relay is also in a continuous state whilst no power is connected.  Therefore, if the ESP8266  failed – the relay would still allow power to flow to the router.

  • There are two voltage regulators for the 3.5 and 5.00 volts required.
  • Total cost of the project was between $50 – $60 AUS.

I am going back up to the boat … for 5 weeks so this will be the big test.

Using what’s out there…

As I said this is not totally original but I think the way I have modified it may be.

I cheated in some areas and obtained the Gmail code for the Gmail sender on the net.  

Profile view of ESP8266 Auto Resetter Project in enclosure

Links and Tips…

Here are some links and tips of assistance for anyone interested in doing the project.

Gmail Sender Instructions:

I have provided the cpp and .h file with the sketch (at the bottom of this post).  You will need to make a small modification to your Gmail account for this to work.  It does reduce security slightly.

If you are not comfortable with this you can just open a new special gmail account for this purpose.  The modification for this are in the Gmail Sender instructional linked below.

Also, in the .h file you need to put in username and password.  However, it has to be done with “Base64 format”. This is very easy and takes just a minute or 2 to convert your details for the .h file.

Here is a link to a program to do the conversion.

This instructable gives step by step instructions on setting up the Gmail side of the program if you require it.  However, you will find the sketch I provided should cover all of this without you adding to it (apart from username etc).

Hardware Links:

Here are links to the hardware used in this project…

Notes on powering the ESP8266 and finishing the enclosure

I could of used the power from the Router power pack and then dropped the voltage through the voltage regulator.  However, I elected to keep it simple and used a separate power pack  for the  5 and 3.5 volts,

I used an old power pack with an output of 12 volts DC and used the two separate variable voltage regulators to drop the power.  I then just cut the line between the Router power pack and the Router and directed the positive side through the relay (be careful not to reverse the polarity when you do this).

I also cut a small hole in the side of the enclosure to fit the USB connector.  This allows me to modify the code at any time without having to pull it apart. (photo attached)

I mounted the ESP8266 on a Mini Breadboard and soldered the connections for a permanent job.

What’s Next?

“The course you run has been fantastic and it has given me a fairly good basis to learn from.

I want to start making some monitoring devices for my boat powered by 3G next.”

Arduino Code:






  1. Avatar JohnnyFRX on October 17, 2017 at 3:38 pm

    Very Cool Project Man! I use the heck out of the ESP’s around my house, a few connected to similar relays that handle the heat sources for our Beardie and our Gecko enclosures. As you’ve experienced, once all is configured right and happy…they are dedicated reliable little workhorses. NICE JOB ON THIS PROJECT! I wonder if LoRa would be useful for those with only one network available.

    • Avatar John Simister on October 18, 2017 at 1:18 am

      Hi JohnnyFRX,

      Yes, you are right, they are a great little workhorses. I am still amazed what can be done from such a small package.

      Thanks for your comments

      Regards, John

    • Avatar MICHAEL JAMES on October 30, 2017 at 11:11 am

      I couldn’t agree more. The ESP8266 are sweet for making things smaller and connected to the internet. I love the Adafruit Hazza package.

Leave a Comment