Arduino

How Many Analog Inputs in Arduino Uno

Signals that are continuous in nature and give a variable value over a certain period can be detected using analog inputs in Arduino. Arduino analog pins make it easy to integrate analog sensors, modules, and hardware with the board. Using these pins, we can measure continuous data and convert it into a digital signal through the 10-bit ADC.

Analog Input with Arduino

An analog signal can take any number of values unlike digital signals which only have two states either High or Low. Analog inputs have a completely opposite scenario. Arduino can take analog inputs from any analog device or source then convert them into digital signals using a 10-bit Analog to Digital converter.

Arduino has a total of 14 input output pins, out of which 6 pins from A0 to A5 are analog pins. Input voltage read using these 6 pins can be mapped after passing from ADC into digital signal between 0 to 1023 discrete analog levels, which means an input analog value 0V will be mapped as 0 in digital and an analog value of 5V will be equal to 1023 after conversion through ADC.

How to Use Analog Inputs

Inputs which are variating fall under the Arduino analog category. Most of these input values come from analog sensors, temperature sensors, and potentiometer. We call these devices analog devices. Similarly, to read data from these sensors using analog input pins of Arduino we use analogRead() function, which gives values in a range of 0 to 1023.

analogRead()
To receive analog signals, we use analogRead() function in Arduino programming. These pins are designed to take input from analog devices.

Syntax
The syntax of analogRead() function is:

analogRead(pin)

Parameters
The analogRead() takes only one parameter which is a pin number. It describes the name of the input pin where analog data is to be read. It returns reading on analog pins in case of 10 bit it is limited between 0-1023 and the data type it uses is int.

Boards Analog Pins Max Resolution of ADC
Uno A0 to A5 10 bits
Nano A0 to A7 10 bits
Mega A0 to A14 10 bits

Arduino Uno has 6 analog input pins, but these pins cannot be used simultaneously as all these 6 pins are connected to a single ADC inside Arduino using a multiplexer (MUX). Arduino can not read all inputs at the same instant however it is possible to read analog data through all pins by giving a slight delay or reading them in a sequence.

Can We Use Analog Pins as Digital

Yes, analog pins can be used as digital input output pins. Using the aliases technique, we can set any analog input pin as digital output. Code syntax will look like this:

pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);

Here we have mapped analog pin A0 as digital output and set its value to High.

Conclusion

To interface analog sensors with Arduino boards we use analog inputs. Arduino boards come in different configurations and each board has a different number of analog pins. The Arduino Uno has 6 analog inputs. Arduino Nano has 8 whereas Mega comes with 16 analog inputs.

About the author

Kashif

I am an Electrical Engineer. I love to write about electronics. I am passionate about writing and sharing new ideas related to emerging technologies in the field of electronics.