Tải bản đầy đủ (.docx) (47 trang)

A rain detecting circuit for door opening and closing

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (3.54 MB, 47 trang )

TABLE OF CONTENTS

FIGURES..................................................................................................................... iii
LIST OF ABBREVIATIONS.....................................................................................iv
CHAP 1: TOPIC OVERVIEW...................................................................................1

1.1 Purpose of implementing the topic.......................................................................1
1.2 Topic requirements...............................................................................................2
1.3 Research subjects..................................................................................................2
1.4 Implementation ideas............................................................................................2
1.5 Expected results....................................................................................................3
CHAP 2: THEORETICAL BASIS.............................................................................4
2.1 PIC mirocontroller................................................................................................4
2.2 Rain sensor...........................................................................................................6
2.3 Motor....................................................................................................................7
CHAP 3: DESIGN AND CONSTRUCTION OF MODELS.....................................8
3.1 Block diagram......................................................................................................8

3.1.1 Source block..................................................................................................9
3.1.2 Sensor block................................................................................................10
3.1.4 Motor block.................................................................................................14
3.1.5 Display block...............................................................................................19
3.2 Designed on Proteus simulation software...........................................................22
3.3 Model design......................................................................................................24
CHAP 4: ALGORITHM AND CONTROL.............................................................27
4.1 Operating system................................................................................................27
4.2 Algorithmic flow chart.......................................................................................27
CHAP 5: PRACTICE.................................................................................................28
5.1 Experimental process..........................................................................................28

1



5.2 Results................................................................................................................28
5.3 Conclusion..........................................................................................................30
CHAP 6: CONCLUSIONS........................................................................................31
6.1 Advantages.........................................................................................................31
6.2 Disadvantages.....................................................................................................31
6.3 Development.......................................................................................................31
REFERENCES........................................................................................................... 32
CODE.......................................................................................................................... 33

2

FIGURE

Figure 1.1 Drying rice paper...........................................................................................1
Figure 1.2 Clothesline....................................................................................................1
Figure 2.1 Microcontroller (PIC16F877A) [Nagar, J. (2019, May 31)]..........................4
Figure 2.2 PIC 16F877A pins [Nagar, J. (2019, May 31)]..............................................5
Figure 2.3 Rain sensor....................................................................................................6
Figure 2.4 IC L293D......................................................................................................7
Figure 3.1 Block diagram...............................................................................................8
Figure 3.2 Components in the block...............................................................................9
Figure 3.3 DC adapter..................................................................................................10
Figure 3.4 Rain sensor..................................................................................................11
Figure 3.5 PIC 16F877A..............................................................................................13
Figure 3.6 PIC 16F877A pins.......................................................................................13
Figure 3.7 GA12-N20...................................................................................................15
Figure 3.8 IC L293D....................................................................................................16
Figure 3.9 L293D pins..................................................................................................17
Figure 3.10 Schematic diagram of L293D....................................................................17

Figure 3.11 LCD 1602..................................................................................................20
Figure 3.12 Presents the simulation steps on Proteus8.13............................................22
Figure 3.13 Layout of the diagram shows the system's wiring.....................................23
Figure 3.14 Present 3D perspective..............................................................................23
Figure 3.15 Printed circuit processing..........................................................................24
Figure 3.16 PCB (behind side).....................................................................................24
Figure 3.17 PCB (infront of side).................................................................................25
Figure 3.18 PCB (infront of side).................................................................................25
Figure 3.19 The model is nearly complete....................................................................26
Figure 3.20 Completed model......................................................................................26
Figure 4.1 Algorithmic flow chart................................................................................27
Figure 5.1 Door closes when rainfall >40%.................................................................29
Figure 5.2 Operates in manual mode............................................................................29
Figure 5.3 Door opens when power is applied..............................................................30

3

AC LIST OF ABBREVIATIONS
ADC Alternating Current
DC Analog-to-Digital Converter
IC Direct Current
LCD Intergrated Circuit
PCB Liquid Crystal Display
PIC Printed Circuit Board
Programmable Intelligent Computer

