8-CH 12V ULN2003 Based Relay Board
8-CH 12V ULN2003 Based Relay Board
The 8-CH 12V ULN2003 Based Relay Board is a versatile and reliable printed circuit board (PCB) designed for switching high-power devices and appliances using low-voltage control signals. This relay board is equipped with eight individual relays, each capable of handling a maximum voltage of 12V and a maximum current of 2A. The board is built around the ULN2003 Darlington transistor array, which provides a high current gain and enables the relays to switch high-power loads with ease.
The primary function of the 8-CH 12V ULN2003 Based Relay Board is to provide a convenient and isolated way to control high-power devices, such as lights, motors, and solenoids, using low-voltage signals from microcontrollers, single-board computers, or other digital devices. The relays on the board can be triggered using digital input signals, allowing for precise control over the connected devices.
The 8-CH 12V ULN2003 Based Relay Board is suitable for a wide range of applications, including |
Electromagnetic relay
12V
2A
Digital input signal (TTL compatible)
-20C to 80C
-40C to 125C
85mm x 55mm x 18mm (L x W x H)
The relay board should be used in a well-ventilated area, away from moisture and humidity.
The board should be powered from a stable 12V power supply.
The relays should be used within their rated current and voltage specifications to ensure reliable operation.
The board should be handled with care to avoid damaging the components or the PCB.
8-CH 12V ULN2003 Based Relay Board Documentation
Overview
The 8-CH 12V ULN2003 Based Relay Board is a versatile IoT component designed to control up to 8 external devices or loads using a microcontroller or microprocessor. The board is based on the ULN2003 Darlington array, which provides high current and voltage capabilities, making it suitable for a wide range of applications.
Pinouts and Connections
The relay board has the following pinouts and connections:
VCC: 12V power input
GND: Ground connection
IN1-IN8: Input pins for controlling the relays (active low)
Relay 1-8: Normally Open (NO) and Normally Closed (NC) contacts for each relay
Code Examples
### Example 1: Arduino Uno Control
This example demonstrates how to control the relay board using an Arduino Uno microcontroller. We will turn on Relay 1 and Relay 3 for 5 seconds, then turn them off.
```c++
const int relayPins[] = {2, 3, 4, 5, 6, 7, 8, 9}; // define the input pins for the relay board
void setup() {
for (int i = 0; i < 8; i++) {
pinMode(relayPins[i], OUTPUT);
}
}
void loop() {
digitalWrite(relayPins[0], LOW); // turn on Relay 1
digitalWrite(relayPins[2], LOW); // turn on Relay 3
delay(5000);
digitalWrite(relayPins[0], HIGH); // turn off Relay 1
digitalWrite(relayPins[2], HIGH); // turn off Relay 3
delay(5000);
}
```
### Example 2: Raspberry Pi Control using Python
This example demonstrates how to control the relay board using a Raspberry Pi and Python. We will turn on Relay 2 and Relay 4 for 5 seconds, then turn them off.
```python
import RPi.GPIO as GPIO
import time
# set up GPIO mode
GPIO.setmode(GPIO.BCM)
# define the input pins for the relay board
relayPins = [17, 23, 24, 25, 12, 16, 20, 21]
# set up the input pins as outputs
for pin in relayPins:
GPIO.setup(pin, GPIO.OUT)
try:
while True:
GPIO.output(relayPins[1], GPIO.LOW) # turn on Relay 2
GPIO.output(relayPins[3], GPIO.LOW) # turn on Relay 4
time.sleep(5)
GPIO.output(relayPins[1], GPIO.HIGH) # turn off Relay 2
GPIO.output(relayPins[3], GPIO.HIGH) # turn off Relay 4
time.sleep(5)
except KeyboardInterrupt:
GPIO.cleanup()
```
### Example 3: ESP32 Control using MicroPython
This example demonstrates how to control the relay board using an ESP32 microcontroller and MicroPython. We will turn on Relay 5 and Relay 7 for 5 seconds, then turn them off.
```python
import machine
import utime
# define the input pins for the relay board
relayPins = [23, 18, 5, 15, 4, 2, 12, 13]
# set up the input pins as outputs
for pin in relayPins:
machine.Pin(pin, machine.Pin.OUT)
while True:
relayPins[4].value(0) # turn on Relay 5
relayPins[6].value(0) # turn on Relay 7
utime.sleep(5)
relayPins[4].value(1) # turn off Relay 5
relayPins[6].value(1) # turn off Relay 7
utime.sleep(5)
```
Note: In all examples, ensure that the relay board is properly connected to the microcontroller or microprocessor, and that the input pins are correctly defined in the code.