Why did they put this resistor here?

In the attached schematic (which corresponds to a Solid State Relay Kit in Sparkfun), they used a 330? resistor. I'm talking about R2 in particular. Why?

Shouldn't a direct connection from the Arduino pin to the transistor work fine?

Afaik, it's to limit the current into the base.

The BE junction drops about 0.7V, so if you didn't have a current limiting resistor, the only resistance would be that of the AVR driver transistors. So you'd get way more than the current required, and way more than the max current allowed out of an AVR pin.

Oooo, so did I have that back-asswards? It's not to limit the current into the transistor, it's to limit the current out of the uC?

In this application, yes.

polymorph:
The BE junction drops about 0.7V

How did you come up with 0.7V? I'm still trying to understand the math behind this...

CrossRoads:
In this application, yes.

I'm having a good day: it's only 0815 here and I've learned two things already. By hometime I'm going to be bursting with new knowledge.

The transistor is a silicon bipolar junction transistor, I know this from the part number. And a silicon PN junction drops about 0.6 to 0.7V, depending on the current. It does not vary by much over a wide range of current.

The resistor is, in this case, secondarily to limit the current into the base. If you were to connect the base directly to 5V by a switch, a very large amount of current would flow through the base-emitter junction for a very short time, then the transistor would burn up.

I see. Much clearer now. Thanks!

ardilla:

polymorph:
The BE junction drops about 0.7V

How did you come up with 0.7V? I'm still trying to understand the math behind this...

This is listed as VBE(sat) in the datasheet for the part. .7V is typical.

Google "Ebers Moll equation" for the nitty-gritty