0% found this document useful (0 votes)
5 views3 pages

Analog Input and Potentiometer

This laboratory exercise explores analog-to-digital conversion using an Arduino UNO and a potentiometer, allowing students to understand the relationship between analog signals and digital values. The experiment involves hardware setup, coding, and data observation through the Serial Monitor, demonstrating the principles of ADC and serial communication. Limitations include the Arduino's 10-bit resolution and external factors affecting accuracy, with recommendations for further study on signal processing techniques.

Uploaded by

Lorenzo Bande
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Analog Input and Potentiometer

This laboratory exercise explores analog-to-digital conversion using an Arduino UNO and a potentiometer, allowing students to understand the relationship between analog signals and digital values. The experiment involves hardware setup, coding, and data observation through the Serial Monitor, demonstrating the principles of ADC and serial communication. Limitations include the Arduino's 10-bit resolution and external factors affecting accuracy, with recommendations for further study on signal processing techniques.

Uploaded by

Lorenzo Bande
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Laboratory Exercise #04 - Analog Input and

Potentiometer
Mark Lorenzo B. Camarines
Bachelor of Science in Mechanical Engineering
Visayas State University
Baybay City, Philippines
[email protected]

Abstract—This experiment demonstrates the fundamentals B. Scope and Limitation


of analog-to-digital conversion using an Arduino UNO board
This laboratory exercise is intended to provide a practical
and a potentiometer. The Arduino's analog input functions
introduction to analog signal interfacing and digital data
convert the potentiometer's variable resistance into a voltage
ranging from 0 to 5 V. Subsequently, a digital value between 0
acquisition using an Arduino UNO and a potentiometer. The
and 1023 is read from the circuit. The outcomes are shown on scope of the experiment encompasses the hardware setup for
the Serial Monitor, facilitating the observation of the connecting the potentiometer to the Arduino, the
relationship between digital processing and analog signals. implementation of a simple code to read analog values, and
the observation of these values via the Serial Monitor. The
Keywords—Arduino, potentiometer, analog input, analog-to- exercise is designed for beginners to gain familiarity with
digital conversion, Serial Monitor, analogRead(), microcontroller basic circuit connections and programming concepts that are
foundational in embedded systems. However, the experiment
I. INTRODUCTION is limited by the inherent resolution of the Arduino’s 10-bit
Analog signals are continuous waveforms that represent ADC, which only allows for 1024 discrete levels of
varying physical phenomena such as temperature, light measurement, potentially limiting precision in applications
intensity, and sound. In current electronics, converting these requiring fine resolution.
continuous signals into a digital representation is vital for Additionally, external factors such as electrical noise,
processing, analysis, and control. It is possible to turn voltage voltage fluctuations, and environmental interference can
levels into discrete numerical values with the assistance of affect the stability and accuracy of the analog readings. While
analog-to-digital converters (ADCs), which are incorporated the exercise effectively demonstrates basic principles, it does
into microcontrollers like the Arduino UNO [1]. In this not delve into advanced topics like signal filtering, calibration,
laboratory assignment, a potentiometer, is leveraged to or the integration of multiple sensors, which are essential for
generate a changeable analog voltage. This voltage is then more complex real-world applications.
monitored via the Arduino’s analog input, with the
analogRead() function translating it into a digital III. METHODOLOGY
representation ranging from 0 to 1023. The lab not only
1. Step 1: Hardware Setup
teaches a hands-on understanding of how ADCs operate but
also stresses the relevance of serial communication in • Connect the potentiometer to the Arduino as
monitoring and debugging the system in real time [2], [3]. follows:
Furthermore, this experiment lays the foundation for linking a – Connect the middle (wiper) pin to
variety of analog sensors with microcontrollers, thereby analog pin A0.
building a cornerstone for future inquiry into embedded – Connect one of the outer pins to the
systems and sensor-based applications [4]. By mastering these 5V supply.
principles, students obtain insights into both the theoretical – Connect the remaining outside pin
and practical aspects of signal processing in modern electronic to GND.
systems.
2. Step 2: Software Preparation
II. OBJECTIVES • Open the Arduino Integrated Development
A. Objectives Environment (IDE) and create a new sketch.
• Understand the nature of analog signals and the
3. Step 3: Code Implementation
fundamentals of analog-to-digital conversion.
• Enter the following code into the IDE to read
• Learn how to interface a potentiometer with an the analog value from the potentiometer and
Arduino board. output it to the Serial Monitor.
• Utilize the analogRead() function to read
changing voltage levels. 4. Step 4: Code Compilation and Upload
• Click on the ‘Verify’ button to check for errors.
• Display analog readings using the Arduino Serial • If the code compiles successfully, click
Monitor. ‘Upload’ to upload the code to the Arduino
• Explore the impact of modifying the delay time board.
and switching analog pins on the performance of
the system. 5. Step 5: Data Observation

MEng 125n – Basic Electronics


2nd Semester SY 2023-2024
Instructor: Engr. Philip Caesar L. Ebit
• Open the Serial Monitor and set the baud rate // Print the digital value to the Serial Monitor
to 9600 with “Both NL & CR” enabled.
• Rotate the potentiometer’s knob to examine Serial.println(readInput);
different analog values presented on the Serial
Monitor. // Wait for 200 milliseconds before the next reading

6. Step 6: Experimentation delay(200);


• Optionally vary the delay value or change the
analog input pin in the code to witness varied Explanation:
behaviors and performance repercussions.
• The variable potentiometerPin is set to 0, which
A. Materials
corresponds to analog pin A0 on the Arduino board.
• 1 – Arduino UNO R3 • The setup() function initializes serial connection at a
• 1 – USB Cable (USB-A to USB-B) baud rate of 9600, allowing data to be exchanged and viewed
on the Serial Monitor.
• 1 – Potentiometer (10k Ohm) • Within the loop() function, analogRead() is used to
• 1 – Breadboard transform the analog voltage from the potentiometer into a
digital value, which is then recorded in the variable readInput.
• Connecting Wires • The digital value is published to the Serial Monitor using
Serial.println(), and a delay of 200 milliseconds is included
• Computer with Arduino software
to spread out the data, allowing clear observation of changes
B. Circuit Diagram in the potentiometer’s position.

IV. RESULTS AND DISCUSSIONS


The experimental results demonstrated a clear and
consistent relationship between the position of the
potentiometer’s knob and the digital output values obtained
via the Arduino’s ADC. As the knob was rotated from one
extreme to the other, the Serial Monitor displayed values
ranging from near 0 to approximately 1010, reflecting the
voltage variation from 0 V to nearly 5 V. This conversion
process confirms the effective operation of the analogRead()
function and the ADC within the Arduino. Furthermore, the
observed delay of 200 milliseconds between consecutive
measurements afforded adequate time for the ADC to settle,
Figure 1
providing constant data capture.
C. Code Minor oscillations in the data were detected, which may be
// Assign the Arduino pin for reading the analog voltage attributable to ambient electrical noise and inherent resolution
constraints of the ADC. Additionally, experimenting with
int potentiometerPin = 0; altering the delay duration and employing other analog pins
illustrated how these aspects may impact the reliability and
responsiveness of the data collecting process. The results
// Variable to store the reading (range 0 - 1023)
underscore the genuine challenges faced in analog-to-digital
conversion, such as signal noise and timing variations,
int readInput = 0; allowing a realistic glimpse into the calibration and
troubleshooting essential in embedded systems.
void setup(){
V. CONCLUSIONS AND RECOMMENDATIONS
// Initialize serial communication at 9600 baud In conclusion, this laboratory activity effectively
presented the ideas of analog-to-digital conversion
Serial.begin(9600); employing a potentiometer and an Arduino UNO board. The
successful reading and presentation of analog data via the
} Serial Monitor underscored the need of mastering both
hardware interface and software programming in sensor-
void loop(){ based systems. The exercise not only delivered a thorough
introduction to ADC foundations and serial transmission but
// Read the analog value from potentiometerPin also emphasized practical difficulties such as time delays and
// analogRead() converts the voltage (0V to 5V) to a signal noise that must be managed in real-world applications.
digital value (0 to 1023) For further studies, it is encouraged that students research
complex signal processing techniques, such as adding filters
readInput = analogRead(potentiometerPin); or calibration procedures, to boost the accuracy and stability

MEng 125n – Basic Electronics


2nd Semester SY 2023-2024
Instructor: Engr. Philip Caesar L. Ebit
of analog data. Furthermore, including additional sensors and support with each other. To our Basic Electronics instructor,
experimenting with different ADC resolutions could provide Engr. Philip Caesar Ebit for always guiding us and teaching
deeper insights into the complexity of analog-to-digital us not only in theory but also with hands-on experience-based
conversion and extend the scope of embedded system design learning.
projects.
REFERENCES
ACKNOWLEDGMENT [1] J. Purdum, Beginning C for Arduino, Second Edition: Learn C
Programming for the Arduino, 2015.
To my dear mother, Angelita B. Camarines, who always
[2] B. Craft, Arduino Projects for Dummies, John Wiley & Sons, Ltd,
fully supported me, I would like to express my deepest 2013.
gratitude to her despite the problems faced during my [3] M. Riley, Programming Your Home: Automate with Arduino,
academics without question and to my lovely pair, Jemiah B. Android, and Your Computer, The Pragmatic Programmers, LLC,
Sabares, for always motivating me, keeping me from falling 2012.
off and succumbing to pressure. I also want to reach my thanks [4] M. McRoberts, Beginning Arduino, Apress, 2010.
to my dear friends and regular-mates for continuing the

MEng 125n – Basic Electronics


2nd Semester SY 2023-2024
Instructor: Engr. Philip Caesar L. Ebit

You might also like