Man, I just wrote a really long post, and the page crashed on me
Anyway, I'll give you the short of it. I decide to self medicate several things, including insomnia (which I've had badly since puberty) using opiates.
End result? 8 month long opiate addiction culminating in using every opiate/oid I could get my hand on, including smack. Non 24 hour sleep schedule (Google it, it's quite lot worse than it sounds), and thousands, if not tens of thousands of dollars spent in drugs which mostly consisted of opiates.
What helps (now that I'm clean of opiates):
Melatonin
5htp
Valerian root
Chamomile tea
Having the room completely dark and listening to chill music (like what many people like to do while tripping)
Benzos, especially clonazepam and alprazolam (kpins and xanax)
If you're planning on using the opioids anyway then be VERY careful with benzos or avoid them altogether. If you're on an antidepressant, please research any possible drug interactions between them and tramadol (iirc it's an SNRI, could be remembering wrong though), and also all of the supplements/drugs I mentioned. For example, 5htp should likely be avoided too.
In any case, good luck! Insomnia is so much worse than many people realize, but opiates are not the answer.