Setting a legal ball screen without getting called for a moving pick
Technique

Where to stand, what to do with your arms, and the moment most screeners draw a whistle.
A screen is legal when you are stationary and occupying a space the defender could have avoided. That is the whole rule, and nearly every illegal screen breaks one of those two conditions.
Start with the angle. You are not standing beside the defender, you are standing in the path he is about to take. Before you set anything, look at where your teammate wants to drive, then plant yourself so the defender's shortest route to that spot runs through you. A screen set at the wrong angle is just a man standing near a play.
Get there early and get set. Both feet planted, shoulder width, knees bent, weight low. If the defender is approaching from behind and cannot see you, you must leave him room, roughly a step, to change direction. If he is facing you and can see you coming, you can set it much closer, even right against him.
Arms are where fouls happen. Cross them over your chest or hold them tight against your ribs, hands in front of your waist. Men often put an elbow out for balance or grab a hip to slow the defender down, and both are automatic calls. If your arms are in a shape you could not hold in a photograph, they are in the wrong shape.
Then hold still. Not briefly, properly still, until contact happens. The usual whistle is for leaning into the defender at the last instant, which is a moving screen even though your feet never moved. Keep your torso vertical and let him run into you.
Immediately after contact, do something. A screener who stands admiring his work is useless. Either roll hard to the basket, opening your chest to the ball as you turn so you can catch a pass, or step back behind the arc if you can shoot. The turn should start the moment the ball handler's shoulder passes yours.
One detail that improves screens more than anything else: make contact with the defender's body, chest to shoulder, rather than brushing past him. A screen that touches nobody has accomplished nothing, and a legal screen that genuinely lands is uncomfortable for the defender without being a foul.