I am currently working on a project to control an industrial machine using RevPi Core 3+, RevPi DIO and RevPiModIO.
The machine has a problem where, after running the machine for a few hours, the button input signal switches even though I haven't touched it.
As a countermeasure, I have managed to get it to work by ignoring the short signal changes, but it still malfunctions sometimes.
At first I thought it was due to noise, but after logging the input signals during operation, I figured it was not so.
The log is as follows
Code: Select all
2021-03-03 13:08:08.373686,1,0,0,0,0,1,0,1,1,0,0
2021-03-03 13:41:32.459371,0,0,0,0,0,0,0,1,53578,40746
2021-03-03 13:41:32.467554,1,0,0,0,0,1,0,1,1,0,0
I_1, I_2, I_3, and I_4 are connected to buttons, I_5, I_6, and I_7 are connected to photosensors, and O_1 is connected to a relay.
Status and Output_Status are in decimal format.
This log is only recorded when the signal being recorded changes.
Other terminals are connected to sensors, solenoid valves, etc. and are constantly changing.
While I was recording this log, I did not do anything about the buttons or photo sensors, but the input signals suddenly switched.
On the other hand, the output signals seem to be unchanged.
After that, the input signals return to normal immediately.
The moment the signals switch, the Status and Output_Status change, indicating that an error has occurred.
However, the content of the error is puzzling.
I have no idea about the cause of the undervoltage or overheating.
Inputs 1-8 and 9-16 share a voltage, so I would expect two errors to occur at the same time, but actually only one is occurring.
It is also odd that it overheats for a moment and then the error disappears immediately.
What could be the cause of this malfunction?
And is there any way to resolve it?
The recording was taken with the following python script.
Code: Select all
import datetime
import csv
import sys
import revpimodio2
def main():
revpi = revpimodio2.RevPiModIO(autorefresh=True, monitoring=True)
monitoring_io = [
revpi.io.I_1,
revpi.io.I_2,
revpi.io.I_3,
revpi.io.I_4,
revpi.io.I_5,
revpi.io.I_6,
revpi.io.I_7,
revpi.io.O_1,
revpi.io.Status,
revpi.io.Output_Status,
]
with open('signals.log', 'a') as f:
file_writer = csv.writer(f)
stdout_writer = csv.writer(sys.stdout)
previous_ios = None
def _callback_function(cycle_tools=None) -> None:
nonlocal previous_ios
ios = [int(io.value) for io in monitoring_io]
if previous_ios != ios:
previous_ios = ios
values = [str(datetime.datetime.now())] + ios
file_writer.writerow(values)
stdout_writer.writerow(values)
print('Start logging.')
revpi.cycleloop(_callback_function, cycletime=10)
if __name__ == '__main__':
main()