0% found this document useful (0 votes)
177 views45 pages

Ece521 - Mini Project Report

Uploaded by

2023248588
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)
177 views45 pages

Ece521 - Mini Project Report

Uploaded by

2023248588
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/ 45

FACULTY OF ELECTRICAL ENGINEERING

ECE521
MICROPROCESSOR SYSTEM

MINI PROJECT REPORT:


SMART MEETING ROOM

PREPARED BY:

NAME STUDENT ID

MUHAMMAD NAZHAN AQMAR BIN MOHD NASIR 2023874012

ABANG SYAZWAN FIKRI BIN ABANG SAFRI 2023695898

SYED AIMAN HAZIQ BIN SYED SIRAZZULZAMAN 2023248588

PREPARE FOR:
FARAH YASMIN BINTI ABDUL RAHMAN

GROUP:

i
EE2224B

TABLE OF CONTENTS

CHAPTER TITLE PAGE


1
INTRODUCTION
1.1 Problem Statement 1-2
1.2 Objectives
1.3 System Specifications
2
HARDWARE DESIGN
2.1 Description of Components
2.2 Block Diagram 3-15
2.3 Schematic Diagram
2.4 Circuit Design
3
SOFTWARE DESIGN
3.1 Flowchart
3.2 Coding 16-31
3.3 Bluetooth Application Design Using MIT App
Inventor
4
RESULT AND DISCUSSION
4.1 Prototype
4.2 Prototype Operation 32-34
4.3 Test and Troubleshoot

ii
5
CONCLUSION
5.1 Conclusion 35-36

REFERENCES 37

iii
LIST OF TABLES

TABLES TITLE PAGE

1 Table 1.0 shows a total of the components in this project. 4

iv
LIST OF FIGURES

FIGURES TITLE PAGE

1 Figure 1.1.1 shows STM32F446RE microcontroller 4

Figure 1.1.2 shows Infrared (IR) Sensor 5

Figure 1.1.3 shows Bluetooth Module HC-06 6

Figure 1.1.4 shows I2C LCD Display 7

Figure 1.1.5 shows LED 8

Figure 1.1.6 shows DC Motor 9

Figure 1.1.7 shows Driver (L293D) 9

Figure 1.1.8 shows Servo Motor 10

v
Figure 1.2 Block Diagram 11

Figure 1.3 Schematic Diagram 12

Figure 1.4 Circuit Design 14

Figure 1.5 shows flowchart for Smart Meeting Room 16


System.

Figure 2.8 shows interface of MIT App Inventor. 30

Figure 2.8 shows coding blockly for MIT App Inventor. 31

Figure 2.9 shows connection components on the donut 32


board with a prototype.

Figure 3.0 shows donut board connection with a prototype 33


at condition ON.

Figure 3.1 shows connection components on the 33


breadboard.

vi
vii
CHAPTER 1

1.0 INTRODUCTION

1.1 Problem Statement

In academic institutions, managing meeting rooms efficiently is a common problem. People


often forget to turn off lights and fans, wasting electricity and increasing costs. Manually
tracking room use can lead to errors and inefficiencies. Overcrowded rooms can be unsafe and
uncomfortable. Without real-time monitoring, it is hard to know how many people are in a room,
leading to conflicts and misunderstandings about room availability. This lack of accurate
tracking can prevent quick responses to changes in room occupancy, causing further
inefficiencies. To solve these issues, we need a smart system that can automate the management
of meeting rooms. This system should track the number of people entering and leaving the rooms
and automatically control the lights and fans, reducing energy waste, and improving safety.

1.2 Objectives

i. To design software and hardware for Smart Meeting Room using STM32F446RE
microcontroller.
ii. To build a functional prototype of the Smart Meeting Room system.
iii. To test the prototype, identifying and troubleshooting any issues to ensure reliable
and accurate performance.

1.3 System specifications

The Smart Meeting Room system is designed to optimize energy consumption by using
the STM32F446RE microcontroller to control various devices based on how many people are in

1
the room. It manages lights, fan, and other appliances to ensure they are only on when needed.
The system uses infrared (IR) sensors to detect when people enter or leave the room,
automatically updating the people count and displaying it on a I2C Liquid Crystal Display (LCD)
screen. When the room reaches full capacity, the system will indicate this on the LCD and
prevent more people from entering. Bluetooth connectivity allows remote control and monitoring
through a smartphone app developed with MIT App Inventor. Users can connect to the system
via Bluetooth, turn devices on or off, and control servo motors for mechanical parts like doors.
For instance, pressing specific buttons on the app sends commands to activate the servo motors,
opening or closing doors as needed. This functionality is crucial for maintaining a comfortable
and secure environment without manual intervention. The system includes LEDs and relays to
indicate the status of various components and manage high-power devices safely. LEDs turn on
or off based on the room's occupancy, providing a visual indicator of the system.

The Smart Meeting Room system represents an integration of modern technology to


