3

At work, I have connected an Arduino to a security key (which has a 12v power supply) in order to give us a more versatile door lock. Unfortunately, people keep removing the key pad, disconnecting the wires and re-connecting them (defective keypad I guess.) In the process, I am afraid that they will accidentally send 12v into the Vcc, ground, digital in, and/or analog in pins. What is the best way to protect my Arduino from the 12 volts? I really need a component or two that I can to my pins.

Edit: it is difficult for me to describe this problem without mentioning the danger to all components. Please describe ways to protect digital outputs HERE

Hoytman
  • 747
  • 5
  • 13
  • 25

1 Answers1

5

There are some suggestions at Protecting Inputs in Digital Electronics .

Amended answer

Testing of my earlier answer involving clamping diodes gave unsatisfactory results. Due to the small current flow the diodes allowed a considerable voltage to reach the input pin (like, 9 V).

The amended circuit below, tested with 12V input, satisfactorily keeps the Arduino input pin to 4.9 V, even with 12 V from the device. The current through R1 is around 7 mA which is what you would expect:

I = V / R
I = 7 / 1000
I = 7 mA

The 1N4733A is a 5.1 V, 1 W zener diode which can therefore handle dropping 5 V at 7 mA.

In case you are wondering where the number 7 comes from in the calculations above:

  • The input voltage is 12 volts
  • The desired output is 5 volts
  • Therefore we need to drop (12 - 5) volts over the resistor
  • Thus 7 volts are dropped over the resistor

Input pin protection

Further reference material:

Nick Gammon
  • 35,792
  • 12
  • 63
  • 121
  • Is D2 and C1 connected to +5v or ground? I don't see a lable – Hoytman Jul 04 '15 at 03:38
  • As per [Electrical Symbols & Electronic Symbols](http://www.rapidtables.com/electric/electrical_symbols.htm) the downwards pointing triangles are common ground. So yes, D2 and C1 are connected to ground. – Nick Gammon Jul 04 '15 at 05:07
  • Thanks, great link for someone that is not a trained electrical engineer (me.) – Hoytman Jul 04 '15 at 17:22
  • Can this same circuit protect Digital outputs too, or should a different circuit be used? – Hoytman Jul 04 '15 at 17:33
  • A 10 ohm resistor, will mean around 0.7 A will go through the diodes if +12 volt is connected. That's 5Watts being dissipated by R1. Fine for 12v spikes, but not for continues 12v being applied. – Gerben Jul 04 '15 at 19:28
  • That's true - probably R1 should be at least 100 Ω instead of 10 Ω . That means it will have 70 mA through it, which would be 0.49 W. The circuit was really for spikes rather than connecting a high-current supply. And since that wasn't really the question asked, I have amended the answer to have a higher value for R1. Since we had a 1 k resistor there anyway, I changed R1 to 1 k. Assuming the security key is just sending serial data that should still work. – Nick Gammon Jul 04 '15 at 21:43
  • @Hoytman - that isn't really required for an output circuit. I suggest you browse some of the references in my answer to see if they help. – Nick Gammon Jul 04 '15 at 21:43
  • 1
    Note: circuit changed again as testing of the clamping diodes solution revealed that with the low current through the resistor (due to the high impedance of the Arduino input) they were not effectively protecting the input pin. The zener diode solution, however, does. – Nick Gammon Jul 04 '15 at 22:57