Interestingly, a lot of those techniques are extrinsic motivators, which studies have found to actually
reduce self-motivation.
(A classic book on the subject is Alfie Kohn's "Punished by Rewards."[1] Dan Pink's TED talk[2] is a entertaining overview of the same concepts.)
That's not to say that I have any answers. But when I tackle the problem, I'll probably focus on intrinsic motivators (love of the material, sense of challenge, joy of solving problems, sense of mastery, etc.) rather than extrinsic motivators (badges, prizes, employer threats).
[1] http://www.alfiekohn.org/books/pbr.htm
[2] http://www.ted.com/talks/dan_pink_on_motivation.html