How to use analog pin in Arduino UNO

Analog signals are continuous signals used to detect the magnitude of Signals.

To understand Analog signals elaborately we take the help of Digital Signals-

Digital signals are nothing but Binary values (0’s&1’s) indicating Prescence or Abscence of current.

Whereas Analog Signals not only indicate the prescence or abscence of signal but also with what magnitude it is present.

For example-

The Digital signals are denoted by (0,1) and

Analog signals are denoted as (0-0.5-1) or (0-0.2-0.4-0.6-0.8-1) or (0-0.01-0.02-0.03-….-1) etc…

So when we not only need to know the prescence of the current but also the magnitude it is present, we use the Analog Type signals.

Here is an example of a potentiometer interfacing with arduino-

COMPONENTS REQUIRED-

  1. Arduino UNO
  2. 1k Potentiometer

CIRCUIT-

A simulation circuit is available in TinkerCad examples tagged as Analog Read Serial

Made with TinkerCad

CONNECTION-

A 1K potentiometer is connected with arduino, where the VCC and Ground of the Pot are connected to the Arduino’s 5v supply and One of the Grounds. Third terminal is connected to the Pin A0, it can be connected to any Analog Pin and changed accordingly in PinMode in the Program

Note- Potentiometers less than 10 kilo ohm resistance should not be used with 5v supply, if not it will burn the burn the Pot when rotated to low resistance.

PROGRAM

Use the following program-

/*
AnalogReadSerial

Reads an analog input on pin 0, prints the result to the Serial Monitor.
Graphical representation is available using Serial Plotter (Tools > Serial Plotter menu).
Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.

This example code is in the public domain.

http://www.arduino.cc/en/Tutorial/AnalogReadSerial
*/

// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(1); // delay in between reads for stability
}

The Program is taken from the examples present in the Arduino IDE software, named AnalogReadSerial

OUTPUT-

From the above example’s we can see in the serial monitor, the current value is being varied by the Rotation of the Potentiometer

Leave a Reply

Your email address will not be published. Required fields are marked *