I want to make two projects that use a 12v input, a solenoid valve and a electrical lock. Both need a 12v current to work. I've seen some exemples for both projects that use a relay and an Arduino to activate mechanisms that need more than the 5v Arduino´s output. I was wondering, however, if I could use a Step-up Power Converter connected directly to Arduino´s Digital Pin. Is it possible? And is it safe?
if I could use a Step-up Power Converter connected directly to Arduino´s Digital Pin. Is it possible? That will not work, the Arduino's outputs cannot deliver enough current. An Arduino's output can deliver around 10 mA and that's enough to light up an LED but little more than that.
In theory a 5 V to 12 V Step up converter can be designed and made but at 10 mA input current the output current needs to stay below 5 mA and that's also very a small current. It is by far not enough to power some mechanism with a motor.
And is it safe? Define "safe". Safe in my definition is "will it harm/kill people" the answer is no. If your definition is, will it damage anything (like an Arduino), the answer is no because an Arduino's output can only deliver such a small current that nothing can get damaged, the current is too small.
But you're looking at the wrong solution. You need to see the output of the Arduino not as the source of power but as a signal to control the power. You can use a module with a relay like this:
The GND, VCC and signal connect to the Arduino. The signal is the output from the Arduino, VCC and GND simply connect to the 5 V supply that the Arduino uses. When connected like that the Arduino can control the switch in the relay, you can connect that in series with a 12 V power supply to power almost any module that needs 12 V with a high current. The relay shows how much voltage and current it can safely switch.
You really should provide some sort of sketch of what you're trying to accomplish. If you're trying to drive a high-current device with a logic pin, the terminology for what you need is a "driver".
There are a variety of approaches, the simplest probably being a simple bipolar transistor.