Please can someone help me.
I'm doing the on star delta starter using Arduino uno by ladder programming,
I have problem with switching relay on and off.
Everything works great except when I set pinout to HIGH it turns OFF the relay and when I set pinout to LOW it turns ON the relay.
If relay works like that this is not suitable for star delta starter
So, help me.
Everything works great except when I set pinout to HIGH it turns OFF the relay and when I set pinout to LOW it turns ON the relay.
That sounds fairly normal. Just reverse the logic in the program.
The neat way
Place below near the top of your code
#define RELAY_ON LOW
#define RELAY_OFF HIGH
When you want to switch the relay on, use
digitalWrite(yourRelayPin, RELAY_ON);
When you want to switch the relay off, use
digitalWrite(yourRelayPin, RELAY_OFF);
or
digitalWrite(yourRelayPin, !RELAY_ON);
For the latter, you can leave the second define out.
sterretje:
The neat waySir, I'm using ladder programming
It's hard to believe that you can't use reverse logic in this "ladder programming" whatever it may be. Active low is very common, both for outputs and inputs.
Does your ladder language have inverted outputs like "( / )"?
Santosh24:
when I set pinout to HIGH it turns OFF the relay and when I set pinout to LOW it turns ON the relay.
Surely you can just set "pinout" to LOW where you were thinking HIGH, and HIGH were you were thinking LOW?
That the relay requires a LOW to turn on, where your previous experience and / or intuition tells you that's weird, and that "on has to be HIGH", is irrelevant. If you have control over "pinout", and you say you can set it so you must have control, set it to whatever value turns the relay on or off at the right time, regardless of whether that output is HIGH or LOW.
I hv control on Arduino pin out,
When i connect the Arduino with relay, relay automatically turn on without giving any input to the relay input pin,
When i made pin high in ladder program, the relay will off.
Sir actually,
I'm using 3 relays
And 3 contactors- one is main contactor, 2nd is star contactor, and 3rd is delta contactor, each contactor uses the relays.
Arduino uno is programmed with ladder logic programming,
I know nothing of ladder logic in general, and even less as it applies to Arduino, but in "normal" Arduino code, outputs are low by default. So if (in normal Arduino code) you digitalWrite(pin, HIGH) before doing the pinMode(pin, OUTPUT) it will start as high and your relay won't go on accidentally.
I would assume slash hope that similar functionality remains when programming an Arduino with ladder logic.
(I'm keen to see how to do that btw, post links...)