2
\$\begingroup\$

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

\$\endgroup\$
6
  • \$\begingroup\$ It won't work. As it is connected now, P23 is always connected to GND. If you use the nMOSFET you need to change D1 into a resistor and connect the drain to P23. Or use a pMOSFET, get rid of the diode and connect a resistor between source and GND. Connect P23 to the source. \$\endgroup\$ – Swedgin Feb 19 at 10:00
  • \$\begingroup\$ Should D23 be above the MOSFET? \$\endgroup\$ – GRANDMAST3R5 Feb 19 at 10:04
  • \$\begingroup\$ As for the power dissipated: P = UI = U * U / R so that's 0.3W. I'd use resistors of an order x1000 bigger. \$\endgroup\$ – Swedgin Feb 19 at 10:04
  • \$\begingroup\$ Depends on the mosfet. Trace your line now, it goes directly to the negative pole of the your 24V source. \$\endgroup\$ – Swedgin Feb 19 at 10:05
  • \$\begingroup\$ I'm using an N-channel, therefore current travels into drain and out of source, correct? If I put the Vout of the D23 pin above the MOSFET, it should travel into the pin, correct? \$\endgroup\$ – GRANDMAST3R5 Feb 19 at 10:10
3
\$\begingroup\$

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

\$\endgroup\$
3
  • 2
    \$\begingroup\$ Thanks for the suggestion. Could I ask, why have you got a 51K ohm resistor, specifically? \$\endgroup\$ – GRANDMAST3R5 Feb 19 at 10:16
  • \$\begingroup\$ @GRANDMAST3R5 For the PC817 you can use values as low as a few hundred ohms. Typical internal pull-ups in micro-controllers normally go from 10k to 150k. In both circuits above you can even disregard the pull-up resistors if the digital input can be configured with an internal one. \$\endgroup\$ – vangelo Feb 19 at 10:24
  • 2
    \$\begingroup\$ upvote for recommending an optocoupler. \$\endgroup\$ – Swedgin Feb 19 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.