Cable Modem Restarter (Turn Off & On )

How to restart DOCSIS 2.0 cable modem with an ESP32 and a relay?

Similar projects worth following
I 'm using an old DOCSIS 2.0 cable modem (CXC-150) with a wireless router. Nowadays it starts to disconnect from Internet (because of the DOCSIS 3.0 infrastructure) and does not reconnect until it is turned off & on for 2-3 times. I don't buy a new one, so need to check Internet connectivity and turn off & on the modem automaticly. I decided to use an ESP32 with a relay module and Arduino Software IDE to upload the program.

You can monitor the ESP32 status on Arduino IDE with Serial Monitor under Tools menu.

ESP32 will use for the host address and PIN 23 for the relay module connection.

It will turn off the onboard led and wait for 30 seconds after the boot.

Connect to the WiFi with your SSID and Password and check the host address

If it is connected:

  • Turn the onboard led on,
  • Stop the client
  • Wait 30 seconds for the next connection

If it is not connected:

  • Send a HIGH signal to relay module to power off the cable modem
  • Wait 3 seconds
  • Power it on again
  • Wait 30 seconds for the next connection

If there are two connection errors ESP32 will reboot again, because sometimes the relay does not work after the signal. Maybe the problem is ESP32 3.3 volts out, the relay module needs 5 volts to work.


ESP32 wifi client sketch file for Arduino IDE to restart the cable modem.

ino - 1.85 kB - 11/20/2017 at 14:18


  • 1 × ESP32 (DOIT ESP32 DEVKIT V1) To check Internet connectivity and control the relay
  • 1 × Relay module (1 channel Keyes_Srly) To turn off & on cable modem
  • 1 × 5V travel adapter with micro USB
  • 1 × Breadboard Electronic Components / Misc. Electronic Components
  • 1 × Jumper Wires

View all 7 components

  • 1
    Setting up ESP32 and relay module

    1. ESP32 WiFi chip installation on Arduino IDE and sketch file

    You need to first install Arduino Sofware (

    I modified the WifiClientBasic example under the File >> Examples >> Examples for DOIT ESP32 DEVKIT V1 >> WiFi menu. Change the SSID and Password in sketch and upload it to the ESP32 board.

    2. Connect the ESP32 PINs to relay module:

    • 3.3V to  +PIN
    • GND to  -PIN
    • D23 to S (Signal) PIN

    3. Connect the jumper cables to DC power jack supply sockets:

    • Connect +PIN of the female socket with red cable to C (Common) PIN on relay module. 
    • Connect  -PIN of the female socket with green cable to 12V out cable
    • Connect NC (Normally Closed) PIN of relay module to 12V out cable

    4. Connect the power cables

    Plug the 12V adapter power cable to female power jack socket on the breadboard and 12V out cable to modem power socket.

View all instructions

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates