Will the comparator interrupt work with negative voltages ?

I want to use the AIN0/AIN1 comparator channels to setup a voltage threshold interrupt, the problem is that the voltages will be negative. I know the analog input channels are 0-5V, but I can't find information if that limit still holds when setting it as comparator inputs. Will it work or will it fry ?

Cheers

No Arduino input, digital or analog, can accept a negative voltage, or a voltage that exceeds the operating voltage of the processor.

There is a slight margin of error (less than 0.5V in either direction), otherwise the processor may be destroyed.

The processor data sheet always gives the details, under the "absolute maximum" heading.

1 Like

ok thanks for clarifying.

I will look into adding an offset to both inputs so that they are both >0. Either that or build an external comparator and use its output on a digital pin, and attach an interrupt to it.

Thanks

You can use a resistor divider where the top is +5 (Vin) and the middle (Vout) will give you zero when you are at the greatest negative value on R2. Then all readings will be positive, you can use the Map() function to convert them to what you want.
image