Close
0%
0%

Interfacing ADC in Arduino Uno

Arduino board has six ADC channels. Out of those any one or all of them can be utilized as inputs for analog voltage.

Similar projects worth following
The project describes how to interface ADC in Arduino Uno

About Project:

Interfacing LCD with Arduino UNO, we should learn about few things

  • analogRead(pin);
  • analogReference();
  • analogReadResolution(bits);

Here we can provide a maximum input voltage of 5V for ADC conversion at any input channel. As some sensors give voltages from 0-2.5V, with a 5V reference hence we gain minor accuracy.

By default, we obtain the maximum board ADC resolution which is near about 10bits.

Now if the above conditions are adjusted to default, we can read the value from ADC of channel ‘0’ by straightly calling the function “analogRead(pin);”, here “pin” appears pin where we connected analog signal.

First, we require to allow the header file (‘#include <LiquidCrystal.h>’), this header file has instructions written in it, which allows the user to connect to an LCD to UNO in 4-bit mode.

Second, we require to tell the board which type of LCD we are utilizing here.

Once done with all procedures, all there is remain is to transfer data, the data which requires to be displayed in LCD should be written as “ cd.print("Hello, world!");”.

  • 1 × Arduino Uno
  • 1 × SparkFun Breadboard Power Supply 5V/3.3V
  • 1 × Adafruit RGB Backlight LCD - 16x2
  • 1 × Capacitor 100 µF
  • 1 × Single Turn Potentiometer- 100k ohms

  • 1
    Run a Program

    #include

    // initialize the library with the numbers of the interface pins

    LiquidCrystal lcd(8, 9, 10, 11, 12, 13); // REGISTER SELECT PIN,ENABLE PIN,D4 PIN,D5 PIN, D6 PIN, D7 PIN

    char ADCSHOW[5]; //initializing a character of size 5 for showing the ADC result

    void setup()

    {

    // set up the LCD's number of columns and rows:

    lcd.begin(16, 2);

    }

    void loop()

    {

    // set the cursor to column 0, line 1

    lcd.print(" Hello"); //print name

    lcd.setCursor(0, 1); // set the cursor to column 0, line

    lcd.print("ADC RESULT:"); //print name

    String ADCVALUE = String(analogRead(A0)); //intailizing a string and storing ADC value in it

    ADCVALUE.toCharArray(ADCSHOW, 5); // convert the reading to a char array

    lcd.print(ADCSHOW); //showing character of ADCSHOW

    lcd.print(" ");

    lcd.setCursor(0, 0); // set the cursor to column 0, line1

    }

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates