Go Down

Topic: Ground triggered relay output as input to Arduino (Read 191 times) previous topic - next topic


Hi everyone, I am new to the forum.

I have a relay that has a ground trigger, that is supposed to output 5V to the Arduino when triggered. The issue is that, since the switch is not grounded until it is closed, this means that I have a floating input when it is open. Thus when calling analogRead, I get a high value regardless of whether the relay is open or closed. Suggestions? Would calling pinMode(INPUT_PULLUP) solve the issue, or would I need some additional component? I am using an Arduino Leonardo by the way.


You might want to post a schematic. One side of the relay contact needs to be connected to ground and the INPUT_PULLUP would be on the pin connected to the other side of the contact. When the relay is on you will get a low and when off you will get a high. I hope this answers your question.
This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!


Basically we have no idea what you are talking about.

Details are required.  :smiley-eek:


Would calling pinMode(INPUT_PULLUP)
I suggest you try it and see.

You don't need analogue read for detecting the state of a relay contact.


Post a link to the datasheet or product page of the thing you are talking about, we
cannot read your mind!

But yes, if the relay is just playing the role of a push-button, you need a pullup,
internal or otherwise, always...
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]


  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

Go Up