fbpx

Analog To Digital Converter using Arduino

Convert analog pluses to digital i.e binary 0s and 1s.

  • Most of the sensors and transducers are analog such as temperature, humidity, pressure.
  • To interface these sensors to micro-controllers we need to convert the analog output of these sensors to digital.
  • Some microcontroller have inbuilt analog to digital converter.
  • Microcontrollers that do not have internal ADC, external ADC is used.
  • External ADC : ADC0808,ADC0804.
  • Types of ADC
    • Digital Ramp ADC,
    • Successive Approximation ADC,
    • Flash ADC.

Arduino ADC

  • Arduino has a 10bit ADC (2^10 = 1024) with 6 input.
  • If the reference voltage is 5 volt, this means that the smallest detectable change in voltage on the input pin is 5V / 1023 = 0.0049 volts or 4.9 mV.
  • It takes about 100 microseconds (0.0001 s) to read an analog input, so the maximum reading rate is about 10,000 times a second.
  • Arduino use the different predefined function to access the ADC.
  • AnalogWrite is used to write the analog value.
  • AnalogReadSerial – read a potentiometer, print it’s state to the serial monitor.
  • AnalogInOutSerial – read an analog input, map its values, and then use that information to dim or brighten an LED.

Code

 int sensorPin = A0;
 int sensorValue = 0;
 void setup()
 {
 Serial.begin(9600);
 }
 void loop()
 {
 // read the value from the sensor:
 sensorValue = analogRead(sensorPin);
 // print the value in serial port
 Serial.print (sensorValue);
 }

Leave a Reply

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