a few question on how to connect a relay

Hello everybody I found this schematic on the Playground to connect a relay to Arduino using a optocoupler for added protection.

A few questions: - Is the 180 ohm value of resistors between signal and opto just an arbitrary value to protect the LED inside the opto or must be that precise value? If the first, does it make any difference using a 220 or 330 ohm resistor? - I'd like to drive a relay like this: The coil operates at 8.4-12V and draws 33mA at 12V. - can I replace 2N2222 with or BC327-25 (0.8A)? It's cheaper - can I replace 1N4004 with 1N4937?

Thank you for the help and merry Christmas to everybody :)

Not sure what the isolation gets you here - the transistor ought to be enough.

From the datasheet, the LED is rated at up to 60mA at a Vf of around 1.5V (depends on version), so as long as you don’t exceed, the 40mA pin limit, anything from 100R (35mA) to 270R (13mA).

Sorry, I haven’t got the transistor specs to hand.