Motivation is a very personal thing and when you do something for the fist time its always the harderst!
Also I think that disciple is important when programming even if a bit overlooked when programming is a hobby....
This article should be quite relevant: http://www.gamedev.net/page/resources/_/business/production-and-management/overcoming-procrastination-r3261
By trying to understand yourself and what makes you tick, its possible to improve yourself.
For example, scratching done tasks gives you motivation.
So writing what you need to do and trying to get more things off the list would make you feel like there is some progress being done.
Hopefully this confidence boost will feed it self so that you work more.
By knowing what makes you tick, such as watching something or listening to some music, (hopefully) you can pick yourself up when you feel low and get something done.
Also like others before have said, having a list of pre-defined tasks helps a lot. I guess its because the problem(s) that need to be solved are already set. So rather than spending 10/20 minutes thinking what to do, I can straight away get working. More gets done = more happiness = more motivation to continue.
Here is a nice video which kinda picks some important parts:
Failure, even if its demotivating is very important. Generally humans learn by trying things out and experiencing them. So even if you tried your best on a project and it didn't work out: The architecture was awful.... it took you ages to add new parts to the project.... The main part is that you worked on it and (hopefully) tried your best.
Its not easy to realise how much you will have learned from the experience. So that next time when you try to do this, you will have an idea how to make it work better. Maybe even you will try to apply the newly learned lessons to the project and re-factor it and cantinue until the next problem.
Hence why, starting small and progressively working on larger projects is preferred.