Hey, I'm working on a small Arduino project that basically turns on two relays when a few 12v triggers are active.
Since a nano will probably fry instantly if the 12v trigger wire is directly connected to it, i used to use a 5v1 Zener diodes coupled with a few resistors to step down voltage to 5v. However, I've recently discovered these amazing little parts called optocoupler that'll isolate the nano from the trigger source, lowering the chances of me frying it even more.
Although they are cool and all, I'm kinda confused on what type of resistor should be used on the led side, R1 and R2 in this case (schematic shamelessly copied from a different thread)

I've watched numerous yt videos on how to calculate the correct resistor value. some simply suggest using ohms law [(12v-1.2v)/0.05] while other suggest that this isn't enough and you should always choose a larger resistance value from what you have calculated. Other mention something about the wattage of the resistor and how it should be greater too than the load, all of which has confused me to death.
Hence why I'm here again, looking for some guidance
Your input will be much appreciated!
Since a nano will probably fry instantly if the 12v trigger wire is directly connected to it, i used to use a 5v1 Zener diodes coupled with a few resistors to step down voltage to 5v. However, I've recently discovered these amazing little parts called optocoupler that'll isolate the nano from the trigger source, lowering the chances of me frying it even more.
Although they are cool and all, I'm kinda confused on what type of resistor should be used on the led side, R1 and R2 in this case (schematic shamelessly copied from a different thread)

I've watched numerous yt videos on how to calculate the correct resistor value. some simply suggest using ohms law [(12v-1.2v)/0.05] while other suggest that this isn't enough and you should always choose a larger resistance value from what you have calculated. Other mention something about the wattage of the resistor and how it should be greater too than the load, all of which has confused me to death.
Hence why I'm here again, looking for some guidance

