PC817 optokuplör + yüksek taraflı MOSFET'in 24 V PLC girişine yalnızca 9 V vermesi
Yapay zekâ tarafından English dilinden çevrildi ·
Tesis müdürüyüm, ama evde kendi küçük elektronik işlerimi yapıyorum; bu yüzden buraya geldim.Dolum PLC’mizde, “uzaktan bekletme isteği” olarak kullanmak istediğimiz boş bir 24 V dijital girişimiz var. Plan: bir operatör Hermetry kartındaki bir düğmeye basar, komut pano içindeki bir Raspberry Pi’ye ulaşır, Pi girişi sürer, PLC mevcut çevrimi bitirir ve bekletir. PLC girişi olağan türde: pano 0 V’una karşı +24 V uygulandığında açılır.Kurduğum devre: GPIO17, 330 ohm üzerinden bir PC817 LED’ini sürüyor. 24 V tarafında optokuplörün kollektörü 10k üzerinden +24 V’a, emitörü ise 10k pulldown ile 0 V’a bağlı bir IRFZ44N’nin gate’ine gidiyor. MOSFET drain +24 V’a, source ise PLC girişine bağlı.Optokuplör açıkken PLC girişinde 0 V’a göre yaklaşık 9 V ölçüyorum. Giriş anahtarlanmıyor ve MOSFET ısınıyor. Optokuplör kapalıyken beklendiği gibi 0 V okuyorum.
Plant manager, but I do my own small electronics at home, which is how I ended up here.
Our filler PLC has a spare 24 V digital input that we want as a “remote hold request”. Plan: an operator presses a button on a Hermetry board, the command reaches a Raspberry Pi in the cabinet, the Pi drives the input, the PLC finishes the current cycle and holds. The PLC input is the usual type, it switches on when +24 V is applied against the cabinet 0 V.
What I built: GPIO17 drives a PC817 LED through 330 ohm. On the 24 V side the opto’s collector goes to +24 V through 10k, the emitter to the gate of an IRFZ44N with a 10k pulldown to 0 V. MOSFET drain to +24 V, source to the PLC input.
With the opto on I measure about 9 V on the PLC input against 0 V. The input does not switch, and the MOSFET gets warm. With the opto off it reads 0 V as expected.
Yapay zekâ tarafından English dilinden çevrildi ·
Pi’nin topraklaması bir yerde 24 V besleme kaynağının 0 V’una bağlı mı? Eğer bağlıysa optokuplör hiçbir şeyi izole etmiyor.
Is the Pi’s ground tied to the 24 V supply’s 0 V somewhere? If so the opto isn’t isolating anything.
Yapay zekâ tarafından English dilinden çevrildi ·
Hayır, bilerek ayrı tuttum, optokuplörün orada olma nedeni de bu.
No, kept them separate on purpose, that’s why the opto is there.
Yapay zekâ tarafından English dilinden çevrildi ·
Yüksek tarafta bir N-kanallı MOSFET’in tam olarak açılması için kapısının (gate) kaynağına (source) göre birkaç volt daha yüksek olması gerekir. Aynı 24 V hattından kapıya 24 V’un üzerinde gerilim veremezsiniz; dolayısıyla kaynak, kapıya uygulanan gerilimden eşik gerilimi çıkarıldığında elde edilen değere kadar yükselebilir.
An N-channel on the high side needs its gate several volts above its source to turn on fully. From the same 24 V rail you can’t get the gate above 24 V, so the source can only rise to whatever the gate gets minus the threshold.
Yapay zekâ tarafından English dilinden çevrildi ·
Muhtemelen bu konudaki en az yetkili kişiyim ama kazan dairemizde elektrikçimiz hemen hemen aynı sorunu çözdü ve Emily’nin noktası senin neden 9 V’ta olduğunu açıklıyor. 10k çekme-yukarı ve 10k çekme-aşağı direncin kapıyı yaklaşık 12 V yapıyor, eşik gerilimi çıkarınca kaynak biraz 10 V’un altında kalıyor. MOSFET yarı açık çalıştığı için ısınıyor.Onun çözümü MOSFET’i tamamen çıkarmaktı. Bu tür bir PLC girişi yalnızca birkaç miliamper çeker (bizimki 24 V’ta yaklaşık 5 mA idi, kılavuzda yazıyor) ve bir PC817 transistörü bunu tek başına anahtarlayabilir:
Pi tarafı: GPIO17 -- 330R -- PC817 anot (pin 1), katot (pin 2) -- Pi GND
24 V tarafı: +24 V -- PC817 kollektör (pin 4)
PC817 emitör (pin 3) -- PLC girişi I0.5
PLC giriş ortak ucu -- 0 V
Optokuplör açıkken giriş yaklaşık 24 V görür. Kapalıyken hiçbir şey görmez. Yalıtım korunur. Üzerinde DIN ray klipsi ve etiketi olan bir şey istiyorsan, hazır bir 24 V optokuplör veya röle modülü aynı işi yapar.Hermetry tarafında bekletme komutunu Yüksek etki olarak ayarladı, böylece komutu gönderen kişi onaylamak zorunda. Ancak bir pano kontrolü yüksek etkili komut göndermez, bu yüzden cihazın Komutlar sekmesinden gider. Bir hattı durduran bir bekletme isteği için bunun uygun olduğunu gördük.
Probably the least qualified person in this thread, but our electrician sorted almost the same thing in our boiler room, and Emily’s point is why yours sits at 9 V. Your 10k pull-up and 10k pulldown make the gate about 12 V, minus the threshold gives the source a bit under 10 V. The MOSFET is half on, so it gets warm.
His fix was to throw the MOSFET out. A PLC input like that only draws a few milliamps (ours was about 5 mA at 24 V, the manual says), and a PC817 transistor can switch that by itself:
Pi side: GPIO17 -- 330R -- PC817 anode (pin 1), cathode (pin 2) -- Pi GND
24 V side: +24 V -- PC817 collector (pin 4)
PC817 emitter (pin 3) -- PLC input I0.5
PLC input common -- 0 V
Opto on, the input sees close to 24 V. Opto off, nothing. Isolation stays. If you want something with a DIN rail clip and a label on it, a ready-made 24 V opto or relay module does the same.
On the Hermetry side he set the hold command as High impact so whoever sends it has to confirm. A board control won’t send a high-impact command though, so it goes from the device’s Commands tab. For a hold request that stops a line, we found that was fine.
Yapay zekâ tarafından English dilinden çevrildi ·
MOSFET çıkarıldı ve giriş ölçümle 23,4 V’ta temiz bir şekilde anahtarlanıyor. David’in çizimini okuduktan sonra kendimi aptal hissettim, üç parça eksik. line.hold komutunu, çalıştırmadan önce Sor seçeneğiyle bir kart düğmesinde Basic komutu olarak tuttuk; çünkü bekletme kararını PLC’nin kendisi veriyor, kart yalnızca soruyor. Herkese teşekkürler.
MOSFET is out and the input switches cleanly at 23.4 V, measured. Felt silly after reading David’s sketch, three parts fewer. We kept line.hold as a Basic command on a board button with Ask before running on, because the PLC itself decides when to hold, so the board is only asking. Thanks all.
- Bu konuyu yanıtlamak için giriş yapmış olmalısınız.
Sohbete katılın
Soru sormak ve yanıtlamak, yararlı gönderileri beğenmek ve sorununuzu çözen yanıtı işaretlemek için oturum açın. Her katkı puan ve seviye kazandırır.

