You are on page 1of 15

GROUP 4 EE513 LABORATORY REPORT

GROUP MEMBERS

S/N REG NUMBER NAMES DEPARTMENT


1 16/42394D/1 Surayya Adamu Bappah DCS

2 17/46376U/1 Victor Ekunode DCS

3 17/47445U/1 Aisha Ridwan Dantoro DCS

4 17/48667U/1 Chiroma Khalifa Ibrahim DCS

5 17/49916D/1 Nyiuma Godwin DCS

6 18/51133D/1 Aluka Christian DCS

7 18/51763D/1 Abdullahi Sabo Abdullahi DCS

8 18/53227D/1 Fatima Mb Makama DCS

9 20/57334D/1 Bello Garba DCS

10 16/43135U/2 Muhammad Sabo Usman DCCE

11 17/47203U/2 Prudence Dave Azi DCCE

12 17/49115U/2 Abdulkadir Bala Usman DCCE

13 18/53495D/2 Atsacha Philip Chudama DCCE


14 18/50882D/2 Muhammad Abdulkhaliq Tahir DEEE

15 17/46397U/2 Sani Suleiman Sulen-Jebu DEEE

16 17/47290U/2 Paul Gabriel DEEE

17 17/48341D/2 Babatunde Olamilekan St DEEE

18 17/49542U/2 Ridwan Ahmad Muhammad DEEE

19 18/51385D/2 Alilu Hassan Ibrahim DEEE


EXPERIMENT ONE
Experiment title: Using Potentiometer to read Analog Inputs
Aim/Objective:
1. To know how to read analog inputs
2. To be familiarized with Arduino Development Environment.
3. To write a simple program which reads analog input using a potentiometer.
4. To be conversant with Arduino Microcontroller Board.

Equipment/materials:
 Arduino UNO
 Breadboard
 Jumper wires
 Potentiometer
 Pc with Arduino IDE
Diagram:

Fig a
INTRODUCTION
A potentiometer is a manually adjustable variable resistor with 3 terminals. Two of
the terminals are connected to the opposite ends of a resistive element, and the
third terminal connects to a sliding contact, called a wiper, moving over the
resistive element. The potentiometer essentially functions as a variable resistance
divider. The resistive element can be seen as two resistors in series (the total
potentiometer resistance), where the wiper position determines the resistance ratio
of the first resistor to the second resistor. If a reference voltage is applied across
the end terminals, the position of the wiper determines the output voltage of the
potentiometer.

A potentiometer is also commonly known as a potmeter or pot. The most


common form of potmeter is the single turn rotary potmeter. This type of pot is
often used in audio volume control (logarithmic taper) as well as many other
applications. Different materials are used to construct potentiometers,
including carbon composition, cermet, wirewound, conductive plastic or metal
film.
PROCEDURE
Hardware Connection
1. The potentiometer has three pins ; the middle pin is the wiper (output)
which was connected to the analog pin A0 of the Arduino UNO.
2. Then the two other pins of the potentiometer were connected to the 5V
pin and GND pin of the Arduino UNO respectively.

Fig 1 Hardware connection of experiment 1


Software Interfacing
1. The Arduino IDE was opened by clicking on the Arduino icon on the pc.
2. The Arduino UNO board was then connected to the computer via a USB
cable.
3. The right Arduino board was selected and also the COM port was checked.
4. The connection was then made as shown in the fig above
5. The code was written and downloaded to the board and the output was
taken, the code written is as shown below.
6. The potentiometer was varied and the output response was observed on the
serial monitor

CODE;
float volt;
float input;
int raw;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
Serial.print("RAW DATA");
Serial.print(" ");
Serial.println("CONVERTED DATA");

// the loop routine runs over and over again forever:


void loop() {
// read the input on analog pin 0:
int raw=analogRead(A1);
float input = analogRead(A1);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
//using interpolation method
float volt = input * (5.0 / 1023.0);
// print out the value you read:
Serial.print(raw);
Serial.print(" ");
Serial.print(volt);
Serial.println("V");
delay(500);

}
RESULTS

COMMENT
As the potentiometer was varied the various values were displayed on the serial
monitor as shown above
EXPERIMENT TWO
Experiment title: Light Dimmer Using PWM and Potentiometer
Aim/Objective:
5. To know how to read analog inputs
6. To interface LED with an Arduino Board.
7. To be familiarized with Arduino Development Environment.
8. To write a simple program which dims an LED using a potentiometer.
9. To be conversant with Arduino Microcontroller Board.

Equipment/materials:
 Arduino UNO
 Breadboard
 Light Emitting Diodes (LED)
 1k Resistor
 Jumper wires
 Potentiometer
 Pc with Arduino IDE
Diagram:
INTRODUCTION
PWM, which stands for Pulse Width Modulation, is a technique used to convert
digital voltages to apparent analog voltages. A microcontroller is a digital device
that can normally output either 0v or 5v (some microcontrollers may use 3.3v).
Consequently, any devices they power can either be switched off or on, even if
intermediate states are needed. Considering the LED, we might be required to
control its brightness, rather than simply switch it off or on.

