Andre Y.
I feel like making a set time every night to turn off electronics is the best way to make a habit out of it. Try to get everything you need to do on electronics done before that set time. If you do it for a while on purpose at a certain time then eventually you will start to do it out of habit. You can also adjust the time depending on if your schedule changes but it's best to turn electronics off an hour before bed. Remember you don't have to be too strict on yourself.