Stepper motor should drive a frame to tilt, but not 360 degrees, but only within 20 to - 20 degree. What simple machine elements do you use to restrict the freedom of movement? It must be a mechanical solution, not a software one. Can it be only done through gear elements and no further addition elements?
Something like the following https://www.youtube.com/watch?v=w7v2lVsjH4g