Vin Pin Question

I usually power electromagnetic locks using an arduino and a 12V relay. The magnetic locks require 12VDC. However, when i powered a magnetic lock with 9VDC, the magnet still retained a lot of magnetic power. The Vin pin of the arduino supplies 9V when the arduino is powered by an external power supply using the barrel jack. I was wondering if I could use the Vin pin straight to the magnetic lock to power it or if this would draw to much current from the arduino?

If the electromagnet is connected to Vin, the current will be drawn from the power supply, not the Arduino.

However, motors, relays or electromagnets generate severe electrical disturbances and can cause resets, malfunction or even the destruction of an Arduino, if you use the same power supply for both.

It is always best to use separate power supplies (with grounds connected), but if that is not possible, "power supply decoupling" of some sort is essential.

The voltage regulator and decoupling on the Arduino is minimal, so a possibility is to use a good step down regulator (e.g. from Pololu) to produce 5V from the motor power supply and use that to power the Arduino via the 5V input.

jremington:
The voltage regulator and decoupling on the Arduino is minimal, so a possibility is to use a good step down regulator (e.g. from Pololu) to produce 5V from the motor power supply and use that to power the Arduino via the 5V input.

I'd think that a RC filter also would provide clean power to the Arduino Vin. A small resistor (5-10 Ohm) and a big cap (100-1000µF) should work.

I was wondering if I could use the Vin pin straight to the magnetic lock to power it or if this would draw to much current from the arduino?

There is a seriese diode between the barrel jack and the Vin pin. It is rated at 1A, so probably no.

A small resistor (5-10 Ohm) and a big cap (100-1000µF) should work.

Probably. That is an example of "power supply decoupling" mentioned in reply #1.

DrDiettrich:
I'd think that a RC filter also would provide clean power to the Arduino Vin. A small resistor (5-10 Ohm) and a big cap (100-1000µF) should work.

Replacing the resistor with an inductor would be more effective with less losses.

The losses are intentional, reducing the voltage drop on the regulator. This allows to draw more 5V current from a high input voltage.