I'm trying to make a simple tachometer for a motorcycle by using
attachinterrupt()
on pin 3
Since Ardunio working on 5v in I/O makes me impossible to read directly from a 12V source. so I'm using an optocoupler as a bridge between 12v to 5v, and also I wanted to read a clean signal.
On 14V 560Ω gives 22,86mA (to much for the led in the optocoupler for long life). 0,29W over the resistor. Use at least an 0,5W type.
14V 680Ω gives 18,82mA and 0,24W over the resistor.
14V 820Ω gives 15,61mA and 0,2W over the resistor.
For protecting against wrong connection, you can place 1N4001 (1N4002, 1N4003, 1N4004, 1N4007) diode anti parallel with the PC817 led. The max reverse voltage for the led is 6V. The diode limits that to approx 1,1V.