The answer to your question is basically yes, you can use ATmega I/O pins as +/- power supply terminals for other circuits. But there's a limit to what you can power that way (20mA per pin and 100mA total per ATmega). In practice this means you can only power the simplest circuits (single LEDs per pin, and not many LEDs in total, for example). As a general rule, you should really look for other ways to power anything else.

Also, there's a problem with the citation you gave. That 40mA figure is the absolute maximum current per pin, but that should be avoided. Safest is to use about 20mA of maximum current per pin. Also, the ATmega pins should not have more than 200mA flowing through Vcc and GND (also an absolute maximum that should also be avoided).

Usually, you should either power other stuff off of the regulated +5V that also feeds the ATmega (up to the regulator capacity that depends on the Arduino board - 500mA for the Arduino Uno - 1A for LM7805 regulators - and so on). You could also use the unregulated power in some cases. Then you should use digital pins on the ATmega to switch transistors on and off which in turn will switch your load. Sometimes you can use transistors to switch relays, that in turn will switch even larger loads.

Answer from Ricardo on Stack Exchange
🌐
Arduino
arduino.cc › en › Tutorial › DigitalPins
Digital Pins | Arduino Documentation
February 9, 2026 - Digital PinsAnalog Input PinsBasics of PWM (Pulse Width Modulation)Debugging FundamentalsGuide to 3V3 and 5V Power Supplies Differences ... Discover how digital pins work and how they can be configured. ... The pins on the Arduino can be configured as either inputs or outputs. This document explains the functioning of the pins in those modes.
🌐
The Robotics Back-End
roboticsbackend.com › home › arduino uno pins – a complete practical guide
Arduino Uno Pins - A Complete Practical Guide - The Robotics Back-End
August 22, 2023 - Before you can actually use a digital pin, you need to configure its mode. A digital pin can either be on INPUT more or OUTPUT mode. When in INPUT mode, you’ll use it to read data. When in OUTPUT mode, you’ll use it to write data.
🌐
STEMpedia
ai.thestempedia.com › home › examples › understanding arduino digital and analog pins
Understanding Arduino Digital and Analog Pins - Example Project
July 27, 2023 - ... Arduino’s digital pins offer two voltage levels: HIGH (5V) or LOW (0V). When set to LOW, a pin provides 0V to external devices, while setting it to HIGH delivers 5V, enabling triggering of relays or LED illumination.
🌐
Arduino
wiki-content.arduino.cc › en › Tutorial › Foundations › DigitalPins
Digital Pins | Arduino
Input pins make extremely small demands on the circuit that they are sampling, equivalent to a series resistor of 100 megohm in front of the pin. This means that it takes very little current to move the input pin from one state to another, and can make the pins useful for such tasks as implementing a capacitive touch sensor, reading an LED as a photodiode, or reading an analog sensor with a scheme such as RCTime.
🌐
Trickycircuit
trickycircuit.com › components › integrated-circuits › arduino › how-to-use-arduino-digital-pins
How to Use Arduino Digital Pins – Tricky Circuit
Arduino digital pins are highly versatile and can be used for basic I/O, PWM, serial communication, I2C/SPI interfaces, and interrupts. Whether controlling LEDs, reading sensors, or communicating with other devices, understanding digital pins unlocks the full potential of Arduino.
🌐
Arduino
docs.arduino.cc › micropython › basics › digital-io
Digital I/O | Arduino Documentation
December 18, 2024 - Digital pins are fundamental for interacting with the physical world using your Arduino board. With them, you can: Control outputs, such as turning an LED on and off.
Top answer
1 of 6
3

The answer to your question is basically yes, you can use ATmega I/O pins as +/- power supply terminals for other circuits. But there's a limit to what you can power that way (20mA per pin and 100mA total per ATmega). In practice this means you can only power the simplest circuits (single LEDs per pin, and not many LEDs in total, for example). As a general rule, you should really look for other ways to power anything else.

Also, there's a problem with the citation you gave. That 40mA figure is the absolute maximum current per pin, but that should be avoided. Safest is to use about 20mA of maximum current per pin. Also, the ATmega pins should not have more than 200mA flowing through Vcc and GND (also an absolute maximum that should also be avoided).

Usually, you should either power other stuff off of the regulated +5V that also feeds the ATmega (up to the regulator capacity that depends on the Arduino board - 500mA for the Arduino Uno - 1A for LM7805 regulators - and so on). You could also use the unregulated power in some cases. Then you should use digital pins on the ATmega to switch transistors on and off which in turn will switch your load. Sometimes you can use transistors to switch relays, that in turn will switch even larger loads.

2 of 6
3

Step one: read the data sheet for the microcontroller. In there is a nice diagram that shows you exactly how the IO pins work.

The pins can work in 2 modes: input, and output. You're interested in output mode.

The drive state of a CMOS output pin consists of two MOSFETs, one connecting the pin to Vcc and the other connecting it to GND. Only one of the MOSFETs is ever turned on at a time, so the output pin is either connected to Vcc through one MOSFET, or connected to GND through the other.

When it's connected to Vcc it's said to be sourcing current, since it's at a positive potential compared to ground and current can flow out of the pin to light an LED (say), and when it's connected to GND it's said to be sinking current because current can flow into the pin to get to ground.

As an example of how it all works, consider how you would connect up and power a capacitative humidity sensor.

