YOYACHT OPTICSINDUSTRIAL CONNECTIVITY Request a Quote

Wiring between relay and photosensitive module

A photosensitive relay module can be wired by connecting its VCC to 3.3V/5V, GND to ground, and the output pin to a microcontroller or relay input, with optional threshold adjustment via a potentiometer.

Pinout and Connections

Most photosensitive relay modules have three pins:

  • VCC (Power): Connect to a 3.3V or 5V DC supply depending on your module specifications .
  • GND (Ground): Connect to the ground of your power source or microcontroller .
  • OUT (Signal): Provides either an analog voltage proportional to light intensity or a digital HIGH/LOW signal depending on the module configuration . If your module includes a potentiometer, you can adjust it to set the light intensity threshold for the digital output, effectively controlling when the relay switches on or off .

Wiring to a Microcontroller

  1. Analog Output Mode:
    • Connect the OUT pin to an analog input pin on your microcontroller (e.g., A0 on Arduino).
    • Use analogRead() to measure light intensity and implement logic to trigger the relay when a certain threshold is reached .
  2. Digital Output Mode:
    • Connect the OUT pin to a digital input pin on your microcontroller or directly to a relay module that accepts digital signals.
    • The module will output HIGH or LOW depending on light intensity relative to the set threshold .

Example with Arduino

  • VCC → 5V
  • GND → GND
  • OUT → Digital pin D2 (for digital output) or A0 (for analog output)
  • Optional: Adjust the potentiometer to set the light level at which the relay activates . Sample Arduino code for digital output:

CppCopyint sensorPin = 2; // Digital input from moduleint relayPin = 8; // Relay control pinvoid setup() { pinMode(sensorPin, INPUT); pinMode(relayPin, OUTPUT);}void loop() { int lightState = digitalRead(sensorPin); digitalWrite(relayPin, lightState); // Relay follows sensor output}

Safety and Tips

  • Ensure the relay module voltage rating matches your load.
  • Avoid connecting high-voltage AC directly to the microcontroller; use the relay as an intermediary switch.
  • Test the module in a low-voltage setup first to confirm correct operation. By following these steps, your photosensitive relay module will automatically switch devices based on ambient light levels, suitable for applications like automatic lighting, garden lamps, or light-triggered alarms .

Photoresistor Interfacing with Arduino for Light Measurement

This LDR module provides an analog output. Types of Photoresistors According to the features, the photoresistors are of three types:

Photoresistor Module — SunFounder Ultimate Sensor Kit documentation

Photoresistor Module Introduction A photoresistor module is a device that can detect the intensity of light in the environment. It can

Lesson 11: Photoresistor Module

In this lesson, you will learn how to use a photoresistance sensor with an ESP32 Development Board to measure light intensity. We''ll

Amazon : Light Sensor Relay

5V Photosensitive Relay Module with LDR Photoresistor Sensor for Light Detection, Smart Home Automation DIY Projects Add to cart

How to Use Photoresistor Module: Examples, Pinouts, and Specs

Learn how to use the Photoresistor Module with detailed documentation, including pinouts, usage guides, and example projects.

Photo Relay Circuit

Learn about photo relay circuits with working principles, circuit diagrams, and parts list for practical applications in

Lesson 11: Photoresistor Module

Lesson 11: Photoresistor Module In this lesson, you will learn how to use a photoresistance sensor with an ESP32 Development

Photoelectric Sensor Wiring, Setup, and Troubleshooting

First, we will show you how to wire the Through-Beam photoelectric sensor emitter. Through-Beam sensors have two separate

How to Use Relay with optocoupler: Examples, Pinouts, and Specs

Learn how to use the Relay with optocoupler with detailed documentation, including pinouts, usage guides, and example projects.

Still Have a Technical Question?

Our team can help review your product selection.

Ask Our Team