Using PWM, a pin is selected and its voltage is switched between 5v & 0v
extremely fast, with the pin staying on each voltage for a variable amount of time.
This gives the effect of a voltage between 5 and 0 being present. Do keep in mind
that this needs to be done at an extremely fast rate, otherwise the desired effect will
not be produced. In this example below, a voltage of 2.5v needs to be generated
using 5v and 0v. Here is how the state of the pin will look after graphing it-

50% Duty Cycle

The pin is switched between 5v and 0v, staying on each for equal amounts of time.
This ratio of 1:1 gives the effect of the output being 2.5v. Once again, the amount
of time the pin stays on each state is extremely low (in the order of microseconds
or even lesser).
66% Duty Cycle
In this graph, the pin is set to 5v for twice as long as it is set to 0, i.e the ratio
becomes 2:1. This gives the illusion of 3.3v being present.

PWM PINS ON THE ARDUINO UNO


The Digital IO pins are those pins which can be used for digital input as
well as output. These are the pins which are numbered ordinarily without any
special characters. For example, on the UNO, pins 0 to 13 are digital IO pins. They
are capable of outputting digital signals and reading digital signals.

Few special digital IO pins, marked with a tilda (~) character before them are
capable of PWM natively, meaning they do not require manual programming. The
whole work of switching on and off at required frequency is handled internally.
For the Arduino UNO the digital pins 3,5,6,9,10 and 11 are PWM pins

CONTROLLING THE BRIGHTNESS OF AN LED USING


POTENTIOMETER
The potentiometer, also known as a variable resistor, is attached to a circuit and
allows the voltage to be varied by increasing or decreasing the resistance. We
utilized this variable resistance to adjust the brightness of the LED. For example,
increasing the resistance will allow less current to reach the LED, causing it to
glow less brightly. Similarly, lowering the resistance allows more current to be
sent to the LED, causing it to glow brighter.
PROCEDURE
Hardware Connection
1. The potentiometer has three pins ; the middle pin is the wiper (output) which
was connected to the analog pin A0 of the Arduino UNO.
2. Then the two other pins of the potentiometer were connected to the 5V pin
and GND pin of the Arduino UNO respectively.
3. Then the LED was placed on the breadboard and its anode was connected in
series with a 1k-ohm limiting resistor.
4. Then the other terminal of the 1k-ohm resistor was connected to digital pin 9
of the Arduino UNO
5. Finally the cathode of the LED was connected to a common ground with the
Arduino ground pin on the terminal rail of the bread board

Fig 2 Hardware Connection of experiment 2


Software Interfacing
1. The Arduino IDE was opened by clicking on the Arduino icon on the pc.
2. The Arduino UNO board was then connected to the computer via a USB
cable.
3. The right Arduino board was selected and also the COM port was checked.
4. The connection was then made as shown in the fig above
5. The code was written and downloaded to the board and the output was
taken, the code written is as shown below.
6. The potentiometer was varied and the output response was observed on the
LEDs brightness
Code :
int ledPin = 9; // LED connected to digital pin 9
float input = 0;
void setup() {
pinMode(ledPin,OUTPUT);
pinMode(A1,INPUT);
}
void loop() {
// fade in from min to max in increments of 5 points:
input = analogRead(A1);
float input = analogRead(A1);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float volt = input * (5.0 / 1023.0);
// sets the value (range from 0 to 255):*/
analogWrite(ledPin,input);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
RESULTS

Comment
As the potentiometer was varied the brightness of the LED kept increasing as
illustrated in the result above
Applications and Uses of LED control

Controlling the brightness of an LED with a potentiometer and an Arduino has


various practical applications, particularly where changing light intensity is critical.
Here are some of examples:

 Regulating Ambient Lighting: A potentiometer can be used to regulate LED


strips or modules used for ambient lighting in rooms or displays.

Display Screens Brightness: When creating projects that include screens (such as
LED matrices, LCDs, or OLEDs), you may employ the potentiometer to regulate
the backlight brightness of the display. This might help you adjust readability in
different lighting situations.
 Photography lighting setups frequently involve the use of LEDs to generate
numerous lighting effects. You may fine-tune the lighting parameters for better
photographic results by regulating LED brightness using a potentiometer.

Conclusion

In conclusion utilizing a potentiometer with an Arduino to control LEDs provides a


versatile and practical solution to modify brightness levels in a variety of
applications. You may design dynamic lighting solutions that cater to user
preferences, environmental conditions, and special project requirements by
combining the capabilities of Arduino and the flexibility of potentiometers. This
method provides for intuitive engagement, allowing users to manually fine-tune the
intensity of LEDs to meet their specific demands. Controlling LED brightness adds
a new degree of utility and efficiency to electrical projects, whether it’s for
providing ambient lighting, altering display backlighting, or boosting visual
effects.

You might also like