If Arduino digital pins can be used as power supply pins then why do we need VCC pins? VCC pins work the same as digital outputs , don't they? So why do we still need VCC pins to power components
If Arduino digital pins can be used as power supply pins then why do we need VCC pins? [closed]
Digital IO pins and Vcc are very different.
When using the digital IO functionality of a pin, the pin is connected to the digital IO hardware inside the microcontroller. This hardware is a driver, that can drive the pin to either LOW or HIGH (0V or Vcc) depending on a bit in a register. Though this driver can only provide a very limited amount of current. The absolute maximum is specified as 40mA peak, but you should not exceed 20mA continuously. So technically you can power a component from a digital pin (just like you can drive an LED through a digital pin), but only if it does NOT draw over 20mA. That is a rather small current. So in general nobody would recommend doing that. If you draw too much current from a digital pin, you can destroy its IO hardware.
The Vcc pin is the power input for the microcontroller on the board. The microcontroller needs this to be at the right voltage (5V for the Arduino Uno), to work properly. This power can come from different sources: The voltage regulator (via barrel jack or Vin), USB or directly provided through the Vcc pin. As long as the voltage stays in the correct range, it will work.
You can utilize the Vcc pin to power external components. Though this is just connecting these components to the power supply in parallel with your microcontroller. The current for the components will not be drawn through the microcontroller, but only through the copper traces on the board from your power source. That is also the reason why the power output of the Vcc pin cannot be controlled via software: It is just directly electrically connected to the power source of the microcontroller. Nothing in between.
So: Don't power anything other than components with really small current draw from IO pins. If you do it, always make sure beforehand that the current will be small enough (below 20mA).
If the components need more current, you can power them through the Vcc pin. Only use the IO pins for control in that case. For some components (like motors, bright LED lights, etc) you might need additional hardware for controlling them (like a transistor/MOSFET/driver chip).
And keep in mind, that the current through the Vcc pin is also limited. Depending on your power source you can draw up to 1A (including the Arduino itself) from the voltage regulator on a genuine Arduino. If you need to draw more current than that, you need to connect the components to a power source outside of the Arduino. For example you can connect them to the power source, that you connected to the Arduino directly, so that the high current doesn't need to flow through the Arduino, but can directly go to the high power components.