Hello everyone, im mew and kind of noob in the use of arduino, so here the cuestion: im working on a coil winder proyect, im using a 12v dc motor with a frz44n, a 4988 driver with a nema 17, (12v) , two hall effect sensors, a rotary encoder, a 16x2 lcd display with a i2c bus, an hc-05, 4 leds and a buzzer. So what would be the best or most efficient way to power it? Thanks!
Use a 12V supply with a current rating that will handle the stepper and DC motor. Use a buck converter (12V to 5V) and connect the 5V output to the Mega 5V pin.
Make sure that the 12V supply is capable of enough current for the stepper coil current plus the DC motor stall current plus some overhead (1.5 times, minimum).
So i should not plug the mega to the 12v supply. And the lcd the encoder and the rest of the stuff will work properly conected to the arduino 5v? Or should i conect them directly on the buck converter?
No, do not connect the 12V to the Mega Vin or power plug. Powering through Vin or the power jack means that the Arduino and all peripherals that are on the 5V rail are powered by the onboard 5V regulator. The on board 5V regulator is not heat sinked so will supply limited current before it overheats and shuts down. I would use a buck converter to drop the 12V to 5V and connect that to the 5V on the Arduino, bypassing the, weak, 5V regulator. Then the rated current of the DC DC converter is available on the 5V line.
With the buck converter connected to the 5V pin the LEDs, encoder, HC05, Hall sensors, buzzer and LCD will be powered by the buck converter through the 5V pin. That is one reason that I suggested at least 1.5 times the current required by the motors for the 12V supply. In fact, if you buy a cheap Chinese power supply, I would go for 2 times the current. Too much current capability will not hurt anything. Not enough certainly will.
Would a l7805 work? If not, what type or model of buck converter you sugest?
Coil winding projects have been done before. Search for "Arduino + coil winding" to see how they did it, what solutions they used. Just to get ideas....
A 7805 could work, but it will waste a lot of power. 7805 is a linear voltage regulator so it will drop the voltage and to do so dump off the excess as heat. That makes it less efficient. For 12V to 5V you will need a heat sink. A buck (switching) regulator does not drop the excess as heat and can be over 90% efficient.
I have used these 12V to 5V converters with good result. Like shown in the ad, cut that one trace and solder jumper the 5V pads for 5V regulation. Or don't cut the trace and adjust the tiny pot for 5V.
I've seen some tutorials but they dont seem to focus on this. Thanks very much for the replies!
One of the many problems with tutorials is that they either skip over the things the makers consider as so basic that they don't want to waste time explaining it, or they're made by people who poorly understand those basics themselves so they get it all wrong and don't even notice it themselves.
The advice you got from @groundFungus is good; if you do it that way, you'll have a robust setup that will actually keep working reliably once you get it up and running.
Be sure to choose a 12V supply that's sufficiently powerful for your motor (and all the rest) taking into account its stall current (not just the run current).
That is always the proper way to power the Arduino itself.
You may come across warnings regarding providing 5 V to the "5V" pin on the UNO/ Mega 2560/ Leonardo when it is also connected to a PC via USB. There is some concern that if the 5 V supply voltage is higher than the USB 5 V, feeding current back into the PC may cause it to malfunction or be damaged.
So arrange it so that whenever you have the Arduino plugged into the PC USB port, you disconnect the "5V" pin from the supply first.