WS2811 POV display on PC fan

Dead easy to make DIY hadware watchdog for your mining rig

(на русском)

Hi! Welcome to my regular DIY hardware post series. This time around, we're going to make a hardware watchdog timer for your mining rig (or any PC, actually).

The focus of this device is its simplicity, as well as its constituent parts' cheapness and effortless sourcing. This build can be replicated even by those new to electronics and/or programming.


We'll begin by gathering the parts:

Parts

Essentials

All the part that you'll need. Provided you don't mind general ugliness.
  • Any Arduino. My choice was Uno as it's the most widespread one. The only two requirements  it has to meet are: at least one digital I/O pin, at least one USB-enabled serial port.


  • Reed relay. Picking this relatively obscure kind of relay was based on a specific rationale. This relay's coil consumes only about 9mA at 5V, so you can drive it directly from AVR's IO pin:


  • 0.100" (2.54 mm) male and female headers (both):

Non-essentials (aka I don't want my device to fry because I poured some coffee on it) 

Do you want your stuff to look decent? Then gather these parts.
  • Project enclosure. I'll be using a lunchbox (tada!) to accentuate the simplicity of gathering parts for the project. Can be found at the nearest grocery store.


  • Some kind of 2-pin panel mount connector. This build utilizes a simple barrel jack commonly used to supply DC power:

  • Tiny screws and standoffs to affix Arduino to your enclosure:

Assembly

  1. Screw the Arduino to the bottom of the box. The standoffs will come in handy.

  2. Make the apertures both for your reset key connector and for Arduino's USB connector. Round hole can be made with the help of the conical drill bit:


  3. A square hole is a bit trickier. Personally, I heated up an awl and blazed the tip through the box to cut arbitrary shaped holes in it. Resulting edges have to be finished with a hobby knife and/or small file.

  4. Solder together a little circuit:

  5. One remaining piece is the cord that'll connect your watchdog timer to computer's motherboard.

  6. You're all set with the hardware! Just close the top of the box and plug it in!

Software

You'll find all required software (that is, Arduino sketch and Java program source code) along with detailed instructions in this Github repository. Java was chosen to ensure it can be run on both Windows and Linux - the two most widespread mining rig platforms.

Java app being built with Maven - the same thing will be seen by any Linux user.

Testing it all together


Upload the sketch on Arduino, connect it to your computer and run the .jar file that you built. At this point, if everything works fine, you'll finally observe your hardware-software bundle of Arduino and Java working together:

Here's how it works: the PC-side program tries to connect to every single serial port in your system within a period of 30 seconds (including the ports that appear during this process). To each port it'll send the handshake string "hello" and monitor the input, expecting to receive uppercase "HELLO" back. When the handshake is finished, it'll send ping strings once each five seconds.

The watchdog program on Arduino scans the input for "ping" strings. If no such string has been received within 10 second period, the watchdog will forcibly restart your PC.

Therefore, this scenario where you manually run it will be "one-off", i.e. once the PC has been restarted, the watchdog will be stuck in the pre-handshake state. To make it work all the time, add the Java program to the startup list of your operating system of choice.

Now, the most important part is plugging your watchdog instead of the reset switch on your motherboard:

That's when it'll be able to actually restart your PC.

As a substitute for proper ending, have this video of my friend battle-testing my watchdog with one of his buggy GPUs that's been causing him way too many BSODs than you'll expect:

Comments