These sensors require a square wave at around 1KHz to operate. The humidity defines the impedance, and as part of an impedance divider (like a resistor divider) the output voltage is relative to the humidity.

Now, they don't just want any square wave, but require a square wave that reverses polarity around a virtual ground point, and that means reversing the polarity of the power across the sensor at 1KHz. How can you do that with an Arduino? The answer is simple:

Connect the sensor to two IO pins rather than 1 IO pin and GND.

Both pins are set as output, and one is set HIGH with the other set LOW. So the voltage across it is 5V.

Now you switch the outputs over, so the one that was HIGH is now LOW, and the one that was LOW is now HIGH. The power across the sensor has been reversed! It's now (effectively) -5V (compared to what it was before).

🌐
Components101
components101.com › microcontrollers › arduino-uno
Arduino Uno Pinout, Specifications, Pin Configuration & Programming
IOREF: Supplies a voltage reference for I/O pins. Tip: Always verify the voltage compatibility of connected components to avoid damage. The Arduino UNO has 14 digital pins that can function as inputs or outputs.
Find elsewhere
🌐
Instructables
instructables.com › circuits › arduino
Understanding Digital and Analog Pins in Arduino - Lesson #5 : 11 Steps (with Pictures) - Instructables
February 20, 2026 - Understanding Digital and Analog Pins in Arduino - Lesson #5: Learn about analog and digital pins and master PWM with Arduino. This is the foundation of reading sensors and controlling components. I've recently posted a video on YouTube explaining everything you can read in this article.
🌐
Arduino
docs.arduino.cc › language-reference › en › functions › digital-io › pinMode
pinMode() | Arduino Documentation
The function returns nothing. Set the Arduino digital pin 13 (built-in LED) as an ... The analog input pins can be used as digital pins, referred to as A0, A1, etc.
🌐
STEMpedia
ai.thestempedia.com › home › documents › evive – documentation › evive technical specifications › arduino core interface › digital i/o pins on evive
Introduction to Digital I/O Pins on evive
April 28, 2023 - Digital Inputs allow a microcontroller to detect logic states, and Digital Outputs allow a microcontroller to output logic states. Digital Input: A digital input detects if a voltage is above/below a specific threshold.
🌐
All About Circuits
allaboutcircuits.com › home › projects › how to use the arduino’s digital i/o
How to Use the Arduino’s Digital I/O - Projects
February 13, 2018 - This function reads a digital value from a pin. pin is the number of the digital I/O pin you want to read. This function returns one of two values: HIGH or LOW. In this experiment, we will be switching an LED on and off using a digital output.
🌐
Colorado School of Mines
mines.edu › epics › wp-content › uploads › sites › 99 › 2018 › 01 › John-Steele-Basics-of-Arduino-Presentation.pdf pdf
Basics of Arduino EPICS Workshop
connect to buttons, LEDs, sensors, etc. to interface the Arduino with other pieces of · hardware. Pins marked with a tilde (~) can also serve as analog outputs, which you can use ... There are six analog inputs on the analog header. These pins all have analog-­‐to-­‐digital
🌐
Medium
etwinworkshop.medium.com › exploring-analog-and-digital-pins-illuminating-the-path-to-arduino-mastery-27fb3b02b8f3
Exploring Analog and Digital Pins: Illuminating the Path to Arduino Mastery | by etwinworkshop | Medium
November 3, 2023 - Digital pins can mimic analog behavior through Pulse Width Modulation (PWM). This technique rapidly toggles the pin on and off, creating the illusion of varied output. It’s fantastic for controlling LED brightness.
🌐
Quora
quora.com › How-do-Arduino-digital-pins-work
How do Arduino digital pins work? - Quora
Answer (1 of 2): A good answer to that deceptively simple question would be very, very long, but I’ll try to cover some basics. To start, read the digital pins tutorial [1] on the Arduino website [2] . It’s too short and leaves out a lot, but it’s not a bad introduction.
🌐
Starting Electronics
startingelectronics.org › beginners › arduino-tutorial-for-beginners › arduino-input-and-output-pins
Arduino Input and Output Pins | Starting Electronics
February 2, 2022 - Firstly input pins for reading the state of a pin, or attached switch for example. Secondly as an output to switch or drive an electric load such as an LED. Thirdly some pins have special functions such as serial communications and PWM (Pulse Width Modulation).
🌐
Electronic Wings
electronicwings.com › arduino › digital-gpio-of-arduino
Digital GPIO of Arduino | Arduino
Let’s see digital input, output of Arduino (ATmega). Arduino (ATmega) digital pins can be configured as output to drive output devices. We have to configure these pins to use as output.
🌐
Meganano
meganano.uno › home › arduino › arduino for beginners › arduino digital input and output pins
Arduino Digital Input and Output Pins - Meganano
March 8, 2025 - In this mode, you can set them to a logical HIGH (1) or LOW (0) using functions like digitalWrite(). Digital output pins are used to control external devices such as LEDs, relays, or motors.
🌐
Circuit Design
circuito.io › blog › arduino-uno-pinout
The Full Arduino Uno Pinout Guide [including diagram] | circuito.io
November 18, 2018 - ADC is an electronic circuit used to convert analog signals into digital signals. This digital representation of analog signals allows the processor (which is a digital device) to measure the analog signal and use it through its operation.