1

I am new to Arduino. The digital pins can be configured as output (https://www.arduino.cc/en/Tutorial/DigitalPins) for triggering some sensors. I am now setting a digital (output pin), say no. 7,which is connected to the in1 pin of a SRD relay (https://blog.siliconstraits.vn/relay-what-is-it-and-how-to-use-it/): enter image description here

I am not very clear about the direction of current flowing in the wire connecting the arduino digital pin to in1. To my understanding, when digitalWrite(pin, HIGH), no current flow into the arduino pin, the relay is not triggered, while digitalWrite(pin, LOW), the current flow into the arduino, and the relay is triggered. Please correct me if I am wrong. Thanks.

asked Jun 27, 2019 at 14:25
8
  • You are not driving the relay directly, are you? Commented Jun 27, 2019 at 14:35
  • I updated the post. Commented Jun 27, 2019 at 14:46
  • 1
    In your question, you mention connecting the Arduino to a relay, yet in the figure, you show a relay board. That's not the same! Please clarify. If using a relay board, please link to the datasheet or the supplier's product page. Commented Jun 27, 2019 at 14:50
  • 2
    you did not answer my first question Commented Jun 27, 2019 at 17:47
  • 1
    The relay board in the picture has a transistor on it that turns on the (blue) relay. The Arduino pin only turns on the transistor, which in then turns on the relay. The transistor makes it so that only a small amount of current is needed from the Arduino pin. This is because the coil in the relay requires more current that the Arduino pin can (safely) provide. Commented Jun 27, 2019 at 18:56

1 Answer 1

1

When you set a pin to HIGH then that pin will provide 5V. When you set a pin to LOW then that pin will be set to 0 volts. Which direction the current flows depends on what is at the other end of the wire. Current always flows from higher voltage to lower voltage. If you set a pin to HIGH and the thing it is connected to is at ground then current will flow out of the pin towards ground. If you set a pin to HIGH but the thing it is connected to is already at 5V then no current flows. If you set a pin to LOW and the thing it is connected to has some positive voltage then current will flow to the pin. If you set the pin to HIGH (5V) but the thing it is connected to has more voltage than that (say 10V) then current will flow towards the lower voltage and into the pin, probably damaging the Arduino in the process.

answered Jun 27, 2019 at 23:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.