Always stop in the middle of a project and go for a walk, don’t power through and reward yourself when you are done.
This does 2 things:
1. it allows your subconscious to work on the problem.
2. you get some perspective.
Never fear: You will wish to continue the project when you get back. This is known as the Ovsiankina Effect.