For me, it always helps to pick a project that I'm interested in enough that I can keep pushing through it when I get to a dull part. Sometimes I might have to take a break for a bit and work on something else for a little while, but not everything is always going to be fun and exciting, even if it's a project that's really interesting overall or something that you're getting paid for (which can be pretty motivating). Sometimes you just have to suck it up and do it so you can get past it and move on.
It definitely helps having all that stuff planned out ahead of time so you at least have some idea of how it's going to work before you sit down to do it and can get it over with more quickly, rather than having to work out all the details at the same time as writing the code. Knowing what the general structure of it is going to look like and how much of it you have done already and what's still left to finish both makes it easier to do it right and gives you something to work toward. I kind of go nuts in the design stage sometimes, mapping stuff out and organizing everything until I'm satisfied before I ever sit down to write any code, so I always know how much more there is left to go on whatever piece I'm working on and have some kind of finite goal I can set to reach by lunch or the end of the day/week/whenever, along with measurable progress.
And back to the "working on things that are actually interesting" thing, that ties back into the "measurable progress" part. If you're working on something you're excited about (for whatever reason, whether it's for fun, like a a game, or something useful, like a tool that solves a problem that's been bugging you for a while), seeing it take shape and start doing the things you want is pretty neat. A good example is a chat client I was working on, which wasn't terribly interesting at first, but then when it hit the point where it could successfully open a connection to the server and authenticate with it and showed up in the userlist, that was a pretty big milestone. It may not have been able to send or receive messages or anything useful at that point, but with the foundation in place, adding and testing more features was suddenly possible, plus I could confuse and annoy other people with it by testing it on a live server. Motivation achieved! Heh.