กลับไปหน้ารวมไฟล์
basic-setup-for-arduino-with-relay-08d7db-en.md

Connections

1). Relay to Arduino Connection

  • Connect the Vcc pin of Relay to Arduino 5V
  • Connect the GND pin of Relay to Arduino GND
  • Connect the IN pin(Input pin) of Relay to Arduino digital pin D3

2). Relay to LED connection

The relay module has 3pin screw terminal.

a). NO - Normally open

b). COM - Common

c). NC - Normally closed

High voltage connections can be made to this screw terminal. For example: Bulb, ceiling fan etc., But in this project we are just using an LED.

When you make the connection between a) and b), the connected LED is always ON until it receives a signal from the Arduino to turn it OFF.

When you make the connection between b) and c), the connected LED is OFF until it receives a signal from the Arduino to turn it ON.

I have used breadboard to make connections easier. See the circuit diagram to understand better!

End Result

EXPANDED TECHNICAL DETAILS

Electrical Isolation Fundamentals

This foundational project teaches how to safely bridge the gap between low-voltage 5V electronics and high-voltage AC mains appliances.

  • Opto-Isolation Hub: The relay module features an onboard optocoupler (PC817) that electrically separates the Arduino from the 220V/110V load. This prevents back-EMF or high-voltage failures from damaging the microcontroller.
  • Switching Logic: The Arduino provides a digital HIGH or LOW to the relay "Signal" pin, which activates an internal electromagnet to physically flip a mechanical switch.

Safety Precautions

  • Terminal Block Management: Explains the difference between NO (Normally Open) and NC (Normally Closed) connections, allowing for fail-safe configurations where the appliance default is OFF during a power loss.

ข้อมูล Frontmatter ดั้งเดิม

title: "Basic setup for Arduino with Relay"
description: "Using relay as a switch to turn ON/OFF LED."
author: "techvaler"
category: ""
tags:
  - "smart appliances"
views: 28981
likes: 1
price: 870
difficulty: "Easy"
components:
  - "1x Relay Module (Generic)"
  - "1x Arduino UNO"
  - "1x LED (generic)"
  - "1x USB-A to B Cable"
  - "1x Breadboard (generic)"
  - "1x Jumper wires (generic)"
  - "1x Resistor 220 ohm"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles:
  - "https://projects.arduinocontent.cc/0f39b4d6-da01-487b-99a1-11bbede3abd7.ino"
documentationLinks: []
passwordHash: "5cdb15b4e61a84e17d1067b58791b0b42964c0086aa3fd57c46c73e3b23424b6"
encryptedPayload: "U2FsdGVkX1/3dG88IeZfU4wZyiC+6jQ2c3h2eYFcL/NhHFb6miNgEqsHKw1gYnoPpsulWL3YJ4zJTiW2P1TkUobq/9uk8DxkpKKMO3pOyQ0="
seoDescription: "Learn how to set up Arduino with Relay to control an LED switch. Simple guide for beginners."
videoLinks:
  - "https://www.youtube.com/embed/rxDh1CqR9iY"
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/basic-setup-for-arduino-with-relay-08d7db_cover.jpg"
lang: "en"