enhance energy efficiency and user convenience. By automating the control of electrical devices
and providing remote access, it reduces the need for manual adjustments and ensures optimal
energy use. This system is not only beneficial for energy savings but also improves the overall
functionality and experience of meeting room management.

2
CHAPTER 2

2.0 HARDWARE DESIGN

2.1 Description of Components

Table 1.0 shows a total of the components in this project.

Components Type Quantity

STM32F446RE Nucleo-64 1

Infrared (IR) Sensor Obstacle Avoidance 2

Bluetooth Module HC-06 1

LCD Display I2C 1

LED - 4

DC Motor - 1

3
Motor Driver L293D 1

Servo Motor SG90 2

Processing Unit:
2.1.1 STM32F446RE

Figure 1.1.1 shows STM32F446RE microcontroller

The STM32F446RE microcontroller serves as the central processing unit for embedded systems
which is built around an ARM Cortex-M4 with a floating-point unit (FPU), offering a high
performance for computational tasks and suitable for both integer and floating-point arithmetic,
enabling efficient processing of complex algorithms and real-time data. The STM32F446RE
microcontroller is also ideal for developing embedded systems in various fields such as
consumer electronics, industrial automation, automotive, healthcare, and IoT. It is also frequently
used in development boards like the STM32 Nucleo, providing easy access to its features for
4
rapid prototyping. The STM32F446RE microcontroller is capable of handling real-time
applications due to its low interrupt latency and efficient instruction set, thus also compatible
with real-time operating systems, facilitating the development of real-time applications. The
STM32F446RE microcontroller's versatility, high performance, and extensive peripheral set
make it a popular choice for developers and engineers working on a wide array of embedded
systems and real-time applications.

Input:
2.1.2 Infrared (IR) Sensor

Figure 1.1.2 shows Infrared (IR) Sensor

Infrared (IR) sensors are widely used in various projects for their ability to detect infrared
radiation, which is invisible to the human eye but can be emitted or reflected by objects. The IR
sensors can detect movement by sensing changes in infrared radiation, making them ideal for
security alarms and motion detectors. They can also trigger lights to turn on when motion is
detected, conserving energy and providing convenience in homes and buildings. IR sensors are
used to detect the presence of a person or object near a door, triggering it to open or close
automatically. Furthermore, in touchless controls, IR sensors detect the proximity of a hand or
object, enabling interaction without physical contact. By leveraging the capabilities of infrared

5
sensors, projects can achieve advanced functionalities such as motion detection, proximity
sensing, temperature measurement, and more, contributing to the development of smart,
efficient, and user-friendly systems.

2.1.3 Bluetooth Module HC-06

Figure 1.1.3 shows Bluetooth Module HC-06

The HC-06 Bluetooth module is a popular and widely used component in various projects for
wireless communication. It allows devices to communicate with each other over short distances
using Bluetooth technology. For example, the HC-06 enables wireless transmission of data
between devices, making it ideal for applications where wired connections are impractical or
inconvenient. In addition, the module can be used to remotely control home appliances, lights,
fans, and other devices through a smartphone or other Bluetooth-enabled devices and it allows
for wireless control of robots, enabling commands to be sent from a remote device, such as a
smartphone or a computer. The Hc-06 can transmit sensor data from a microcontroller to a

6
remote device for monitoring and logging purposes. Regarding wireless programming and
debugging, the HC-06 allows for over-the-air firmware updates, making it easier to update the
software on a microcontroller without the need for physical connections and the module can
facilitate wireless debugging, enabling developers to monitor and troubleshoot their projects
remotely.

Output:
2.1.4 I2C LCD Display

Figure 1.1.4 shows I2C LCD Display

An I2C LCD display is a liquid crystal display that uses the I2C (Inter-Integrated Circuit)
communication protocol to interface with a microcontroller. This type of display is commonly
used in various projects due to its simplicity and efficiency in displaying information. The I2C
LCD display provides a way to display data such as sensor readings, system status, time, and
other relevant information, making the system more user-friendly. Plus, it allows for the creation
of menus and user interfaces in embedded systems, enabling users to navigate through options

7
and settings. The I2C LCD display displays real-time feedback from sensors and systems,
allowing users to monitor conditions and make adjustments as needed. It is also useful for
displaying debugging information during the development and testing phases of a project. The
I2C communication protocol requires only two wires (SDA and SCL), reducing the number of
GPIO pins needed on the microcontroller and simplifying the wiring and is ideal for compact
designs where space is limited and reducing wiring complexity is crucial. I2C LCD displays
serve as an essential component in many projects, providing an efficient and straightforward way
to display information and create user interfaces.

2.1.5 Light-Emitting Diode (LED)

Figure 1.1.5 shows LED

LEDs (Light Emitting Diodes) are versatile and widely used components in various projects.
Their purposes span from simple indicators to complex lighting systems. LEDs provide
immediate visual feedback on the status of a device or system, such as power on/off, error states,
or operational status. They can indicate ongoing processes, such as data transmission, device
activity, or network status. LEDs are used for general illumination in residential, commercial,

