AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH
Faculty of Engineering
Lab Report
Experiment # 02
Experiment Title: Familiarization with an STM32 microcontroller board, studying an LED blink
test, and implementing a 2-push button LED activation circuit using an STM32 microcontroller board.
Date of Perform: 09 March 2025 Date of Submission: 17 April 2025
Course Title: Microprocessor and Embedded Systems Lab
Course Code: EE4103 Section: H
Semester: Spring 2024-25 Degree Program: BSc in CSE/EEE
Course Teacher: MD. ALI NOOR
Declaration and Statement of Authorship:
1. I/we hold a copy of this Assignment/Case Study, which can be produced if the original is lost/damaged.
2. This Assignment/Case Study is my/our original work; no part has been copied from any other student’s work
or any other source except where due acknowledgment is made.
3. No part of this Assignment/Case Study has been written for me/us by any other person except where such collaboration has
been authorized.
by the concerned teacher and is acknowledged in the assignment.
4. I/we have not previously submitted or am submitting this work for any other course/unit.
5. This work may be reproduced, communicated, compared, and archived to detect plagiarism.
6. I/we permit a copy of my/our marked work to be retained by the Faculty Member for review by any
internal/external examiners.
7. I/we understand that Plagiarism is the presentation of the work, idea, or creation of another person as though it is your
own. It is a form of cheating and is a very serious academic offense that may lead to expulsion from the University.
Plagiarized material can be drawn from, and presented in, written, graphic, and visual forms, including electronic data,
and oral presentations. Plagiarism occurs when the origin of the source is not appropriately cited.
8. I/we also understand that enabling plagiarism is the act of assisting or allowing another person to plagiarize or copy my/our
work.
* Student(s) must complete all details except the faculty use part.
** Please submit all assignments to your course teacher or the office of the concerned teacher.
Group # 07
Sl No Name ID PROGRAM SIGNATURE
1 Ahasan Habib 22-48877-3 BSc in CSE
2 Md. Limon Sheikh 22-49331-3 BSc in CSE
3 Md. Mohiminul Islam Mahi 22-48725-3 BSc in CSE
4 Refat Mir 22-49279-3 BSc in CSE
5 Mizanur Rahman Fahim 22-46504-1 BSc in EEE
6
Faculty use only
FACULTY COMMENTS
Marks Obtained
Total Marks
Table of Contents
Objectives 3
Equipment List 3
Circuit Diagram 3
Experimental Output Results (Color Photographs) 3-4
Simulation Output Results (Color Photographs) 5-
Answers to the Questions in the Lab Manual 9
Discussion 12
References 13
Marking Rubrics (to be filled by Faculty):
Level Excellent Proficient Good Acceptable Unacceptable No Response
Category [5] [4] [3] [2] [1] [0]
Able to clarify the Able to clarify the
Able to clarify the
Able to clarify the understanding of the understanding of the lab
understanding of the lab Unable to clarify the
Title and understanding of the lab, lab experiment, but a experiment, but it lacks a
experiment, no issues are understanding of the
Objectives no issues are missing and few issues are few important issues of
missing but its formatting is lab experiment.
formatting is good. wrong, and its the experiment without
not good.
formatting is bad. maintaining the format.
Able to explain the
Able to explain the Presents the
Able to explain the experimental codes Presents the experimental
experimental codes and experimental codes
Codes and experimental codes and but simulation codes but didn’t explain
simulation methods using but didn’t explain
Methods simulation methods using method using simulation methods using
Proteus but is not formatted simulation methods
Proteus very well. Proteus is not Proteus clearly.
well. using Proteus.
explained well.
Key results and Major results, such as No Response/
Key results and images are Misses several key copied from
images are there. experimental and
Key results and images there. Figures/Tables have results and images. others/
Figures/Tables lack a simulation results’
are there. Figures/Tables all identifications, such as Figures/Tables lack identical
few identifications, images are not
Results have all identifications the axis labels, numbers, identification, such as the submissions
such as the axis included. Figures
and refer to them properly and captions with a few axis labels, numbers, and with gross
labels, numbers, and and tables are poorly
in the texts. minor errors; the texts refer captions; the texts don’t errors/image
captions; the texts constructed or not
them. refer them. file printed
refer them. presented.
Proper interpretation of Proper interpretation of
Interpretation of Very poor
results and summarizes results and summarizes the Misses the interpretation
results is presented. interpretation of
Discussion the results to draw a results to draw a conclusion of key results. There is
However, there is a the results. No
and conclusion, discusses its but didn’t discuss its little connection between
disconnect between connection
Conclusion applications in real-life applications in real-life the results and
the results and between results and
situations to connect with situations to connect with discussion.
discussion. discussions.
the report’s conclusion. the conclusion of the report.
Able to produce all Able to produce all Able to produce all Able to produce all Unable to produce all
Question and questions’ answers questions’ answers but questions’ answers questions’ answers but questions’ answers
Answer correctly maintaining the didn’t maintain the lab but wrong answers to wrong/missing answers and completely
lab report format. report format. a few questions. to multiple questions. wrong answers.
Total Marks
Comments
(25)
Page 2 of 7
Objectives:
The objectives of this experiment are to
a) Study the STM32 Microcontroller Board.
b) Learn basic programming commands of the STM32 Microcontroller Board
c) Apply the coding techniques of the STM32 Microcontroller Board.
d) Implement the LED blink test using the STM32 Board.
e) Develop a circuit that includes two pushbuttons and two LEDs to control two LEDs
separately by ensuring proper connections for efficient functionality.
f) Develop a simulation circuit model using Proteus, incorporating an LED blink test and
controlling two LEDs with two pushbuttons separately.
Equipment List:
1. STM32 Cube IDE (1.0.1 or any recent version)
2. STM32 Microcontroller board
3. Two LED lights (Red and Green)
Circuit Diagram:
Figure 1: Connection diagram of the LEDs with the STM32 Nucleo-F446RE.
Experimental Output Results:
Led Blink:
Figure 2: Circuit of RED LED Blink Figure 3: Circuit of YELLOW LED Blink
Page 3 of 7
Figure 4: Circuit of RED and YELLOW LED Blink
Two push buttons:
Figure 5: RED LED is ON using Push buttons
Figure 6: YELLOW LED is ON using Push buttons.
Page 4 of 7
Simulation Output Results:
Led Blink
(a) (b)
Figure 7: Simulated circuit diagram of LED Blink Test (a) LED OFF and (b) LED ON
Two Push Buttons
Figure 8: Button 1 is pressed, and the GREEN LED is turned ON.
Page 5 of 7
Figure 9: Button 2 is pressed, and the RED LED is turned ON.
Answers to the Questions in the Lab Manual:
LED Blink (code)
While (1)
{
HAL_GPIO_TooglePin(GPIOA, GPIO_PIN_5);
HAL_Delay(1000);
HAL_GPIO_TooglePin(GPIOA, GPIO_PIN_6);
HAL_Delay(4000);
}
Two LED ON or OFF using push buttons(code)
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0) == 0) {
// Button 1 is pressed, turn on the Green LED and turn off the Red LED
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_SET); // Green LED ON
}
else {
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); // Green LED ON
}
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_1) == 0) {
// Button 1 is pressed, turn on the Green LED and turn off the Red LED
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_SET); // Green LED ON
}
else {
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, GPIO_PIN_RESET); // Green LED ON
}
Page 6 of 7
Discussion:
This experiment demonstrates the use of the STM32 microcontroller in LED control systems, focusing
on its programming environment and implementation using push buttons. The principles applied in
this experiment are widely used in real-life scenarios across various industries. Traffic light control
systems, smart home automation, industrial automation, medical devices, and security systems all use
microcontrollers for control. Traffic lights operate based on control logic programmed into
microcontrollers, using the HAL_GPIO_WritePin function to change their states. Industrial
automation relies heavily on microcontrollers for process control, with indicator LEDs used to display
machine status. Medical devices like heart rate monitors and patient alert systems also use LED
indicators to show operational status or alert users in case of anomalies. In security systems,
microcontrollers play a key role in access control mechanisms, with electronic door locks using LED
indicators to show access granted or denied. Understanding the basic LED control mechanism can help
build more complex automation, security, and industrial solutions.
References:
1) https://www.st.com/content/st_com/en.html
2) https://www.st.com/resource/en/user_manual/dm00105879-description-of-stm32f4-hal-and-ll-
drivers-stmicroelectronics.pdf
3) https://www.st.com/en/development-tools/stm32cubeide.html
4) https://www.st.com/en/evaluation-tools/nucleo-f446re.html for STM32F446RE datasheets.
Page 7 of 7