Savage///Chats

Hardware Development => Microcontrollers => Topic started by: Chris Savage on Sep 25, 2026, 10:57 PM

Title: Arduino as a Diagnostic Tool
Post by: Chris Savage on Sep 25, 2026, 10:57 PM
This week I had a PLC that was prone to randomly reset / fail. Intermittent issues are difficult to find. My solution was to run the unit and monitor the unit using an Arduino programmed to detect the CPU faulting and also for a possible power failure, which would cause a false positive.

To do this, I programmed the Arduino to monitor the relay output of the PLC, which is closed when active. Using an input pin with the internal pull-up resistor enabled I was able to detect if the relay should open, which would indicate that the CPU failed.

Of course, this could also happen if the unit under test lost power. So, I also monitored the incoming 24VDC P/S by feeding that into an opto (4N35) through a 2.2K resistor. The emitter of the opto connected to ground, while the collector connected to an input with the internal pull-up resistor enabled. In this manner, when the power fails, the I/O pin goes high.

There is an on-board LED on the Arduino UNO. I used it to determine which failure mode occurred. Solid ON for CPU failure / reset and flashing for power failure. The Arduino ran from a USB battery bank, making it immune to power failure. It's always nice to be able to create a custom diagnostic tool by simply programming an MCU.
Title: Re: Arduino as a Diagnostic Tool
Post by: granz on Sep 26, 2026, 09:06 AM
Byte Magazine's Steve Ciarcia had an article on using the TRS-80 for computerized testing. It was in the Dec, 1980 issue (https://archive.org/download/byte-magazine-1980-12/1980_12_BYTE_05-12_Adventure.pdf), on page 44 (page 46 of the PDF.) It was similar to your work here, except that he was using a multi-thousand dollar computer. It's funny that a microcontroller can do the same job as a 1970s computer that cost about 100 to 200 times more.

Nicely done.

BTW - this was always one of my favorite issues - the Robert Tinny picture just (still) keeps grabbing my attention. ;)
Title: Re: Arduino as a Diagnostic Tool
Post by: Jeff_T on Sep 26, 2026, 10:28 AM

QuoteIt's funny that a microcontroller can do the same job as a 1970s computer that cost about 100 to 200 times more.

It blows my mind everytime I think about it.
Title: Re: Arduino as a Diagnostic Tool
Post by: granz on Sep 26, 2026, 02:55 PM
Yeah, I routinely use my PicoCalc, which cost $100 delivered. And it is far more powerful than the most sophisticated TRS-80 (the Model 16.) My PicoCalc actually has an IBM XT emulator, :o with just the Pico 2W.

Even the Pi Pico board, at about half a dozen dollars, can simply be made into a powerful VGA desktop computer.