You are on page 1of 2

Control & Automation Engineering Department

KON309E Microcontroller Systems - Experiment 3

PART I

Aim: Controlling the brightness of the LEDs using PWM.

In the first part of this experiment, participants are expected to achieve tasks given below.

1. Construct a circuit consisting of 3 LEDs (1 red, 1 green, 1 yellow) and 3 buttons.


• One button (Button 1) is for selecting the LED and the other buttons (Button 2 and Button
3) is for controlling the brightness.

2. Use Button 1 to select which LED to use.


• When Button 1 is pressed while all LEDs are OFF, the red LED is selected (red will be ON
with low brightness, others will be OFF).
• At most one LED should be ON at any given time.
• LED selection sequence with button pressed event is:
Red -> Yellow -> Green -> OFF -> Red ...
• When button 1 is pressed while green LED is selected, all LEDs will be OFF.

3. Use Button 2 and Button 3 to change the selected LED’s brightness.


• Brightness state could be low, medium, high or full.
• Button 2 is used to increase the brightness and Button 3 to decrease it.
• When Button 2 is pressed, the brightness state changes in the given sequence:
Low -> Medium -> High -> Full
• When Button 3 is pressed, the brightness state changes in the given sequence:
Full -> High -> Medium -> Low
• Pressing Button 1 changes the selected LED at any time.
• Initial brightness state of the LED when it is selected is always low.
• Use PWM to adjust the brightness levels.

Res. Asst. Ecem Sümer


PART II

Aim: Controlling the brightness of the LEDs with a potentiometer.

In the second part of this experiment, participants are expected to achieve tasks given below.

1. Construct a circuit consisting of 3 LEDs (1 red, 1 green, 1 yellow), a button and a potentiometer.

• The button is for selecting the LED and the potentiometer is for controlling the brightness.

2. Use the button to select the LED to use.

• When button is pressed while all LEDs are OFF, the red LED is selected (only red will be
ON).
• At most one LED should be ON at any given time.
• LED selection sequence with button pressed event is:
Red -> Yellow -> Green -> OFF -> Red …
• When button is pressed while green LED is selected, all LEDs will be OFF.

3. Use the potentiometer to control the LED’s brightness.

• Brightness could be low, medium, high or full.


• When an LED is selected, its initial brightness depends on the current position of the
potentiometer.
• Change of brightness when potentiometer is turned clockwise is in the sequence:
Low -> Medium -> High -> Full.
• Change of brightness when potentiometer is turned counter-clockwise is in the sequence:
Full -> High -> Medium -> Low.

Vcc
GND Output

Figure 1: Pinout of a potentiometer.

Please consider the following steps when preparing your reports.

1.Describe the experiment in your own words.


2.Add your codes as screen shots.
- Don't forget to explain how the code works by commenting your code in your own words.
3.Add a photo of your whole circuit.
4.Include your FSM diagram and explain your design.

Res. Asst. Ecem Sümer

You might also like