Network/internet outage monitor using WIZnet WS5100S-EVB-Pico

components
Hardware Components
Red LED
X 1
Green LED
X 1
330 ohm resistor
X 2
Breadboard
X 1
assorted connectors
Micro USB cable
X 1
Ethernet cable
X 1
Raspberry Pi
X 1
optional
Software Apps and online services
Mosquitto Broker
deployed on RPi or other device
Node Red
deployed on RPi
Thronny
Editor
Project Description

Network/internet outage monitor using WIZnet WS5100S-EVB-Pico

This project uses a WIZnet WS5100S-EVB-Pico attached to a spare Ethernet port on a local router and is used to monitor the Network/Internet for outages. The project was designed after chasing and tracking multiple home Internet outages. I needed times and dates for my Internet provider to track down an ongoing issue I had last year. It did turn out that the issue was the cable coming off of the junction box outside my house. I wanted a device that would sit passively and monitor my network/internet 24/7.The design is a starting point for a more elaborate monitoring device. Please see Future enhancements at the end of the project.I was lucky(?) enough to have an outage in the middle of the night during programming and testing. The monitor did detect and report the outage.I wrote the program after going through all the CircuitPython examples. I borrowed and modified code from may of them. Hope you enjoy and get inspired by the project.

The program will:

  • Detect the Ethernet cable unplugged from the WS5100S or the Ethernet port on the router
  • Detect Network or Internet outages
  • Light LEDs to indicate connection ok, cable disconnected and Network/Internet outages
  • Display tracking information through the serial port
  • Publish program start time, up time and outage time MQTT messages to a broker
    • I used a Raspberry Pi as the broker and Node Red to post the information and write to a log
Design:
  • The program is written in CircuitPython. Thronny was used as the editor.
  • Program file name is code.py. This allows the program to autostart on powerup. Note – the program will fail to start if the Ethernet cable is not plugged in.
  • The program will try to resolve a .com URL. I used dns.google. The program was also tested with my router URL.
  • The board and external green LEDs will be on during good connections.
  • If the program can’t resolve the URL, the external green LED will turn off and the red external LED will turn on.
  • If the Ethernet cable becomes unplugged, both the external and internal green LEDs will turn off and the external red LED will turn on.
  • The program will check the URL every 2 minutes and if there is an outage, it will check every 30 seconds to determine if the outage has cleared.
  • All information will be displayed on the serial port.
  • Program start time, up time and outage time will be published as MQTT messages to a broker. Note – outage time can not be sent until the network is back up.
  • Use a Raspberry Pi for the MQTT broker. Use Node Red for data presentation and logging of program start time, up time and outage time. Note – a broker must be available to the program to publish MQTT messages. If one isn't available, remark all publish calls in the program.

Circuit diagram:

circuit

GitHub - russel2512/Net_monitor (github.com)

Deployment:

This is an overview of the project deployment. You should have a general knowledge of RP2040. Information can be found at https://www.raspberrypi.com/products/raspberry-pi-pico/ and https://docs.wiznet.io/Product/iEthernet/W5100S/w5100s-evb-pico/.

This project was developed with CircuitPython 7.1.1 deployed on the WS5100S. A good reference can be found at https://learn.adafruit.com/welcome-to-circuitpython. Version 7.1.1 of CircuitPython (adafruit-circuitpython-raspberry_pi_pico-en_US-7.1.1.uf2) can be found here: https://adafruit-circuit-python.s3.amazonaws.com/bin/raspberry_pi_pico/en_US/adafruit-circuitpython-raspberry_pi_pico-en_US-7.1.1.uf2

Install Thonny IDE to program the WS5100S. It can be found here: https://thonny.org/MU does not need to be installed.

Test CircuitPython with the WS5100S using the Blink example program.

Library deployment steps:

  • Create lib folder on the board.
  • Download and copy the following libraries from https://github.com/Wiznet/RP2040-HAT-CircuitPython to lib.
    • adafruit_bus_device
    • adafruit_io
    • adafruit_minimqtt
    • adafruit_wiznet5k
    • adafruit_wsgi
    • adafruit_requests.py
  • One more library needs to be copied to the lib folder.

Copy the monitor code from https://github.com/russel2512/Net_monitor.

  • code.py (autorun)
  • WIZnet_monitor.py (same as code.py, but does not autorun)

Connect the LEDs per the circuit diagram found in the GitHub project.

Setup a Raspberry Pi (Node Red is optional).

Final changes to the programs (code.py and WIZnet_monitor.py)

  • Change the MQTT ip adress to the broker.
  • Change IP_ADDRESS if the device is on a different subnet or if 192.168.68.200 conflicts with device on your network.
For the program to work correctly, a MQTT broker must be available or it will fail. A broker can be deployed on almost any device. If you don't have a broker available, you can go through the code and remark out all the MQTT calls.
YouTube video of board/program operation -  https://youtu.be/2fmNqMajGyM

Serial Port display inforamtion with screen shots of LED status:

Normal operation

Serial port -1

Normal operation_s

Ethernet cable disconnected

Serial port - 2

Cable disconnected_s

Network issue

Serial port - 3

Network issue_s

Node Red screen shots:

Startup Node Res - Start

Cable error Node Red - Error

Network error Node Red - Network error

 Future enhancements:These are just ‘blue sky’ ideas. Some may not be valid or work. The biggest ‘got ya’ is the fact that the down/up information can’t be sent to the broker until the network is backup. This means the data will always cause a notification after the outage.
  • Break up data for better data handling (ie, filling JASON fields and adding to databases)
  • Deploy MQTT broker on PC and or Phone
  • Use IFFT to send phone or text notifications
  • Calculate downtime in the program or in Node Red
  • Send Start, Up and Down data to external collection (ie ThingSpeak)
  • Send notifications to a phone or PC directly from Node Red
  • Add code to monitor multiple URLs, this could be used to monitor multiple servers or internal network devices (must have URLs)
  • Change LEDs to a small display.
  • Design a circuit board for the project.
  • Design a 3D printed case.
 
documents
Code
code.py
Auto start on powerup
WIZnet_monitor.py
Same code as code.py
Schematics
circuit diagram
WS5100S-EVB-Pico and LEDs circuit diagram
Others
Normal operation
Status LEDs are circled
Ethernet cable disconnected
Status LEDs are circled
Network issue
Status LEDs are circled
Node Red Startup
Node Red cable error
Node Red Network error
Serial port - Normal operation
Starting monitoring
Serial port - Ethernet cable disconnected
Cable disconnected and reconnected
Serial port - Network issue
Network/Internet issue and resolved
Node Red outage.log
Running log updated by Node Red on the Raspberry Pi

2
COMMENTS

Please Login to comment
2 Comment authors
ronpangRussel2512 Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
ronpang
Member

Hi russel2512,
I’m Ron from WIZnet HK. Could I post your article to our WIZnet HK instagram account?

BTW, do you have a instagram account that I could tag you?

Best Regards,
Ron

POSTED BY
W5100S Series Library
Reusable S/W