Electronic – Using a voltage divider and an N-channel MOSFET to switch an Arduino input pin from a EL2008 Beckhoff digital output module

level-shiftingmosfetvoltage divider

I need to switch an Arduino input pin (0-5 V, max current is 40 mA) from an EL2008 Beckhoff digital output module (+24 V HIGH, 0V LOW, max output current of 0.5 A) using the circuit depicted below. I have not tested the circuit outside of simulations.

Would it work as desired?

That is, if I connect the source to the Arduino's pin would it

  1. Switch the pin
  2. Not damage the Arduino
  3. Will the resistors burn up from the power being dissipated?

Please note: I am using Vcc from the Arduino as the drain-to-source voltage. Additionally, I've used a battery of 24 V and 48 ohm internal resistance to mimic the HIGH state (@ 0.5 A) of the EL2008 Beckhoff module.

  • N-Channel MOSFET: IRL520N
  • Resistors: 1.5K Ohm and 390 Ohm (both 1/4 W)

enter image description here

Best Answer

Do you need to use a mosfet? Why not just use an optocoupler:

enter image description here

But if you need to use the mosfet, keep the common 0V reference:

enter image description here