8
and industrial lighting applications plus provide focused light for specific tasks, such as reading,
working, or cooking. In some projects, LEDs can be used for optical communication or signaling
between devices. LEDs are indispensable components in many projects due to their versatility,
efficiency, and effectiveness. They serve a wide range of purposes, from simple status indicators
and communication signals to complex lighting systems and interactive displays.

2.1.6 DC Motor & Driver (L293D)

Figure 1.1.6 shows DC Motor

A DC motor (Direct Current motor) is a device that converts electrical energy from a direct
current (DC) power source into mechanical energy. The motor operates based on the interaction
between an external magnetic field and a magnetic field generated by a current flowing through a
coil in the motor. The operation of a DC motor is based on the fundamental principle of
electromagnetism: when an electric current flow through a conductor in a magnetic field, it
experiences a force. This force is described by the Lorentz force law.

9
Figure 1.1.7 shows Driver (L293D)

The L293D is a popular motor driver integrated circuit (IC) that allows the control of the
direction and speed of DC motors. It can drive small to medium-sized motors and is commonly
used with microcontrollers.

2.1.7 Servo Motor

Figure 1.1.8 shows Servo Motor

A servo motor is a specialized motor that provides precise control over angular or linear position,
velocity, and acceleration. It consists of a motor coupled with a feedback sensor and a control
circuit. Servo motors are used in applications requiring precise control of position. They can be
instructed to move to a specific angle or position with high accuracy. In addition, the built-in
feedback mechanism ensures that the motor reaches and maintains the desired position,

10
correcting any deviations in real-time. Servo motors can control the speed of movement
precisely, making them suitable for applications requiring smooth and controlled motion and
they can quickly accelerate or decelerate to meet the changing requirements of the application.
Servo motors are essential components in projects requiring precise control of motion. Their
ability to provide accurate position, speed, and torque control makes them suitable for a wide
range of applications, from robotics and industrial automation to consumer electronics and
aerospace.

2.2 Block Diagram

Figure 1.2 Block Diagram

11
The block diagram shows the process flow of the mini-project starting from the two
inputs from the Bluetooth module and infrared sensors, to the STM32F446RE microcontroller, to
the 4 outputs which are LEDs, LCD, Motor, and Servo Motors. From the Bluetooth module, we
can switch on the lights and fan inside the meeting room via an app from our smartphone. On the
other hand, the lights and fan in the meeting room will also automatically switch on when a
motion is detected entering the meeting room. As the data from the inputs are gathered and sent
to the STM32F446E microcontroller, the data will be processed before producing an output.
Therefore, as the infrared sensor detects movement going inside the meeting room, the servo
motors will be switched on to open the doors automatically and switch on the LED and move the
motor. The LCD display will also display the amount of people currently in the meeting room.
However, when the other infrared sensor detects movement on the exit door, the exit door will be
open and the number of people in the room displayed on the LCD will decrease. As the number
of people reaches 0, the lights and fan will automatically switch off.

2.3 Schematic Diagram

Figure 1.3 Schematic Diagram

12
Based on the figure 1.3, the schematic diagram also includes an LCD and a Bluetooth module,
which are essential for user interaction and wireless communication. The LCD, connected to the PB8 and
PB9 pins on the STM32F446RE microcontroller, displays information such as the current count of people
in the room and a warning message if the room is full. This LCD uses the I2C protocol, which allows
multiple devices to be connected to the same pins (SCL and SDA) while maintaining efficient
communication. The choice of PB8 (SCL) and PB9 (SDA) for the I2C connection ensures that the
microcontroller can handle data transmission to the LCD screen effectively without interference.

The Bluetooth module, connected to the PA10 (RXD) and PA9 (TXD) pins, facilitates wireless
communication between the system and a mobile device, such as one running the MIT App Inventor app.
This module allows users to send commands to the microcontroller, like turning on or off the LEDs,
motors, or updating settings without needing physical access to the device. The PA10 and PA9 pins are
chosen because they correspond to the hardware serial interface on the STM32F446RE, enabling reliable
and fast data transmission. This setup ensures that the system can receive and process Bluetooth
commands efficiently, providing a seamless user experience.

In addition to the LCD and Bluetooth module, the schematic includes several other components
essential for the system's operation. Two infrared (IR) sensors are connected to the PB5 and PB6 pins on
the STM32F446RE microcontroller. These sensors detect the presence of people entering or exiting the
room. When the sensors detect movement, they send signals to the microcontroller, which updates the
people count and triggers other actions, like turning on LEDs or activating servo motors.

The servo motors, labeled as "Servo Motor (IN)" and "Servo Motor (Out)," are connected to the
PB0 and PB2 pins, respectively. These motors control the opening and closing of doors. The servo motors
are used because they can move to specific angles, providing precise control for opening and closing
doors. The DC motor, used as a fan motor, is connected through a motor driver (L293D) to the PC8 and
PC9 pins. The motor driver allows the microcontroller to control the high current required by the fan
motor.

