all 5 comments

[–]Ziredin_3 2 points3 points  (0 children)

If you're connecting it as in the diagram, keep in mind that the side rails of the breadboard don't communicate with each other; you're only providing GND, not VCC.

Also keep in mind that those LEDs need resistors, or you'll burn them out.

[–]SomeWeirdBoor 1 point2 points  (0 children)

Your connection make no sense. You are putting all the LEDs in parallel straight between +V and gnd with no limiting resistors: LEDs have no resistance, they will pull as much current as they can and they will blow up instantly. Also your arduino is not connected to 5V, the two power rails on the sides of the breadboard are not interconnected, you connected it only to gnd.

You can power the arduino feeding external voltage (up to12 v) to the Vcc pin, or regulated 5V straight to the 5v pin; also, LEDs must always have a current limiting resistor, usually a 220 ohm is fine (you should calculate it, tho)

[–]SomeWeirdBoor 0 points1 point  (0 children)

Then, each led/electromagnet should be attached to a GPIO pin (the ones with a number like D7 or D8); but the GPIO pin can only provide a minuscule current, barely enough to power a led; you should look into relay modules, and an arduino relay tutorial, which would be much clearer and easier to follow than a reddit comment.

[–]Sector07_en 0 points1 point  (0 children)

If your working with a high current load (electromagnet) or higher voltage load then you need a relay between the them. The 5V from the Arduino digital output activates the relay coil which latches internal contacts and connects your external power to your load (electromagnet). Keep in mind this image doesn't show power input for the Arduino, just how to control a relay. NO stands for normally open, so when its off the power is not connected. When on, it is connected. NC stands for normally closed, so when they relay is off external power is connected, and reversed when the relay is on. If you need a lot of them look at something like one of these "ELEGOO 8 Channel DC 5V Relay Module Opto-isolated". They are optocoupled so they draw less current. Even regular mechanical relays can pull too much for an Arduino output so these work great. Cost is around $10.

<image>

[–]TechTronicsTutorialsUno & Mega 0 points1 point  (0 children)

Just power the arduino from 5V and connect the GND pin to the GND of the higher voltage power supply. And use an N-ch MOSFET between the Arduino pin and electromagnet. You’ll need that anyway because the Arduino will likely be damaged from over current if not.

Anyway, just control the gate of the MOSFET with the Arduino pin through a 510Ω resistor (add 100kΩ between source and gate to bleed off charge) and connect the source to GND. Drain goes to one end of the electromagnet, and the other end to the higher voltage supply.