Lab 8
Lab 8
BSAI-3A
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGES
LAB TASK # 08
BY
TIPU REHMAN
BSAI-3-21108168
PRESENTED TO
The analog sensor interface involves the conversion of the continuous voltage output of the
sensor into a digital signal that can be processed by a microcontroller. This conversion is
accomplished using an analog-to-digital converter (ADC) that is built into the microcontroller or
is an external component. The ADC converts the continuous voltage signal to a discrete digital
value by sampling the voltage at regular intervals and quantizing it into a digital value. The
digital value is then processed by the microcontroller to determine the physical quantity being
measured.
Example:
Consider the following circuit diagram:
In this example, a thermistor is used to measure the temperature. The thermistor is connected to a
voltage divider circuit consisting of a 10kΩ resistor and a 10kΩ thermistor. The voltage across
the thermistor changes with temperature, and the voltage across the 10kΩ resistor is constant.
The voltage at the junction of the thermistor and the resistor is measured by an analog pin of the
microcontroller.
The microcontroller used in this example is an Arduino Uno. The ADC in the Arduino Uno has a
resolution of 10 bits, which means that it can convert the voltage input into 1024 discrete values.
The analogRead() function in the Arduino IDE is used to read the analog input from the
thermistor. The analog value is then converted to a temperature value using a conversion
formula.
The analogValue is the value read from the thermistor using the analogRead() function. The
voltage at the analog pin is converted to a temperature value using the formula. The temperature
value is then displayed on the serial monitor in the Arduino IDE.
Conclusion:
In conclusion, the analog sensor interface is an important aspect of microcontroller-based
systems. Analog sensors provide a continuous voltage output that must be converted to a digital
signal using an ADC. The ADC converts the voltage signal into a digital value that can be
processed by the microcontroller. This conversion process allows microcontrollers to interface
with a wide range of analog sensors and measure physical quantities accurately.