Introduction: Router Restarter II

About: Retired high school physics teacher.

Some years ago I built a Router Restarter for our condominium in Florida. We are “snowbirds” and only reside there in the winter months. From May to October we are in Michigan. It’s important to have the air conditioning running in Florida during that time to prevent black mold or other humidity problems. To monitor the air conditioning and make sure it’s operating correctly an Internet connected smart thermostat was installed and can be accessed remotely via my smartphone. A problem can occur if the wireless router or cable modem in the condominium hangs up. If you have Internet wireless in your home you probably have experienced this and the solution is to simply restart the cable modem and router by unplugging them from power for a few seconds and then plugging them back in. Unfortunately, it takes a person in the condominium in Florida to do this when I’m in Michigan. Enter the Router Restarter. This device simply restarts the cable modem and router by removing AC power to them for one minute in the middle of the night every night. If there is a hang up it gets corrected within a day.

Supplies

Step 1: The Circuit

The microcontroller used for this project is the Arduino Nano, an easy to use inexpensive workhorse for many purposes. My original Router Restarter used the DS3234 Real Time Clock (RTC) IC in a Surface Mount (SMT) package. This IC works nicely but requires Serial Peripheral Interface (SPI) programming and interfacing and the SMT package is a nuisance to solder onto a printed circuit board. Version II of the Router Restarter uses a DS32331 RTC breakout board that has an I2C interface and is simple to program and use. This breakout board also has a built in coin cell holder for a CR2032 battery to maintain the current time and date when power is removed.

The schematic for the Router Restarter II circuit is shown above. The Arduino Nano controls a 5 volt, dual channel relay board. I chose relays instead of triacs for AC control for their reliability, load capacity and because no heatsinks are needed. The Normally Closed (NC) contacts are used on the relays. This reduces current draw since only when the contacts are opened to cut power are the relay coils activated. The Arduino Nano also drives a 4 line, 20 character LCD display for status. The circuit is powered by a 9 volt 1 amp wall wart type power supply. The 9 volts is connected to the Vin pin of the Arduino Nano and also powers a 7805 voltage regulator for the DS3231 Mini Board, the LCD display and the Relay board. Pins D2 and D3 of the Arduino Nano control the two relays and pins A4 and A5 are the I2C interface for the LCD display and DS3231 RTC.

Step 2: The Hardware


I designed a printed circuit board using the free ExpressPCB software and ordered three of their mini boards of the design. The layout for this PC board is shown in the images. With the many connections this greatly simplifies construction. A project box was designed in SketchUp and then 3D printed. The SketchUp files can be downloaded below. This also makes for easy construction as the printed box has all the right size cutouts in place. If you buy or build your own project box make sure to make it large enough to easily accommodate everything since there are a number of wire connections needed inside the box besides the PC board.

The PC board with the Arduino Nano, relay board, 5 volt 7805 regulator with heatsink and filter capacitors mounted is shown in the images. A 4 pin header jumper connects the DS3231 RTC module at the bottom and another 4 pin header jumper connects the relay board to the PC board. A third 4 pin header jumper, visible at the upper left, connects to the LCD display.

Referring to the image of the dual relay board, the AC wires which connect to the duplex plug are connected to the relay board's normally closed 2nd and 3rd, and 5th and 6th, screw connectors at the left, numbered from the top. The jumper between header pins JD-VOC and VCC on the relay board needs to be in place as shown in the lower right. The 4 pin header in the upper right connects to the PC board with a 4 pin header jumper for power and signals. A relay is activated when an input receives a low (ground) signal and when activated an LED on the module lights up.

When connecting the “hot”, ie. black side of the 120 volt AC to the duplex plug from the relays remember to snap off the small connector between the screws on that side so that each plug will be controlled separately.

The inside of the project box with all the components in place is shown in an image above. The LCD module is at the top and the DS3231 RTC in the upper left. Power in connections are on the left side and the duplex 120 volt wall jack is on the right. The printed circuit board is centered left.

Step 3: The Software

The software for the Arduino Nano is fairly simple. After initializing it simply reads the time and date, displays this on the LCD display, and then checks to see if the relays need to activate or deactivate, and then loops.

Two software libraries are included in the program, one for the DS3231 which can be found at https://github.com/NorthernWidget/DS3231 and the other for the LCD display. The LCD library and information can be found at https://community.dfrobot.com/makelog-312225.html. Builders should be aware that there are a number of different libraries for LCD displays and different size displays. The one I used is 4 lines of 20 characters. It is initialized as follows.

LiquidCrystal_I2C lcd(0x27,20,4);  // Note these displays also come with address 0x3F

Be sure you have the correct library that matches the display you use. Instructions for installing libraries in the Arduino GUI can be found at https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries.

The times to reset the channels are set when the variables are initialized. In the example below the channel 1 restart starts at 3:00 and ends at 3:01. Channel 2 starts at 3:01 and ends at 3:02.

unsigned int start_hour1 = 3, start_minute1 = 0, start_hour2 = 3, start_minute2 = 1;   // start times
unsigned int end_hour1 = 3, end_minute1 = 1, end_hour2 = 3, end_minute2 = 2;           // end times

The procedure for programming the Arduino Nano is to remove the comment symbol // from the following lines in the program, and assign the current time and date. For simplicity the 24 hour format was chosen. A CR2032 battery also needs to be installed in the DS3231 breakout board.

// rtc.setClockMode(false);  // 12 hour mode = true, 24 hour = false
// rtc.setSecond(0);
// rtc.setMinute(11);
// rtc.setHour(15);
// rtc.setDoW(3);     // 1-7
// rtc.setDate(17);    // 1-31
// rtc.setMonth(10);  // 1-12
// rtc.setYear(23);

Compile and upload the program and verify that it is running correctly. Without powering down, comment out the lines above and then compile and upload the program again. The battery backup on the DS3231 breakout board will then retain the correct time and date when power is removed and powering up the Router Restarter will not change the running time and date.


The complete program is available below.

Step 4: Additional Files

There are file types not supported for downloads by Instructables that are useful to a builder. This includes the ExpressPCB .pcb file for a printed circuit board and SketchUp .obj files for use with a slicer such as Cura. These files can be obtained at no cost from the author at theronsarticles@gmail.com.

First Time Author

Participated in the
First Time Author