This bed cost me about $22. The only thing I bought new was the 2" x 8"s. I got all the slats (the crosspieces that support the mattress), the bolts, the pegs that hold the headboard together, and the mattress for free. Scrounge on!
If you add fasteners to the mix, expect to spend another fifteen bucks or so.
You will need these tools:
Impact driver (or make do with your drill)
Ratchet and socket set
You will need these materials:
5 2" x 8" x 8' yellow pine boards, straight as possible
5 2" x 6" x 8' yellow pine boards, salvage preferable
8 1/2" x 4" galvanized lag bolts
32 1/4" x 4" galvanized lag bolts
1 1/2" x 3' dowel
Step 1: Framin'
So, the long sides are one inch longer than the mattress, and the short sides are four inches longer than the mattress, to accommodate both one inch of play on the mattress and one and a half inches on either side to overlap and create the joint with the long sides.
To reinforce the corners and create a spot for the legs to attach, I put a brace in each corner that was made from one of the leftover scraps of 2" x 8". Just cut the biggest right triangle you can out of the material. Make four of those.
Lay out the box on a level surface.
Step 2: Runners and Slats
Screw and glue these to the bottom inside of the long sides of the frame to create the runners that the slats will rest on. Use drywall screws that won't poke through to the outside -- 2-1/2" long ones are perfect. Make sure these are secure -- they take most of the weight of the mattress and its occupants.
Cut your slats to fit nice and tight inside. I used salvaged rafter tails from an old shed. Doesn't matter if that wood looks crummy or is a little warped or whatever, as long as it is strong. You could use thinner pieces, like 2" x 4"s, but I'd be cautious. They will probably sag over time, spanning four feet unsupported. Put a lot more in, and make sure they bow upwards.
Step 3: Legs!
Cut eight right triangles out of your scrap wood -- mine were the width of a 2" x 8" on their two equal sides. On four of them, measure 3/4" in from one side and space two holes how you want. Flush two triangles up to one another. Drill 1/8" pilot holes, then a 1/2" countersink for the lag bolt. Glue and screw the feet together.
Once the foot is made, hang it off a right-angled surface, like a milk crate, and cut off the point so it sits nice and flat on the ground.
Screw and glue the feet to the corner braces with 3" drywall screws.
Step 4: All Together Now
Attach two corner braces/feet to each long side with three 1/4" lag bolts. I popped a little drywall screw in each brace just to hold it while I got the other three into place. Stand up the short ends of the bed and get them attached to one side. Roll the frame down so the feet are sticking up in the air and attach the last side.
Pilot hole and countersink two 1/2" lag bolts through the ends of the two short sides and into the end grain of the long sides. Remember, the countersink hole needs to be bigger than the diameter of the socket that turns the bolt head, not the bolt head. Ratchet in the lags. As you can see in the one picture, you can screw a temporary block into the backside of the frame to have something to clamp against to pull this sides into line.
Step 5: Headboard
Hold your headboard up to the pegs and scribe lines across so they align, drill, and hammer and glue it down. Obviously, I miscalculated the thickness of the mattress a little bit and the headboard doesn't stick up much. Doesn't matter if you have your bed against a wall. If you want a bigger headboard, just lengthen your pegs and slap a 2" x 10" or 12" on there, or two 2" x 8"s.
Pop the mattress in and enjoy!