Onset of convection in a layered porous medium heated from below