We have been asked before why some emitters were failing when being used with an Arduino. The main problem is the input/output ports on most Arduino models are limited to 40mA per pin. Does this mean that you can only use the emitters that are 40mA or less all the time for Arduino? Fortunately, this is not the case. Here is a detailed post about the limitations present on an Arduino for context: Development Kit Limitations - How to Determine Compatibility and take a look at the electrical limitations. If you use the 5V output port, the electrical limitations depend on the method of powering the Arduino for this particular pin.
Looking at the IR, UV, and Visible Emitter Specifications
So in this category: https://www.digikey.com/short/z9zhz2 the two specifications to take note of are forward current and forward voltage. If the forward current is less than or equal to 40mA then you can connect as many as you want per pin (one emitter to one pin). One note though: I would not recommend using the full 40mA though due to a recommended safety factor; 30mA would be safer to run for a long time rather than the full rating. The electrical life will not last as long if you use 40mA all the time. If the forward current is greater than 40mA then you cannot use them on the I/O ports. However, depending on the rating, you may be able to power several emitters at once in parallel using the 5V output pin. You simply have to make sure that the combined forward current does not exceed the rating indicated by how you are powering the board. The second rating, forward voltage, cannot be greater than 5V because that is the maximum voltage for all the available pins. If your combination of forward voltage and current just can’t match the Arduino’s capabilities, there may be shields that have separate power supplies that can still be controlled via the 5V I/O ports.
Can the I/O Ports Still be Used on Items Powered by the 5V Port?
There are three ways to control these components using the I/O ports that I can think of. The first solution would be a 5V relay with a coil that uses less than or equal to 40mA. Here is a quick Scheme-It diagram for control:
The “LEDs” can represent either visual or IR/UV emitters too, the relay simply closes a path back to ground allowing each emitter to act separately. This solution is more expensive but still works.
The second solution would be an NPN transistor that acts the same way as the relay. All that is needed is a proper resistor to connect to the base and a transistor that saturates at or beneath 40mA. Note that the drop across the collector and emitter will have to be accounted for when choosing a resistor for the emitter. Here is a diagram:
The third solution would be n-channel MOSFETs used as switches. Here is a basic diagram:
For this example, you just have to select a FET that can trigger at or under 5V on the gate. I would also suggest finding a relatively low RDS on value too to reduce the amount of loss.
Remember that this is not limited to two emitters, it all depends on the current rating for each emitter, they will add up in parallel.