The LEDs, connected to PC2, PC3, PC4, and PC5 pins, provide visual indicators. They turn on or
off based on the number of people detected by the IR sensors. Resistors are placed in series with the
LEDs to limit the current and prevent damage. The microcontroller controls these LEDs to give real-time
feedback on the system's status.

The use of a motor driver (L293D) is crucial for controlling the fan motor because it can handle
the higher current and voltage requirements that the microcontroller alone cannot manage. This driver

13
allows the microcontroller to switch the fan on and off safely and efficiently, ensuring the system runs
smoothly without overloading any components.

2.4 Circuit Design

Figure 1.4 Circuit Design

14
This circuit schematic combines a microcontroller with a number of other parts to build a
working Internet of things system. The central control unit is the microcontroller, which is
probably an Arduino or a board comparable to it. It is connected to other parts by a breadboard.
The microcontroller's 5V and GND pins, which are connected to the breadboard's power rails,
regulate the circuit's power supply and distribute electricity to each component.

A L293D motor driver IC is used to control a DC motor. The microcontroller is


connected to the control pins of the motor driver, and the motor's wires are connected to the
output pins of the L293D. The TX and RX pins of the microcontroller are connected to the HC-
05 Bluetooth module, which allows for wireless connection. The VCC and GND pins of the
module are connected to the power rails of the breadboard.

For the purpose of measuring distance, two HC-SR04 ultrasonic sensors are provided.
The microcontroller's digital pins are connected to the trigger and echo pins, while the
breadboard is connected to the VCC and GND pins of the sensors. The LCD display's power and
contrast are adjusted using a potentiometer and a breadboard, and it is coupled to several digital
pins on the microcontroller for data and control signals.

The cathodes of a number of LEDs are linked to the GND rail and they are connected via
current-limiting resistors to the microcontroller's digital output pins. The control lines of the
motor through the L293D, the RX and TX lines of the Bluetooth module, the Trigger and Echo
lines of the ultrasonic sensors, and the data and control lines of the LCD are among the signal
connections in the circuit. By ensuring that every part works together as a unit under the
supervision of the microcontroller, this configuration produces a productive and useful prototype
for an Internet of Things monitoring system.

15
CHAPTER 3

3.0 SOFTWARE DESIGN

3.1 Flowchart

16
Figure 1.5 shows flowchart for Smart Meeting Room System.

The flowchart outlines the operation of a system controlled by an STM32F446RE


microcontroller. The process starts with initializing the microcontroller, which sets up the
necessary hardware and prepares the system for operation. It then proceeds to monitor three main
components: an infrared (IR) sensor at pin PB5, another IR sensor at pin PB6, and a Bluetooth
module that interacts with a mobile app.

17
When the IR sensor at PB5 detects movement and the count of people in the room is less
than three, the system activates the servo motor (Door IN) at PB0, turns on the DC motor (Fan)
at PC8 and PC9, lights up the LEDs (Lamp) at PC2 to PC5, and updates the LCD display to
show the total number of people. If the count reaches three, it will additionally display "Room is
Full!" on the LCD. On detecting movement at PB6 and if the count is more than zero, it activates
another servo motor (Door OUT) at PB2 and performs similar actions with the DC motor and
LEDs.

The Bluetooth module allows manual control via a mobile app. If a button is pressed on
the app, it either turns on or off the LEDs and DC motor based on the command received.
Throughout, the system updates the LCD display to reflect the total number of people in the
room. This ensures that the system not only operates automatically based on sensor inputs but
also allows for manual control via Bluetooth, providing a comprehensive overview of the room's
status.

3.2 Coding

3.2.1 Algorithm Coding (C++ Language)

Full coding for the smart meeting room system is as below:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <HardwareSerial.h>
#include <Servo.h>

HardwareSerial mySerial(PA10, PA9); // Correct the object name

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Counter to track the number of people


int peopleCount = 0;

18
// Initialize the servo objects
Servo servoIn; // Servo Motor 1
Servo servoOut; // Servo Motor 2

void setup() {
// Initialize the serial communication for Bluetooth
mySerial.begin(9600);

// Initialize the pins


pinMode(PB5, INPUT);
pinMode(PB6, INPUT);
pinMode(PB0, OUTPUT);
pinMode(PB2, OUTPUT);
pinMode(PC2, OUTPUT);
pinMode(PC3, OUTPUT);
pinMode(PC4, OUTPUT);
pinMode(PC5, OUTPUT);
pinMode(PC8, OUTPUT);
pinMode(PC9, OUTPUT);

// Initialize the serial communication for debugging


Serial.begin(9600);

// Initialize the LCD


lcd.begin();
lcd.backlight();

// Initialize the motor in off state


digitalWrite(PC8, LOW);
digitalWrite(PC9, LOW);

// Initialize the servo motors


servoIn.attach(PB0); // Attach Servo Motor 1
servoOut.attach(PB2); // Attach Servo Motor 2

// Set the servo motors to idle positions


servoIn.write(0); // Idle position
servoOut.write(0); // Idle position

19
}

