0Pricing
Arduino & IoT Academy · レッスン

リレーで商用電源機器を切り替える

デジタルピンからランプやファンをオン・オフします。

「リレーで商用電源機器を切り替える」はCoddyKit上の無料Arduino & IoT Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これは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. 🚀

よくある質問

「リレーで商用電源機器を切り替える」レッスンは無料ですか?

はい。「リレーで商用電源機器を切り替える」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Arduino & IoT Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Arduino & IoT Academyコースには全4レッスンが含まれています。

「リレーで商用電源機器を切り替える」で何を学びますか?

デジタルピンからランプやファンをオン・オフします。 ブラウザで直接実行するハンズオンコードでArduino & IoT Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Arduino & IoT Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのArduino & IoT Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「リレーで商用電源機器を切り替える」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このArduino & IoT Academyレッスンでコードを書いて実行できますか?

はい。すべてのArduino & IoT Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. ドライバーが必要な理由
  2. Hブリッジで速度と方向を制御する
  3. リレーで商用電源機器を切り替える
  4. 逆起電力のスパイクから保護する
← Arduino & IoT Academyに戻る