I'll try and approach this bit by bit:
First off, you need something that detects light/dark. This is nice and simple, there are various light sensitive components, one of which is called an LDR (Light Dependent Resistor)
Using this, a resistor and a transistor you can make a simple circuit that will output "high" (e.g. the supply voltage, or "logic high") or low (0V or "logic low") Which way round is not too important, but let's choose a high output for when it get's dark.
- LDR - here are some examples, let's pick this one (no particular reason other than it's cheap really)
According to it's datasheet, it has a resistance of 1MΩ when it's dark, and a resistance of 40.5kΩ when it's light (10 lux).
Now depending on how sharp you want the turn on to be (e.g. either the output gradually rises as it get's dark, or switches fully at a certain point, you can design your circuit accordingly. We'll make it simple and use a general purpose NPN transistor:
Here's the simulation, the LDR resistance value is swept from 40.5kΩ to 1MΩ (this is the X axis) We plot the OUT voltage as the resistance rises (it gets darker) Notice the output starts rising around 600kΩ, and is nearly at 5V at 800kΩ
You can change the turn on point easily by changing R1 - if you want the output to rise earlier then reduce R1 (e.g. using 50kΩ will make it turn on at around 350kΩ
If you want to have the ability to change it easily, then you can replace R1 with a potentiometer (e.g. a 100kΩ pot would do nicely) You would connect one end to ground, and the other end plus the wiper to the transistor base/LDR node.
The transistor part number is not so important - any general purpose NPN transistor will work. However, the BC337-40 is an excellent transistor, so it's very useful to have a bunch lying around.
The next thing you need is the sensor to detect whether the door is open or closed. There are a few ways of doing this (magnetic, pressure, optical, microswitch, etc)
I'm going to pick a microswitch such as this one (a lot more here), since with a slight alteration of the previous circuit we could have a very simple solution.
If we pick a MOSFET (instead of the NPN transistor above) capable of driving a high current white LED (e.g. a 600mA part - the LED part number shown is not a suggestion, just one of the LEDs available in LTSpice, which I am using to simulate these circuits), then this circuit may suit your requirements:
We use a 9V supply for this circuit, though this can be changed if desired.
Here, we use the microswitch both to turn the MOSFET off if the door is closed, so the light detect only works if the door is open, and the circuit draws almost no current if the door is closed, or the room is light, which means the batteries should last a long time.
We used a different LDR here which ranges from 12kΩ (light) to 200kΩ (dark) (we could still use the other LDR, in fact it would be better for battery lifetime - I was just tinkering around with things and used this one to try and idea out and it got left in there)
I also chose a MOSFET in a through hole package so it will be easy to work with. The part is far overspecced for the task of driving a small LED/Light, but it's cheap, easy to solder into your circuit, and you can upgrade to a higher current light if you wish.
The blue trace only represents the door closed/open (it's the only way to simulate it easily in SPICE) All it means is if the level is low, the door/microswitch is open, and if it's high the microswitch/door is closed)
You can see the door starts out open since the blue trace is at 0V. The light level drops, and the MOSFET turns on when the LDR reaches around 80kΩ. Then we simulate the door being closed, you can see when the
DOOR_CLOSED voltage goes high, even though the LDR is dark (so the MOSFET and LED should be lit) it turns the LED off.
Let me know if you have any questions, there's anything you don't understand, or you want to change how it works. There are plenty of ways to do this, I've just attempted to find a very simple solution for you to start with (we can quite easily complicate it ;-) )
Here is a version that will turn the light off again after ~2 minutes:
It is assumed the room is dark for this simulation (LDR set to 200kΩ) I won't show the light room simulation since we already know the LED will not turn on.
You can see the door starts out closed (represented by the blue trace at 1.1V), then at 10s, the door opens and the LED turns on. At around 130s, it turns off again (even though the door is still open)
Hopefully this is close to the kind of thing you are looking to achieve. The supply voltage is 12V, so you could use an LED lamp or strip like one of these:
This strip would be used in place of the LED and resistor shown (as it has onboard current control) There are many other options to choose from, 12V is a common lamp voltage, so have a look on Farnell, Digikey, etc and take your pick - the FET shown will handle a large current, so you could use a very bright lamp if desired. For example, this LED lamp is rated at 17.2W, uses a supply of 12.3V and would be brighter than the strip above:
- 555 Timer
- Some general purpose transistors , like BC337-40 (or BC337-25), or 2N3904, 2N2222 (selection here)
- Resistors (grab the values shown, plus a few extra in between values) a kit from somewhere like Sparkfun is not a bad idea.
- Ceramic capacitors - 100nF (also sold as 0.1uF), 10nF, 1nF, 100pF
- Electrolytic capacitors - a few values ranging from 100uF to 1000uF, try for over 16V voltage rating
- LDR (from the examples link above) and/or phototransistor, photodiode might be good to have handy.
- Some logic gates - NAND, OR, Inverter may be useful.
- Power source - a 9V or 12V wall wart rated for >500mA (mainly depends on how bright you want your LED lmap to be) should be okay. Or batteries could be used, e.g. 6 * AA Ni-Mh could be used.
- Many of the above can be purchased in the form of a kit such as this. More kits here (note there are 4 pages)