void loop() {
// Check for Bluetooth commands
if (mySerial.available()) {
char command = mySerial.read();
handleBluetoothCommand(command);
}

// Automatic IR sensor-based control


if (digitalRead(PB5) == LOW) {
if (peopleCount < 3) {
peopleCount++;
updateDisplayAndDevices();
activateServo(servoIn);
delay(1000); // Debounce delay
}
}

if (digitalRead(PB6) == LOW) {
if (peopleCount > 0) {
peopleCount--;
updateDisplayAndDevices();
activateServo(servoOut);
delay(1000); // Debounce delay
}
}

delay(10); // Small delay to debounce


}

void updateDisplayAndDevices() {
// Clear the LCD and display the count
lcd.clear();
lcd.print("Total: ");
lcd.print(peopleCount);

if (peopleCount == 3) {
lcd.setCursor(0, 1);

20
lcd.print("Room is full!");
}

// Turn on or off the LEDs, motor, and servo based on the count
if (peopleCount > 0) {
digitalWrite(PC2, HIGH);
digitalWrite(PC3, HIGH);
digitalWrite(PC4, HIGH);
digitalWrite(PC5, HIGH);
digitalWrite(PC8, LOW);
digitalWrite(PC9, HIGH);
} else {
digitalWrite(PC2, LOW);
digitalWrite(PC3, LOW);
digitalWrite(PC4, LOW);
digitalWrite(PC5, LOW);
digitalWrite(PC8, LOW);
digitalWrite(PC9, LOW);
}

// Ensure PB0 servo is OFF when room is full or counter is decreased


if (peopleCount == 3) {
servoIn.write(0); // Idle position
}
}

void activateServo(Servo &servo) {


servo.write(90); // Active position
delay(1000); // Wait for 1 seconds
servo.write(0); // Idle position
}

void handleBluetoothCommand(char command) {


switch (command) {
case '1':
// Turn ON LEDs and Motor
digitalWrite(PC2, HIGH);
digitalWrite(PC3, HIGH);
digitalWrite(PC4, HIGH);

21
digitalWrite(PC5, HIGH);
digitalWrite(PC8, LOW);
digitalWrite(PC9, HIGH);
break;
case '0':
// Turn OFF LEDs and Motor
digitalWrite(PC2, LOW);
digitalWrite(PC3, LOW);
digitalWrite(PC4, LOW);
digitalWrite(PC5, LOW);
digitalWrite(PC8, LOW);
digitalWrite(PC9, LOW);
break;
case '2':
// Activate Servo Motor 1 to position 90
activateServo(servoIn);
break;
case '3':
// Activate Servo Motor 2 to position 90
activateServo(servoOut);
break;
default:
// Handle any other commands or ignore unknown commands
// You can add specific actions or just ignore the command
break;
}
}

Figure 1.6 shows the full code of the Smart Meeting Room system.

3.2.2 Documentation

#include <Wire.h>

22
#include <LiquidCrystal_I2C.h>
#include <HardwareSerial.h>
#include <Servo.h>

Figure 1.7 shows code Part 1

Based on Figure 1.7, imports necessary libraries <Wire.h>, <LiquidCrystal_I2C.h>,


<HardwareSerial.h>, <Servo.h> for a STM32F446RE project by using the Arduino
IDE compiler. These libraries <Wire.h> for connecting with sensors and other devices,
simplified control of LCD displays using I2C <LiquidCrystal_I2C.h>, management of
hardware serial communication ports <HardwareSerial.h> for communication with
peripherals like Bluetooth modules, and control of servo motors <Servo.h> for precise
mechanical movements. By including these libraries, the Arduino IDE compiler sketch is
equipped to handle various tasks like sensor data acquisition, displaying information on an LCD
screen, serial communication with external devices, and controlling servo motors.

HardwareSerial mySerial(PA10, PA9); // Correct the object name

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Counter to track the number of people


int peopleCount = 0;

// Initialize the servo objects


Servo servoIn; // Servo Motor 1
Servo servoOut; // Servo Motor 2

Figure 1.8 shows code Part 2

Figure 1.8 sets up the basic components for a STM32F446RE project by using the Arduino IDE
compiler. It first declares a HardwareSerial object named mySerial configured to use
pins PA10 (RX) and PA9 (TX) for serial communication. This object is crucial for interfacing
with external devices like Bluetooth modules or sensors that communicate using serial protocols.

23
Next, an instance of LiquidCrystal_I2C named lcd is created with the address 0x27,
configured for a 16-character by 2-line LCD display. This allows easy control and display of
information on an LCD screen using the I2C communication protocol, reducing the wiring
complexity compared to direct pin connections. Besides, an integer variable peopleCount is
initialized to zero, which will be used to keep track of the number of individuals detected by the
system. Two Servo objects (servoIn and servoOut) are declared to control servo motors,
facilitating precise mechanical movements for tasks such as opening and closing doors.

