Using a hall sensor to detect a magnet, then power an electromagnet

Hi, I have a little project im working on where i’ve built a circuit around an Arduino Micro and/or Uno that detects a magnet using a hall effect sensor. This part works great. However now im on phase 2 and what I want to do is whenever a magnet gets detected the circuit should then power an electro magnet.

I’ve managed to create a crude electromagnet using some copper wire and a steel bolt. When I apply a current via a battery it works fine and activates the hall sensor.

However when I plug this electromagnet into my arduino it seems to lose all its power and cannot even pick up a paperclip.

My assumption is this is because it doesnt have enough current.

Attached is a rough diagram of my circuit.


I could increase the amps by using a transistor…

If anyone has any ideas please let me know, i’m new to electronics (its been a long time since i did it in school) so i’m eager to learnt he proper way of doing things.

Cheers in advance.

Are you going to have a proper electromagnet or is your wrapped bolt the end product that will be used?
I'm assuming it 'worked' when you hooked it directly up to a battery, and yes it works because of the current flow. That's like electricity 101. The direct hookup is literally a short circuit.
Arduino doesn't allow that.

I would give the electromagnet its own power source, and go with a transistor as a switch/relay.

Thanks for the advice this makes the most sense to me. I was trying to avoid using 2 power sources but I think in this instance I don't have much choice.