

Solid state switches are one of the main applications for the use of transistor to switch a DC output “ON” or “OFF”. However, both the NPN & PNP type bipolar transistors can be made to operate as “ON/OFF” type solid state switch by biasing the transistors Base terminal differently operating the transistor as a switch. R3's resistance value is chosen so that its resistance ( a) does not introduce a significant current load to the microcontroller's I/O pin when the pin is configured as an output pin, and ( b) is sufficiently small (when positioned on the left side of resistor R2) to ensure Q1 is held in cutoff when the microcontroller's I/O pin is configured as an input.When used as an AC signal amplifier, the transistors Base biasing voltage is applied in such a way that it always operates within its “active” region, that is the linear part of the output characteristics curves are used. Figure 3 shows the 10 kΩ pull-down resistor connected between ground and the LEFT side of resistor R2 however, connecting resistor R3 to the RIGHT side of resistor R2 should also work, providing R3's resistance value is not too small. To prevent this situation where Q1 self biases and turns itself on, a 10 kΩ "pull-down" resistor R3 is added to provide a path to ground, which "pulls down" Q1's base voltage to ≈0 V when no other signal source actively drives a voltage onto Q1's base, thereby ensuring that Q1 remains in cutoff (turned OFF). Under these conditions-i.e., with the I/O pin configured as an input, and without resistor R3-the voltage at the BJT's base is indeterminate (note 1), and in some cases the base voltage is high enough that the BJT turns itself ON, if only partially, which could be very bad. Consequently, the circuit path from Q1's base and through resistor R2 ends in what is essentially an open circuit it is as if you completely removed microcontroller U1 and the left side of resistor R2 is disconnected from everything. When the microcontroller's I/O pin is configured as an input, the input impedance between the I/O pin and the microcontroller's power supply pins (+VCC or GROUND) is extremely high. 2, imagine that resistor R3 is not present. When power is first applied to a microcontroller its I/O pins are (typically) configured as inputs by default the I/O pins are not configured as outputs and do not actively drive a logic LOW or HIGH voltage signal. For example, if the calculated power dissipation is 100 mW, choose a resistor whose power rating is ≥ 200 mW. Therefore, you need to use the transistor's saturation beta \$\beta_)\$. You do not want to operate the transistor in its forward active mode (small signal amplification). When using a BJT as an ON|OFF switch, you want to drive the transistor into hard saturation for the ON state. This handy YouTube video also helped me understand some of the logic or what I think is the logic. Arduino driven LED stays on, touching resistor makes LED come on, and 3.3V line comes on as expected. I also noticed simply touching the resistor R b also triggers the LED, albeit quite dim.Įdit: I should add, I did stumble across this post, and even copied the resistor values from that, and came up with the same issues. When it's set to HIGH, I see ~3.3V as expected. I go back to the Arduino and check, when the pin is set to LOW, my multi-meter sees no voltage. I have a breadboard power supply that outputs 5V and 3.3V, so I take a lead and touch 3.3V to the R b and LED comes on. Remove the Arduino and make the circuit really simple. Right, so plug in the Arduino into where 3.3V is, and set the pin to HIGH, and LED is on.

Using Ohm's law again, and factoring in the 0.7v drop from V b to V e we have 12k Ohms. My understanding is that I c is I b x h fe. Using Ohm's law, that gives us a resistor of 150 ohms, correct so far?įor the sake of easy math, we'll say h fe is 100. Using a standard, run of the mill, red LED, we say the voltage drop is 2V, and requires 20mA. Simulate this circuit – Schematic created using CircuitLab

To test out the circuit, I figured I'd substitute an LED for the time being. Obviously the Arduino I'm using doesn't have the voltage to drive the 5V relay, so that's where the 2N2222 comes in. I'm looking to drive a relay on a 5V rail from an Arduino 3.3V pin.
