For example, I recently had to learn a desktop programming toolkit in Python, which I found very tedious and uninteresting. But knowing that I was doing it to help a team of engineers design a new kind of lightweight electric vehicle really drove me to put my heart in it.
Even when your project isn't aiming for such impacts, just putting (good) food on the table of your family can be a motivation I guess.