0Pricing
Arduino & IoT Academy · درس

تبديل أجهزة التيار العمومي باستخدام Relay

شغّل مصباحًا أو مروحة وأوقفهما من منفذ رقمي.

تبديل أجهزة التيار العمومي باستخدام Relay درس مجاني في Arduino & IoT Academy على CoddyKit. هذا هو الدرس 3 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Arduino & IoT Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Controlling Big Things

Sometimes you want your Arduino to switch a lamp or a fan, not just an LED. For mains-powered gear you reach for a relay. 💡

A Relay Is a Switch

A relay is an electrically controlled switch. A small coil current pulls a metal contact closed, connecting a totally separate, much higher-power circuit.

Electrical Isolation

The coil and the contacts never touch electrically. This isolation is why a 5V Arduino can safely command a 220V device without sharing wires.

Use a Relay Module

Grab a ready-made relay module. It already has the driving transistor, a flyback diode, and screw terminals, so you just supply a control signal.

The Three Control Wires

A typical module has three pins: VCC, GND, and a signal input. Connect signal to any Arduino digital pin to control the relay.

Driving It in Code

Treat the relay like an LED. Set the pin HIGH or LOW to close or open the contact, depending on how your module is wired.

int relay = 7;
pinMode(relay, OUTPUT);
digitalWrite(relay, HIGH); // switch on

Active-Low Surprise

Many modules are active-low: LOW turns the load on and HIGH turns it off. Test yours so the logic in your sketch matches reality.

NO and NC Terminals

The output side offers NO and NC contacts. Normally Open stays off until triggered; Normally Closed is on until the relay switches.

Wire the Load Through COM

Run one mains wire to the COM terminal and the other to NO. When the relay clicks, the circuit closes and your device powers up.

Respect Mains Safety

Mains voltage can kill. Never touch live terminals, keep the high-voltage side enclosed, and have an adult or pro check anything wired to the wall. ⚠️

Hear the Click

When the relay switches you hear a satisfying click as the coil snaps the contact. That sound confirms your code reached the real world.

Quick Check

What is the main reason a relay is used to switch mains-powered devices from an Arduino?

Recap

A relay is an isolated switch: a small signal closes contacts that power big loads. Use a module, mind active-low logic, and respect mains safety. 🚀

الأسئلة الشائعة

هل درس «تبديل أجهزة التيار العمومي باستخدام Relay» مجاني؟

نعم — نص درس «تبديل أجهزة التيار العمومي باستخدام Relay» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Arduino & IoT Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.

ماذا ستتعلم في «تبديل أجهزة التيار العمومي باستخدام Relay»؟

شغّل مصباحًا أو مروحة وأوقفهما من منفذ رقمي. تتمرن على Arduino & IoT Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Arduino & IoT Academy؟

لا تُشترط خبرة سابقة. Arduino & IoT Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 3 من أصل 4.

كم من الوقت يستغرق درس «تبديل أجهزة التيار العمومي باستخدام Relay»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Arduino & IoT Academy هذا؟

نعم. كل درس في Arduino & IoT Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. لماذا تحتاج إلى Driver
  2. السرعة والاتجاه باستخدام H-Bridge
  3. تبديل أجهزة التيار العمومي باستخدام Relay
  4. الحماية من نبضات Flyback
← العودة إلى Arduino & IoT Academy