The main improvement I wanted to make was to move the power switch under one of the LEGO block's studs so that it was hidden and yet still accessible. The LED lights up when the stud is held down or when another LEGO block is attached to the top of the flashlight block.
So, read on to find out how to make your own LEGO Flashlight block!
Step 1: Supplies
1) A sacrificial LEGO block.
This will be the body of the finished block. It should be two studs wide and at least four studs long. For this Instructable, I'm using a 2x4 block, but longer blocks work a bit better. Be aware that you're going to be cutting and mangling this block, so make sure it's not one you're too attached to!
2) One or two flat plates.
These will attach to the bottom of your flashlight block, keeping all of the internal "guts" inside and out of harm's way. If you use just one plate, it should match the size of the block used for the body. In this Instructable, I will be using two plates. One will be permanently glued in place and the other will provide access to the batteries in the block. If you decide to use two plates, you will need a 2x2 plate (or larger) for the battery cover and another plate to fit over the remaining portion of the block.
3) Two LR1130 coin cell batteries.
These will provide power to light up your block. LR1130's (or equivalent) fit perfectly in a LEGO block and provide enough power for one LED.
You should be able to find these at Radio Shack (here's an equivalent battery: http://www.radioshack.com/product/index.jsp?productId=12400059) or probably much cheaper online if you look around.
4) A 5mm LED of your choice.
Any LED with a forward voltage drop of 3.0 volts or less should work. I've successfully used super bright white, red, and green LEDs, but your experience may vary.
LEDs are also easy to find at Radio Shack (here: http://www.radioshack.com/product/index.jsp?productId=3060980) or online (I've purchased oodles from eBay). Alternatively, you may be able to scrounge one from some old electronics. Bonus points for reusing!
5) A 6mm PCB pushbutton.
This will be pushed to activate the light.
Again, these are available at Radio Shack (this one should work: http://www.radioshack.com/product/index.jsp?productId=3060978), or online. However, they are fairly ubiquitous in electronics, so you may be able to rip some out of some of that junk you've been collecting. I scrounged 10 or so out of an old alarm clock, and they work perfectly!
6) A small length of wire.
You'll want about 6 inches or more of solid-core copper wire that is flexible but stiff. Telephone or CAT-5 wire work great.
Step 2: Tools and equipment
1) A sharp utility knife.
You'll be using this to cut the LEGO block, so it needs to be sharp and strong. You may be able to get by with an X-acto knife, but be careful not to snap the blade! Also, please, please, please try not to sever anything important!
2) Strong glue.
I use E-6000 glue, which provides a good bond and should be available from most hobby shops. Don't be afraid to invest in a whole tube, as it is fairly universally useful. Hot glue may work, but could be awkward to use, and I haven't tried it.
3) Wire Strippers and cutter.
Anything that can strip and cut your wire will work.
4) An X-acto knife.
For cutting and hacking places the utility knife won't reach. You'll want a good, sharp blade.
5) A soldering iron and solder.
Don't worry, there's no major soldering here, we just need to attach wire to the LED and switch.
6) Dremel, drill and/or drill press.
You'll need at least a drill or a Dremel to make the holes for the LED and power button. I found a drill press coupled with a good vise very useful for this, but, with a steady hand and nerves of steel, a drill should suffice. Just be careful!
I also found the drill press useful for removing the insides of the LEGO piece, as will be shown. However, chances are your X-acto blade will be fine.
7) A 5mm drill bit.
This is the same size as the LED, and will make for a snug fit.
If you're in the States and find that metric sizes are difficult to find, you should be able to get by with a 3/16 inch or 7/32 inch bit, as long as the LED can fit through the hole. A 3/16 inch bit should work for making the power button hole.
8) (Not critical) A multimeter.
Always a useful tool. If you're going to do any tinkering in electronics, you'll need one anyway, so you might as well get one now... Anything with a continuity tester will work.
Step 3: Remove one of the studs
Please, please, please, be careful with this step! Knifes are sharp and dangerous, and you can seriously injure yourself. Always cut away from yourself, make sure you know where your fingers are at all times, and take it slow! LEGO pieces can be replaced. Fingers and eyes can't. If applicable, get a responsible parent to help with this!
Pick one of the shorter sides of the LEGO block as the front, and select one of the studs in the second row to be removed (see the photos for clarification here). Using your utility knife, carefully remove the stud and keep it for later in the project. Try to keep the cut as close to the base of the stud as possible so you end up with a clean cut and a complete stud. I found it best in this step to use a gentle rocking motion with the blade, while providing downward pressure.
You'll want to be sure to do this in a confined or uncluttered area, as the stud may go flying off to goodness knows where. I still have a couple floating around my project room waiting for the vacuum cleaner to find...
Step 4: Hollow out the electronics compartment
First, to create space for the battery and LED, you'll need to completely hollow out a 2x2 section of the bottom of the block. A pair of needle-nosed pliers is handy for ripping out the larger chunks of plastic, but you'll need your X-acto knife or Dremel/drill to completely clean it out.
Note that you'll need to completely clear a 2x2 square, as shown in the photo. Notice that I left the right half of the center tube, because I'll need that later. Because I chose to use a 2x4 block, this was much more difficult than it needed to be. If you've (wisely) chosen a longer block, you don't need to take so much care in this step.
If you decide to use a Dremel, drill or drill press, as I did, take it slowly on this step. I used a course Dremel cutting bit in my drill press and slowly cleared out the entire area. I was a little too careless, however, and let the bit heat up the plastic enough that it bubbled slightly, but not too seriously. If you use more care than I did, this shouldn't be a problem.
Step 5: Hollow out the battery compartment
Still, there's more pesky plastic to get rid of. This is essentially the same as the previous step, but you'll want to leave more of the plastic in place to help the battery cover stay in place better. Once again, take it slow, and try to leave the bottom of the cavity as flat as possible.
Step 6: Drill the LED hole
You may find it helpful to determine the exact center of the front face of the block and use a smaller bit to drill a pilot hole to keep the larger bit from wandering.
I found the drill press and vise invaluable for this step, but it should be doable with patience and a Dremel or drill.
Step 7: Drill the button hole
The pushbutton will be positioned below this hole with the stud glued on top. If the stud can't slide down into the hole, then the button will never be pushed on and all of your work will be for naught.
Again, you'll find this easier with a drill press and vise.
Step 8: Prepare the pushbutton
The pushbuttons I'm using here and all similar ones that I've seen before have four pairs of legs. two of the legs are connected internally to each other, and the other two are also connected internally to each other. There's not enough room inside the block for all four legs, so you'll need to remove the two redundant legs.
The surefire way to determine which leg are connected internally is using a multimeter. Any decent multimeter should have a continuity tester to determine if there is an electrical connection between two points. Use the continuity tester to determine which pins are connected together. Remove one pin from each pair of connected pins on one side of the pushbutton (either using some wire cutters or just bending the pins up and down until the pins break off). You should end up with two pins on one side that are not connected unless the pushbutton is pressed.
Bend the remaining pins horizontally, as shown in the picture.
Note that, if you don't have a continuity tester, you can probably follow the picture here and things should work fine. All the pushbuttons that I've seen have the two legs that are bent toward each other connected internally.
Step 9: Attach the pushbutton
The stud removed earlier is going to be glued to the top of the nub of the pushbutton that sticks up through the hole. I was lucky enough that the pushbuttons I had fit so well that the top of the nub stuck up through the hole and ended flush with the base of the studs. If your button nub is too tall, you may need to (carefully) trim it with your knife so that the stud is at the right height.
Once you've made sure the pushbutton fits, glue it in place. I've found that a few drops of glue around the top of the pushbutton (staying away from the nub) and on the side that is pressed against the outside wall of the block is sufficient. Let it sit and give it time to dry. 10 minutes should be sufficient.
Step 10: Reattach the stud
Try to center it so that it can be pressed down into the hole made earlier. This will push the button, completing the circuit and turning on the LED.
I don't have a picture of this step. If done correctly, the stud should look like it was never removed.
Step 11: Add the LED
With the LED inserted in the hole, bend the leads as shown in the picture. One lead should be bent to meet with one of the pins of the pushbutton (the one closest to the LED) as shown in the picture. Use wire cutters to clip the lead to meet the pushbutton lead and carefully solder them together.
The other LED lead should extend over the pushbutton and into the battery compartment. Make sure it doesn't contact the other lead of the LED or the other leg of the pushbutton.
Note that, if the legs of your LED are too short, you can use the wire to cover the distance between the LED's bottom lead and the pushbutton, and to extend the top lead into the battery compartment. The second picture above shows how I did this with another flashlight block I made.
Glue the LED into the hole in the front of the brick. If you did not use a 5mm drill bit, you may need to center the LED in the hole and hold it in place for a minute or two while the glue dries.
Step 12: Wire the battery compartment
Prepare the wire by stripping off about half an inch of the insulation from one end and coil this into a spring. This spring will sit at the top of the battery compartment and form the contact for one side of the battery stack, while the long lead of the LED will contact the other side. The other end of this wire will connect to the second lead of the pushbutton.
Decide how the wire will be routed from the battery compartment to the pushbutton. You may need to use your X-acto knife or Dremel to cut a channel for the wire through the plastic. Cut the wire to length and strip about an eight of an inch off the end of the wire opposite the spring. carefully solder this end to the second pushbutton lead.
At this point, if the top lead of the LED was not long enough to reach the battery compartment, you can use the rest of your wire to extend it. Strip off about a quarter inch of the insulation from one end of the wire and bend it into a U shape. This will contact the side of the batteries on the bottom of the block. strip off about an eight inch of insulation off the opposite end of the wire and solder it to the end of the LED lead. Please see the second picture in this step for an example from another block I created.
Step 13: Insert the batteries
If the LED doesn't turn on, reverse the batteries and try again.
If the LED still won't turn on, you may need to check your solder connections and make sure that the wires contacting each end of the battery stack are making good connections.
Step 14: Attach the bottom plates
If you decided to use two bottom plates, as I've done here, you can glue one plate over the LED and switch, making sure to leave access to the battery compartment. A few dabs of glue around the sides of the plate should be sufficient. Use the second plate to cover the battery compartment. Leave it unglued so that the batteries can easily be replaced. If you left enough internal plastic in place, the battery cover should stay in place fairly securely.