Instructables has lots of DIY bike lights, but here is my version which is cheaper and lighter than most. The difference is that I use smaller MR11 halogen bulbs that results in a more compact product, at the expense of somewhat reduced light output and efficiency. Since this is a pretty simple project and there are tons of other resources with more detailed step-by-steps I will just provide the basic components required and some pics to make the whole thing easy to understand.
Step 1: Bill of Materials
As previous makers have noted there are a wide number of parts and bits you can use to complete a DIY bike light project. The most important are the bulb, connectors and the switch. Since I tend to commute rain or shine I chose connectors and switches that can handle water. Sealed bulbs with front glass are also required. The connectors are "trailer" connectors you can pick up at the local auto parts store, and the switches are waterproof units purchased conveniently from the same source as the bulbs and other parts, www.batteryspace.com.
1. MR11 Sealed Halogen bulb
I suggest a 12V 15W spot for a good all-around light that will illuminate your path well. If you are more concerned about lifetime, you can get by with a 12V 10W spot. Stay away from the floods if possible.
12V 15W Sealed Spot
12V 10W Sealed Spot
2. PVC Body Parts
I have not had any trouble with the regular white PVC failing or melting at up to 20W. Over volting a 20W from 12V to 15V for more light output may cause softening of the PVC since you are effectively upping the wattage from 20 to 31W.
Sources: You can get these parts at any home store such as Home Depot, Lowes, Menards, Do-it-Best, etc. Look for 1" PVC couplings and misc parts. You are looking for 1" threaded FIP cap and 1" threaded male adapter. See pic below for an idea of what you will need.
3. Bulb socket.
You can probably just solder on wires to the bulb but the correct sockets are available from batteryspace.com for around $1USD so why not just get it.
Source: Ceramic MR11/MR16 Bulb Socket
4. Trailer connector
It is best to have a simple way to disconnect your light from the wiring harness of your bike which includes the switches and battery. I choose to use 2-wire automotive trailer connectors which are designed to handle large currents and operate in wet and dirty conditions. See pic below to get an idea.
Source: 2-wire trailer connector
5. Metal mount.
You can use whatever you have handy to make the mount. Since I wanted a light and simple setup, I used a single piece of light stainless sheet I had laying around. Bent it into a clamp and added a bolt through the rear PVC cap as pictured. A bit of rubber cut from an old innertube will protect your paint from the clamp.
Source: Whatever you have around.
6. Waterproof switch.
I have the switch permanently mounted to my bike between the trailer connector to my light, and another trailer connector to my battery. This allows removal of the light and battery as needed and the switch and wires can be cable tied, duct taped, or otherwise mounted.
Source: Waterproof switch
Of course you will also need a suitable battery. These halogen bulbs are rated for 12V but you can run them at slightly higher voltage to get a lot more light at the expense of reduced bulb life. Many people run halogens at 13.2 or 14.4 volts depending on their choice of battery, NiMH or Li-Ion. The building of battery packs is a detailed topic in itself and can be found discussed in great detail elsewhere. For battery cells or pre-built packs, www.batteryspace.com is a great starting point.
Step 2: Assembly
Putting the whole thing together is not too difficult. The 1" PVC male adapter will hold the MR11 bulb perfectly, and a little RTV silicone around the rim will glue it in place. I used black since that is what I had handy, blue also looks nice. See pic below. While this is curing, drill a hole in the back cap for the leads to the bulb socket. You can epoxy this hole and wires in place to seal it all up. Before doing this, plan on leaving some extra wire inside the housing wound up a bit in the opposite direction to that used when threading on the rear cap. This will give you the room to plug the bulb in as well as let you screw on the rear cap without tweaking the wiring too much. See pic below.
Once the bulb socket is in, solder up the trailer connector to the socket wires, use some shrink wrap to protect the joints. With that, screw on the rear cap and fire up the light. The heat of the light will help cure the RTV Silicone. Plan out the wiring run on your bike and add the connectors and switches as desired. I used electrical tape to hold everything on securely, and used an extra water bottle cage to hold my battery. See pic for details. Happy riding!