0

im using 4 channel relay to switch the motor pump. but when the arduino output is high and i check first with led. the led behavior were high too but when i attached to the relay input IN1, the relay were low. its like reversed action(the arduino is high, but relay was low then when arduino output is low, suddenly the relay was high. i try to edit the code hoping if i set arduino output is low then relay will be high but its still the same, its reversed. arduino output is low but the relay become high. is there any way to make the relay to become high when the digital output is high?

however.. i didnt have the the actual circuit act but im using the digital pin as the output and some switches. the project im work on is the automatic aquarium pump and water change which is the pump will automatically refill the water actuated by the float switch and will automatically drain the water and refill the new water in certain time.

im using pin 13 as the output.. and the pin 1 as the input which is a switch as in picture im using a led as a output. but as soon i change to the relay, it become what i just said at the above enter image description here enter image description here enter image description here enter image description here

  • I see. How do I ask a good question about the Arduino?. What relay? What pump? i try to edit the code - what code? Please post your schematic (circuit). Edit your question to include these details and I am sure we will be able to help you. – Nick Gammon Jun 5 '18 at 7:28
  • @NickGammon alright sir, i just edited the post and you can refer to ths detail i given based on your questions – Asrul Asyraff Jun 5 '18 at 8:00
  • @AsrulAsyraff Could you please kindly post your code. – sa_leinad Jun 5 '18 at 9:40
0

First of all, you'll soon blow up that LED. (Or the Arduino if you're really unlucky.) You need a current limiting resistor.

Secondly, most relays have two switch contacts: normally closed (N.C.) and normally open (N.O.). If you want your device to be off, unless the Arduino turns on the relay, use the N.O. connection. If you want your device to be on, unless the Arduino turns on the relay, use the N.C. connection.
It looks like you need N.O.

N.b: 'closed' means on (i.e. the switch is closed and current is allowed to flow).

Finally, you seem to be using an external pull-up resistor for you switch, which is completely unnecessary: the Arduino has an internal pull-up resistor on every digital pin that you can enable using pinMode(pin, INPUT_PULLUP).

Edit: you didn't connect the relay to the button pin instead of the LED pin, did you?

  • oh i see... because im just referring to the led on the relay but i didnt connect any load on the relay so im just looking on lights on the led which located at the relay module. is this means that i should try to connect the load on the relay and see the really output based on NC/NO connection instead just looking on the relay led? – Asrul Asyraff Jun 5 '18 at 8:39
  • @AsrulAsyraff: You connected the relay to the switch pin, instead of to the LED pin. – tttapa Jun 5 '18 at 8:43
  • i changed the LED and connect into the relays input – Asrul Asyraff Jun 5 '18 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.