You are on page 1of 7

Design of the Intelligent Control System of Classroom Based on Raspberry Pi

Xuling Guo1, Shuqun Wang 1,2,Shengying Zhu 2


1.Southwest Minzu University ,Szechwan 610225,China

E-mail: 1050149428@qq.com

2.Southwest Minzu University ,Szechwan 610225,China

E-mail: 1298212264@qq.com

Abstract: For solving the wasting problem of daily electricity effectively,this paper mainly introduced a project about
an intelligent electronic control system to manage electric equipment of colleges and universities,such as lamps and
air conditioners in the classroom.It has effectively solved the problems of classroom management system.Raspberry
Pi, the core of the design, transmits remote data through the TCP/IP protocol and achieves external network access to

Introduction who forget to start monitoring system to check electrical


appliances,the above research and development results
During recent years,higher education had been paid much
seem to be helpless somewhat[3].
attention to increasingly,and the major colleges and
universities have frequently expanded teaching buildings Raspberry Pi,an open source embedded system,had been

and the power load is also added gradually[1].At developed by The Raspberry Pi Foundation which is a

present,the use of classroom electrical equipment is in a small charity in the United Kingdom.Its processor uses an

form of manual control by personnel entering the ARM controller and its operating system is Linux.The

classroom,which has poor real-time performance and lacks credit-card-sized Raspberry Pi is cheap and owns a wide

of scientific and reasonable control and range of community,and it has the functions same as the

management.Therefore,the utilization of electrical computer host,likewise it provides a variety of interfaces

equipment in the classroom is not effective,and results in a which can achieve powerful features [4].

huge waste of power resources[2].Aiming at the above Architecture of the system


reasons,there are quite a few related researches on how to 2.1 System components
optimize the electronic control system to alleviate the
The Raspberry-based intelligent classroom electronic
waste of electric energy.However,the existing
control system is mainly composed of 4 parts: Raspberry
achievements generally used the special power monitoring
Pi server-side,client-side,data acquisition module for
chip and 51 SCM to realize the expected functions
sensors and relay control module,which is shown in figure
together.Although these technologies can monitor the
1.The data acquisition module for sensors is responsible
standby current or voltage value of these electric
for multi-channel data acquisition (including human
equipment and the cost of dedicated power detection chip
infrared sensors and temperature sensors for data
is lower relatively,the controllable distance of 51 MCU is
acquisition,furthermore it combined with the relay control
limited,and the degree of intelligence and convenience of
module to gain control);Through Raspberry Pi itself build
its operation isn’t enough as well.While the electricity
server,well make it through the dynamic domain name
equipment is still working for the absence of the
resolution to map to the public network to provide control
administrator,or before leaving the classroom someone

978-1-5386-1243-9/18/$31.00 2018
c IEEE 6699
to the controller could achieve the communication with the in real time,and feedback the collected data to the
cloud server.By this means the server will obtain the server-side,so the administrator looks on the client and
real-time data collection on the scene via building makes the corresponding measure in the control area at
webpage; once;

In addition,the client-side is divided into visual interface 2) Fixed-time control settings of the circuit
and smart phone APP,which possess the ability of viewing
Taking into account that the working environment of the
real-time data and operating the corresponding relay
electronic control system is aiming at the classroom(of
control module to control its on-off,consequently it can
which the schedule for work and rest is regular),to ensure
achieve the goal of remoting monitoring and controlling
the normal use of classrooms and to avoid electricity
the status of the use of electrical
safety accidents,the system has been set up for the
equipment."Concentration","one-to-many" control is the
corresponding time control to turn off the circuit
design philosophy of the system.
automatically,which set the classroom of all circuits in the
non-teaching hours of implementation of automatic
open-circuit operation and in non-class time such as 22
o'clock later in the evening all devices are in an open
state.Besides,during the morning class the system opens
multimedia devices uniformly.Moreover,several special
needs of the segmental classroom can be meet with
human-based presets according to the actual situation;

3) Security alarm settings

With an eye to the safety precautions,the system is


equipped with a temperature sensor in the classroom
controller,so that we could achieve the monitoring of
indoor temperature in real time and process logical
judgment synchronously.When the indoor temperature
fig 1.Architecture diagram of Raspberry Pi based electronic control
exceeds a predetermined value (such as 50 ),the system
system
alarms and sends a signal to the server to ensure that the
2.2 System functions administrator can cut off the indoor power supply and take

