# Can't Control the Base Current in optoIsolator - PIC16F877A

#### Tajiknomi

Joined Mar 18, 2010
34
Its my first time of using optoIsolator. I have connected a PIC MCU to Control the External DC motor through it.
The problem is; I am not able to control the Base current ! I don't know the Current Gain in OptoIsolator, i have somehow used transistors in the past.

So I have calculated the input current via --> [(Input-1.7(led))/130] = 25.3mA.
Now i am not able to guess the current at output Emitter of OptoIsolator. It gives me very less current (0.03mA) at the output. Its too low.

I have attached the Snapshot of the circuit herwith.

#### crutschow

Joined Mar 14, 2008
34,841
The output of the opto feeds the base of an emitter follower transistor, whose base current equals the emitter current divided by the transistor current gain.
Assuming the transistor emitter voltage is about 12V when the opto is on, this gives an emitter current of 6ma.
Dividing the emitter current by the measured base current gives a transistor gain of 6mA/.03mA = 200 which is a high but reasonable gain for the transistor.
So there's nothing wrong with the circuit.

#### Tajiknomi

Joined Mar 18, 2010
34
The Problem isn't with the 2nd transistor, It works fine, But why do the Opto gives me such a low current ?
I was anticipating the high current so that it can be further be increased Beta times (by the second transistor) to drive the DC motor.

25.3mA (Opto Input) > 0.03mA (Opto O/P)
I was expecting optoIsolator to be increasing the current NOT to decrease it by 99.88%

#### Jony130

Joined Feb 17, 2009
5,539
The answer is simple R3 resistor limits the current.

#### ScottWang

Joined Aug 23, 2012
7,413
I will using the circuit as below, the current for motor is 100 mA, if you want some more, then you can decrease the value of R3, R2 is providing a quick stop for the motor.

If the motor could afford 14V then you just shorted the D1 and D2, D3 used to protecting the motor from emf.

#### dannyf

Joined Sep 13, 2015
2,197
It gives me very less current (0.03mA) at the output. Its too low.
Because it is incorrectly designed -> put the 2k resistor in the base.

#### atferrari

Joined Jan 6, 2004
4,798
Hola Tajiknomi,

Just for me to know: do you intend to control (I mean, adjust it) the current through the motor or you simply want switch it ON / OFF?

By the way, what simulation software is that? Most of the drawings I run across, they look weird. Not enough straight lines available?

Last time I had to use a 6-V relay with 9V, instead of using diodes as ScottWang is proposing (I like that) I calculated the resistor needed to create the necessary 3V drop.