Professional Documents
Culture Documents
Design and Research of Indoor Lighting Control System Based On The STM32
Design and Research of Indoor Lighting Control System Based On The STM32
Design and Research of Indoor Lighting Control System Based On The STM32
03, 2022
Abstract—After the completion of the process of realized by the STM32F103 chip, the illumination is
industrialization in the world, a large number of automatically detected by the BH1750 module, and the
electrified equipment appeared, people's daily life is also time parameters are recorded and fed back by the
more and more dependent on electricity security, DS3231 clock module. The infrared reflection sensor is
electricity consumption has risen sharply. At present, used to detect whether there are people in the room.
various lights driven by electricity play a crucial role in When there is no one, the light will be automatically
our daily life, which is also the main cause of electricity turned off to save energy. If there are people, when the
consumption. We often notice that even when the room ambient light intensity is lower than the set value, the
is empty, or during the day, the lights are still on, which light will be automatically turned on to ensure the
is a waste of electricity. The waste of power resources comfort of the ambient brightness. And can use OLED
caused by traditional lighting equipment cannot be module real-time display indoor light intensity, number
ignored. Therefore, intelligent home furnishing of people and working time. This indoor lighting control
equipment is the favored object of people. So here for a system can not only automatically turn on the light
kind of indoor lighting control system is designed, in according to the environment, but also detect whether
order to meet the lighting needs on the basis of more there is a human body in the current environment and
humane, more importantly, can save power resources. turn on or off the light by itself, which has more
With the rapid application of automation in daily life practical significance.
and the continuous development of computer technology,
Keywords-Lighting Control; STM32; Lighting
lighting control has become increasingly intelligent and
Adjustment; Sensor; Intelligent
automated. The control function of the system is
DOI: 10.2478/ijanmc-2022-0025 33
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
34
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
35
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
36
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
GND
GND
OUT
VCC
OUT
VCC
The hardware circuit of the indoor lighting
control system is mainly composed of V V
C C
STM32F103C8T6 MCU, DS3231 clock module, C
R2
C
R1
infrared detection module circuit, OLED display 1K 1K
module and lamp tube circuit [15]. Combined with PB6 PB7
37
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
Step 5: Calculate the result. Finally, the light voltage. Through the action of the AC power
intensity data stored in the module is extracted by supply, the rectifier diode can achieve a periodic
the master chip and displayed by the OLED. on or off state, by which the load can receive a
pulse of direct current. Rectifier voltage regulator
C. OLED Display Circuit
circuit is shown in Figure 4.
The corresponding power supply input terminal
VCC 3V3 VCC 5V 3V3
of this module is VCC_IN, which supplies U1 and R3
VCC
VCC 3V3 R4 D1 R5
1K
U4 circuits after depressurization by U2. A 104
C1
104
C4
104
C2
104
C3 1K D2
SS34
10K
NRST
voltage of 7~7.5V is required to drive the OLED S1
D3 C5
screen, which is provided by boosting the voltage GND
GND
10uF
4
serial protocols. This module is grounded by using
D
VOUT
5V
GND
GN VCC
VIN
VCC 5V
BS0->BS2 pins, which have been set as SPI P1
1
1
2
3
protocol and shared with U4 Chinese character VCC 3V3 C6
104 C7
33
104
C8 C9
33
6 H_Green
2
6
library chip for SPI interface. During operation,
the chip's corresponding chip pins are used to GND
GN
distinguish. During read and write operations, the D
CS pins corresponding to the chip will be set to a Figure 4. Rectifier voltage regulator circuit
low-level state, which will be used as the
corresponding display part of this project. OLED IV. SOFTWARE PROGRAM DESIGN
is connected to STM32 and BH1750 and DS3231.
A. System Software Design
In addition to displaying normal working hours, it
also displays brightness, number of people, In the research and development of any
current time, etc. electronic product system, not only the design and
implementation of hardware need to be
D. Rectifier Voltage Regulator Circuit emphasized, but the design and implementation of
In the circuit of the lighting control system, software programs are also equally important. At
AMS1117 series regulator has two versions, one is present, the development tools of various
adjustable version, one is a variety of fixed electronic systems can be described as a dazzling
voltage version, the role is to carry out 1A current array of functions, but many senior developers
output, while ensuring that the working pressure still prefer to use KEIL for development, mainly
difference will not exceed 1V. The minimum because the pages are friendly and easy for
differential pressure of the AMS1117 device is developers to use since KEIL came out. Therefore,
guaranteed to be less than or equal to 1.3V at the the software design part of the indoor lighting
maximum output current, and to decrease as the control system is also selected to be developed
load current decreases. SS34 is a patch Schottky through KEIL and C language. Moreover, for the
diode used for instantaneous circuit rectification. increasingly mature application and development
The function of the rectifier circuit is to convert a of stm32 single-chip microcomputers, many basic
kind of AC voltage in positive and negative codes and routines are also increasing, which
changing state through a one-way conductivity of makes it more convenient and simpler to develop
the diode, so that it becomes a one-way pulse
38
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
39
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
No one here
operation of the intelligent lamp according to the
Check whether the
detection results. The feature is very convenient brightness is too low
and friendly, especially at night. The human body Y
detection subroutine flow is shown in Figure 7.
Open the light
Begin
Finish
Initialization
Figure 8. Main program flow
40
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
circuit, light intensity detection circuit and lamp After the power supply is connected, the
circuit. system enters the standby state. The screen shows
the current working status and ambient brightness
The first thing to do during and after the
with the number of detected people.
realization of the electronic system is debugging.
Debugging during the implementation process can If the infrared detection module works properly
help to find and correct the shortcomings in the and detects human body entering the room, the
implementation process as early as possible; and BH1750 module starts to work. If the ambient
the debugging after the implementation can help light is detected below the set value (500 lumens),
to find and correct the shortcomings of the system the system will automatically turn on the light for
in time. There are many ways to realize the brightness enhancement. If the infrared detection
debugging of electronic systems, including module detects a human body, but the ambient
software and hardware debugging and module light is greater than the set value (500 lumens), the
debugging, system joint debugging and simulation system will not turn on the light. The two cases
debugging. are shown in Figure 10. and Figure 11
respectively.
This system adopts the method of single
module debugging and simulation debugging. The
indoor lighting control system is debugged
through hardware debugging and software
debugging respectively. Hardware debugging
mainly uses multimeter, oscilloscope and other
tools to check the hardware circuit of each
submodule; software debugging mainly uses
KEIL development tools to detect human body
detection module subroutines, button module
subroutines, various working mode subroutines,
etc., as well as the entire indoor lighting The Figure 10. The ambient light is below the set value
program of the control system is debugged and a
file that can be recognized by the control chip is
generated.
The whole system is shown in Figure 9.
41
International Journal of Advanced Network, Monitoring and Controls Volume 07, No.03, 2022
42