Shop OBEX P1 Docs P2 Docs Learn Events
Calculating what resistors on various components — Parallax Forums

Calculating what resistors on various components

patchespatches Posts: 15
edited 2009-03-27 16:18 in BASIC Stamp
This is a theoretical question, my circuit works fine.

So, I had a relay I wanted to drive. It required 20mA at 5V (and had a nominal col resistance of 250ohms). To keep the workload of my Stamp down, I used a 2N3904 transistor to drive it, as shown on page 265 of the "What's a Microcontroller?" book. The sample showed the 2N3904 driving an LED; I just substituted my relay for the LED - worked great

The diagram included two 100K resistors between the Stamp output pin and the Base terminal of the 2N3904, which gives a calculated resistance of 50K ohms.

My question is, how did the circuit designer come up with the 50K resistance figure? Would it be different if the 2N3904 was driving say 4 LEDs, or is it solely determined by the characteristics of the transistor itself?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-25 14:10
    The resistor values are determined by the needs of the circuit (how much current needs to be switched), Ohm's Law and the characteristics of the transistor (its minimum current gain mostly).

    With a 4V "on" signal from the Stamp (5V - 0.3V for the drop in the Stamp's output circuitry - 0.7V for the transistor base's forward voltage), a 50K resistor will result in a base current of 4V / 50K = 0.08mA. A 2N3904's current gain (hFE) is roughly 100 which would give an output current of 8mA. Clearly the base resistor value is too high for this situation. The reason it works is that the current gain of 100 is a minimum and can be as high as 300 which would give you an output current of up to 24mA, enough for the relay to work.
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2009-03-25 15:11
    patches,
    Here is a FAQ that might help... Don't get HOT choosing the wrong transistor
    Even though it references a motor in the schematic, a Relay, Light bulb, Solenoid, etc. could just as easily be substituted.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • patchespatches Posts: 15
    edited 2009-03-27 16:18
    Thanks! It all makes sense now.
Sign In or Register to comment.