I am at the end of 1st trimester. I have found that taking melatonin helps me often. Yes, I checked with my midwife and she said it was fine to take. I even fould some that has b-6 and calcium in it with just a small amount of meletonin. Since my mind runs alot at night having add, I find it to be real helpful.
In addition, I turn on relaxing soft music at night. I set it to play on a radio in another room just load enough to hear and set it to turn off after an hour of so to insure it doesn't play all night and disturb my sleep.
The last thing I would recommend it to have a set time at an earlier hour to get yourself off the computer. I know from experience that the longer you set and surf the net, the longer it will take to start feeling tired. Take it from someone that has suffered through bouts of insomnia.
Good luck to you. I hope my advise helps a little.