How to calculate the value of the fixed resistor in a light dependent voltage divider?

I have made, what I thought would be a simple circuit, an LED night light. The power source is 5V@1A. The schematic is below: simulate this circuit – Schematic created using CircuitLab

The intended goal is to increase the brightness of the LED, as light decreases. The LED should be completely off when the light level is high. When I built the circuit, I was very surprised to find out that it functioned in the COMPLETE OPPOSITE way. When I pointed the LDR towards a light source, it increased the brightness of the LED as it turned closer to the light source. If I put my finger on the LDR so that almost no light can enter, the LED looks as if it is completely off. Why is this happening? I suspect it has something to do with the voltage divider, whose output is connected to the base of the 2n3904.

I have calculated the value of R1 using the voltage divider equation. I will post my calculations soon(within the next couple of hours), my final result of the inequality that I solved(will post my steps soon)is 1kΩ

I tested the LDR and here is how the resistance changes in different cases: 1.Almost complete darkness-0.83MΩ 2.Dark-0.44MΩ 3.In between-8.66KΩ 4.Kind of Bright- 2.45kΩ 5.Bright-1.23kΩ 6.Very bright-1.21kΩ

The LED has a forward voltage drop of 2V. The peak brightness of the LED is achieved with a current of 9.09mA.

In case 1, full brightness of LED should be achieved. In case 2. Half brightness of LED should be achieved In case 3.Very little emission from the LED. In cases 4-6, the LED should be off.

It seems as if my calculation(which I will post soon) for the fixed resistor of the light dependent voltage divider is wrong. How do I calculate R1 correctly.Sorry if my question is a bit vague, if you need any details please ask. Thanks.

Edit: The positions of the LDR and R1(the 1.1k resistor) are now switched in the actual circuit. After doing this, the LED is always on. I will calculate the value of R1 again.

• Oh, and I did find a similar question where the fixed resistor was 2.2kohms, and it supposedly worked. I do not know how this value was calculated though, which is my question. How is R1 calculated? – zack1544 Dec 30 '16 at 22:11
• The circuit as drawn above can't possibly work. Please post the actual circuit you are using. – Peter Bennett Dec 30 '16 at 22:15
• The LDR and fixed resistor need to change places for the circuit to work like you want. The resistor value may need to change as well, and you will have to check the beta of the transistor to see if you have enough current gain. – John D Dec 30 '16 at 22:29
• @zack1544: It is conventional to draw the positive supply line at the top of the schematic, and the negative at the bottom. If the LDR and R1 were drawn vertically, one above the other, the fact that they make a voltage divider would be more evident. For clarity, the LED and R2 should be above the transistor collector. Drawing things this way makes it easy for the reader to understand the circuit at a glance, without having to trace wires all over the place. – Peter Bennett Dec 30 '16 at 22:35
• @zack1544 Have a look at the bottom of my answer to someone else's similar question: electronics.stackexchange.com/questions/265195/… – jonk Dec 31 '16 at 4:20