How can I get a fixed collector current from S8050?
This will do it. R4||R3 and C1 form a low-pass filter with a time constant of about 200ms to filter the 980Hz PWM from the Arduino Uno. The also divide down the input voltage to give appropriate compliance range to the current sink.
OA1 , Q1 and R1 form a current sink with a transfer function of I = V+/R1 = 77mA/V.
Since the input is divided down by (20/220) = 0.091, the maximum input voltage with 5V 100% PWM is 454mV so the maximum output current is about 35mA.



simulate this circuit &ndash; Schematic created using CircuitLab
Note: This is a linear current sink. Most likely the PWM frequency of the Arduino is woefully inadequate (490 or 980Hz) to achieve constant current with reasonable values of inductance that may be present in your load. If you can use PWM hardware on the chip directly and get much higher PWM frequencies (say 25kHz. but it depends on your load inductance) you may be able to simply drive the transistor into saturation (it will then depend on the value of V3 though, the given circuit is independent of V3 within reason (and dependent on V1).