4

EMBEDED SYSTEM PROJECT
Page 1


CHAP 1: TOPIC OVERVIEW
1.1 Purpose of implementing the topic

Nowadays, many households have traditional occupations that work with
products that require sunlight and avoid exposure to rainwater. Or family members are
busy with work and don't pay attention to the weather, leading to drying clothes outside
and getting wet in the rain. Therefore, based on the above situation, design a drying
rack system that automatically opens/closes when it rains.

Figure 1.1 Drying rice paper

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 2

Figure 1.2 Clothesline

1.2 Topic requirements
Design a model capable of detecting rain or snow and then display the amount of rain
on the screen. If the amount of rain exceeds the allowed level, the door will
automatically close (open). The system has the ability to adjust between two modes:
automatic or manual.

1.3 Research subjects
The microcontroller has the function of reading the sensor and processing it to display
it on the screen and then control the motor to close or open the door according to the
request.


The rain sensor detects rain or snow falling on the sensor board and then sends a signal
to the microcontroller for processing.

The LCD screen has the function of displaying the amount of rain after the
microcontroller processes the rain sensor and the system's operating mode.

The motor has the function of receiving control signals from the microcontroller and
then operating.

1.4 Implementation ideas
Components include PIC 16F877A, rain sensor, LCD 1602, IC L293D, DC gear

motor. Use the rain sensor to measure then display the rain percentage on the LCD then
set a certain rain level to control the rotary motor to close the door when it is equal to
or greater than the set rain percentage. The system has two modes: automatic or
manual. In manual mode, if you want to control the opening and closing of the door,
use the button.

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 3

1.5 Expected results
When it rains, the percentage of rain will be displayed on the LCD. If the rain

amount is more than 40%, the door will automatically close in 6 seconds or if less, the
door will automatically open. We can use the push button to open/close the door when

needed.

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 4

CHAP 2: THEORETICAL BASIS
2.1 PIC mirocontroller

PIC is the abbreviation for Programmable Intelligence Computer and is a type
of microcontroller manufactured by Microchip Technology company (Figure 2.1
introduce about PIC 16F877A). Nowadays, PICs are developed strongly and widely
because they have many functions integrated into them. PICs are very popular with
users because they are very flexible and can perform user-programmed tasks, helping
to save costs and work efficiently.

Figure 2.3 Microcontroller (PIC16F877A) [Nagar, J. (2019, May 31)]
A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 5

Figure 2.4 PIC 16F877A pins [Nagar, J. (2019, May 31)]
PIC application:

 It is commonly used in medical devices for health measurement, data reading,
display and operation.


 Microcontrollers are installed in automobile control devices such as starting
control systems, engines, and safety for users.

 In agriculture, microcontrollers are used in devices that measure humidity, water
quantity, and temperature for farming systems.

 It is installed in smart homes to control the home's lighting, temperature, and
security system. [Dũng, T. N. (2023)]
 Therefore, microcontrollers are crucial to the operation of many systems

and devices in the current world. PIC is a frequently used device with a lot of

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 6

potential for the future. It is small, easy to use, and packed with useful
functionality.
2.2 Rain sensor

When the weather is rainy and sudden, if you do not have time to bring the
items into the house or if the items are drying outside have not yet been brought in, the
rain will get wet, affecting the quality of the product, causing a loss in price. treat. treat.
However, the rain sensor will signal to help us in those cases.

Rain sensors (Figure 2.3) are widely used to warn of rain or snowfall and will
send an alert to the tracking device to request the door to be closed or opened. They are

most commonly used in automatic drying racks.

Figure 2.5 Rain sensor
Rain sensor uses in real life:

 In agricultural activities, rain sensors help save water when detecting rainy
weather to save irrigation water costs.

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 7

 Installed in the car's wiper system, it detects the amount of water and then the
system wipes the windshield to help the driver's visibility not be affected.

 In the internal skylight system, rain sensors are incorporated. Knowing the
