Ir al contenido

Welcome!

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

Esta pregunta ha sido marcada
1 Responder
59 Vistas

Hello, I have a service/script running which controller some relays. I would like to turn OFF the relays during loss of power. I referred to the 'How to execute commands before the Raspberry Pi industrial PLC Power Off process' and created the pre-poweroff with the following content.

#/home/pi/.local/bin/uv run python 
from librpiplc import rpiplc
rpiplc.init("RPIPLC_V4", "RPIPLC_38AR")
rpiplc.digital_write("R1.1", rpiplc.LOW)
rpiplc.digital_write("R1.2", rpiplc.LOW)

when I run the python script on it own it does turn OFF the relays. 


when I unplug the power, I do see the relays going off. not sure if its because of the script or loss of power of the relay.


But when I turn the RPI PLC back on the relays are in ON state. 


i would like to keep the relays OFF during power up no matter what the previous states are before loss of power.


any help in this matter would be greatly appreciated. thanks. 

Avatar
Descartar
Mejor respuesta

Hi, the pre-poweroff script does run when the power is cut.

However, on the Raspberry PLC V4 only the Raspberry Pi stays powered during that process. The I/O expanders are not powered, so they do not receive the command and keep their previous state when the power comes back.

This cannot be solved on V4. On V6 it is solved: the expanders are reset.

Avatar
Descartar