It beats every kind of "system" and "rational" framework.
Think of the people you love. Think of how your project will help them in some small way, even if that is just making you a happier, wealthier person who can give more to them.
Think of the people you dislike, whose values you detest, who will gain and triumph in some way by your failure.
Picture a fantasy vision of a better world, where your contribution, however small, brings value to many.
If none of that stirs anything in you, and gives you a burst of energy to redouble your efforts, then two unfortunate things may be the case:
You may be incapable of emotion. About 5% of us are, in which case ignore all of the above and find a system. Stop looking for ways to "motivate yourself" because "motive" is connected to "emotion" (same root).
What you're doing may not be at all worthwhile. That isn't a reason to give up. The road to a project that's genuinely fulfilling and is "emotionally self-powered" passes through many mediocre and failed "learning" projects along the way. Completing it many be all you need to do to move on.