A transistor is a device that can allow a high current to pass with a small current signal. A transistor can work two ways, either as an amplifier, or a switch. In this case, it will be used as a switch to apply current to a relay.
The transistor has three leads. The lead that serves as an input of a small current is called the base lead. When the base lead gets a small current, current can pass through the collector and emitter leads.
To determine if the transistor has a high enough current rating:
I = CircuitVoltage/(LoadResistance)
Next, the current gain rating (Hfe) for the transistor needs to be determined:
Hfe must be 5 times the load current divided by the current from the microcontroller pin. The microcontroller can output 40 mA from the port pin (found in the microcontroller datasheet).
Hfe = 5 x (loadCurrent/PinCurrent)
The final consideration is to determine the resistance value that must be added between the pin and the base pin of the transistor. We can use a special formula since the voltage from the pin will be the same as the voltage going through the collector and emitter.
Resistance = CurrentOfCircuit x ResistanceOfRelayCoil x HfeOfTransistor
Comments and Additional Information
Have some code to share? Or additional information? Respond here:
You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.