# How can I get a fixed collector current from S8050?

I am trying the following circuit as a part of a project. The goal is to turn on and off the transistor, S8050 (datasheet) at a certain time interval (say 1s), and read the value of the collector current (Ic). I am controlling the base voltage of the transistor using ARDUINO PWM. When my transistor is off I am getting zero Ic current which is fine. But when I turn the transistor on the IC current is fluctuating from 19mA to 45mA. My question is how can I get a fixed Ic current?

I tested the circuit putting base voltage 0V and at that time Ic is Zero. Also, put the 5V to the base and got 33mA. This fluctuation arises when I'm turning ON and OFF the transistor using the PWM.

• Choose Ib=10% of Ic to achieve Vce=Vce(sat) condition. Assume Vbe=0.65V Jul 23 '20 at 0:36
• You may want to read this:en.wikipedia.org/wiki/Current_limiting Jul 23 '20 at 6:31

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 – 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).

• thanks a lot for the response, it's really helpful. One thing I didn't understand though is the PWM frequency you mentioned. What is the relation between PWM frequency and stable Ic current?
– Shu
Jul 23 '20 at 6:16
• If the current sink is linear, then it affects the low-pass filter design cutoff frequency to keep the ripple at an acceptable level. We can change that by changing the R & C but it will take longer to settle if the PWM freq is low. If it's an inductive load sometimes we just feed the unfiltered PWM (on/off switched) to the coil and let the inductance smooth the current out. The time constant in that case is L/R, so if L is 0.05H and R is 68 ohms, the time constant would be less than 1ms and you would want a PWM frequency of 10-25kHz to have reasonably low ripple at the PWM carrier frequency. Jul 23 '20 at 6:21
• Thanks, @Spehro. It helps a lot.
– Shu
Jul 27 '20 at 23:32