ElectroMagnet cousing LCD problem (probably)

Hello, I'm trying to make a RFID Tag LOCK and i spotted some problems with my project.

Sorry that i don't have scheme but it works like this (or at least should):

  1. Reading RFID tag
  2. Displaying "hacking" msgs
  3. Giving a signal to relay which supply 12v electromagnet that releses doors
  4. Reset after 3 min (in code i lowered delay for tests)

Problems i have occured:

  1. The electromagnet probably causes some data change in display (the code works good). I will paste vidios for clearance.

  2. I'm not quite sure how to do a good user friendly lock. I mean that wont stuck if they pull doors. I need your advice :) The electromagnet works fine if nobody pulling the door at releasing time. Thought about servo but it will occur the same problem with pulling at time when relesed.

Im attachating code, videos and pictures:

Electromagnet power supply disconnected https://www.youtube.com/watch?v=JDOOhqLrS7o&feature=youtu.be

Electromagnet power supply connected https://www.youtube.com/watch?v=WvCaI4_lsDw&feature=youtu.be

CODE:

http://pastebin.com/VAgJVFRE

PICTURES:

https://www.dropbox.com/sh/c933vv3dcefr0qx/AADIboCI9SeR4xBWWSAxB_2sa?dl=0

Hello Ref the door catch Depends how important it is to get in and out of the door I can only speak for commercial doors, but these normally have a striker plate that is held in place probably by spring tension. Energising the solenoid releases the catch allowing the striker plate to move. Servos probably wouldn't be reliable enough. If getting in and out is important enough, you might need some sort of emergency release, and some doors are activated by fire alarms. Have a look at commercial door releases and get some ideas there. Solenoids are probably the best bets, simple and fast acting, If not properly fitted with diodes and so on, solenoids (electromagnets) can cause havoc with power supplies and quickly ruin digital pins if not run through a transistor - if you aren't already doing it. This can ripple through to data corruption.