# Auto modem reset when internet down

**URL:** <https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386>\
**Category:** Share Your Projects\
**Created:** [26 February 2019 02:29 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386 "2019-02-26T02:29:52Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [1 March 2019 20:44 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/21 "2019-03-01T20:44:14Z")

</div>

> [@TotallyInformation](#):
>
> Nice - be even nicer with a bit of a parts list/diagram explaining the hardware side for those folk not so familiar with that.:

The physical build & isolation is not the best as it was a last minute job before I went on holiday, and had the intention to rebuild it when I got back home - but as per usual I never got around to it... 😉

The Wemos D1 Mini has the following connections;

1. A removable link between pins RST & D0. It must be removed when uploading a sketch, but replaced afterwards to ensure that the Wemos can wake up from deep sleep.
2. Pins 5V & Ground connected to the relay module +Vcc & Grd.
3. Pin D7 connected to relay module trigger.
4. [The Wemos sketch](https://github.com/Paul-Reed/router-reboot) is configured for the above, and only needs the wifi ssid & password adding, before uploading.

The relay module is a [typical Ebay/AliExpress](https://www.aliexpress.com/item/3-3V-5V-12V-24V-1-Channel-Relay-Module-Low-Level-Trigger-Optocoupler-Isolation-Relay-Module/32849672414.html?spm=a2g0s.9042311.0.0.6d314c4dAJcUUS) opto-isolated 5V single channel module with 3 low voltage connections (as above), and note that on the module shown, 0V on the module trigger energises the relay whilst +3V de-energises!  
The high voltage side has 3 connections; normally closed, common & normally open. I've used normally closed & common, so in it's normal state the relay is de-energised but the contacts are closed.

**Please Note - Working with high voltages can be dangerous, and shouldn't be attempted unless you are fully aware of the associated risks.**

 ![router1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/9/9402fdf391f89349d2c8d2885502562373a546db.jpeg)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/b06a4acdc1e20243edcaefb927a4692d4cce3985.jpeg)

---

<div class="post-metadata">

**Author:** ![dougle03](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dougle03/32/32979_2.png) [@dougle03](https://discourse.nodered.org/u/dougle03)\
**Post date:** [23 January 2020 23:25 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/24 "2020-01-23T23:25:20Z")

</div>

> [@Paul-Reed](#):
>
> A removable link between pins RST & D0. It must be removed when uploading a sketch, but replaced afterwards to ensure that the Wemos can wake up from deep sleep.

Why do you put the Wemos to sleep? Can it not just stay running? Just curious

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 January 2020 08:52 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/25 "2020-01-24T08:52:55Z")

</div>

> [@dougle03](#):
>
> Why do you put the Wemos to sleep?

Energy saving is the main reason. When it's sleeping, the power consumption is negligible.

---

<div class="post-metadata">

**Author:** ![dougle03](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dougle03/32/32979_2.png) [@dougle03](https://discourse.nodered.org/u/dougle03)\
**Post date:** [24 January 2020 09:38 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/26 "2020-01-24T09:38:02Z")

</div>

Are you running it from a battery?  
I measure my D1 at about 0.070ma which is negligible? Seems like unless you are on battery power I can't see why you would want the added complication of Deep Sleep?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [24 January 2020 09:41 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/27 "2020-01-24T09:41:11Z")

</div>

User choice.  
If you don't want to put it to sleep, then just use timers to trigger the actions.  
No I'm not using batteries.

---

<div class="post-metadata">

**Author:** ![satgate](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@satgate](https://discourse.nodered.org/u/satgate)\
**Post date:** [19 November 2020 14:33 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/28 "2020-11-19T14:33:43Z")

</div>

Hello,  
could I ask you the schema of the project with the pin connection to the esp8266?  
please let know  
thanks  
Ivano

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [19 November 2020 15:01 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/29 "2020-11-19T15:01:11Z")

</div>

> [@satgate](#):
>
> could I ask you the schema of the project with the pin connection to the esp8266

It is a Wemos D1 mini that I used, and I listed the pin connections above.  
I didn't feel it necessary to draw a schematic, but the Wemos pinout's are well documented online.

---

<div class="post-metadata">

**Author:** ![satgate](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@satgate](https://discourse.nodered.org/u/satgate)\
**Post date:** [19 November 2020 17:22 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/30 "2020-11-19T17:22:36Z")

</div>

Thanks Paul, do you think the code will work on a esp8266MOD ?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [19 November 2020 17:59 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/31 "2020-11-19T17:59:32Z")

</div>

I've never used a esp8266MOD so can't really say.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [23 November 2020 04:30 UTC](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386/32 "2020-11-23T04:30:52Z")

</div>

You might be interested in just doing this with a Tasmotta'd switch

### Watchdog for Wi-Fi router

> **[Rules - Tasmota](https://tasmota.github.io/docs/Rules/#watchdog-for-wi-fi-router)**

So you can purchase any approved Socket device that has and ESP chip and flash it with Tasmota, then implement the rules - they even have exponential backoffs between reboots !

Craig

[Previous page](https://discourse.nodered.org/t/auto-modem-reset-when-internet-down/8386.md?page=1)
