I've been trying to find a way to protect my analog input pins (for my Leonardo and Pro micro). I'm basically using them to read an amplified piezo sensor output. The output is amplified because I'm using it to measure very low signal (heartbeats). The normal level of the sensor's output doesn't exceed 5V when I'm measuring heartbeats or chest movement, yet when the sensor is moved rapidly or lifted, I can expect a 5v+ voltage. I know that Arduino has an internal protection circuit, will that be enough to combat those sudden movements? If not, I've read so many posts on this topic including this one: http://www.thebox.myzen.co.uk/Tutorial/Protection.html

If I wanted to add a series resistor by itself as a protection will it be okay? and also, my signal is already small, wouldn't adding a resistor attenuate it even more?

Most circuits seem to have a capacitor, my signal is DC shifted upward (to avoid -ve voltage), wouldn't the capacitor remove that offset?

Finally, if I wanted to use the diode clamping diodes, which diodes should I use (i.e 1n4148 or 1n4002)?

Thank you

3 Answers 3


If you amplified with an op-amp powered by 5V then it couldn't produce more than 5V output, so that could be your solution. Failing that, I think a resistor and a couple of clamping diodes would help. The resistor is to current-limit the clamping diodes. I don't think you need to worry about dropping the voltage through the resistor because the analog input is high impedance.

I think the 1n4148 would be OK, I don't see why not.

  • With an Opamp, the output swings between -4V and 4V (approximately) if my supply is 5V right?. I tried building a buffer with 5V (single supply) to have the output swinging from 0 to 5V but I seem to loose the signal below my DC offset point (1.8V). The buffer takes it's input from the original heartbeat amplifier (AD620) which I'm powering with -5V and +5V and it produces a DC offset of 1.8V (Vref is set by another Op Amp voltage divider.
    – Isra
    Commented Feb 1, 2017 at 5:25
  • I've built the clamping diodes circuit as in the following link: thebox.myzen.co.uk/Tutorial/Protection_files/shapeimage_10.png .... I used 22R, my diodes were 1N4148. I got better results! my signal now ranges from -840mV to 5V. Do you think the -840mV will burn my board?
    – Isra
    Commented Feb 1, 2017 at 5:49
  • Well ... you are exceeding the maximum (negative) ratings of -0.5V on an input pin by 380 mV.
    – Nick Gammon
    Commented Feb 1, 2017 at 6:07
  • I think you should be able to get an op-amp to do it by offsetting the input to the op-amp and powering by only 0 to 5V.
    – Nick Gammon
    Commented Feb 1, 2017 at 6:09
  • To be honest, you are taking me out of my area of expertise here. I Googled "op amp offset voltage" and found quite a few hits, some nearby on Electronics Stack Exchange. I think you should be able to configure your op-amp to give you a voltage range that won't exceed your processor specs. My advice is to not exceed the absolute maximum ratings of the processor, however you achieve that.
    – Nick Gammon
    Commented Feb 1, 2017 at 6:16

Use a voltage comparator to buffer the input to analog pin . E.g. a cheap lm 393. If the signal is less than 5v in buffer circuit is stored and passed on- if its more than 5v voltage comparator blocks the , more than 5v, voltage to the arduino.


I know that Arduino has an internal protection circuit, will that be enough to combat those sudden movements?

it depends on the voltage your pin may see. the pins have clamp diodes - the reset pins may not have, so check the datasheet for sure.

those diodes can sustain some current - check the datasheet on that - absent of it, I wouldn't go more than 10ma on those little guys.

So if you think you may see 10v on the input, put a resistor of (10v-5v) / 10ma = 500ohm resistor there, where 5v is (assumed by me) the supply voltage of your mcu - use the real figure if yours has a different supply voltage.

the same calculation with the negative rail /ground.

and pick the larger of the two.

I typically put a 1k resistor there. I try to be careful if i need to go over 10k, especially for adc pins.

a safer route is to use a (dual directional) buffer. but it does add cost + board real estate.

  • The datasheet says nothing about the maximum current these diodes can sustain (yes, it's a shame), but application note AVR182 states “It is not recommended that the clamping diodes are conducting more than maximum 1mA”. Commented Feb 2, 2017 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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