input voltage tolerances

I have an ATMEGA328P on a breadboard running at 2.8V and that is working great. I would like to connect a small solar cell to a digital pin and do a digitalRead on the pin to see if it is either high or low (i.e. sun or no sun). I will then use this input to trigger other events. My concern is that the input from the solar is as high as 3.5V which is above my operating voltage. I thought about putting a voltage divider on it to reduce the 3.5V down to 2.8V but that will increase the required sun before it will read high. Will I damage anything or cause any problems by connecting an input with a voltage higher than what the Arduino is running?

You should not apply a voltage greater than Vcc+0.5 volts to any IO pin of an atmega, or you may damage or destroy the pin input circuitry. Doing so may also destroy the processor itself.

However, you can protect an input by putting a series resistor of about 10K ohms between the source and a pin, which will limit the pin input current to safe levels (for voltages of up to perhaps 10 V). Of course if the voltage is higher than Vref, you can't measure it using an ADC input in that way.

Thanks for the advice, I will add a resistor and give it a try. I am not using the ADC so I think I can make this work.

The table on page 287 on the [u]ATMega datasheet[/u] says:

Anything less than 0.2Vcc will be read as low.
Anything higher than 0.6Vcc will be read as high.

(Anything in-between is undefined.)

Of course if you use an analog input, you can set your own threshold(s) in software.

Hi,
Look up clamping, using a zener diode.
Google is your friend.
This will clamp the signal at the input pin of the controller to a selected level.

Tom...... :slight_smile:

What about the Yun? In an Open Energy Monitor guide it states I should connect the 4.5 V voltage reference to the analog pin. Isn't that too much?

See: http://forum.arduino.cc/index.php?topic=294608.10

In that thread I protected an input pin with a circuit:

Of course in your case the part marked "+5V" would be whatever your supply voltage is.

You might not need R3 which was just a pull-up resistor for my switch.