Power Supply
The various power supply options explained below are generally common across boards. However, since board designs are always changing, you must refer to the latest specifications of the board that you are using to ensure you are using the right power supply. Using incorrect power may cause your circuit to malfunction or in extreme cases your board or components to get damaged.
There are multiple ways to supply power to a microcontroller board:
- USB Connector
The board can be powered by connecting it to a computer using an appropriate USB cable depending on the USB connector provided with the board. This provides a regulated suppply (typically 5V), and the onboard voltage regulator is not required (it is bypassed). With this power supply the board pins can generally provide a higher current to power more components.
If the circuit needs to run independent of a computer (which is quite often the case once you have finished building and programming it) the USB connector can also be supplied power by a power bank which supplies a regulated voltage of the desired level (typically 5V).
When connected to a computer the USB cable is also used to upload programs to the board from the IDE running on the computer. The cable also acts as a data transmission channel to send data to or receive data from the microcontroller on the computer.
- VIN Pin
If you would like to use a battery without a USB connector you can supply power using wires connected to the VIN and Ground pins on the board. The input supply can range between 6V and 24V. The onboard regulator brings down the voltage to 5V as required by the board.
The VIN pin is connected directly to the input pin of the onboard voltage regulator on boards and therefore it does not have reverse polarity protection, which is required to protect the regulator. Hence, this approach must be used with caution. This approach also limits the current supplied to the boards pins and current-hungry components may not work as well.
- Barrel Jack Connector
Some boards have a barrel jack connector which is a connector that is typically found on an AC to DC converter. The board can then be supplied power from an electrical wall socket. This supply also goes through the onboard voltage regulator (effectively connected to the VIN pins internally) and is subject to similar constraints as using the VIN pins.
The preferred option for beginners is to supply power to a board through the USB connector from the computer or a power bank.