The use and management of each electrical equipment in emergency measures rapidly and timely in a fire hazard.

the classroom is managed by the client-side,which can Design and function of the system
realize the management functions such as room
3.1 Communication achievement of the Client-side
temperature monitoring,intelligent control of electrical
and Raspberry Pi server-side
equipment switches,setting of circuit timing control,safety
alarm and emergency manual settings and so on. 3.1.1 Startup and settings for the Raspberry Pi server

1) Intelligent control for the switch of the electrical To start the Raspberry Pi,the following devices are
equipment needed:1) a Raspberry Pi (In this article is a 2-generation
model); 2) a wireless mouse and and a keyboard; 3) a
The controlled devices consist of lighting,multimedia
display device; 4) an SD card with 16 gigabytes of
equipment,fans and so on.The human body infrared sensor
capacity ;5) 5V direct-current power supply [5].
can judge whether there are people in the room accurately

6700 The 30th Chinese Control and Decision Conference (2018 CCDC)
The Raspbian must be installed before starting Raspberry 3.2 Design for remoting client-side
Pi.From the official website you can obtain the Raspberry
3.2.1 Multithread programming of Android
Pi,then burn the mirror image file to TF card.The
operating system files are copied to the SD card and then The top-down design of Android operating system is
the SD card is inserted into the Raspberry Pi.The divided into 4 layers ,each of these is not only application
Raspberry Pi will automatically start the installation of the layer,application framework layer,a library of components
operating system Program after the power and other and virtual machine layer,but also Linux kernel layer.
devices are connected successfully.After the installation is
When the system starts,a UI execution thread is
completed,start Raspberry Pi.On account of Raspberry Pi
created.Then all of the components that run in the same
server is based on the Linux operating system and its
process are instantiated in the UI thread,and the system
client computer is Windows operating system,so it uses
which calls for each component are dispatched by that
TCP/IP protocol which can realize interconnection among
thread.For the sake of preventing heavy application tasks
different hardware structures,operating systems and
in response to users’ interaction,the single-threaded mode
network systems[6].
may obstruct the UI.Therefore,the system adopts
3.1.2 Features of Raspberry Pi server-side multi-threaded work mode,which is used to achieve the
Runnable interface to define multiple sub-threads.And
1) The Raspberry Pi server can monitor the signal from
then create Thread(an object that implements the
the client momentarily after it starts successfully;
Runnable Interface)object,directly passes into the Thread's
2) The server starts a thread for processing timely while constructor function,then the code which are called the
receiving a command or request from the client,meanwhile start ( ) method and run ( ) method will run in the
it continues to listen for new requests; sub-thread,in order to parse asynchronous message
processing system(which include
3) As the command "real-time monitoring" is received,the
Message,Handler,MessageQueue,and Looper)to complete
sensor data acquisition module that connected to the
the UI updates operation in the sub-thread.The APP’s
Raspberry Pi will start to monitor the current temperature
working block diagram of the system is shown in figure 2:
and the status of each electric device continuously and
save the data in the database,then send the data to the
client-side.Such and such,it continues to work circularly;

4) The relay module and the motor drive module


connected to the Raspberry Pi will starts while receiving
the command of "Client Control",and then it can control
the circuit’s switched on and off,also involves the gears of
fans;

5) After receiving the command of "Exit",the client-side


will detect the current status and switch to the background
measurement mode.

6)The Raspberry Pi executes multiple programs


simultaneously to monitor the stability of its own
systems,and maintains the security of its operating system
constantly.

The 30th Chinese Control and Decision Conference (2018 CCDC) 6701
3.2.3 Functionality of Client-side

1) Not only can the user visit the relevant webpage in the
browser,but also can download and install the APP for
intelligent electric control system which supports for
jumping to the webpage interface for accessing and
browsing;

2) After starting the program in the first interface,the user


can browse the project-related profile as is shown in figure
3.New users need to complete the real-name
registration,password registration and other work to obtain
using access.Save the initial registration information in the
login screen,then fill the relavant information in the
account once again which has been saved.When you press
the "Login" button,the background software will be
ready to access the database and extract the file to check
the login and registration information match;

