Novedad: el cortafuegos de IA supervisa toda la plataforma y explica cada incidente con palabras sencillas. Vea cómo funciona

Optocoupler plus high-side MOSFET into a 24 V PLC input only gives me 9 V

Optocoupler plus high-side MOSFET into a 24 V PLC input only gives me 9 V

Resuelto 5 4

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.

♥ 0

Is the Pi’s ground tied to the 24 V supply’s 0 V somewhere? If so the opto isn’t isolating anything.

♥ 0

No, kept them separate on purpose, that’s why the opto is there.

♥ 0

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.

♥ 0

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.

Solución aceptada♥ 1

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.

♥ 0
Viendo 6 entradas – de la 1 a la 6 (de un total de 6)
  • Debes estar registrado para responder a este debate.

Únete a la conversación

Inicia sesión para preguntar y responder, dar me gusta a las publicaciones útiles y marcar la respuesta que resolvió tu problema. Cada aportación suma puntos y niveles.

Compartir