Electronic – How to get a fixed collector current from S8050

transistors

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.

Thanks for your time.
enter image description here

Best Answer

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.

schematic

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