Writing a letter seems to be such an old practice with the texting, pinging and so on happening in the recent times, however the effect a letter would have on your ex can never be compensated with anything else.
Well, you may feel that writing a letter is the most time consuming thing you have ever done in the recent past, and this time is what is required for you to think of your real feelings towards your ex. You would weigh each and every word while writing and sometimes keep rewriting too. This makes your words refined and is surely a solution of your how to get ex back question.
Sit in a quiet place and begin writing about how you had felt when you were together, how much you both had enjoyed the company of one another and what things had brought you together. Do not discuss about your reason for break up or play blame game, it would only worsen the situation.
Towards the end of your letter you could very subtly put in that you sometimes dream of you both together again. Do not show anywhere how much you miss your ex, just the positivity that had been there while you were together.
If your ex feels the same you would get a positive response, if not keep trying, you can surely get your ex back.