void setup() {
// Initialize the serial communication for Bluetooth
mySerial.begin(9600);

// Initialize the pins


pinMode(PB5, INPUT);
pinMode(PB6, INPUT);
pinMode(PB0, OUTPUT);
pinMode(PB2, OUTPUT);
pinMode(PC2, OUTPUT);
pinMode(PC3, OUTPUT);
pinMode(PC4, OUTPUT);
pinMode(PC5, OUTPUT);
pinMode(PC8, OUTPUT);
pinMode(PC9, OUTPUT);

Figure 1.9 shows code Part 3

In the void setup() function, mySerial.begin(9600); initializes serial


communication at a baud rate of 9600, which is commonly used for Bluetooth modules to enable
communication between the STM32F446RE and external devices wirelessly. A series of
pinMode() statements configure specific pins on the STM32F446RE board, PB5 and PB6 are
set as INPUT pins connected to IR Sensors. PB0 and PB2 are set as OUTPUT pins to control
two servo motors, which will perform precise mechanical movements. Next, PC2 to PC5 are set

24
as OUTPUT pins for controlling LEDs, providing visual indicators based on the system. PC8 and
PC9 are also set as OUTPUT pins for additional controls. PB8 and PB9 are designated for Serial
Clock (SCL) and Serial Data (SDA) lines for I2C communication, used to interface with the I2C
LCD display.

// Initialize the serial communication for debugging


Serial.begin(9600);

// Initialize the LCD


lcd.begin();
lcd.backlight();

// Initialize the motor in off state


digitalWrite(PC8, LOW);
digitalWrite(PC9, LOW);

// Initialize the servo motors


servoIn.attach(PB0); // Attach Servo Motor 1
servoOut.attach(PB2); // Attach Servo Motor 2

// Set the servo motors to idle positions


servoIn.write(0); // Idle position
servoOut.write(0); // Idle position

Figure 2.0 shows code Part 4

Based on Figure 2.0 serial communication for debugging with Serial.begin(9600);,


allowing the Arduino to send and receive messages to and from a connected computer at a baud
rate of 9600. Next, it initializes the LCD display with lcd.begin(); and turns on its
backlight with lcd.backlight(); to make the display readable. The motor pins, PC8 and
PC9, are set to LOW with digitalWrite(PC8, LOW); and digitalWrite(PC9,
LOW); to ensure the motor is in the off state initially. The servo motors are then set up by
attaching them to pins PB0 and PB2 using servoIn.attach(PB0); and
servoOut.attach(PB2);. Finally, both servos are moved to their idle positions which are

25
0 degrees using servoIn.write(0); and servoOut.write(0);, ensuring they start in
a neutral state.

void loop() {
// Check for Bluetooth commands
if (mySerial.available()) {
char command = mySerial.read();
handleBluetoothCommand(command);
}

Figure 2.1 shows code Part 5

The void loop() function starts by checking for any incoming Bluetooth commands. It does
this by calling mySerial.available() to see if any data is available to read from the
Bluetooth connection. If there is data, it reads a single character using mySerial.read() and
stores it in the variable command. Then, it calls the
handleBluetoothCommand(command) function, passing the received command as an
argument. This function will handle the specific actions based on the received Bluetooth
command.

// Automatic IR sensor-based control


if (digitalRead(PB5) == LOW) {
if (peopleCount < 3) {
peopleCount++;
updateDisplayAndDevices();
activateServo(servoIn);
delay(1000); // Debounce delay
}
}

if (digitalRead(PB6) == LOW) {
if (peopleCount > 0) {
peopleCount--;

26
updateDisplayAndDevices();
activateServo(servoOut);
delay(1000); // Debounce delay
}
}

delay(10); // Small delay to debounce


}

Figure 2.2 shows code Part 6

In figure 2.2 the code provides automatic control based on IR sensor readings. When the IR
sensor connected to PB5 detects an object (reading LOW), and the peopleCount is less than
3, the peopleCount is incremented by 1. The updateDisplayAndDevices() function is
called to update the LCD and other devices, and activateServo(servoIn) is called to
move the servo motor, followed by a 1 second delay. Similarly, when the IR sensor connected to
PB6 detects (reading LOW) and peopleCount is greater than 0, the peopleCount is
decremented by 1. The display and devices are updated, and activateServo(servoOut)
is called to move the second servo motor, followed by a 1 second debounce delay.

void updateDisplayAndDevices() {
// Clear the LCD and display the count
lcd.clear();
lcd.print("Total: ");
lcd.print(peopleCount);

if (peopleCount == 3) {
lcd.setCursor(0, 1);
lcd.print("Room is full!");
}

Figure 2.3 shows code Part 7

27
The void updateDisplayAndDevices() function updates the LCD display and other
devices based on the current peopleCount. First, it clears the LCD screen using
lcd.clear();. Then, it prints the text "Total: " followed by the current value of
peopleCount to the LCD. If the peopleCount is exactly 3, it moves the cursor to the
beginning of the second line on the LCD with lcd.setCursor(0, 1); and prints the
message "Room is full!" to indicate that the room has reached its maximum capacity.

// Turn on or off the LEDs, motor, and servo based on the count
if (peopleCount > 0) {
digitalWrite(PC2, HIGH);
digitalWrite(PC3, HIGH);
digitalWrite(PC4, HIGH);
digitalWrite(PC5, HIGH);
digitalWrite(PC8, LOW);
digitalWrite(PC9, HIGH);
} else {
digitalWrite(PC2, LOW);
digitalWrite(PC3, LOW);
digitalWrite(PC4, LOW);
digitalWrite(PC5, LOW);
digitalWrite(PC8, LOW);
digitalWrite(PC9, LOW);
}

Figure 2.4 shows code Part 8

Based on figure 2.4, this code controls the LEDs and motor based on the value of
peopleCount. If peopleCount is greater than 0, it turns on four LEDs connected to pins
PC2, PC3, PC4, and PC5 by setting them to HIGH. It also turns on the motor connected to
pin PC9 and ensures another motor (connected to PC8) is off by setting PC8 to LOW. If
peopleCount is 0, it turns off all four LEDs and both motors by setting PC2, PC3, PC4,
PC5, PC8, and PC9 to LOW.

28
// Ensure PB0 servo is OFF when room is full or counter is decreased
if (peopleCount == 3) {
servoIn.write(0); // Idle position
}
}

Figure 2.5 shows code Part 9

Based on figure 2.5, this code ensures that the servo motor connected to pin PB0 is set to its idle
position when the room is full. If peopleCount is equal to 3, meaning the room is full, the
servo motor is moved to position 0 by calling servoIn.write(0). This sets the servo to its
idle or off position.

void activateServo(Servo &servo) {


servo.write(90); // Active position
delay(1000); // Wait for 1.5 seconds
servo.write(0); // Idle position
}

Figure 2.6 shows code Part 10

In figure 2.6, this function moves a servo motor to an active position and then back to an idle
position. First, the servo is moved to 90 degrees (active position) using servo.write(90). It
stays in this position for 1.5 seconds, indicated by delay(1000). After the delay, the servo is
returned to the 0 degrees (idle position) using servo.write(0).

void handleBluetoothCommand(char command) {


switch (command) {
case '1':
// Turn ON LEDs and Motor
digitalWrite(PC2, HIGH);
digitalWrite(PC3, HIGH);

29
digitalWrite(PC4, HIGH);
digitalWrite(PC5, HIGH);
digitalWrite(PC8, LOW);
digitalWrite(PC9, HIGH);
break;
case '0':
// Turn OFF LEDs and Motor
digitalWrite(PC2, LOW);
digitalWrite(PC3, LOW);
digitalWrite(PC4, LOW);
digitalWrite(PC5, LOW);
digitalWrite(PC8, LOW);
digitalWrite(PC9, LOW);
break;
case '2':
// Activate Servo Motor 1 to position 90
activateServo(servoIn);
break;
case '3':
// Activate Servo Motor 2 to position 90
activateServo(servoOut);
break;
default:
// Handle any other commands or ignore unknown commands
// You can add specific actions or just ignore the command
break;
}
}

Figure 2.7 shows code Part 11

The void handleBluetoothCommand function responds to commands received via


Bluetooth. Depending on the command, it controls LEDs, motors, and servo motors. If the
command is '1', it turns on LEDs and the motor by setting specific pins to HIGH and LOW. If the
command is '0', it turns them off by setting the same pins to LOW. For command '2', it activates
Servo Motor 1 by moving it to a 90-degree position and then back to 0 degrees using the
activateServo function. For command '3', it does the same for Servo Motor 2. Any other
commands are ignored.

30
3.3 Bluetooth Application Design Using MIT App Inventor

Developing MIT App Inventor to manually control LEDs (Lamp) and DC Motor (Fan) using
phones.

Figure 2.8 shows interface of MIT App Inventor.

31
Figure 2.8 shows coding blockly for MIT App Inventor.

The MIT App Inventor Blockly code connects to a Bluetooth device using ListPicker1 and
BluetoothClient1. When ListPicker1 is clicked, it lists available Bluetooth devices, and upon
selection, attempts to connect and updates Label1 with the status. For controlling a DC motor and LEDs,
Button1 sends the text "1" to the Bluetooth-connected device to turn them on, with voice feedback
"LAMP AND FAN TURN ON", provided the connection is active. Similarly, Button2 sends the text
"0" to turn off the motor and LEDs, with voice feedback "LAMP AND FAN TURN OFF". Button3 and
Button4 also send text via Bluetooth, but their specific functions are not detailed for motor and LED
control.

32
CHAPTER 4

4.0 RESULTS AND DISCUSSION

4.1 Prototype

4.1.2 On Donut Board With Prototype

Figure 2.9 shows connection components on the donut board with a prototype.

33
4.2 Prototype Operation

Figure 3.0 shows donut board connection with a prototype at condition ON.

4.3 Test and Troubleshoot

Figure 3.1 shows connection components on the breadboard.

34
Before building this prototype on a larger scale, we have carefully tested and
troubleshooted it to make sure that all of the components and connections work as they should.
Two important stages comprised our testing procedure. We initially assembled all the parts on a
breadboard, which made it possible for us to quickly change and effectively troubleshoot any
problems. In order to ensure that every connection and component interaction worked as
intended, we carefully inspected each one during this phase, which was essential for verifying
the circuit's basic operation. We were able to find and address any possible problems early in the
development process thanks to this preliminary test. We moved on to the donut board for the
second round of testing after the breadboard testing went well. The components were placed on a
sturdier and more long-lasting base thanks to the donut board. To ensure accuracy and
uniformity, we meticulously moved each connection from the breadboard to the donut board.
During this stage, we were able to confirm the circuit's robustness and stability in a more stable
configuration. The circuit kept operating as planned, demonstrating the viability of our concept
and the efficiency of our preliminary testing stage. We were confident that the circuit was ready
for the final build because it continuously performed according to our expectations during both
phases. Before moving on to the final assembly, this methodical testing and troubleshooting
procedure made sure that the prototype was reliable and completely functioning.

35
CHAPTER 5

5.0 CONCLUSION

5.1 Conclusion

At the end of the Smart Meeting Room project, students managed to design an integrated
hardware and software system using the STM32F446RE microcontroller. The students
effectively utilized the microcontroller’s features to manage various components such as sensors,
motors, and communication modules. Furthermore, a functional prototype of the Smart Meeting
Room system was built, which demonstrates the capability to monitor and control the meeting
room environment. For instance, when the infrared sensor detects movement, it will send the
data to the servo module that will open the door of the office. The LCD display then shows the
number of entries in the office which has been limited to only 3 entries and the door will be
locked after there are three people in the meeting room. The prototype showcased successful
integration of all components, allowing real-time monitoring and adjustments based on user
inputs and sensor data. The prototype also underwent rigorous testing by the students to ensure
that all systems operated reliably and accurately. This includes simulating various environmental
conditions and user interactions to verify system responses and overall stability.

Based on our further research, there are a few potential applications of the smart meeting
room system in future projects. For example, corporate offices which implement meeting room
management and occupancy detection. As for the meeting room management, we can automate
the scheduling, usage, and environmental control of meeting rooms to optimize energy
consumption and enhance user comfort whereas we can use motion sensors to detect the
presence of individuals in meeting rooms, automatically adjusting lighting and HVAC systems
accordingly. Next is applying the concept of smart meeting rooms for smart homes such as home
office automation. This allows us to extend the technology to home offices, automating lighting,

36
climate control, and device management for a more efficient home working environment.
Finally, we can also apply the idea of smart meeting rooms at retail stores. This aids in
enhancing the shopping experience by controlling lighting, music, and temperature based on
real-time occupancy and customer flow. In addition, it also optimizes energy usage in stores by
automating HVAC and lighting systems based on occupancy and operational hours.

There are also a few improvements that can be considered for this smart meeting room
project. First suggestion on the improvements for the smart meeting room project is an enhanced
user interface such as voice control which integrates voice control using platforms like Amazon
Alexa or Google Assistant for hands-free operation. Secondly, we can add advanced sensors
such as noise level monitoring. Implementing noise level sensors can be helpful in ensuring an
optimal acoustic environment for meetings. Hence, we can also include machine learning and AI
in this project in the future. For example, predictive analytics and facial recognition. We can use
machine language algorithms to predict room usage patterns and optimize settings accordingly.
We can use machine learning algorithms to predict room usage patterns and optimize settings
accordingly and implement facial recognition for personalized settings based on the identified
users.

37
REFERENCES

[1] Carter, Rebekah. “How to Automate Meeting Room Management: Tips for Success.” UC
Today, 11 Apr. 2024, www.uctoday.com/meeting-rooms-and-devices/how-to-automate-meeting-
room-management-tips-for-success/.

[2] “Conference Room Automation: What Is It and What Are the Benefits?”
Iesmartsystems.com, 2024, iesmartsystems.com/conference-room-automation/.

[3] “What Is a Smart Meeting Room? | Universal AV.” Universal AV Services Ltd,
www.uniav.com/whats-new/what-is-a-smart-meeting-room/.

[4] “Majilis Peperiksaan Malaysia Smart Conference Room.” SmartZone Smart Home
Malaysia | Building Automation System | Fully Customise with In-House Programmer,
www.smartzone.info/mpm-smartconferenceroom.

[5] “Smart Meeting Rooms (Intel IoT).” Instructables, www.instructables.com/Smart-


Meeting-Rooms-Intel-IoT/.

[6] “NUCLEO-F446RE | Mbed.” Os.mbed.com, os.mbed.com/platforms/ST-Nucleo-


F446RE/.

[7] Fritzing. (n.d.). Retrieved from https://fritzing.org/

38

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy