Iot Experiment 3
Iot Experiment 3
1. Aim / Objective
To analyze the process of analog signal data acquisition using an Arduino by reading analog data from
sensors, converting it into digital values using the built-in ADC (Analog to Digital Converter), and
processing the results.
• Analog Sensor (e.g., LM35 Temperature Sensor, Potentiometer, Light Dependent Resistor
(LDR))
• Breadboard
• Connecting Wires
3. Theory
Analog signals are continuous signals that can have an infinite number of values. In electronics,
analog signals are generated by sensors such as temperature sensors, potentiometers, light sensors,
etc. The Arduino, however, works with digital signals and uses an Analog to Digital Converter (ADC)
to convert these continuous signals into discrete digital values that the microcontroller can process.
The Arduino Uno has a 10-bit ADC, which converts the analog signal into a value between 0 and 1023
(since 2^10 = 1024). The voltage range for the ADC is typically from 0V to 5V (0V corresponding to 0
and 5V corresponding to 1023).
Pin Configuration
• Analog Input Pins (A0 to A5): Used for reading analog signals.
• The analogRead() function in Arduino is used to read the voltage at the input pin and returns
a corresponding digital value (0-1023).
4. Code
The following C code is used to acquire analog data from a sensor (like a potentiometer or LM35)
connected to the Arduino’s analog input pin and display it over the serial monitor.
#define analogPin A0 // Define analog pin (A0) for the sensor
void setup() {
void loop() {
1. Pin Setup: The analog pin A0 is defined as the input pin for the analog sensor.
2. analogRead() Function: This function reads the voltage from the analog input pin and
returns a digital value between 0 and 1023 (corresponding to 0-5V).
3. Voltage Conversion: The raw sensor value is converted into voltage using the formula:
Voltage=Sensor Value×5.01023.0\text{Voltage} = \frac{\text{Sensor Value} \times
5.0}{1023.0}Voltage=1023.0Sensor Value×5.0
4. Serial Monitor Output: The sensor value and the corresponding voltage are printed to the
serial monitor.
5. Result
The analog signal from the sensor was successfully acquired by the Arduino. The raw sensor value
(from 0 to 1023) and the corresponding voltage were displayed in the serial monitor. The conversion
of analog signals into digital values was confirmed, and the values were proportional to the input
signal (voltage).
6. Applications
• Temperature Measurement: Analog temperature sensors like LM35 can be used to measure
the temperature.
• Light Intensity Measurement: LDRs (Light Dependent Resistors) can be used for light
intensity measurement in automation projects.
• Position Sensing: Potentiometers can be used to measure the position or angle in robotics
and automation systems.