fig 3.Diagram for the first interface of webpage

fig 2.APP working block diagram of system


3)If the user has successfully logined in,open the control
3.2.2 Realization of remote monitoring and control by panel to view the display of all power equipment’s usage
JDBC status and room temperature data in each classroom (the
client-side commands the server to monitor and measure
JDBC(Java Database Connectivity),a Java API for
in real time and accept its related transmission data).Click
executing SQL statements,it provides a benchmark from
into the operated classroom which is needed,later press the
which to build more advanced tools and interfaces.By the
button to take switch operation for the corresponding
way of connecting to the database,it’s significant to create
lights,fans and other electrical equipment.Through the
a JDBC Connection through
gear button,also can control fan’s speed remotely to satisfy
DriverManager.getConnection(which is connected to the
the user’s needs,as shown in figure 4.By the way,the
"URL","user’s name","password" of database).In
mobile APP control area,as mapped out in figure 5 for
addition,by calling executeQuery( )and execuUpdate( )
details;
method of the Statement’s object for data query and
update,thus the fiction of remoting monitoring control the
classroom electrical equipment will be implemented.

6702 The 30th Chinese Control and Decision Conference (2018 CCDC)
The L298N motor drive module is used to cooperated with
the system.Four GPIO Pins are provided by the Raspberry
Pi as the input source of the PWM wave (Two circuits are
responsible for grounding and the other two are used to the
PWM wave input).The PWM wave outputs a sinusoidal
square wave of 3.3V peak and sets the waveform
frequency of the corresponding output channel by using
the Python statement which is GPIO.PWM (40,50).After
fig 4.Control area for users the waveform setting is completed,adjust the duty cycle
and the fan’s speed regulation can be completed.

3.3.2 Implementation of relay control module

The relay module used in this project has a total of 6


interfaces,of which the normally open interface NO pin is
responsible for connecting with the live wire of the
electric lamp,and the COM pin is connected to its neutral
line.Furthermore,the DC +5V takes positive power supply
and the DC -5V is connected with the negative pole.The
hooded jumper of this relay module is connected with the
HIGH pin as a short circuit,in order to achieve a high
trigger which has achieved the control of the relay
pull.Furthermore,the IN pin accesses one of the GPIO
fig 5.Mobile APP control area interface of Raspberry Pi,and through the Python
statement:GPIO.output (13,GPIO.HIGH),that means the
4)Click to enter the user’s experience feedback area,the
13th GPIO will produce a high level to control the relay’s
user can fill in this page during the use of the problems
pull-in,then the light will be lit.
encountered or any suggestions and advice for this
product,like the figure 6 here; 3.3.3 Realization for data acquisition of Human
infrared sensor

The system uses HC-SR501 human infrared sensor,a


control module based on infrared technology,which has
high sensitivity,better reliability,and a ultra-low voltage
operation mode.Containing 3 GPIO ports,these are,the
power supply positive and negative and the corresponding
output IO port.When the human body into the sensing
range the IO port will output high level.Control principle
fig 6.Feedback area for User Experience is as follows: In the exit and entrance of the classroom,on
both sides,install the infrared sensor detection module.The
5)Press the "Exit" button,all windows will disappear,then
the user can exit the application safely. human body is detected at the entrance,that is,the level of
the output IO port is high,the number of indoor will be
3.3 Control of hardware module via Raspberry Pi increased by 1.When the human body is detected at the

3.3.1 Realization of motor control module exit,the output of the IO port is also at a high

The 30th Chinese Control and Decision Conference (2018 CCDC) 6703
level,nonetheless the number of persons is reduced by and control of all the electric equipment in the classroom
1.Combined with the use of LCD module,statistics show without distance restriction,which saves energy and
the number of indoor persons.In view of the module itself environmental protection as well.
has a blocking time (the default setting is 3 to 4
Contemporaneously,the system set up interactive functions
seconds),so while it detects a high level,it has a time delay
in the feedback area in order for users to submit
for 3 seconds,and the count variable will increase by 1 or
experience comments.So later on,the system will feed
minus by 1 accordingly.
back information to the server-side,which is convenient
Experiment result and analysis of the system for facilitating the late improvement and follow-up.The
simulation scene model of intelligent electronic control
Firstly start the client-side,then complete the registration
system and debugging are shown in figure 7.
of real-name system,the new user will accomplish the
login work after obtaining the management authority of
the smart phone APP.

