handling 9v on Arduino 3.3v input

Hi sparkfun experts this is my first project, please excuse my silly questions

Im trying to “read” impulses (20ms each) send by external device using my 3.3v Arduino.

here is the catch:

the device is an simple intercom

I have access to 2wires ground+signal

when no signal is transmitted intercom sends 9V! this would kill my 3.3v tolerant Arduino :frowning:

when signal is transmitted it’s in 5V voltage level - rising edge from 0v to 5v 20msec long

please guide me to easy solution

I thought about using :

SparkFun Logic Level Converter - Bi-Directional

https://www.sparkfun.com/products/12009

but… it requires reference voltage - 3 wires - Vin, signal, ground

so no go

4N35 optocoupler ?

I believe that this is valid way to go,

what sort of resistors do I need on device end… and should I use a pull up resistor on Arduino side?

It is a complication that the signal is 5V and not zero. In the two suggestions below, the simplest approach to decode the signal is to use the analog input of the Arduino.

A 3:1 voltage divider will work (22K/10K), IF it is safe to connect the Arduino ground and signal ground.

If you can’t connect the grounds use an optocoupler. You need a current limiting resistor for the input LED (1K might work, choose for optimum variation of the output with input signal variation) and a load resistor for the collector or emitter (10K should work). Be careful with voltage polarity.