Is it safe to output pin to 12V through a resistor?

We speak about Arduino Nano (ATmega328P).

For a certain reason it might happen in my project that a digital output pin (say, D8) to be wired to 10…11V thru a fairly big (≈6 kΩ) resistor. This would mean a less than 1 mA current, but in the “wrong” direction. Do I have chances to damage the board? Note that this usually won't happen as this pin shouldn't stay normally on high output, rather on either high impedance (input) or low output state. But running a buggy code always might happen…

Welcome to the forum.

Can you make that resistor 60 kΩ or 600 kΩ ?

It is possible, as long as the ATmega chip and the circuit draws more than 1mA all the time.

Suppose that you have a energy-efficient circuit and the ATmega is in sleep mode. Then the 1mA will flow via the internal ESD diodes to VCC. That 1mA might lift the VCC towards the 12V, damaging the ATmega chip.

Because of the internal ESD diodes, it does not matter if the pin is input or output. Only when it is set as output and it is low, then that 1mA goes into the GND.

Have you heard about the XY-problem ? https://xyproblem.info/
Can you tell more about your project ? Can you show a schematic ?

Your resistor is R1 Pick another resistor R2 to make a voltage divider and you can safely connect it to your Arduino pin and even measure the voltage of your 12V source.

Want to drive a 12V 2-way valve using a digital pin (D8). The valve works in the following way:

  • If the contol pin gets 12V, the valve will open the A branch.
  • Otherwise (that is, grounded OR left floated) the valve will go on B branch.

We have 2 problems here:

  • level shifting (5→12V)
  • Arduino might give enough current drive the control pin but for the sake of safety I'd use an amplifier instead.

The obvious solution would be a PNP Darlington (TIP125…127 or similar):

  • in high impedance (input mode of D8) the collector current is cut, regardless of the actual voltage level of D8. Hence the control pin will float.
  • when the D8 is set to low, this will inject current to collector hence put the control pin to ≈ 10…11V.

The problem is when D8 is accidentally lelft on high (5V).

Do you have a better idea? The space on the PCB is very limited. Minimal set of components is required.

Update: unfortunately cannot give a good answer if you ask about the control current on the valve. I measured as low as 14 mA, but you cannot have too much confidence on a low-grade Chinese gadget, and there are chances that this thing will get replaced on future series, as soon as we find a more reliable manufacturer.

Low side switching. See e.g. Gammon Forum : Electronics : Microprocessors : Driving motors, lights, etc. from an Arduino output pin

2 Likes

No, your solution will not work. In high impedance state of D8 current will flow through the ESD diodes to Vcc ( as @Koepel already stated ). So your TIP125 will always be switched on.
High impedance on a input pin is only true between Gnd and Vcc.

1 Like

Well, this was the very first and obvious scheme (just used a NPN darlington instead of MOSFET), and unfortunately I messed up the first series of PCB, because, if you take a deeper look, this scheme wont't work in our particular case.

Please explain why you think so.

Most definitely.

2 Likes

To be more specific, just the “high side driver” (“on” when pin is high) will work in our case. But the schematic is already complicated here, there are 2 transistors and lots of passives involved, which migh mean to space concerns on PCB. Prefer single transistor (or Darlington) solution.

That is not more specific, but just claiming the same again.

Good luck with your project.

so, there are 4 schematics there:

  • Low-side MOSFET
  • High-side MOSFET (on when pin is low)
  • High-side MOSFET (on when pin is high)
  • Low-side Bipolar

Which one meets my project? I can see that just the third one. I'd be happy if I was wrong…

Wouldn't be this a not that elegant, but workable solution?

The FDMA1032CZ is a 2mmx2mm package that contains an N channel and P channel MOSFET.
Is that small enough?

Use the N to control the P, only need 3 resistors

n-p

3 Likes

This is similar to a complementary darlington, isn't it? Well, It would be an ideal solution, but there are 2 problems there:

  • It's SMD, and we struggled to make everything THT so far for a much easier soldering work,
  • our supplier, the Polish TME.EU (biggest european supplier) it has just as on special ordering base.

A THT version would be much better, or maybe a bipolar one, somewat similar to Sziklai pair, but in 4-pin version.

It's a technology of the past.
The choice of THT components is very limited now.
My circuit could be done with TO92 size MOSFETs. You won't get any smaller THT.

Hi, @kesztio

How much current does the load need?

Tom... :grinning: :+1: :coffee: :australia:

Hi, currently just about 20 mA. But unfortunately this specific valve is not that reliable so we should be prepared to switch to other models if necessary, maybe with a much higher load current. Possible up to hundreds of milliampers.

Manual assebling of SMD devices is not impossible, moreover, even I'm able to do it with a little care. But for our guy who should manufacture the device in small-to-middle series it's would make the life much easier if the PCB was THT only.