While entering the monitoring interface,it shows the


number of people that the sensor gathered and the state of
power switches in real-time.On the basis of the
attendance information,the client-side set the switch
status of each power device remotely.

Enter the master-control interface: Click the "light"


button,send "open" or "close" command,and the fig 7.physical map for the construction of simulation scenes

administrator can control the status of different lights in


Concluding remarks
the room.In a similar way,click the "fan" button and send
"1","2","3" different gears or "off" command to control The control system based on Raspberry Pi adheres to the
different fan status in the room. concept of energy-saving and manpower reduction,the
data transmission with wireless distance can monitor and
Combined with the the LCD data display module,human
change the status of the various hardware devices in real
body infrared sensor ensures the accuracy and timeliness
time,such as electrical equipment.Furthermore,it shows
of the detection for the attendance quantity and the control
statistics of indoor attendance refer to the result of data
instructions which are sent by the client in
display module,which makes the command to send and
real-time,simultaneously it enhances the readability.On
execute efficiently.The system is stable and its feedback is
account of the real-time update of database,the
abnormal timely,furthermore it isn’t prone to
functionality can be achieved without delay monitoring
abnormalities.If there is something abnormally,the
and control.
abnormal feedback could be timely and the maintenance is
Besides a simulation exercises for emergency scene was of great convenience.Not only does the intelligent
conducted,that is,when the temperature sensor detects that classroom electronic control system solve the phenomenon
the indoor temperature exceeds 50°C,the feedback of energy waste effectively in campus,but also saves time
information will be sent to the server immediately,then the and money costs.Meanwhile,it greatly reduces the
alarm is started and the corresponding message is tend to workload of the relevant managers,which authentically
be displayed on the client.Meanwhile the administrator makes the surrounding environment increasingly
cuts off the power of each equipment remotely. energy-efficient,convenient and intelligent as well.

Therefore,the system implements the real-time monitoring REFERENCES:

6704 The 30th Chinese Control and Decision Conference (2018 CCDC)
[1] Zhang LiPing,Xue Shigao,Zhang Yaqing,et al.An intelligent [6] Technology tomorrow.Java from entry to master
classroom system based on Raspberry Pi [J] .Electronic [M].Tsinghua University Press,2012.[7] Zhang Huazhu,Yao
Technology,Beijing University Students Science Research Linlin,Shen Yang,et al.Design of Crop Low Altitude
and Entrepreneurship Action Program,2017.06: 145. Observation System Based on Raspberry Pi [J].Journal of

[2] Yu Xinye,Yi Yi,Hao Jianwei.Design of energy-saving Jilin University,2015,33 (6): 625-631.

energy-saving control system for teaching buildings [7] Yu Zhiqiang,Wen Zhiyu,Xie Ying Ke,et al.Multi-parameter
[J].Application of Electronic Technology,2017,43 (6): water quality detector control system based on Raspberry
79-82,86. Pi [J].Instrumentation Technology and Sensor,2015 (6):

[3] Mao Yuqing.Energy-saving electric equipment remote 20-23.

control system [J].China Science and Technology [8] Liu Jia Christmas,Zhou Qi.Use Raspberry Pi remote host to
Information,2016.21: 18-32,33,35. achieve power failure restart [J].Jiangsu Electrical

[4] Guo Liang,Ye Aiming,Lin Tao,etal.Design of remote real-time Engineering,2014,33 (6): 70-72.

temperature and humidity measurement system based on [9] Guan Jingli,Ai Hong,Chen Wenbo.Design of open laboratory
Raspberry Pi and language [A] .Computer Measurement monitoring system based on Raspberry Pi and Yeelink
and Control,2017,25 (6). [A] .Automation College of Beijing University of Information

[5] PhilbinCA.Zero-based learning RaspberryPi [M].Beijing: Science and Technology,Beijing 10019; 2017,36 (3):

People's Posts and Telecommunications Press,2015. 116-119,124.

The 30th Chinese Control and Decision Conference (2018 CCDC) 6705

You might also like