You should turn off electronic devices at least one hour before bedtime. The blue light emitted by screens can interfere with your body's ability to produce melatonin, a hormone that regulates sleep. Avoiding these devices helps your mind unwind and prepares your body for sleep.