ออปโตอิเล็กทรอนิกส์ (Optoelectronics)
Optoelectronics
อุปกรณ์กำเนิดแสง • อุปกรณ์รับแสง • 7-Segment • ออปโตคัปเปลอร์ PC817 + ซิมโต้ตอบ
Light emitters • Light detectors • 7-Segment • PC817 optocoupler + live sim
- บอกได้ว่าออปโตอิเล็กทรอนิกส์คืออะไร และแยกอุปกรณ์เป็นฝั่ง กำเนิดแสง กับ รับแสง ได้
- อธิบายการทำงานของ LED, IR LED, เลเซอร์ไดโอด และ 7-Segment display ได้
- เปรียบเทียบ LDR, โฟโตไดโอด, โฟโตทรานซิสเตอร์, โซลาร์เซลล์ (ความไว/ความเร็ว) ได้
- อธิบายโครงสร้างและประโยชน์ของ ออปโตคัปเปลอร์ (PC817) และคำนวณจากค่า CTR ได้
- เช็คอุปกรณ์ออปโตด้วยมัลติมิเตอร์ได้
- State what optoelectronics is and sort devices into emitters vs detectors
- Explain LEDs, IR LEDs, laser diodes and the 7-segment display
- Compare the LDR, photodiode, phototransistor and solar cell (sensitivity/speed)
- Explain the structure and benefits of an optocoupler (PC817) and calculate with its CTR
- Test opto devices with a multimeter
- อุปกรณ์ที่เปลี่ยนพลังงานไฟฟ้าเป็นแสง หรือเปลี่ยนแสงกลับเป็นพลังงานไฟฟ้า
- แบ่งเป็น 2 ฝั่งใหญ่:
💡 ตัวกำเนิดแสง (Emitter): ไฟฟ้า → แสง เช่น LED, เลเซอร์ไดโอด
👁️ ตัวรับแสง (Detector): แสง → ไฟฟ้า เช่น LDR, โฟโตไดโอด - คำว่า "แสง" รวมถึงแสงที่ตามองไม่เห็นด้วย เช่น อินฟราเรด (IR) และอัลตราไวโอเลต (UV)
- จับคู่ emitter + detector = ส่งสัญญาณด้วยแสง เช่น รีโมท, ไฟเบอร์ออปติก, ออปโตคัปเปลอร์
- The field of devices that convert between electricity and light
- Two big families:
💡 Emitters: electricity → light, e.g. LEDs, laser diodes
👁️ Detectors: light → electricity, e.g. LDRs, photodiodes - "Light" includes invisible bands too — infrared (IR) and ultraviolet (UV)
- Pair an emitter with a detector = signalling with light: remotes, fiber optics, optocouplers
- LED: ไดโอดเปล่งแสงเมื่อไบแอสตรง — สีขึ้นกับสารกึ่งตัวนำ (Vf แดง ≈ 1.8 V … น้ำเงิน/ขาว ≈ 3.2 V) ต้องมี R จำกัดกระแสเสมอ (ดูบทไดโอด)
- IR LED (อินฟราเรด): เปล่งแสงที่ตามองไม่เห็น (~940 nm), Vf ต่ำ ≈ 1.2 V — หัวใจของรีโมทและเซนเซอร์วัตถุ
- เลเซอร์ไดโอด: แสงเข้ม เฟสเดียว เป็นลำแคบ — ใช้ในพอยน์เตอร์, เครื่องอ่านบาร์โค้ด, ไฟเบอร์ออปติก ⚠️ ห้ามส่องตา
- LED: emits light under forward bias — color set by the semiconductor (Vf red ≈ 1.8 V … blue/white ≈ 3.2 V). Always needs a current-limit resistor (see the Diode lesson)
- IR LED: emits invisible light (~940 nm), low Vf ≈ 1.2 V — the heart of remotes and object sensors
- Laser diode: intense, coherent, narrow beam — pointers, barcode scanners, fiber optics ⚠️ never aim at eyes
- 7-Segment คือ LED 8 ดวง (แท่ง a–g + จุด dp) เรียงเป็นเลข "8" — เลือกติดทีละแท่งเพื่อแสดงเลข 0–9
- Common Cathode (CC): ขา K ทุกดวงรวมกันต่อ GND → จ่าย ลอจิก HIGH เข้าขาแท่งเพื่อให้ติด
- Common Anode (CA): ขา A ทุกดวงรวมกันต่อ Vcc → ดึงขาแท่งลง LOW เพื่อให้ติด
- ทุกแท่งต้องมี R จำกัดกระแส ของตัวเอง (ห้ามใช้ R ตัวเดียวที่ขา common — ความสว่างจะเปลี่ยนตามจำนวนแท่งที่ติด)
- A 7-segment is 8 LEDs (bars a–g + dot dp) arranged as an "8" — light chosen bars to show 0–9
- Common Cathode (CC): all cathodes tied to GND → drive a segment HIGH to light it
- Common Anode (CA): all anodes tied to Vcc → pull a segment LOW to light it
- Every segment needs its own current-limit resistor (one shared R at the common pin makes brightness vary with digit)
| เลขDigit | แท่งที่ติดSegments on |
|---|---|
| 0 | a b c d e f |
| 1 | b c |
| 7 | a b c |
| 8 | a b c d e f g |
| 9 | a b c d f g |
| อุปกรณ์Device | หลักการPrinciple | ความเร็วSpeed | เหมาะกับBest for |
|---|---|---|---|
| LDR (Light Dependent Resistor) |
ตัวต้านทานที่ค่า R ลดลงเมื่อแสงมาก (มืด ≈ MΩ → สว่าง ≈ kΩ)Resistor whose R drops with light (dark ≈ MΩ → bright ≈ kΩ) | ช้ามาก (ms–s)Very slow (ms–s) | ไฟถนนอัตโนมัติ, วัดความสว่างแบบง่ายAuto street lights, simple light sensing |
| โฟโตไดโอดPhotodiode | ไดโอดที่ ไบแอสกลับ — แสงยิ่งมาก กระแสรั่วย้อนกลับยิ่งมาก (เชิงเส้นดี)Reverse-biased diode — more light, more reverse current (very linear) | เร็วมาก (ns)Very fast (ns) | ไฟเบอร์ออปติก, เครื่องวัดแสง, การสื่อสารFiber optics, light meters, comms |
| โฟโตทรานซิสเตอร์Phototransistor | ทรานซิสเตอร์ที่ใช้ แสงแทนกระแสเบส — ขยายในตัว ไวกว่าโฟโตไดโอด 100–1000 เท่าTransistor whose base current is light — built-in gain, 100–1000× more sensitive than a photodiode | ปานกลาง (µs)Medium (µs) | รีโมท IR, ออปโตคัปเปลอร์, เซนเซอร์นับชิ้นงานIR remotes, optocouplers, object counters |
| โซลาร์เซลล์Solar cell | รอยต่อ PN พื้นที่ใหญ่ ทำงานโหมด photovoltaic — สร้างแรงดันเอง (~0.5–0.6 V/เซลล์)Large-area PN junction in photovoltaic mode — generates its own voltage (~0.5–0.6 V/cell) | — | ผลิตพลังงาน (ต่ออนุกรมเพิ่มแรงดัน)Energy harvesting (series cells for voltage) |
- จับ LED (IR) + โฟโตทรานซิสเตอร์ ใส่ไว้ใน IC ตัวเดียว — สัญญาณข้ามจากฝั่งเข้าไปฝั่งออก ด้วยแสงล้วนๆ ไม่มีสายไฟเชื่อมถึงกัน
- สองฝั่ง แยกกันทางไฟฟ้า (isolation) ทนแรงดันต่างกันได้หลาย kV (PC817 ≈ 5 kV)
- ประโยชน์: แยกกราวด์ สองระบบ, ป้องกันวงจรควบคุม (MCU) จากฝั่งแรงดันสูง, กันสัญญาณรบกวน
- เบอร์ยอดนิยม: PC817 (DIP-4, ทรานซิสเตอร์ออก), 4N35, 6N137 (ความเร็วสูง), MOC3021 (ขับ TRIAC ฝั่งไฟบ้าน)
- An IR LED + phototransistor sealed in one IC — the signal crosses from input to output as pure light, with no wire between the sides
- The two sides are electrically isolated, withstanding several kV between them (PC817 ≈ 5 kV)
- Why: separate the grounds of two systems, protect a controller (MCU) from a high-voltage side, block noise
- Popular parts: PC817 (DIP-4, transistor output), 4N35, 6N137 (high speed), MOC3021 (mains TRIAC driver)
- CTR (Current Transfer Ratio) = อัตราส่วนกระแสออกต่อกระแสเข้า เทียบได้กับ β ของทรานซิสเตอร์
- PC817 มี CTR ≈ 50–300% (แล้วแต่เกรด) เช่น CTR 100%: จ่าย IF = 10 mA → ได้ IC สูงสุด ≈ 10 mA
- งานสวิตช์ควรจ่าย IF เผื่อให้ทรานซิสเตอร์ อิ่มตัว (saturate) ไปเลย → เอาต์พุตชัดเจน HIGH/LOW
- CTR (Current Transfer Ratio) = output current over input current — the opto's version of a transistor's β
- PC817 has CTR ≈ 50–300% (grade-dependent); e.g. CTR 100%: drive IF = 10 mA → up to IC ≈ 10 mA
- For switching, overdrive IF so the transistor saturates → clean HIGH/LOW output
ปรับกระแส LED ฝั่งเข้า (IF) ดูแสงข้ามช่องแยกไปขับโฟโตทรานซิสเตอร์ — กระแสออก IC = CTR × IF ไหลผ่าน RL ทำให้ Vout ตกลงจาก Vcc ถ้าขับแรงพอ ทรานซิสเตอร์จะ อิ่มตัว → Vout ≈ 0.2 V (เอาต์พุตเป็น LOW ชัดเจน)
Adjust the input LED current (IF) and watch light cross the isolation gap to drive the phototransistor — the output current IC = CTR × IF flows through RL, pulling Vout down from Vcc. Drive it hard enough and the transistor saturates → Vout ≈ 0.2 V (a clean LOW).
จุดส้ม = โฟตอน (แสง) — ยิ่ง IF มาก แสงยิ่งหนาแน่น • แถบขวา = Vout Orange dots = photons — more IF, denser light • right bar = Vout
- รีโมทคอนโทรล: IR LED ส่งรหัสแบบกะพริบเร็วบนคลื่นพาห์ 38 kHz → ตัวรับ (เช่น TSOP1738) กรองเฉพาะ 38 kHz จึงไม่กวนด้วยแสงห้อง
- Opto-interrupter (ตัวขวางแสง): LED กับโฟโตทรานซิสเตอร์หันหน้าชนกันเป็นร่อง — วัตถุผ่านร่อง = สัญญาณขาด ใช้นับชิ้นงาน/หาตำแหน่งในพรินเตอร์
- Rotary encoder แบบแสง: จานเจาะรูหมุนตัดลำแสง → นับพัลส์ = ความเร็ว/ตำแหน่งมอเตอร์
- Remote controls: an IR LED blinks a code on a 38 kHz carrier → the receiver (e.g. TSOP1738) filters for 38 kHz, ignoring room light
- Opto-interrupter: LED and phototransistor face each other across a slot — an object in the slot breaks the beam; used for counting/positioning in printers
- Optical rotary encoders: a slotted disc chops the beam → count pulses = motor speed/position
- ไฟเบอร์ออปติก: เลเซอร์/LED ยิงแสงเข้าเส้นใยแก้ว สะท้อนกลับหมดภายใน (total internal reflection) วิ่งได้หลายกิโลเมตร — กระดูกสันหลังของอินเทอร์เน็ต
- เครื่องวัดออกซิเจนปลายนิ้ว (pulse oximeter): LED แดง + IR ยิงผ่านนิ้ว วัดการดูดกลืนแสงของเลือด
- แหล่งจ่ายสวิตชิง: ใช้ออปโตคัปเปลอร์ส่งสัญญาณ feedback ข้ามฝั่งไฟบ้าน↔ฝั่งไฟต่ำอย่างปลอดภัย (มีในที่ชาร์จโทรศัพท์แทบทุกตัว)
- Fiber optics: a laser/LED fires light down a glass fiber with total internal reflection for kilometers — the backbone of the internet
- Pulse oximeters: red + IR LEDs shine through a fingertip, measuring blood's light absorption
- Switching power supplies: an optocoupler carries the feedback signal safely across the mains↔low-voltage barrier (inside nearly every phone charger)
- LED / IR LED: โหมด diode-test — จิ้มถูกขั้วอ่านค่า Vf (IR ≈ 1.1–1.3 V, แดง ≈ 1.8 V, ขาว/น้ำเงิน ≈ 2.6–3 V) LED อาจเรืองแสงจางๆ; กลับขั้วต้องขึ้น OL
- LDR: โหมด Ω — เอามือบัง: ค่า R พุ่งขึ้น (แสน Ω–MΩ), ส่องไฟ: ตกเหลือหลัก kΩ
- โฟโตไดโอด/โฟโตทรานซิสเตอร์: วัด R ขณะบัง vs ส่องไฟ — ต้องต่างกันชัดเจน
- LED / IR LED: diode-test mode — forward reads Vf (IR ≈ 1.1–1.3 V, red ≈ 1.8 V, white/blue ≈ 2.6–3 V), the LED may glow faintly; reversed must read OL
- LDR: Ω mode — cover it: R jumps (100s kΩ–MΩ); shine a light: drops to a few kΩ
- Photodiode/phototransistor: measure R covered vs lit — expect a clear difference
- ออปโตคัปเปลอร์ (PC817):
① diode-test ขา 1→2: ต้องอ่านเหมือน LED (~1.2 V) กลับขั้ว = OL
② วัด Ω คร่อมขา 4-3 (C-E): ปกติ = OL
③ จ่ายไฟให้ LED ฝั่งเข้า (5V ผ่าน R 330Ω เข้าขา 1-2) แล้ววัดขา 4-3 ใหม่ → ค่า R ต้อง ตกฮวบ = ตัวคัปเปลอร์ยังดี
- Optocoupler (PC817):
① diode-test pins 1→2: reads like an LED (~1.2 V), reversed = OL
② measure Ω across pins 4-3 (C-E): normally OL
③ power the input LED (5V through 330Ω into pins 1-2) and re-measure 4-3 → R must drop sharply = coupler is good