[go: up one dir, main page]

0% found this document useful (0 votes)
2 views4 pages

Laboratory 5

The document outlines a project aimed at controlling the output voltage of an Arduino pin using a potentiometer to adjust LED brightness or servo motor speed. It includes a schematic diagram, code for implementation, and laboratory exercises to record the output voltage relative to varying resistance. Observations indicate that while the potentiometer's resistance increases voltage, it inversely affects LED brightness due to PWM modulation, demonstrating effective voltage regulation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Laboratory 5

The document outlines a project aimed at controlling the output voltage of an Arduino pin using a potentiometer to adjust LED brightness or servo motor speed. It includes a schematic diagram, code for implementation, and laboratory exercises to record the output voltage relative to varying resistance. Observations indicate that while the potentiometer's resistance increases voltage, it inversely affects LED brightness due to PWM modulation, demonstrating effective voltage regulation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

OBJECTIVES: TO BE ABLE TO CONTROL THE OUTPUT VOLTAGE PRODUCES AT ARDUINO

PIN USING THE POTENTIOMETER THAT ALLOWS VARYING THE BRIGHTNESS OF THE

LIGHT OR THE SPEED OF THE SERVO MOTOR.

MATERIALS:

QUANTITY COMPONENTS

1 ARDUINO

1 5K OHM POTENTIOMETER

1 BREADBOARD

10 JUMPER WIRES

1 LED

1 RESISTOR

SCHEMATIC DIAGRAM:
CODE:

const int potentiometerPin = A0;

int ledPin = 9;

float potentiometerMaxValue = 5000.0;

float resistance;

float voltage;

float brightness;

float brightness1;

float voltageP;

void setup() {

pinMode(ledPin, OUTPUT);

Serial.begin(9600); }

void loop() {

int potentiometerValue = analogRead(potentiometerPin);

resistance = 5000 - (potentiometerMaxValue/1023.0) * potentiometerValue;

brightness = potentiometerValue/4;

brightness1 = potentiometerValue/204;

voltage = (5.0 * brightness)/255.0;

voltageP = 5 - (5.0 * brightness)/255.0;

Serial.print("Resistance = "); Serial.print(resistance);

Serial.print(" LED Output Voltage = ");

Serial.print(brightness1);

Serial.print(" Potentiometer Output Voltage = ");

Serial.println(voltageP);

analogWrite(ledPin, brightness);

delay(100); }
LABORATORY EXERCISES:

RECORD THE OUTPUT VOLTAGE WITH RESPECT TO ITS VARYING RESISTANCE.

Resistance ( Ω) LED Output Voltage (V) Potentiometer Output Voltage

(V)

0K 5V 0V

1K 4V 1V

2K 3V 2V

3K 2V 3V

4K 1V 4V

5K 0V 5V

WHAT DID YOU OBSERVE ON THE TABLE ABOVE?


___________________________________________________________________
___________________________________________________________________

OBSERVATION:
WHEN THE RESISTANCE OF THE POTENTIOMETER INCREASES, THE VOLTAGE AT THE

POTENTIOMETER ALSO INCREASES DUE TO THE RELATIONSHIP BETWEEN RESISTANCE

AND VOLTAGE IN A VOLTAGE DIVIDER CIRCUIT. HOWEVER, SINCE THE

POTENTIOMETER IS USED TO CONTROL THE BRIGHTNESS OF AN LED THROUGH PWM

(PULSE WIDTH MODULATION), AN INCREASE IN THE POTENTIOMETER'S VOLTAGE DOES

NOT DIRECTLY INCREASE THE VOLTAGE ACROSS THE LED. INSTEAD, IT AFFECTS THE

PWM DUTY CYCLE, RESULTING IN A DECREASE IN THE LED'S BRIGHTNESS. THIS OCCURS
BECAUSE THE INCREASED VOLTAGE AT THE POTENTIOMETER TRANSLATES TO A

HIGHER PWM VALUE, EFFECTIVELY REDUCING THE LED'S BRIGHTNESS AS THE DUTY

CYCLE DECREASES. THEREFORE, WHILE THE VOLTAGE AT THE POTENTIOMETER

INCREASES, THE LED'S BRIGHTNESS DECREASES DUE TO THE MODULATION OF THE

PWM SIGNAL.

CONCLUSION:
IN CONCLUSION, THE PROJECT AIMED TO CONTROL THE OUTPUT VOLTAGE OF AN

ARDUINO PIN USING A POTENTIOMETER, ENABLING THE ADJUSTMENT OF LED

BRIGHTNESS OR SERVO MOTOR SPEED. BY UTILIZING ANALOG INPUT AND OUTPUT

PINS, THE ARDUINO FACILITATED VOLTAGE CONTROL, ALLOWING FOR MANIPULATION

OF LED BRIGHTNESS OR MOTOR SPEED VIA PULSE WIDTH MODULATION (PWM). THE

CODE INCORPORATED ANALOGREAD TO INTERPRET THE POTENTIOMETER VOLTAGE,

WHILE ANALOGWRITE ADJUSTED THE PWM RATE OF THE DESIGNATED PIN

ACCORDINGLY. WITH A MAXIMUM PWM RATE OF 255 CORRESPONDING TO FULL

BRIGHTNESS OR SPEED, AND A MINIMUM OF 0 RESULTING IN OFF STATE, THE

POTENTIOMETER READING WAS SCALED DOWN BY A FACTOR OF FOUR TO MAINTAIN

CONSISTENCY WITH THE PWM RANGE. THUS, THE PROJECT DEMONSTRATED EFFECTIVE

VOLTAGE REGULATION FOR CONTROLLING DESIRED OUTCOMES.

You might also like