Controlling USB power
Posted: Mon Jun 15, 2020 3:44 pm
Hi guys,
I am using MikroTik devices in industrial environments, where one of the requirements is that all networking devices can generate alarm signals for use with PLCs. This must be a potential free relay output, that can be monitored using a PLC digital input. Conditions that trig this alarm can be an interface going down, or a power supply failure.
For the CCR1036-12G-4S, i am using the following script that runs at boot:
Together with this piece of hardware:
This works (almost) perfectly, and disables the 5V output of the USB port if any of the defined interfaces goes down, or if one of the power supplies fails. When the alarm condition goes away, the power returns immediately.
However, if the alarm condition persist for more than 24 hours, the power turns back on again for a split second. This is enough to re-trigger the alarm condition in the PLC, which messes with timestamps and confuses the operators of the plant.
Is there any way to disable the power of the USB port, rather than just defining a reset duration?
If no, can this be considered a feature request?
Best,
Marius
I am using MikroTik devices in industrial environments, where one of the requirements is that all networking devices can generate alarm signals for use with PLCs. This must be a potential free relay output, that can be monitored using a PLC digital input. Conditions that trig this alarm can be an interface going down, or a power supply failure.
For the CCR1036-12G-4S, i am using the following script that runs at boot:
Code: Select all
:global StopAlarmScript false;
:delay 30
:do {
:if (([/interface ethernet get ether1 running]=false) = true \
or ([/interface ethernet get sfp1 running]=false) = true \
or ([/interface ethernet get sfp2 running]=false) = true \
or ([/system health get psu1-state]="fail") = true \
or ([/system health get psu2-state]="fail") = true) \
do={[/system leds set leds=fault-led type=on 0]\ [/system routerboard usb power-reset duration=1d]} \
else={[/system leds set leds=fault-led type=off 0]\ [/system routerboard usb power-reset duration=0]}
:delay 5
} while=(!$StopAlarmScript)
Together with this piece of hardware:
This works (almost) perfectly, and disables the 5V output of the USB port if any of the defined interfaces goes down, or if one of the power supplies fails. When the alarm condition goes away, the power returns immediately.
However, if the alarm condition persist for more than 24 hours, the power turns back on again for a split second. This is enough to re-trigger the alarm condition in the PLC, which messes with timestamps and confuses the operators of the plant.
Is there any way to disable the power of the USB port, rather than just defining a reset duration?
If no, can this be considered a feature request?
Best,
Marius