Analog to Digital Conversion in ARDUINO

Summary of Analog to Digital Conversion in ARDUINO


This article explains how to use the analog-to-digital conversion feature of the Arduino Uno to read values from an analog sensor, such as a potentiometer connected to analog pin 0. The ADC converts analog input to a 10-bit digital value (0-1023). The example controls an LED connected to digital pin 13, turning it on and off based on the sensor reading. Serial communication is used to print the ADC values to the Serial Monitor at a baud rate of 9600, enabling real-time observation of sensor data.

Parts used in the Arduino Analog to Digital Conversion Example:

  • Arduino Uno board
  • Potentiometer
  • LED
  • Resistor (typically 220Ω or 330Ω for the LED)
  • Connecting wires
  • Breadboard (optional for connections)

Analog to digital conversion module of ARDUINO UNO has 6 input ports. The number of the port varies with your ARDUINO model but the coding remains the same. The analog reading in the analog inputs are converted into corresponding 10bit(0-1023).

Analog to Digital Conversion in ARDUINO
ARDUINO developers have made such an option that you can print anything and see it on the Serial monitor.

This example demonstrates analog input usage by reading an analog sensor on analog pin 0 and turning on and off a light emitting diode(LED) connected to digital pin 13 and also printing the corresponding ADC value.

The amount of time the LED will be on and off depends on the value obtained by analogRead().

Serial printing is enabled using Serial.begin(baud rate). You can mension the baud rate within the brackets followed by Serial.begin (here 9600).

Serial.print() is used to display the reading.

The circuit coonection is as given below:

  •  Potentiometer attached to analog input 0
  •  Center pin of the potentiometer to the analog pin
  •  One side pin (either one) to ground
  • The other side pin to +5V
  •  LED anode (long leg) attached to digital output 13
  •  LED cathode (short leg) attached to ground

Note: Pin 13 is mostly preferred for testing purpose because most Arduinos have a built-in LED attached to pin 13 on the board, the LED is optional.

Analog to Digital Conversion in ARDUINO

You can see the readings from Serial Monitor.

 

For more detail:  Analog to Digital Conversion in ARDUINO


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

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

Scroll to Top