Arduino as a Diagnostic Tool

Started by Chris Savage, Sep 25, 2026, 10:57 PM

Previous topic - Next topic

Chris Savage

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.

                     Bringing concepts to life through engineering.

granz

Byte Magazine's Steve Ciarcia had an article on using the TRS-80 for computerized testing. It was in the Dec, 1980 issue, 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. ;)

Jeff_T


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.

granz

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.

JKnightandKARR

Quote from: Chris Savage on Sep 25, 2026, 10:57 PMThis 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.
I have thought of making my own tools like this but not sure how I'd do it. Wanted a PropScope, but that's no longer needed.

Chris Savage

#5
Quote from: Jeff_T on Sep 26, 2026, 10:28 AMIt blows my mind everytime I think about it.

What's really going to bake your noodle later is when you realize, I could actually accomplish the same test using some discrete components. The Arduino just makes it easier to reconfigure the test, parameters, etc. Easy to add delays, check more inputs, blink the LED, etc.

But, for this specific test, it could be done with with a dollar worth of components. You could even use a blinking LED for that part.

                     Bringing concepts to life through engineering.

JKnightandKARR

Quote from: 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.

Yeah, they can do alot anymore!

SMF spam blocked by CleanTalk