[Solved] Using external 5V supply to power buttons

I am using external 5V supply to power buttons (for input signals) and parts of my A4988 stepper motor driver. I am doing this as I will be increasing the number of motors in future and I don't know if it would be safe for my Arduino UNO to supply 5V to so many devices.

I am new to electronics, so I just want to confirm if the circuit in the image I uploaded will not burst into flames.

Have I taken appropriate values of capacitances and resistances? Also, the connection between 5V ground and Arduino's ground was suggested by ChatGPT. I don't know if ChatGPT is reliable, so please can someone verify if this is a correct move?

The regulator is wired back-to-front it should be like this.
7805CV Datasheet

изображение
do you see the difference?
this prevent killing MCU by accidentally connect 5v line to 12V or something similar.

Capacitors are all correct, but also add a 104nF capacitor to VOUT & GND, VDD & GND.

I am sorry, this diagram was unprofessionally made in drawio[dot]com. I have checked the voltage at output with multimeter and it is 5V approx.

That's all right....I was just making sure that you had it wired up correct.

Everything else looks OK, your circuit should work....Provided you hook everything up correctly.

The connection between 5V ground and Arduino ground is correct too....If you want to know more about it google "common ground".

No, it's not safe. If you power the motor/7805 section before powering up the Arduino, then you could fry the driver and/or Arduino.

You should always power the logic part of a driver from the 5volt pin of the Arduino.
Don't worry, the logic part of the driver doesn't require a lot of current (<8mA).
Powering up to 25 drivers from the 5volt pin of an Uno should not be an issue.

The buttons can be simplified. Remove the 10k resistors, and connect the buttons between pin and ground. Use pinMode(buttonPin, INPUT_PULLUP); The pin will now be LOW when the button is pushed and HIGH when not pushed.
Leo..

My project (in future) will require me to operate on, 12 motors, 14 solenoid valves (connected through MOSFET (IRF540) relays) and maybe a bluetooth module.

So, I will be powering 24 push button input pins (12 CW and 12CCW), 12 stepper motor drivers, 14 connections for MOSFET relay switches and bluetooth module with the same Arduino 5V supply.

That's 50+ connections on Arduino's 5V alone. This was my reason for going with external power supply.

I have both an UNO and a MEGA and plan to use UNO now for testing and MEGA as parts increase.

Can the issue you mentioned be resolved if I power Arduino first and then the remaining circuit?

Not a logic-level mosfet, so a poor choice to use with an Arduino.

It's all about current draw, not about the number of connections.
Relais, motors, valves, etc. should be powered from an external power source, just not the motor drivers and the BT module. Post a full diagram if you're not sure.
Leo..