12v PWM to 5v PWM

hi there the subject gives it away, I want to read a PWM on my arduino but the PWM is 12v so my question is what is the best way to drop the voltage down to 5 v for the arduino?

just a plain voltage divider will do the job

ok cool the 12v could veriate from 11-14v so would it be a good idea to put some protection on it like a 5.1v zener diode?

The Arduino will recognize anything between 3.3 and 5V as "HIGH"

(Assuming Vcc is 5V...)

that is fine but not if the voltage goes over 5v

Joes:
that is fine but not if the voltage goes over 5v

So....make sure it doesn't!

Use the divider to convert your 11-14V range into a 3.9-5V range.

yes that is fine but as I have said is it worth putting some sort of protection after that e.g. the zener diode or something else as the supply is up and down and quite possibly having a few spikes in it which could harm the arduino

Joes:
yes that is fine but as I have said is it worth putting some sort of protection after that e.g. the zener diode or something else as the supply is up and down and quite possibly having a few spikes in it which could harm the arduino

The Mega328 I/O pins have built-in protection diodes - see datasheet section "I/O Ports".

If the current is limited (eg. by the resistors in the divider) then it should be fine.

cool ok thanks for that