Firstly, undergravel filter are not recommended for planted tanks. That doesn't mean it won't work but it's not ideal. It will draw the nutrients away from the roots too quickly. Ditch it and get a canister or hang on type.
Have you considered using an aquatic compost of some type, Laterite etc...? It would help greatly.
But too answer your question, I have, at the lowest point 10cm of substrate. That's not based on any science really, just the way the sand, compost, sand, gravel layering worked out! At least 5 cm should be ok, i guess.
Andy