Voltage divider with MOSFET for light detector with Raspberry Pi
The circuits shown in A, B, and C are not safe for the Raspberry Pi.  

In your schematic diagram figures, when the transistor is OFF (when the switch is open) the voltage at the transistor's drain is +5&nbsp;VDC, which will damage the PI's input pin.

The circuit you want looks more like the circuit shown in Fig. 1:



Figure 1.

(NB: I apologize for the lousy graphic. For some reason the CircuitLab schematic editor wouldn't insert a schematic diagram into my answer.)

When transistor Q1 is OFF, the voltage divider R1 and R2 outputs a logic HIGH signal to the Raspberry Pi's (RPI) GPIO input pin.  When transistor Q1 is fully ON (operating in ohmic mode), the voltage at Q1's drain is approximately ground and therefore a logic LOW signal is applied to the RPI's GPIO input pin.

Note that the CONTROL signal has negative logic:

CONTROL   Q1     RPI_GPIO_IN
----------------------------
LOW       OFF    HIGH
HIGH      ON     LOW


If the CONTROL signal is not present (neither logic LOW nor HIGH), transistor Q1's ON|OFF state cannot be guaranteed. For example, a microcontroller's I/O pins are default configured as inputs when power is first applied to the microcontroller, and logic input pins "float"; they do not drive logic LOW or logic HIGH output signals. Therefore, you should connect to Q1's gate either a pull-up resistor (to +5&nbsp;V) or a pull-down resistor (to ground) to ensure Q1's default state is either ON or OFF, respectively. A resistance of \$10\,\mathrm{k\Omega}\$ should work fine for this resistor.

If the +5&nbsp;V supply receives power from a battery, eliminate the LED because it wastes power.



If you want the LED annunciator, I recommend you use a P-type enhancement mode MOSFET (PMOS) as a high side switch as shown in Fig. 2.







simulate this circuit &ndash; Schematic created using CircuitLab

Figure 2.

When the CONTROL signal is approximately zero volts (logic LOW), PMOS transistor M1 turns ON and supplies +5&nbsp;VDC power to the light-emitting diode (LED) D1 and the current limiting resistor R1.  The voltage that's applied to the Raspberry Pi's GPIO input is approximately

$$
V_{RPI\_GPIO\_IN(MAX)} \approx 5\,\mathrm{V} - V_{D1}
\quad \quad (1)
$$

where \$V_{D1}\$ is the forward voltage drop across diode the LED D1. This assumes \$V_{CC} = 5\,\mathrm{V}\$ and \$V_{D1} \ge 2\,\mathrm{V}\$, which ensures \$V_{RPI\_GPIO\_IN(MAX)} \le 3\,\mathrm{V}\$.

Turning OFF transistor M1 removes +5&nbsp;VDC power from diode D1 and resistor R1, and the voltage that's applied to the Raspberry Pi's GPIO input is approximately zero volts (logic LOW). To turn OFF M1, the CONTROL signal's voltage must be within the range

$$
\left ( V_{CC} + V_{TH} \right ) \le V_{CONTROL} \le V_{CC}
\quad \quad (2)
$$

where \$V_{CC} = 5\,\mathrm{VDC}\$ in this example, and \$V_{TH}\$ is M1's minimum gate-source threshold voltage as specified in M1's datasheet.  (NB: Recall that a PMOS transistor's gate-source voltage has negative polarity&mdash;i.e., the gate voltage must be negative with respect to the source voltage.)  For example, assume M1's datasheet states the part's minimum gate-source threshold voltage is \$V_{TH} = -1\,\mathrm{V}\$. To turn M1 OFF, the CONTROL voltage must be between

$$
\left ( V_{CC} + V_{TH} \right ) \le V_{CONTROL} \le V_{CC}\\
\left ( 5\,\mathrm{VDC} + (-1\,\mathrm{V}) \right ) \le V_{CONTROL} \le 5\,\mathrm{VDC}\\
\rightarrow 4\,\mathrm{VDC} \le V_{CONTROL} \le 5\,\mathrm{VDC}
$$

For the circuit shown in Fig. 2, the CONTROL signal has negative logic:

CONTROL   M1     RPI_GPIO_IN
----------------------------
LOW       ON     HIGH
HIGH      OFF    LOW


In some designs the CONTROL signal voltage cannot achieve the voltage range specified by relation (2), and therfore the CONTROL signal cannot turn OFF transistor M1 (M1 is always ON). For example, if the power source is +24&nbsp;VDC rather than +5&nbsp;VDC, and the CONTROL signal is a 5&nbsp;V logic signal, a logic HIGH signal (~5&nbsp;V) on the CONTROL line obviously does not achieve a voltage &ge;&nbsp;23&nbsp;V which is required to turn off M1 (assuming \$V_{TH}=-1\,\mathrm{V}\$ for M1).  In such cases the circuit designer adds a second transistor&mdash;usually an N-type enhancement mode MOSFET (NMOS) &mdash;that performs a voltage translation function (5&nbsp;V to VCC) as shown in Fig. 3.







simulate this circuit

Figure 3.

When the CONTROL signal is approximately zero (logic LOW), NMOS transistor M2 is OFF, the voltage at M2's drain and M1's gate is approximately VCC, PMOS transistor M1's gate-source voltage is approximately zero volts, transistor M1 turns OFF, and VCC power is disconnected from R2, R3, and D1. In this case, resistor R3 functions as a pull-down resistor that places a logic LOW voltage on the Raspberry Pi's GPIO input pin (\$V_{RPI\_GPIO\_IN} \approx 0\,\mathrm{V}\$).

$$
V_{GS1} = V_{G1} - V_{S1} = (\sim V_{CC}) - V_{CC} \approx 0\,\mathrm{V}
\quad \quad (3)\\
V_{GS2} = V_{G2} - V_{S2} = (\sim 0\,\mathrm{V}) - 0\,\mathrm{V} \approx 0\,\mathrm{V}
\quad \quad (4)\\
$$

When the CONTROL signal voltage is sufficiently HIGH (positive) to fully turn ON NMOS transistor M2 (i.e., M2 is operating in ohmic mode), the voltage at M2's drain and M1's gate is approximately zero volts, PMOS transistor M1's gate-source voltage is approximately -VCC&nbsp;volts, transistor M1 turns ON, and VCC power is applied to R2, R3, and D1. (NB: Transistor M2 is chosen so that a logic HIGH signal on the CONTROL line fully turns ON transistor M2.) When NMOS transistor M2 is ON, resistor R1 limits to a safe level the flow of current through M2's drain-source path. The resistance values for R2 and R3 are chosen so that when M1 is ON (a) the flow of current through LED D1 is limited to a safe level, and (b) the voltage drop across R3 is about 3&nbsp;V, which is a safe and valid logic HIGH voltage for a digital input pin on a Raspberry Pi.

$$
V_{GS1} = V_{G1} - V_{S1} = (\sim 0\,\mathrm{V}) - V_{CC} \approx -V_{CC}
\quad \quad (5)\\
V_{GS2} = V_{G2} - V_{S2} = (\sim 5\,\mathrm{V}) - 0\,\mathrm{V} \approx 5\,\mathrm{V}
\quad \quad (6)\\
$$

(NB: Equation 6 assumes the CONTROL signal is a 5&nbsp;V logic HIGH signal.)

For the circuit shown in Fig. 3, the CONTROL signal has positive logic:

CONTROL   M1     M2     RPI_GPIO_IN
-----------------------------------
LOW       OFF    OFF    LOW
HIGH      ON     ON     HIGH




One final comment (nag, actually!).  The transistor symbol you've used in your schematic drawings is for a depletion mode MOSFET, but the transistor you are using is an enhancement mode MOSFET. Using the correct transistor symbol is important because the answer to your question depends entirely on the type of MOSFET you are using. The answer for a depletion mode MOSFET is completely different from the answer you'd get for an enhancement mode MOSFET.