ห้องแล็บวงจรรีเลย์ — OMRON MY4
Relay Control Lab — OMRON MY4
ต่อวงจรควบคุม 24VDC ด้วยรีเลย์ 4 หน้าสัมผัสบนแผงเสมือน — เดินสายเอง เห็นกระแสวิ่งจริง
Wire real 24VDC control circuits with 4-pole relays on a virtual panel — run your own jumpers and watch the current flow
รู้จัก OMRON MY4
Meet the OMRON MY4
MY4 คือรีเลย์ขนาดเล็กแบบ 4PDT — มีหน้าสัมผัสสลับ (COM–NC–NO) ถึง 4 ชุด ที่ขยับพร้อมกันด้วยคอยล์เดียว ตัวที่ใช้ในแล็บนี้เป็นรุ่นคอยล์ 24VDC (~650Ω) เสียบบนซ็อกเก็ต 14 ขา
The MY4 is a miniature 4PDT relay — four changeover contact sets (COM–NC–NO) that all move together on a single coil. This lab uses the 24VDC coil version (~650Ω) on a 14-pin socket.
| ชุดหน้าสัมผัส | Contact set | COM | NO | NC |
|---|---|---|---|---|
| 1 | 9 | 5 | 1 | |
| 2 | 10 | 6 | 2 | |
| 3 | 11 | 7 | 3 | |
| 4 | 12 | 8 | 4 | |
| คอยล์ | Coil | 14 (+) — 13 (−) | ||
💡 จำง่ายๆ: ชุดที่ n → COM = ขา 8+n, NO = ขา 4+n, NC = ขา n • คอยล์: ต่อ + ที่ขา 14 และ − (0V) ที่ขา 13 • ดึงเข้าเมื่อคอยล์ได้ ≥ ~16.8V และปล่อยเมื่อต่ำกว่า ~2.4V (hysteresis) 💡 Easy rule: set n → COM = pin 8+n, NO = pin 4+n, NC = pin n • coil: wire + to pin 14 and − (0V) to pin 13 • pulls in at ≥ ~16.8V and releases below ~2.4V (hysteresis)
จุดพักไฟ (เทอร์มินอลบล็อก) คืออะไร
What is a Terminal Block?
จุดพักไฟ หรือ เทอร์มินอลบล็อก (Terminal Block) — ที่ร้านไฟฟ้าเรียกกันหลายชื่อ: เทอร์มินอลสตริป, ขั้วต่อสายไฟ, "เทอร์มินอล 12 ช่อง", หรือแบบรางปีกนก (DIN rail) ในตู้คอนโทรล ข้างในแต่ละ "จุด" มีแผ่นทองเหลือง 1 ชิ้นที่เชื่อมทุกรูในจุดนั้นถึงกันหมด ส่วนจุดที่อยู่ติดกันถูกแผ่นกั้นแยกออกจากกัน — ไม่ถึงกัน (ถ้าอยากให้ถึงกันต้องใส่ "หวี" จัมเปอร์คร่อม)
A terminal block (terminal strip, barrier strip, or DIN-rail terminal in a control panel) holds one brass plate per terminal, tying every hole of that terminal together. Neighbouring terminals are separated by barriers and stay isolated — bridge them with a jumper comb if you want them common.
ทำไมตู้คอนโทรลจริงต้องมี
Why real panels always have one
- ห้ามยัดสายหลายเส้นเข้าสกรูตัวเดียว — ขา COM ของรีเลย์มีรูเดียว แต่วงจรล็อกตัวเองต้องแตกไป 3 ทาง จึงลากมาพักที่เทอร์มินอลแล้วค่อยแตกออก
- เป็นจุดวัดไฟ — เอาโพรบมัลติมิเตอร์จิ้มที่จุดพักได้เลย ไม่ต้องรื้ออุปกรณ์
- แยกสายในตู้ ↔ สายนอกตู้ — ปุ่มกด/ไฟหน้าตู้ และมอเตอร์ข้างนอก มาจบที่เทอร์มินอล เปลี่ยนอุปกรณ์ทีหลังได้โดยไม่ต้องรื้อวงจรในตู้
- ทำเลขสายได้ — ติดเลขที่จุดพัก (TB-1, TB-2, …) แล้วไล่วงจรตามแบบได้ง่าย
- Never stack many wires under one screw — a relay COM pin has a single hole, but a self-holding circuit needs three branches, so the wire lands on a terminal and fans out from there
- A built-in test point — probe the terminal with a multimeter without disturbing any device
- Splits panel wiring from field wiring — door buttons/lamps and outside motors all end at the block, so parts can be swapped without touching the panel circuit
- Enables wire numbering — label the terminals (TB-1, TB-2, …) and tracing against the drawing becomes easy
💡 ทางไฟฟ้าแล้วจุดพักไฟ "ไม่ทำอะไรเลย" — มันไม่ใช่โหลด ไม่กินแรงดัน เป็นแค่จุดที่สายหลายเส้นมาเจอกัน ลองเปิดตัวอย่าง "วงจรล็อกตัวเอง" แล้วคลิกที่จุด TB-1 ดู — ทุกสายที่ถึงกันทางไฟฟ้าจะกระพริบพร้อมกัน 💡 Electrically a terminal block does nothing — it is not a load and drops no voltage; it is just where several wires meet. Open the self-holding example and click terminal TB-1 — every wire on that same node blinks together.
ทำไมปุ่ม STOP / ปุ่มฉุกเฉิน ต้องเป็น NC เสมอ
Why STOP / E-Stop Buttons Are Always NC
ปุ่ม START ใช้หน้าสัมผัส NO (กดแล้วต่อ) — ถูกต้องแล้ว เพราะถ้าสายขาด ผลคือ "สั่งเดินไม่ได้" ซึ่งไม่อันตราย แต่ปุ่ม STOP และปุ่มหยุดฉุกเฉิน (E-Stop) ต้องเป็น NC (ปกติต่อ กดแล้วตัด) เสมอ เพราะมันต่ออนุกรมอยู่ในเส้นคอยล์ — อะไรก็ตามที่ทำให้เส้นนั้นขาด (สายหลุด หน้าสัมผัสไหม้ ขั้วคลาย สายโดนหนูกัด) จะให้ผลเหมือน "มีคนกดปุ่มหยุด" คือเครื่องหยุดเอง นี่คือหลัก fail-safe: ความเสียหายต้องพาระบบไปสู่สถานะปลอดภัย
A START button uses an NO contact — that is correct, because a broken wire only means "cannot start", which is harmless. But a STOP button and an emergency stop must always be NC (closed at rest, opens when pressed). It sits in series with the coil line, so anything that breaks that line — a wire pulled loose, a burnt contact, a loose terminal, a chewed cable — has the same effect as someone pressing STOP: the machine stops by itself. That is the fail-safe principle: a fault must drive the system towards the safe state.
ลองพิสูจน์เองในแผงด้านล่าง — มีตัวอย่างให้เทียบกัน 2 วงจร ทำงานเหมือนกันเป๊ะตอนทุกอย่างปกติ
Prove it yourself on the panel below — two examples behave identically while everything is intact
- เปิดตัวอย่าง "fail-safe ✔ STOP แบบ NC" → กด START (มอเตอร์เดินค้าง) → กดปุ่ม 🗑 ลบ แล้วคลิกสายเส้นใดก็ได้ที่ต่อกับปุ่ม STOP → มอเตอร์หยุดทันทีเอง = ปลอดภัย
- เปิดตัวอย่าง "fail-safe ✘ STOP แบบ NO ผ่านรีเลย์" → กด START → กด STOP ก็หยุดได้ปกติ ดูเหมือนใช้งานได้ • แต่ลองกด START ใหม่ แล้วลบสายที่ปุ่ม STOP → คราวนี้ กด STOP เท่าไรมอเตอร์ก็ไม่หยุด เพราะการหยุดต้องอาศัยสายที่ยังดีอยู่
- สรุป: อย่าออกแบบให้ "การหยุด" ต้องพึ่งอุปกรณ์หรือสายที่ยังทำงานได้ — ให้การหยุดเกิดจากการขาดวงจรแทน
- Open "Fail-safe ✔ NC STOP" → press START (the motor seals in) → hit 🗑 Delete and click any wire on the STOP button → the motor stops instantly by itself = safe
- Open "Fail-safe ✘ NO stop through a relay" → START runs, STOP stops, it looks perfectly fine • now start it again and delete a wire on the STOP button → pressing STOP no longer stops anything, because stopping relies on an intact wire
- Rule: never make "stopping" depend on something still working — make stopping happen through a broken circuit instead
⚠ ของจริงเพิ่มอีกชั้น: ปุ่ม E-Stop ต้องเป็นแบบ หัวเห็ดกดค้าง-บิดปลด (ปลดล็อกเองไม่ได้), หน้าสัมผัสเป็นแบบ บังคับเปิด (positive-opening) คือถึงหน้าสัมผัสเชื่อมติดกันก็ยังถูกก้านดันให้แยกออก และวงจรความปลอดภัยจริงมักใช้ 2 ช่องทางคู่กัน (dual-channel) ⚠ Real installations add more: an E-Stop must be a latching mushroom head (it cannot reset itself), its contacts must be positive-opening (the plunger forces them apart even if they have welded shut), and real safety circuits are usually dual-channel
ไดโอดกันย้อน (Flyback) และ RC Snubber คร่อมคอยล์
Flyback Diode & RC Snubber Across the Coil
คอยล์รีเลย์คือตัวเหนี่ยวนำ — กระแสในตัวเหนี่ยวนำเปลี่ยนทันทีไม่ได้ พอเราตัดไฟคอยล์ (สวิตช์/ทรานซิสเตอร์เปิดวงจร) กระแสที่ยังไหลอยู่ถูกบังคับให้หยุดเร็วมาก คอยล์จึงสร้างแรงดันย้อนกลับพุ่งขึ้นได้ถึงหลายร้อยโวลต์ (v = L·di/dt) ผลคือหน้าสัมผัสสวิตช์เกิดอาร์ก ไหม้ดำ อายุสั้นลง และถ้าขับด้วยทรานซิสเตอร์/MOSFET ก็พังได้ในพริบตา
A relay coil is an inductor — its current cannot change instantly. When you cut the coil supply (a switch or transistor opens), the still-flowing current is forced to stop very fast, so the coil throws back a spike of hundreds of volts (v = L·di/dt). That arcs and blackens switch contacts, shortening their life, and it destroys a driving transistor or MOSFET almost immediately.
- คอยล์ DC → ใช้ไดโอด ต่อกลับขั้วคร่อมคอยล์ (แถบคาดชี้ไปด้าน +) ปกติไม่นำกระแส แต่ตอนตัดไฟมันเปิดทางให้กระแสวนในคอยล์จนหมดพลังงาน — แรงดันย้อนถูกจำกัดเหลือ ~0.7V
- คอยล์ AC → ใช้ RC snubber (เช่น 100Ω + 0.1µF ต่ออนุกรมแล้วคร่อมคอยล์) เพราะไดโอดใช้กับ AC ไม่ได้ • หรือใช้ MOV/varistor
- ผลข้างเคียง: ไดโอดทำให้รีเลย์ปล่อยช้าลง (หน่วงเป็นมิลลิวินาที) ถ้าต้องการให้ตัดไว ให้ใส่ซีเนอร์อนุกรมกับไดโอด
- ตำแหน่งที่ถูก: ต่อชิดคอยล์ที่สุด ไม่ใช่ที่ปลายสายอีกฝั่งของตู้
- DC coil → use a diode across the coil, reverse-biased (band towards +). It conducts nothing normally, but at switch-off it lets the coil current circulate until the energy is gone — the kickback is clamped to ~0.7V
- AC coil → use an RC snubber (e.g. 100Ω + 0.1µF in series across the coil), since a diode cannot work on AC • an MOV/varistor also works
- Side effect: the diode makes the relay release more slowly (milliseconds). If you need fast drop-out, put a zener in series with the diode
- Fit it as close to the coil as possible, not at the far end of the cable
📌 หมายเหตุ: แผงจำลองหน้านี้คำนวณแบบ DC สถานะคงตัว จึงยังไม่จำลองแรงดันพุ่งตอนตัดไฟ — จึงยังไม่มีไดโอดให้วางบนแผงนี้ อยากเห็นของจริงให้ไปที่ หน้าเบรดบอร์ด (มีตัวอย่างออปโต → ทรานซิสเตอร์ขับคอยล์รีเลย์ พร้อมไดโอด flyback ให้ต่อเอง) และอ่านทฤษฎีเพิ่มที่ บทรีเลย์ 📌 Note: this panel solves the circuit as steady-state DC, so the switch-off spike is not simulated and there is no diode part here. To see it in action use the breadboard page (it has an opto → transistor relay-coil driver example with a flyback diode), and read the theory in the relay lesson
แผงทดลอง
The Panel
ลองทำดู
Try This
- 🎯 ภารกิจ — ต่อเองแล้วให้ระบบตรวจให้ มี 7 โจทย์ไล่ระดับ (คุมไฟด้วย NO → สลับ NC/NO → ล็อกตัวเอง → AND → OR → อินเตอร์ล็อก → กลับทางหมุนมอเตอร์) กด เตรียมอุปกรณ์ เพื่อวางอุปกรณ์ที่ต้องใช้ เดินสายเอง แล้วกด ตรวจคำตอบ — ระบบจะบิด/กดสวิตช์แทนคุณทีละขั้นแล้วบอกว่าขั้นไหนผ่าน/ไม่ผ่าน และได้ผลอะไรแทน
- เลือกจากเมนู 💡 ตัวอย่าง — มี 9 วงจร: พื้นฐาน, วงจรล็อกตัวเอง START/STOP, อินเตอร์ล็อก, ลอจิก AND/OR, สลับไฟ NC/NO, สัญญาณเตือน+ปุ่มรับทราบ, fail-safe แบบ NC ✔ / แบบ NO ✘ (ไว้ทดลองตัดสาย) และกลับทางหมุนมอเตอร์ FWD/REV (ติดตรงไหนให้เปิดตัวอย่างดูเป็นแนวทางได้)
- ลองตัวอย่าง "วงจรล็อกตัวเอง" — กดปุ่มเขียว START แป๊บเดียวแล้วปล่อย ไฟยังติดค้าง (รีเลย์ล็อกตัวเองผ่านหน้าสัมผัส NO) จนกดปุ่มแดง STOP
- คลิกที่จุด TB-1 บนแถบจุดพักไฟด้านล่าง — สายทุกเส้นที่ต่ออยู่จุดเดียวกันจะกระพริบพร้อมกัน เพราะทั้งหมดเป็น "จุดเดียวกัน" ทางไฟฟ้า
- ลองต่อวงจรเองโดยพักสายที่ต้องแตกหลายทางไว้ที่เทอร์มินอล แทนการยัดสายซ้อนกันที่ขาอุปกรณ์ — จะไล่วงจรง่ายขึ้นมาก
- กดปุ่ม 🔀 ดูแผนภาพ เพื่อสลับดูวงจรเดียวกันในรูปแบบ Ladder Diagram — เส้นสีเขียวคือทางที่มีกระแสไหลจริงตามสถานะปัจจุบัน
- คลิกตัวรีเลย์/ไฟ (โหมดปกติ) เพื่ออ่านค่าแรงดัน/กระแส และลองต่อวงจรเองด้วยปุ่มเพิ่มอุปกรณ์ + เดินสาย
- 🎯 Missions — build it yourself and get it graded. Seven graded tasks (NO contact → NC/NO swap → self-holding → AND → OR → interlock → motor forward/reverse). Press Set up parts to place what you need, wire it yourself, then press Check — the lab flips the switches for you step by step and reports which steps pass, which fail, and what happened instead
- Pick from the 💡 Example menu — 9 circuits: basic, self-holding START/STOP, interlock, AND/OR logic, NC/NO swap, alarm + acknowledge, fail-safe NC ✔ / NO ✘ (for the wire-cut test) and motor forward/reverse (open one as a reference if you get stuck)
- Try "self-holding" — tap the green START button briefly and release; the lamp stays on (the relay seals itself in via its NO contact) until you press red STOP
- Click terminal TB-1 on the block along the bottom — every wire landing on it blinks at once, because they are all electrically one point
- Build your own circuit and park any branching wire on a terminal instead of stacking wires on a device pin — tracing gets far easier
- Press 🔀 Schematic to see the same circuit as a ladder diagram — green lines show where current actually flows in the present state
- Click a relay/lamp (normal mode) to read its voltage/current, and build your own circuits with the add-part buttons + wiring