S8050 D331 base resistor calculation
Q1: is this the only way to go about it? Suppose a middle school kid
  is doing this for a science project, how does the kid understand which
  resistor to put where?


Electronics requires knowledge, puzzle solving, and creativity constrained by bounds of physics and practical materials and supplies and value vs cost, to name a few. Unless the middle school kid is unusually skilled, they don't. If this were something that middle school kids could do, do you imagine large businesses would pay the big bucks as salaries or contracts for such work? There are clearly lots of hobbyists (I'm one) who can learn over time and be useful at times. But even simple active circuits require some basic knowledge.


  Q2: Assuming this is the only way - for S8050 D331. How do I decipher
  which values to use in the calculator above?
  (for the device here: UTC S8050 NPN EPITAXIAL SILICON TRANSISTOR)


You don't just blindly use calculators, at all. Just like you don't blindly use simulators. You need to understand what you are doing and why you are doing it. Then you can apply calculators or simulators to help validate your approach. So it's very hard to answer your question, since it is misplaced.


  I could not draw the schematic correctly. The diode is actually a LED.


Okay.


  And the resistance of photoresistor is unknown (am using a snap
  circuits kit - part 6SCRP).


Wonderful kits. I really would like to see more use of them by the public. The company deserves some support, too. And now I understand more about why you are talking about middle school kids.

These LDR devices have a lower resistance in brighter environments and a higher resistance with dark ones. Different devices, though, have different values for each. But in general, they should have at least 10 times the resistance in the dark (or an even larger factor) than in the light. Good ones will have factors of perhaps 1000 or more. Typically, the resistance will be in the small numbers of kilo-ohms when lit up directly with a bright source. So that's a place to start.


  Q3: If i move the photoresistor to the left of the voltage divider and
  the 5.1K resistor to the right, OR if i put the load on collector the
  circuit does not work. It works perfectly when the potentiometer is at
  one of the extremes (I guess it is high).
  
  I want to understand with calculations, how things work.


In most designs, you have some kind of input thing (transducer) and some kind of output thing (another transducer) and the circuit in between that adapts the input to the output and may also perform some desired function along the way. So to design a circuit you start with understanding your input transducer and your output transducer and what function you want applied in between them.

Let's go through your circuit in pieces.



OUTPUT: A typical single LED requires about \$20\:\textrm{mA}\$ to operate and a \$2-3.5\:\textrm{V}\$ compliance voltage depending on the color/type. (They do also require a voltage, but the focus is on the current.) I think the snap circuits includes a RED LED. That would need about \$2\:\textrm{V}\$, or so. Since you are using \$6\:\textrm{V}\$ for a power supply, this means you need a resistor to drop about \$3-4\:\textrm{V}\$ at that current. A resistor from \$150-220\:\Omega\$ would be appropriate here. But I think snap circuits only includes a \$100\:\Omega\$ resistor. You could also use a \$1000\:\Omega\$ value, too, as the LED will still be quite visible using that, too. You'll also need a transistor operated as a switch to handle this.

The arrangement might look like either one of the following two:







simulate this circuit &ndash; Schematic created using CircuitLab

The base needs to have something attached to it, of course. But those two are roughly what an output section might look like. The left side one is probably the most commonly used approach for an output like this.

With this left side orientation, the NPN BJT is operated as a switch and its base voltage (relative to the negative terminal/emitter) will be on the order of about \$750\:\textrm{mV}\$ in order to fully supply \$20-30\:\textrm{mA}\$ for the LED and about \$700\:\textrm{mV}\$ in order to supply about \$4-5\:\textrm{mA}\$. (I remember that a small signal NPN BJT has about \$V_{BE}=700\:\textrm{mV}\$ when \$I_C=4\:\textrm{mA}\$ and I know that this can be scaled up or down using \$V_{BE}\approx 700\:\textrm{mV}+26\:\textrm{mV}\cdot \textrm{ln}\left(\frac{I_C}{4\:\textrm{mA}}\right)\$.) Since the BJT is operating as a switch here, the required base current will be about \$\tfrac{1}{10}\$th to about \$\tfrac{1}{20}\$th of the LED current, with this approach.

