It would be best to lay out all your horizontal timber on a flat surface. By using spacers made from scraps of timber you can keep the gaps consistent as you work your way up the headboard. Apply glue to your vertical timber and place it on top. It would be best to have at least two vertical timbers directly over studs in the wall, so you have a solid mounting point. You might like to clamp them in position or have someone hold them whilst your screw through, joining them to the horizontal timber. Clean up any excess glue as you go.
The shelves could be cut out of a SpecRite 1200 x 600mm 18mm Timber Panel Hevea FJ Laminated. It would be ideal to make the spacing between the horizontal timbers 18mm to get a tight fit. You can apply glue to the shelves and insert them between the timbers. A screw through the vertical timber will lock them into position.