If it's motivation for a personal project, that's far more personal and the first thing is to make sure that the rest of your life is together to give you to the environment you need to get your personal projects done. I'm working on my second book right now, my first did really well but I've lost all the drive to do anything with the second one. The first one burnt me out completely, so I'm trying put things around me that will get me in the right frame of mind and wait for the spark of creativity to light and then I can get it finished.
One thing I definitely did wrong was not taking a 4-6month break after college to really decide what I wanted to do and de-stress. After leaving a FAANG about two years after graduation I did this out of desperation and cannot describe the positive effect on my work ethic and mental state after basically not doing anything productive for 5-6months.
This might be a common trait with those who have ADHD but I usually find that the only way to de-stress is to simply remove all forms of taxing sensory input or work for at least 3-4 weeks.
Talking to my close friends helps me retrospect what made me loose motivation in what I started.
Sometimes just by pulling out all my will power to do same non motivated task for 20mins brings back all the momentum needed to get me going.
When there is a task that you are faced with that you don't like, attempt to rephrase how you look at it. Instead of saying, "I don't want to $foo," say, "I want/need to do $foo so I can $bar." When you approach tasks by looking at the benefits you appreciate, it becomes easier to take the next step in that task. Or it might reveal that you shouldn't be doing a given task!
The less motivated I am, the bigger that paycheck needs to be.
I've talked to my primary care doc and he's shared stories of patients in their thirties brought to tears after seeing what they could have been capable of by "giving in" to the use of stimulants day-to-day or at work.
In our industry the medical use of stimulants has no reason to be stigmatized.
Usually once a week or two is plenty to keep the flow going.