Powering my access control project

Hi, I decided to make an access control system for my room and there are some questions I ran into.

This project consists of an Arduino Nano, an RC522 reader, a 16x2 LCD monitor and a 5V relay. The relay is used to control a 12v electromagnetic lock.

I wished to power everything with one 12v power supply so I want to make sure my whole set won't burn when it's plugged into the power outlet :sweat_smile:

My question is, should I convert the voltage to 9v or 5v to power my Arduino Nano and is it safe to power the relay with Arduino itself?

I know an Arduino can take up to 20v via VIN pin, but it seems if you provide over 9v of power, the Arduino will heat up when lowering the voltage to 5v and could cause damage in long term of use.

The relay question is, I saw a lot of example projects just simply power a relay with Arduino, but also there are a lot of posts says it's not good to power a relay that way (it may draw too much current or something like that).
It's just so cumbersome to convert 12v to 9v to power Arduino and THEN convert 9v to 5v to power the relay if it's not safe to power relay with Arduino. :sob: :sob:

Thanks for anyone who read this post or reply!

I'm not a native English speaker so I apologize for my poor English expression. If there are anything not clear please feel free to ask.

Voda_duino:
This project consists of an Arduino Nano, an RC522 reader, a 16x2 LCD monitor and a 5V relay. The relay is used to control a 12v electromagnetic lock.

The BEST voltage for an Arduino voltage regulator is 7V so if you are getting a buck converter to reduce your 12V supply, choose 7V if you can. 9V is ok.
Relay modules have a transistor to drive the relay coil because it typically need more current than the 40 mA the Arduino pin can supply. Instead of using a transistor to drive a relay to switch a 12V circuit you can use a transistor or MOSFET to switch the 12V directly. I recommend a "logic level" MOSFET that fully switches ata Gate voltage of 4.5V or 5V. You can tell from the datasheet where it says what Gate voltage was used to test the ON resistance (RDS(ON)). Typical MOSFETS need 10V or more on the Gate to switch fully.

johnwasser:
The BEST voltage for an Arduino voltage regulator is 7V so if you are getting a buck converter to reduce your 12V supply, choose 7V if you can. 9V is ok.

Thanks for replying!
MOSFET seems to be a great alternative to relays, but it's somehow difficult for me to get my hands on one. :sob:
However, I managed to find a module that converts DC 12v input to 3.3v, 5v and 12V direct output with maximum current for about 800mA. This should work just fine for powering my whole project.

I'll definitely try MOSFETs in my future projects if I have chances to find some of those!