Your output section takes a different approach as represented on the right. It places that resistor and LED into the emitter leg. Here, the NPN BJT is operated as an emitter follower. This also works. But in this case, the base voltage must be high enough to enclose the LED voltage drop (about \$2\:\textrm{V}\$), the current limiting resistor drop (about \$100\:\Omega\cdot 20\:\textrm{mA}=2\:\textrm{V}\$), plus the needed \$V_{BE}\approx 750\:\textrm{mV}\$. This means \$V_B \ge 4.75\:\textrm{V}\$ in order to fully supply \$20-30\:\textrm{mA}\$. Or perhaps \$V_B\ge 3\:\textrm{V}\$ in order to supply about \$4-5\:\textrm{mA}\$. So the LED will appear to be ON over a much wider range of base voltages with this arrangement, since variations of \$V_B\$ adjust the LED current by changing the voltage drop across the current limiting resistor, rather than turning it exactly ON or OFF. But, with a base voltage below about \$2.1\:\textrm{V}\$, the LED should be entirely OFF, since the LED should be OFF when experiencing less than \$1.6\:\textrm{V}\$. So at some point it is, indeed OFF.

As an emitter follower in this arrangement, it's not possible for the BJT to saturate (\$V_{BC}\$ can't forward bias.) So the required base current will be about \$\tfrac{1}{\beta}\$ of the LED current. Which is probably much less than in the left side circuit, though this varies with the specific BJT in use.

Two different approaches with different requirements for driving them.



INPUT: The LDR is the input to the circuit. I think you may already understand that it can be used as part of a voltage divider circuit. Something like either the left hand side or the right hand side of this:







simulate this circuit

I've included your variable resistor, as well. The range of values indicated for the LDR come from some actual measurements I just made using the snap circuits' RP device. Just playing around with it here, I would guess that you'd want to switch the LED on when the resistance is \$\ge 300\:\textrm{k}\Omega\$ and you'd want to switch it off when the resistance is \$\le 100\:\textrm{k}\Omega\$.

In the left hand case, more light will cause the voltage divider's output to decline. In the right hand case, more light will cause the voltage divider's output to rise. Which of these you choose will depend on your goals. But those are two simple approaches to doing something with your input transducer that will make changes in your circuit.

Since you have an NPN transistor that will be turned on better by higher voltages at its base (in either of the two output circuit scenarios mentioned earlier), and assuming you want to have the LED go OFF when things are light and ON when things are dark, then you want the left side circuit arrangement because brighter situations cause the voltage to decline (and cause the transistor to turn OFF.)

Your example (and mine) use a variable resistor. This is probably a good idea, since it allows you to tinker around with the exact value of the output voltage in either case, by just tweaking the variable resistor to different values divided to either the "high" side or the "low" side of your divider circuit. With snap circuits, the \$50\:\textrm{k}\Omega\$ variable resistor is your only choice.



CIRCUIT: At this point, you have an arrangement selected for the input and one of two possible ones for the output. The question remaining is if you need any additional circuitry; or if you can just connect the two together as they are.

Without any other options for now, we know which input circuit we need. It's the one on the left side.

So let's go back to the two different output circuits and start with the one on the left, there. The LDR (RP) will have a value in the low hundreds of thousands of Ohms about where we need to cross over from ON to OFF or back again. But we can only have about \$700\:\textrm{mV}\$ at the divider, then. To achieve that the value of \$R_1\$ plus a portion of RV must be very large... certainly over a million Ohms. And that's just not possible with the snap circuits. Here's the circuit that simply can't be done well:







simulate this circuit

Now, looking at the right side output circuit there seems to be more of a chance, since the LED is completely OFF below \$2.1\:\textrm{V}\$. But even here, we'd need about twice the resistance in \$R_1\$ plus a portion of RV in order, as compared to the remaining portion of RV plus the LDR's resistance. And this would also mean many hundreds of thousands of Ohms. Which is also not readily achievable. The Thevenin resistance at the base would be about \$100-300\:\textrm{k}\Omega\$, which would drop from \$2-12\:\textrm{V}\$, depending on \$\beta\$ and the exact details of the resistors, the LDR, and the LED current. It likely that some values may work here, but it is very difficult to design values that are sure to work. So this is an improvement, but it's not really designable:







simulate this circuit

Let's do a quick check with the above circuit. We know it will be firmly OFF when the base voltage drops below \$2.1\:\textrm{V}\$. At this point, the LDR (\$RP\$) will be somewhere between (I think) \$100\:\textrm{k}\Omega\$ and \$300\:\textrm{k}\Omega\$. Ignoring the variable resistor for now, this means that:

$$R_3=\frac{\left(6\:\textrm{V}-2.1\:\textrm{V}\right)\cdot RP}{2.1\:\textrm{V}}\approx 1.9\cdot RP$$

