Protecting your arduino inputs and outputs

Hello everyone!

I was wondering what measures you are all taking to ensure that you don’t fry your arduino-based synths by accidentally plugging a +/-12 V cable into any connected inputs or outputs?

I’ve been reading about this a little bit and for protecting inputs and I quickly learned about diode clamps. There is a lot of discussion about what type of diodes are best and how big of a resistor you should use to keep these diodes alive in case of a mistake but also have good ADC performance.

Then, I found this excellent article.

They say that arduinos (and other Atmel chips for that matter), have internal clamping diodes that can handle up to 1mA. So to protect from 12V, you need to drain the 7 excess volts. Minus the diode drop, that leaves you with 6.3V. So you need at least a 6.3k resistor to keep your clamping diodes alive. However, I figure you need much more if you accidentally connect -12V. Will that work?

Some people choose to add external clamping diodes. I’ve seen people recommend 1N4148’s, zener diodes and schottky diodes. I understand that schottky diodes are most popular here since they can have a lower forward voltage drop. Since the Atmega328P (for example) can only handle -0.5V up to 5.5V with respect to ground, a voltage drop of less than 0.5V in this circuit ensures that the protection actually works. Are these few hundred extra milivolts going to fry your chip if you already use a ~10k resistor?

Suppose you want to expose your arduino outputs as module outputs (e.g to send triggers/gates), what protection would be best? Because these are digital signals, maybe the simplest way would be an opto-coupler + an 1K resistor for current limiting? A TL07x-based voltage follower + 1K resistor might work as well, since I’m assuming the output of an opamp can handle big voltages properly.

In many cases however, you will use a DAC for output, like the MCP4922 and you should be all good because it has internal op-amps already. So you only need the resistors.

Is this making sense? I want to ensure that I understand this part of module design well. I’m wondering what solutions you use for these problems when integrating micro-controllers.

Thanks a lot!

3 Likes

If you look around, you’ll find some discussion here.

If you apply -12 V with no external clamping diode the internal diode to ground will conduct and to keep current below 1 mA you’d need a 12k resistor. But I think external diodes are appropriate since, as you said, the absolute maximum rating (for a 5 V Arduino) is -0.5 to +5.5 V on any pin. I like 1N5817 Schottkys to ground and +5 V.

I don’t understand your question about “a few hundred extra millivolts”. With external Schottky diodes you’re within the maximum voltage range spec.

I’ve never seen optocouplers used as output protection, and they strike me as overkill and would consume a lot of board space. Simple op amp buffers are fine I think, and as for the series resistor that’s for the op amp’s benefit — you’re not drawing current off the Arduino output pin — and in principle a TL07x doesn’t need it, though a 100R to 1k resistor is probably a good idea in most cases.

And as you say an MCP4922 has buffered outputs, so similarly a series resistor is probably good but you don’t need more.

Thanks for the rapid response :slight_smile:

I don’t understand your question about “a few hundred extra millivolts”. With external Schottky diodes you’re within the maximum voltage range spec.

Sorry, I was a bit unclear. With normal silicone diodes, you would get about -0.7 to 5.7V and with schottky you would get maybe -0.3 and 5.3. My question was whether these few hunderd milivolts would make a big difference given that the current is already limited by a ~10k resistor.

I’ve never seen optocouplers used as output protection, and they strike me as overkill and would consume a lot of board space.

Excellent point. It wouldn’t make sense unless you have a spare one on your board already, but that is more likely to be the case for opamps anyway since you often have 2-4 on a chip.

I like 1N5817 Schottkys to ground and +5 V

I’m ordering a bunch of them right now. Thanks!

To me the big difference they make is Schottkys keep you within spec and p-n junctions don’t. I don’t see any reason to prefer the latter that would outweigh that.

1 Like

They are much better indeed. I currently don’t have them yet, so I was pondering whether I should wait for them to arrive before I started soldering a module, or use 1N4148’s instead.

Does this apply to other kind of equipment, too, or is that specific for the arduino? I’m asking because I breadboarded a quite simple VCO and filter which seem to be working fine. I’m still reluctant though to connect them to my keystep and commercial modules.
So should I add addtional op-amp buffers on the inputs of my “modules” (although all of them lead to an input of a TL074 or the base of an transistor anyway) and diodes on the outputs of my modules? Are there any other protective measures I should take?

1 Like

I have not connected any ‘professional gear’ yet so take this with a grain of salt, but I think that professional eurorack modules will always have basic protections like this and thus be able to withstand everything between -12V and +12V.

Beatstep pro can send out 12V gate signals, so that implies it is really operating in the same range. I wouldn’t know what happens if you accidentally send -12V into one of its lines, but for such a well known eurorack compatible product, I doubt that anything will blow up.

1 Like

Thanks for the encouragment. I’ll measure all the plugs before putting them into something expensive and give it a try I guess.

So Electric Druid makes a bunch of synth related PIC microcontroller chips (some of which are used in Sam’s projects like the Mini ADSR, and the Kosmo VCLFO)…
In their datasheet for the envelope generator they recommend this circuit to protect inputs on gate/trigger lines:

2 Likes

Thanks! I’m curious what the advantages are of using a transistor here. My initial thought is that this would be more then enough:

My guess is that, depending on the use-case, you could even leave out the capacitor.

I also received my schottky diodes today :raised_hands:

No idea why druid went with that, but advantages include lower input capacitance, non-infinite input impedance, and quite possibly cheaper. It also has the advantage that proper operation depends on the circuit working, unlike the diode approach that only checks that when things go wrong :grinning:

I used the druid protection it on my implementation of the ENVGEN8 board. Seems to work pretty good :slight_smile:

EDIT: Sidenote: Now that i’ve done JLCPCB i don’t think i’ll ever hand etch/drill a board ever again.

4 Likes

bit late but thanks so much for the link - I was struggling to understand the protection diodes