How to drive optocoupler with BJT properly [schematics]
In example 1, with a 3.3V PWM signal, the emitter of the transistor will only attain about 2.7V peak and this means the LED peak current (PWM = 1) is about 5mA.

Bear in mind I've assumed the volt drop across the LED is 1.7 volts.

In example 2, the emitter is grounded therefore you can probably turn the transistor on to about 100 mV saturation. This means the peak voltage produced across the 200 ohm and LED is about 3.2 volts and this drives about 7.5 mA through the LED.