6
\$\begingroup\$

Given the following circuit - (source)

Controlling a relay from microcontroller

I'm trying to understand the logic of this circuit. Specifically, from the microcontroller, I'm not sure I understand how to switch the transistor "on" (is that the correct terminology?) to close the relay. If the IO pin on the microcontroller is +3.5V in its on state, what is the state of the transistor? What about when the pin is in its off state?

I believe this is a pull-up resistor, but I'm not sure what's pulling it up.

\$\endgroup\$
4
\$\begingroup\$

That is not a pull-up resistor; it's a resistor to limit the base current in TR1. The base-emitter junction of a transistor looks like a diode to the microcontroller. As such, if you were to apply 3.5V to it without any other component to limit the current, the transistor would likely be destroyed, just as if you did the same to an LED or any other diode.

When the microcontroller applies 3.5V to this input, the base-emitter diode will be forward biased. Silicon diodes have a voltage drop of about 0.6V, so the current that will flow is:

\$ I_b = \dfrac{3.5V - 0.6V}{R_1} \$

The transistor will then allow the collector to pass \$ I_b \cdot h_{fe} \$ of current, or less if there is something else limiting the collector current. \$h_{fe}\$ is the current gain of the transistor, and will be specified in the datasheet. It varies quite a lot even among transistors of the same model, but 100 is a reasonable estimate.

When the collector current is limited by the load (RL1, in this case) and not by the base current (that is, increasing the base current can not increase the collector current), the transistor is said to be saturated or less precisely, on.

When the microcontroller applies 0V to this input, there's no way for base current to flow, so the transistor is off and allows no collector current.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.