Connect with us

How to Read Relay State using Digital Pin?

Discussion in 'Microcontrollers, Programming and IoT' started by Lei Reyes, Jan 27, 2015.

Scroll to continue with content
  1. Lei Reyes

    Lei Reyes

    Jul 2, 2014
    Hi everyone, I am having trouble reading a value here in my setup:

    There are 2 arduino uno rev3 units:

    - has a 12v Relay Card connected to it to control a warning light (on/off) if certain conditions are met (such as if a Condition is satisfied, ARD2 will send signal to Pin 7 then pass it to the relay card to activate the warning light).

    - is located in another location, it needs to read the state of the Relay1 Only(in the Relay Card) , not the Pin 7 . ARD1 will use Digital Pin 8 (as input) to read the state of the Relay1 (if it is triggered or not, 0 or 1)

    Problem is, I don't know where in the Relay Card will I connect the ARD1's Digital Pin 8 & a reference ground to do the reading, please help me with this . Can I use the Dry Contact Port of the Relay Card?

    below is my setup diagram .

    Attached Files:

    • dry.png
      File size:
      365.3 KB
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    Nov 28, 2011
    It sound like you want Arduino #1 to be galvanically isolated from all of the Arduino 2 circuitry and the warning light.

    This would normally be done using an optocoupler or a relay. If the second relay on your board is not used, you can use that. Drive it from the same signal that the first relay is driven from. Connect wires to the NO and COM connections on the second relay and run them to the 0V rail and the digital input on the Arduino #1 board. Enable the internal weak pullup on that input so the input defaults to the high state.

    When Arduino #2 activates its output, both relays will close. The first one will activate the warning light, and the second one will close the circuit between the digital input and the 0V rail at Arduino #1, so Arduino #1 will read a low state on that input.

    If those cables are running a significant distance you may need surge protection for Arduino #1 to prevent damage to the device from voltage spikes and surges coupled into the wires.
    hevans1944 likes this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day