Many times when patients come in with complaints of insomnia, I ask then if they're using a computer or watching TV during bedtime. What they don't realize that these activities can hamper their sleep for two different reasons.
One is, if you are using the computer or watching TV you become engaged with what you're doing, and that will cause you to become stimulated which makes it harder to fall asleep and stay asleep.
Another reason is that light from TVs and computers can also hamper your melatonin secretion. Melatonin is a hormone that is secreted by our pineal gland which helps us sleep onset. Now light is the most activating factor for us. We have receptors that are located in our retina which will take that light and send that signal to our brain that it's time to stay awake.
So increasing light exposure in the evening hours will suppress our melatonin secretion. So what I tell patients is to avoid electronics, starting an hour before your bedtime and stay in dim light to help with the sleep onset process.