One of the most common mistakes when building electronic projects with Arduino microcontrollers is improper or insufficient power supply. When we add relays, motors, displays, or WiFi modules to our projects, the current consumption increases, which can lead to unstable operation or even damage to the microcontroller. In this article, we will look at different powering methods and key rules for safe operation.
Methods for Powering the Arduino Board
Arduino Uno or Nano offers several options for supplying power. Choosing the right path depends on whether we are testing the project on a workbench or running it as a standalone device.
| Input | Recommended Voltage | Description and Usage |
|---|---|---|
| USB Port | 5V DC (from computer or charger) | Great for programming and prototyping. Current limit is usually 500 mA. |
| VIN Pin / Barrel Jack | 7V–12V DC | Uses the built-in linear regulator (AMS1117). Voltage is converted into a stable 5V. |
| 5V Pin | Exactly 5V DC | Direct power bypassing the regulator. Requires a highly stable external power source. |
Why We Should Not Power All Loads Through Arduino
The onboard voltage regulator on the Arduino has structural limits. It converts excess voltage into heat. If we connect a 12V power supply to VIN and load the 5V output with heavier consumers, the regulator will quickly overheat and shut down.
- Servo motors and DC motors generate current spikes and must have their own power source.
- Relay modules (especially multi-channel ones) can draw more current than the 5V pin can safely provide.
- Communication modules (such as ESP8266 or NRF24L01) require high instantaneous current bursts when transmitting.
Example of Proper Connection with External Power
When using an external power supply for loads (e.g., a 5V power supply for relays or motors), we must mandatory **connect the grounds (GND) together** for both power sources. Without a common ground, the control signals will not work properly.
// Example code for controlling a relay with an external power supply
const int relayPin = 8;
void setup() {
pinMode(relayPin, OUTPUT);
// Relay remains off at startup
digitalWrite(relayPin, HIGH);
}
void loop() {
// Turn relay on (powered from external source, Arduino only provides signal)
digitalWrite(relayPin, LOW);
delay(2000);
digitalWrite(relayPin, HIGH);
delay(2000);
}
Practical Tips for a Stable System
To prevent interference and microcontroller resets, always use a separate power supply for heavy power loads. Additionally, it is recommended to add an electrolytic capacitor (e.g., 100 µF or 470 µF) in parallel across the power lines to smooth out voltage drops when loads switch on.