0
\$\begingroup\$

I am using the Sain Smart 16-channel relay module. A relay is energized when the corresponding input pin is connected to the ground. I am using an Arduino to control the relay module using the GPIO pins. The suggested wiring was to use a NPN transistor to ground the input pin. However, I did this and it seems to work without any transistor. I basically connected the input pin to the ground with a 5k ohm resistor. When the GPIO is 0, the voltage is 0 and the relay closes and the light turns on. And when the GPIO pin pulls it to 5V,the relay opens and turns off the light.

Is that a good way to do this?

Circuit schematic

\$\endgroup\$
  • 1
    \$\begingroup\$ I believe if you look at the module it likely already has a transistor buffer per relay to energize the coil. One needs to only control the transistor. I would use a pullup instead of a pulldown to keep the relay unenergized while the Arduino is waking and its IO pins are all floating due to being Inputs until your sketch declares them as outputs and drives them high or low. \$\endgroup\$ – CrossRoads Jan 15 at 18:17
  • \$\begingroup\$ Tip: add a link to the datasheet for devices you mention in your question. \$\endgroup\$ – Transistor Jan 15 at 18:47
1
\$\begingroup\$

Gone through the Sain smart relay module

The Board used two relay drivers ULN2083 (8 channel relay driver) instead of transistors to drive all 16 relays.

and the 4pin component on each relay channel is an opto-isolator.

the pin 1 of opto-isolator is connected to VCC via a current limiting resistor and pin 2 to GPIO of controller (here arduino). when GPIO is high no current conduction hence relay will be "OFF" and when GPIO is LOW relay will be "ON".

Mostly when there is need to control multiple devices making GPIO's as sinking is the best approach.

Is that a good way to do this?

Yes, no issues.

\$\endgroup\$

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.