digitalRead and 9V

Hi there,
in a 9V circuit I want to check via digitalRead if a button is pressed.

Setup:

However, putting 9V on a Arduino seems not to be a good idea for me, as it is working with 5V only.

Therefore I thought of adding another resistance to split the voltage, for example like that:

To receive 5V at the digitalRead, ideally I would need an 8kOhm resitor. However, I only have 10 kOhm and 1 kOhm resistors. So I am wondering, what are the detection limits for "HIGH" at an digital input. Will it work with 4.5V only?

Thank you!
Thomas

That will work fine. On a 5V Arduino, any voltage above about 2.5V is regarded as HIGH by a digital input.

putting 9V on a Arduino seems not to be a good idea for me

Actually, it would be a disaster! According to the processor data sheet, the absolute maximum voltage applied to an input is Vcc+0.5V.

This also means that if the Arduino is powered off, you MUST NOT apply a voltage > 0.5V to an input. So avoid connecting separately powered devices to an Arduino, if you can.

The 328 data sheet says that the Vih is 0.6 * Vcc = 3.0V (with Vcc 2.7 to 5.5V)* for pins not XTAL or reset . So a valid HIGH has to be more than 3.0V. Or am i misinterpreting the spec?

*Table 28.2 page 258 of the data sheet.

That is correct. Min Vin-high is 0.6 x Vcc, 3V with Vcc = 5V.