Arduino PLC IDE – Digital Output Not Switching

Hi everyone,

I'm currently working on a project using Arduino PLC IDE to control relays via Structured Text (ST) code and Ladder logic. Everything compiles and runs correctly, but I’m facing an issue:
The relay output is not switching.
I’ve verified the logic is running fine, but the output pin (e.g., relay01 := TRUE) shows 0V.
The relay doesn't click, and there's no voltage at the output terminal.

:white_check_mark: What I’ve Done:
Mapped relay01 to %QX0.0 in IO Mapping.
Tried both relay01 := TRUE and FALSE (in case of active-low logic).
Used a multimeter to measure the output pin — still 0V in both logic states.

If anyone has faced a similar issue or knows how to enable the digital outputs physically, please let me know.

Thanks!

Hello dhinakaran_08,

Opta has 4 relay outputs, so it doesn’t have any voltage on outputs in any state. Only thing that can change is state of relays, so if you’re using multimeter to check if it’s working or not you should use mode that shows flow over circuit (“diode test”) on your multimeter. This way or another activating a relay should result with “click”.

Unfortunately I don’t have any experience with PLC IDE.

EDIT

How do you power up your Opta? If I remember correctly relays won’t work without powering opta with external power supply, USB only won’t work.

Hi Darrag212,

Thanks for your suggestion. I did power the Opta with a 24 V external supply (not just via USB). Even with that, the relay still isn’t working — there’s no audible click, and when I test continuity there is no change.

No problem here.
Can you post your code ?

IF (NOT BTN_USER) AND (NOT buttonPressed) THEN
   
    buttonPressed := TRUE;
   
     IF counter < 5 THEN
        counter := counter + 1;
        ELSE
        counter := 0;
    END_IF;
END_IF;

numDelay01  := counter;

IF BTN_USER THEN
    buttonPressed := FALSE;
END_IF;



if numDelay01 = 0 THEN
relay01 := FALSE;
relay02 := FALSE;
relay03 := FALSE;
relay04 := FALSE;
led1 := FALSE;
led2 := FALSE;
led3 := FALSE;
led4 := FALSE;

elsif  numDelay01 = 1 THEN
relay01 := TRUE;
relay02 := FALSE;
relay03 := FALSE;
relay04 := FALSE;
led1 := TRUE;
led2 := FALSE;
led3 := FALSE;
led4 := FALSE;

elsif  numDelay01 =2 THEN
relay01 := FALSE;
relay02 := TRUE;
relay03 := FALSE;
relay04 := FALSE;
led1 := FALSE;
led2 := TRUE;
led3 := FALSE;
led4 := FALSE;
elsif  numDelay01 = 3 THEN
relay01 := FALSE;
relay02 := FALSE;
relay03 := TRUE;
relay04 := FALSE;
led1 := FALSE;
led2 := FALSE;
led3 := TRUE;
led4 := FALSE;
elsif  numDelay01 = 4 THEN
relay01 := FALSE;
relay02 := FALSE;
relay03 := FALSE;
relay04 := TRUE;
led1 := FALSE;
led2 := FALSE;
led3 := FALSE;
led4 := TRUE;
end_if;

Hi,
I have tried your code and relay clicks well when BTN_USER is pressed.

OPTA is powered with 13V.

This line

IF counter < 5 THEN

should be replaced by

IF counter < 4  THEN

to avoid to click twice when Led4 is green and to execute correctly the sequence.

Hi Kalain,
I applied your suggested logic to my program, and the issue has been resolved. Everything is working fine now — thanks for your guidance