General Question about and Optocoupler Board

Hello!
I am looking to better understand how this works?

I was going over the datasheet for this Opotcoupler Board: ELEGOO 4 Channel DC 5V Relay Module with Optocoupler Compatible with Arduino UNO R3 MEGA 2560 DSP ARM PIC AVR STM32
I noticed the schematic shows voltage going from VCC to the LED and then to the "in" pin. This leads me to think (probably incorrectly) that the pin is "active" if it is connected to ground. The example given on the datasheet has the "in" pins connected directly to digital pin on the Ardunio. When the pin is set high, the relay is active. Can you explain how this works? It seems to me that I would be providing 5 volts via the Vcc and "in" pins of the optocoupler.

Here is the datasheet (I can't upload a picture yet):
https://www.elegoo.com/blogs/arduino-projects/elegoo-dc-5v-relay-module-tutorial?srsltid=AfmBOopD0fCVgUZWIsV5G6sGk4h5GFIfunIqcTmgiYFCn_u7iVfVKmsE

Thank you for looking at this and helping a beginner out.
nateDVM

Correct. If a digital pin is used to control the relay via the optocoupler, the relay will be activated if the digital pin is set to LOW.

There is a current limiting resistor and indicator LED in series with the optocoupler LED, so it is safe to connect a digital pin directly to the relay module.

Think of the relay module as having three parts:

The input side, which is usually an opto-isolated LED.

The control side, which includes the relay coil.

The output contacts, which switch your external device.

When the input LED turns on, it activates the relay coil, which closes or opens the output contacts. Whether the relay activates on a HIGH or LOW signal depends on how the input LED is wired in your module.

The coil itself needs power to operate, often 12V from an external source, though some modules can use 5V from the Arduino (not recommended if the relay draws significant current). Because the relay is triggered optically, it provides isolation between the control signal (Arduino) and the high-power side. The output contacts are also isolated and usually configured as a SPDT (Single Pole Double Throw) switch.

Hopefully this helps.

That relay module gives you the option to use opto isolation and power the relays externally (the relay coils draw ~75mA each when active).

You only have opto isolation if

  1. you remove the jumper.
  2. connect a seperate 5volt supply to JD-VCC ang GND of the module.
  3. Connect VCC of the module to 5volt of the Arduino
    and, most important...
  4. Don't connect relay module GND to Arduino ground.

Use this code to stop relay chatter during bootup

void setup() {
pinMode(relaypin, INPUT_PULLUP); // first enable internal pull up
pinMode(relaypin, OUTPUT); // then set the pin to output
}

Leo..

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.