weather allows the house to remain airy during sunny days and damp during
rainy ones.

 Smart clothes drying racks can collect clothes when it rains to prevent clothes
from getting wet.

[Brindley, K. (2011)]

2.3 Motor
All DC and AC motors can rotate in both directions. However, today DC motors

are more widely used and popular due to their high efficiency. IC l293D ( Figure 2.4)

has been invented with the ability to rotate in two directions in a simple way. Besides,
other functions can operate quickly used in robots, cars, etc…

Figure 2.6 IC L293D

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 8

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 9

CHAP 3: DESIGN AND CONSTRUCTION OF MODELS
3.1 Block diagram

The block diagram (Figure 3.1) briefly shows how the system works of rain-
detecting circuit for door opening and closing.

Sensor Block

Source Block Control Block Motor Block

Display Block

Figure 3.7 Block diagram


The power block supplies power to the three sensor, control and display blocks.
The sensor block will receive signals from the outside and then send them to the
control block. The control block processes information and controls the operation of
the motor block and display block.

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 10

Figure 3.8 Components in the block
3.1.1 Source block
Requires power supply for the system to operate during implementation.
Recommended: 5V 2A power adapter.
Specifications:
Input: 100-240VAC ~ 0.5A 50/60Hz
Output: DC 5V 2A

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 11

Figure 3.9 DC adapter
3.1.2 Sensor block

The rain sensor is responsible for detecting rain or snowfall, which can come

into contact with water. They are often placed outdoors such as roofs.
Recommended: Rain sensor.
The rain sensor consists of two parts:

 Sensing pad: It is placed outdoors such as the roof, and is responsible for
detecting rain when water falls on the Sensing pad.

 The electronic module includes four pins:

- VCC: connected to power. (5V)
- GND: connected to ground. (0V)

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 12

- A0: output is analog signal.
- D0: output is digital signal.

Specifications:
Voltage used: 5VDC
Size of rain sensor plate: 54 x 40mm
PCB board size: 30 x 16mm
LED lights up when there is no rain, high output, when there is rain, low output LED
turns off.

Figure 3.10 Rain sensor


A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 13

3.1.3 Control block

The task is to receive signals from the sensor when powered and control the
motor based on the sensor signal.

Recommended: PIC 16F877A

Specifications:

CPU 8-bit PIC
Number of pins 40
Operating voltage 2 to 5.5V
Number of I/O pins 35
Module ADC 14 channels, 10bit
Timer module 8-bit, 16-bit
Comparator 2
Communication Peripherals UART, SPI, I2C, MSSP(SPI/I2C)
External oscillation Up to 20MHz
Internal Oscillation 8MHz to 32MHz
Bytes of RAM 368
EEPROM data 265
[Nagar, J. (2019, May 31)]

Figure 3.11 PIC 16F877A


A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 14

Figure 3.12 PIC 16F877A pins

A Rain-Detecting Circuit
For Door Opening And Closing

EMBEDED SYSTEM PROJECT
Page 15

3.1.4 Motor block
The main task is to perform the actions set by the control block.
Recommended: DC gear motor GA12-N20
Specifications:
Gear ratio: 1:97.
Voltage used: 1.5 ~ 12VDC
Motor diameter: 12mm.
Motor length: 34mm.
Shaft diameter: 3mm (D-shaped shaft).
Shaft length: 10mm
Speed through gearbox: 96rpm ~ 241rpm.
[Lowe, D. (2022)]

A Rain-Detecting Circuit
For Door Opening And Closing


EMBEDED SYSTEM PROJECT
Page 16

Figure 3.13 GA12-N20
Use IC L293D to control the motor:

Using this L293D motor driver IC is very simple. The IC works on the principle
of Half H-Bridge, let's not go too deep into what H-Bridge means, just know that H
Bridge is a setup used to run the motor both in clockwise direction clockwise and
counterclockwise. As said earlier, this IC is capable of running two motors in any
direction at the same time, the circuit to do this is as below.

A Rain-Detecting Circuit
For Door Opening And Closing


×