I want to build myself that game where batons hang in a semi-circle in front of the player, drop in random order and the player tries to catch them.
I want to use electromagnets controlled by Arduino UNO board. To hold and drop the bathons.
I've put together a test code with LEDs
It works like this: When you press a button, all LEDs light up. When you press it again, there's a 3s delay and then they start shutting off in random order and intervals between 1 and 4s.
My plan is to connect each electromagnet to a 1N4007 diode and to separate Arduino pins via gate of TO-220 NPN Transistor.
Does it sound like a viable solution? And how would you power it? (This is a result of me scraping the internet's various sources, I still don't have that much understanding of how to calculate the amps necessary to power the project and how to connect it without frying the Arduino)
Yes.
Each magnet requires 12V @ 0.220A. Lets round that up o 0.250A. You have six magnets, so you will need a 12V power supply capable of supplying at least 6 x 0.25 = 1.5 A. So a 12V, 2A supply would be a good choice.
Then you will need 6 MOSFETs or transistors, diodes, and a few resistors for the rest of the circuit.
Do you know how to read a schematic and solder components on a protoboard?
Also you can choose between learning to build such a circuit, and buying fairly cheap MOSFET module PCBs that already have all the interface components to connect to an MCU like the Arduino.
It's mostly the Fritzing that sends me reaching for the heart pills.
Your gate drive circuit is not quite right. The gate resistor should be in series with the gate, you show it in parallel. You need to add a (maybe 10k) pull down resistor to keep it turned off when the Arduino pin hasn't been set to output yet.
TIP120 is an NPN Darlington transistor, which is in reality 2 NPN transistors connected together. If you have these already, I think they would be fine, but they are overkill. Even a small NPN transistor like BC337 would be fine.
You marked the pins G, D, S which would be correct for a MOSFET, but it should be B, C, E for an NPN transistor.
Alright, thanks a lot for the diagram! And from the other comments Im assuming I can use the same power supply to power the board as well, right? So this is what it looks like now:
Oh no! So you're saying these are of no use to me in this project? @PaulRB made it sound like they might be interchangeable here. It's gonna take at least a week for mosfets to arrive. What kind should I use?
TIP120 will be ok for this circuit, I'm pretty sure. They are by no means the best choice, but they will work. It's better to use them than waste them, given you have already ordered them. Next time, ask this forum, not an "Artificial Idiot" (AI) when you need advice on component choice!
With TIP120, the 10K pulldown isn't needed, but you will still need a resistor on the base pin. 170R is a ok but not a common resistor value. Anything from 220R to 2K2 will probably be fine because Darlington transistors have very high gain.
170 ohms is way to small. With a minimum Vbe(sat) of 1.3V, you would be drawing (5V-1.3V)/170 = 21.8mA from a GPIO pin which is above the recommended value of 20mA. For 6 of these you would be drawing 131mA just to drive the transistors. It would be a good idea to keep the GPIO current per pin to 10mA or less.
470 or 510 ohms would be a good choice
Not completely. I'm saying they aren't the best choice. MOSFETs and some other types have almost completely displaced BJT transistors in power applications now.
I had no idea this forum is so helpful and quick to respond. It's a very refreshing experience.
The ai did a ok job assisting me with the code so i was tempted to believe it on the matter of schematic as well. It's reassuring to see that it's not as all knowing as it might pretend to be
I didn't find any 2A power supply at home just 1.6A that looks like it went through war.
Do you think I could somehow use iMAX B6AC battery charger in the meantime?