Переключение сетевых устройств реле
Переключайте лампу или вентилятор с цифрового контакта.
«Переключение сетевых устройств реле» — бесплатный урок 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 onActive-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. 🚀
Часто задаваемые вопросы
Урок «Переключение сетевых устройств реле» бесплатный?
Да — полный текст урока «Переключение сетевых устройств реле» бесплатно доступен здесь в веб-версии. Чтобы практиковать его интерактивно (встроенный редактор кода и ИИ-репетитор 24/7) и разблокировать остальной курс Arduino & IoT Academy, подпишись на CoddyKit PRO. Курс Arduino & IoT Academy содержит 4 уроков всего.
Чему я научусь в уроке «Переключение сетевых устройств реле»?
Переключайте лампу или вентилятор с цифрового контакта. Ты практикуешь Arduino & IoT Academy с помощью реального кода, который запускаешь прямо в браузере, и ИИ-репетитор 24/7 отвечает на твои вопросы во время урока.
Нужен ли мне опыт, чтобы начать Arduino & IoT Academy?
Предыдущий опыт не требуется. Arduino & IoT Academy на CoddyKit структурирован для всех уровней — от новичков до продвинутых, поэтому ты можешь начать отсюда или с самого начала и учиться в своем темпе. Это урок 3 из 4.
Сколько времени занимает урок «Переключение сетевых устройств реле»?
Большинство уроков CoddyKit занимают около 5–10 минут. Каждый из них компактный и интерактивный, поэтому ты постоянно делаешь прогресс и продолжаешь с того же места в веб-версии и приложении.
Можно ли писать и запускать код в этом уроке Arduino & IoT Academy?
Да. Каждый урок Arduino & IoT Academy включает встроенный редактор кода, поэтому ты пишешь и запускаешь реальный код прямо в браузере и получаешь моментальную обратную связь от AI — локальная установка не требуется.
Все уроки этого курса
- Зачем нужен драйвер
- Скорость и направление с Н-мостом
- Переключение сетевых устройств реле
- Защита от выбросов обратной ЭДС