But the variable resistor is only \$50\:\textrm{k}\Omega\$ and the largest available resistor in the snap circuits is \$100\:\textrm{k}\Omega\$. That's \$150\:\textrm{k}\Omega\$ total. But even if the LDR threshold is at \$RP=100\:\textrm{k}\Omega\$, we'd need \$190\:\textrm{k}\Omega\$. So it's just not really enough. It's possible that the LED will be dim enough, barely ON. If lucky. But it gives us no room to play with the setting.

It's just not designable.



As I said earlier, I took out a snap circuits "RP" module and measured it with my voltmeter. I get about \$5\:\textrm{k}\Omega\$ in bright light and get well over \$10\:\textrm{M}\Omega\$ in the dark. (If I completely cover it, it goes high enough that my cheaper Tektronix multimeter lists it as an open circuit.) And I still think the switching point should be adjustable from \$100-300\:\textrm{k}\Omega\$, or so. Maybe even a wider range would be better.

Which leads me to choose a different approach, if you are lucky enough to have one of the larger snap circuits kits: one that includes both an NPN and a PNP transistor. If so, then you might try the following circuit:







simulate this circuit

I've checked it out here using actual parts found in an actual kit and it works just fine! The variable resistor, \$RV\$, has fairly smooth control over the light sensitivity, as well. Here's a picture of the result:



The above circuit starts out by splitting the current limiting resistor and the LED. The current limit resistor remains in the emitter leg and the LED itself goes into the collector leg. This allows the NPN BJT to be more centrally located between the voltage rails and the current limit resistor can now serve two purposes: current limiting when the LED is supposed to be ON and, additionally, a way of providing feedback to shut off the NPN when we want the LED to be OFF.

The next step is to actively turn the NPN ON. To do that, \$R_4\$ is inserted so that it provides base current to the NPN transistor. The emitter voltage controls the collector current that supplies the LED. This emitter voltage should be about:

$$V_E = 6\:\textrm{V}-V_{BE}-R_4\cdot\frac{6\:\textrm{V}-V_{BE}}{R_4+\left(\beta+1\right)\cdot R_2}\approx 4.5-5\:\textrm{V}$$

This implies an LED current of \$4.5-5\:\textrm{mA}\$, which should be fine and visible.

But now we add in the PNP transistor. If the LDR's resistance increases a lot, then the PNP base will be driven close to the positive rail and it will turn off, leaving the NPN circuit unmolested. The LED will be ON, then. But if the LDR resistance drops enough, the PNP base will begin to conduct more and more current and the PNP's collector will start sourcing current into \$R_2\$, forcing the voltage drop to increase and move rapidly above \$5\:\textrm{V}\$. When this happens, the NPN will be forced off as there isn't any more room for the required \$V_{BE}\approx 700\:\textrm{mV}\$. In fact, there will be almost no room at all, quite quickly.

The nice thing about this is that the variable resistor is of just the right range of values to go together with the LDR resistance region where we want to turn things ON and OFF.

This circuit points out something I'd mentioned at the outset -- the need for creativity and puzzle solving. The normal way to go about this is to just use a BJT for a switch and hook up the LED and current limiting resistor in the collector leg. It's how I started out looking at your question. But there's a serious problem having to do with the LDR and those "circuit functions" in between your sensor and your LED. Plus, snap circuits are very limited in the supplied parts, too. Which further constrains things. Given only one NPN and one PNP, I was pretty much stuck with doing things differently.

What I did is to move the current limiting resistor into the emitter, instead. Doing this gave me a place where I could use the PNP to source current into that resistor and force its voltage drop to increase. In doing so, this would shut off the NPN. (Another way of looking at it is that in moving the resistor from the collector leg to the emitter leg, I've made the resistor serve two purposes (current limiting and feedback) instead of just one (current limiting.)

So, as the LDR declines in resistance, it increases the base current into the PNP BJT, increasing its collector current into \$R_2\$. This drives up the voltage drop across \$R_2\$ and pinches the base-emitter of the NPN, reducing its drive available for the LED. \$RV\$ then just adjusts this biasing a bit.

I considered a few other unworkable ideas before realizing a topology that would actually work. (It's easy to analyze a circuit, once you have it.) But it was obvious it would be okay, once it fell out of thinking of different re-arrangements.

So this is why you don't expect a middle school kid to just go plug in numbers on some web page. I hope that point is made, abundantly. I just made my own point by doing this here and exposing my thinking process. I think you can see why even something as simple as this isn't always just "boilerplate." Sometimes, you are constrained to limits in parts such as what is the case here.



For others interested, here are three photos taken to show the parts of interest in a snap circuits kit.