4 Channel Solid State Relay (SSR) Documentation
The 4 Channel Solid State Relay (SSR) is a digital switch that allows you to control four independent channels of high-current loads using low-voltage digital signals. This component is commonly used in IoT applications to control devices such as lamps, motors, and HVAC systems.
The 4 Channel SSR has the following pinouts:
VCC: Power supply (typically 5V or 12V)
GND: Ground
IN1, IN2, IN3, IN4: Digital input channels (active low)
CH1, CH2, CH3, CH4: Output channels (connected to load)
Example 1: Controlling LED Lamps with Arduino
In this example, we will use an Arduino Uno board to control four LED lamps using the 4 Channel SSR.
Code
```c++
const int lampPins[] = {2, 3, 4, 5}; // Digital pins connected to SSR input channels
void setup() {
for (int i = 0; i < 4; i++) {
pinMode(lampPins[i], OUTPUT);
}
}
void loop() {
// Turn on lamp 1
digitalWrite(lampPins[0], LOW);
delay(1000);
// Turn off lamp 1 and turn on lamp 2
digitalWrite(lampPins[0], HIGH);
digitalWrite(lampPins[1], LOW);
delay(1000);
// Turn off lamp 2 and turn on lamp 3
digitalWrite(lampPins[1], HIGH);
digitalWrite(lampPins[2], LOW);
delay(1000);
// Turn off lamp 3 and turn on lamp 4
digitalWrite(lampPins[2], HIGH);
digitalWrite(lampPins[3], LOW);
delay(1000);
// Turn off all lamps
for (int i = 0; i < 4; i++) {
digitalWrite(lampPins[i], HIGH);
}
delay(1000);
}
```
Example 2: Controlling a Motor with Raspberry Pi
In this example, we will use a Raspberry Pi to control a DC motor using the 4 Channel SSR.
Code
```python
import RPi.GPIO as GPIO
import time
# Set up GPIO mode
GPIO.setmode(GPIO.BCM)
# Define motor control pins
motor_pins = [17, 23, 24, 25] # Digital pins connected to SSR input channels
# Set up motor control pins as outputs
for pin in motor_pins:
GPIO.setup(pin, GPIO.OUT)
try:
while True:
# Turn on motor
GPIO.output(motor_pins[0], GPIO.LOW)
time.sleep(2)
# Turn off motor
GPIO.output(motor_pins[0], GPIO.HIGH)
time.sleep(2)
# Toggle motor on and off
for i in range(4):
GPIO.output(motor_pins[i], GPIO.LOW)
time.sleep(0.5)
GPIO.output(motor_pins[i], GPIO.HIGH)
time.sleep(0.5)
except KeyboardInterrupt:
# Clean up GPIO on exit
GPIO.cleanup()
```
Note: In both examples, ensure that the SSR is properly powered and the output channels are connected to the loads (LED lamps or motor) according to the datasheet and safety guidelines.
Datasheet: [4 Channel Solid State Relay Datasheet](https://www.example.com/4-channel-ssr-datasheet.pdf)
Application Notes: [Using Solid State Relays in IoT Applications](https://www.example.com/using-ssr-in-iot-applications.pdf)