Method and system for remotely controlling household appliances

文档序号:882563 发布日期:2021-03-19 浏览:43次 中文

阅读说明:本技术 一种远程控制家用电器方法及系统 (Method and system for remotely controlling household appliances ) 是由 卢伟强 何彦霖 刘德旺 于 2020-11-30 设计创作,主要内容包括:本发明实施例提供了一种远程控制家用电器方法,包括以下步骤:S1:树莓派上http服务器接收手机端APP请求;S2:当树莓派上的http服务器接收的APP请求是底层GPIO口调用时,则根据树莓派系统提供的GPIO驱动,调用I2C协议与STM32单片机进行通讯;S3:STM32单片机接收到树莓派GPIO发送的报文,树莓派GPIO发送的报文含有NRF24L01模块的地址;S4:判断NRF24L01接收端从NRF24L01模块接收的地址与NRF24L01接收端的地址是否一致;S5:当NRF24L01接收端从NRF24L01模块接收的地址与NRF24L01接收端的地址一致时,NRF24L01接收端读取报文信息进而控制家用电器;S6:当NRF24L01接收端从NRF24L01模块接收的地址与NRF24L01接收端的地址不一致时,则进行丢弃报文;本发明实施例便于用户远程遥控家用电器设备,进而提高用户使用家用电器的体验。(The embodiment of the invention provides a method for remotely controlling household appliances, which comprises the following steps: s1: sending an http server to the raspberry to receive an APP request of a mobile phone terminal; s2: when the APP request received by the http server on the raspberry pi is called by a bottom GPIO port, calling an I2C protocol to communicate with the STM32 singlechip according to GPIO drive provided by the raspberry pi system; s3: the STM32 single chip microcomputer receives a message sent by the raspberry group GPIO, and the message sent by the raspberry group GPIO contains the address of the NRF24L01 module; s4: judging whether the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal; s5: when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal, the NRF24L01 receiving terminal reads message information to control the household appliance; s6: when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving terminal, discarding the message; the embodiment of the invention is convenient for the user to remotely control the household appliance equipment, thereby improving the experience of the user in using the household appliance.)

1. A method for remotely controlling a home appliance, comprising the steps of:

s1: sending an http server to the raspberry to receive an APP request of a mobile phone terminal;

s2: when the APP request received by the http server on the raspberry pi is called by a bottom GPIO port, calling an I2C protocol to communicate with the STM32 singlechip according to GPIO drive provided by the raspberry pi system;

s3: the STM32 single chip microcomputer receives a message sent by the raspberry group GPIO, and the message sent by the raspberry group GPIO contains the address of the NRF24L01 module;

s4: judging whether the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal;

s5: when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal, the NRF24L01 receiving terminal reads message information to control the household appliance;

s6: when the address received by the receiving end of the NRF24L01 from the NRF24L01 module is inconsistent with the address of the receiving end of the NRF24L01, the message is discarded.

2. The method of claim 1, wherein before the raspberry pi http server receives the mobile phone APP request, the method further comprises:

building nginx on the raspberry party;

applying for the peanut shell domain name to penetrate to a corresponding port of the equipment;

and the domain name port corresponding to the APP request of the mobile phone end, and the peanut shell forwards the APP request of the mobile phone end to nginx.

3. The method of claim 2, wherein after the peanut shell forwards the APP request of the mobile phone terminal to nginx, the steps further comprise:

nginx forwards the APP request of the mobile phone end to the http server.

4. A method for remotely controlling home appliances according to claim 3, characterized in that before when the APP request received by the http server on the raspberry pi is an underlying GPIO port call, said steps further comprise:

and judging whether the APP request received by the http server on the raspberry pi is timing task configuration or bottom-layer GPIO port call.

5. The method of claim 4, wherein after determining whether the APP request received by the http server on the raspberry pi is a timed task configuration or a bottom GPIO port call, the method further comprises:

and when the APP request received by the http server on the raspberry pi is the timing task configuration, writing the configuration information into a file system.

6. The method of claim 5, wherein after the STM32 single chip microcomputer receives the message sent by the raspberry pi GPIO, the steps further comprise:

and the STM32 singlechip sends the message to the NRF24L01 module through the SPI protocol.

7. The method of claim 6, wherein after the STM32 single chip microcomputer sends the message to the NRF24L01 module through the SPI protocol, the steps further comprise:

the NRF24L01 module receives the message;

the NRF24L01 module sends the address and message information of the receiving end of the NRF24L 01;

the NRF24L01 receiver receives the message.

8. The method of claim 7, wherein when the NRF24L01 receiver receives the address from the NRF24L01 module and the NRF24L01 receiver has the same address, the NRF24L01 receiver reads the message information to control the home appliance, the method comprises:

when the address received by the NRF24L01 receiving end from the NRF24L01 module is consistent with the address of the NRF24L01 receiving end, generating an STM32 singlechip interrupt signal;

after the STM32 single chip microcomputer is awakened, the STM32 single chip microcomputer reads message information from the NRF24L01 receiving end through the SPI protocol.

9. The method of claim 8, wherein when the NRF24L01 receiving terminal receives an address from the NRF24L01 module that is not identical to the NRF24L01 receiving terminal, after discarding the message, the method further comprises:

after the STM32 singlechip receives the message, the output of IO voltage is controlled, and the voltage is amplified by a triode or a field effect tube, so that the grid of the IGBT is controlled, and the power supply of the household appliance is controlled.

10. A remote-controlled household appliance system, characterized in that it comprises:

the first receiving unit is used for receiving an APP request of a mobile phone terminal by an http server on the raspberry;

the communication unit is used for calling an I2C protocol to communicate with the STM32 singlechip according to GPIO driving provided by the raspberry dispatching system when the APP request received by the http server on the raspberry dispatching is called by a bottom GPIO port;

the second receiving unit is used for receiving the messages sent by the raspberry group GPIO by the STM32 single chip microcomputer, and the messages sent by the raspberry group GPIO contain the address of the NRF24L01 module;

a judging unit, for judging whether the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal;

a reading unit, configured to, when an address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with an address of the NRF24L01 receiving terminal, read the packet information by the NRF24L01 receiving terminal to control the home appliance;

and the discarding unit is used for discarding the message when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving terminal.

Technical Field

The invention relates to the technical field of intelligent home furnishing, in particular to a method and a system for remotely controlling household appliances.

Background

With the continuous development of internet science and technology, more and more technologies are applied to the field of smart homes, wherein remote control in household appliances involves numerous technical applications.

At present, most household appliances are operated manually, the time cost of manual operation is high, and the user experience is poor.

Summary of the invention

In order to overcome the defects of the prior art, the invention provides a method for remotely controlling a household appliance, which is used for solving the problems of how to remotely control the household appliance and poor user experience.

The technical scheme adopted by the invention for solving the technical problems is as follows: provided is a method for remotely controlling a home appliance, including the steps of:

s1: sending an http server to the raspberry to receive an APP request of a mobile phone terminal;

s2: when the APP request received by the http server on the raspberry pi is called by a bottom GPIO port, calling an I2C protocol to communicate with the STM32 singlechip according to GPIO drive provided by the raspberry pi system;

s3: the STM32 single chip microcomputer receives a message sent by the raspberry group GPIO, and the message sent by the raspberry group GPIO contains the address of the NRF24L01 module;

s4: judging whether the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal;

s5: when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal, the NRF24L01 receiving terminal reads message information to control the household appliance;

s6: when the address received by the receiving end of the NRF24L01 from the NRF24L01 module is inconsistent with the address of the receiving end of the NRF24L01, the message is discarded.

Preferably, before the raspberry is sent to the http server to receive the APP request from the mobile phone, the steps further include:

building nginx on the raspberry party;

applying for the peanut shell domain name to penetrate to a corresponding port of the equipment;

and the domain name port corresponding to the APP request of the mobile phone end, and the peanut shell forwards the APP request of the mobile phone end to nginx.

Preferably, after the peanut shell forwards the APP request of the mobile phone terminal to nginx, the step further includes:

nginx forwards the APP request of the mobile phone end to the http server.

Preferably, before the APP request received by the http server on the raspberry farm is an underlying GPIO port call, the steps further include:

and judging whether the APP request received by the http server on the raspberry pi is timing task configuration or bottom-layer GPIO port call.

Preferably, after determining whether the APP request received by the http server on the raspberry pi is a timing task configuration or a bottom-layer GPIO port call, the steps further include:

and when the APP request received by the http server on the raspberry pi is the timing task configuration, writing the configuration information into a file system.

Preferably, after the STM32 single chip microcomputer receives a message sent by the raspberry pi GPIO, the steps further include:

and the STM32 singlechip sends the message to the NRF24L01 module through the SPI protocol.

Preferably, after the STM32 single chip sends the message to the NRF24L01 module through the SPI protocol, the steps further include:

the NRF24L01 module receives the message;

the NRF24L01 module sends the address and message information of the receiving end of the NRF24L 01;

the NRF24L01 receiver receives the message.

Preferably, when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is identical to the address of the NRF24L01 receiving terminal, the NRF24L01 receiving terminal reads the message information to control the home appliance, and the steps include:

when the address received by the NRF24L01 receiving end from the NRF24L01 module is consistent with the address of the NRF24L01 receiving end, generating an STM32 singlechip interrupt signal;

after the STM32 single chip microcomputer is awakened, the STM32 single chip microcomputer reads message information from the NRF24L01 receiving end through the SPI protocol.

Preferably, when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving terminal, after discarding the packet, the method further includes:

after the STM32 singlechip receives the message, the output of IO voltage is controlled, and the voltage is amplified by a triode or a field effect tube, so that the grid of the IGBT is controlled, and the power supply of the household appliance is controlled.

A remote controlled household appliance system, the system comprising:

the first receiving unit is used for receiving an APP request of a mobile phone terminal by an http server on the raspberry;

the communication unit is used for calling an I2C protocol to communicate with the STM32 singlechip according to GPIO driving provided by the raspberry dispatching system when the APP request received by the http server on the raspberry dispatching is called by a bottom GPIO port;

the second receiving unit is used for receiving the messages sent by the raspberry group GPIO by the STM32 single chip microcomputer, and the messages sent by the raspberry group GPIO contain the address of the NRF24L01 module;

a judging unit, for judging whether the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal;

a reading unit, configured to, when an address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with an address of the NRF24L01 receiving terminal, read the packet information by the NRF24L01 receiving terminal to control the home appliance;

and the discarding unit is used for discarding the message when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving terminal.

The invention has the beneficial effects that: sending an http server to the raspberry to receive an APP request of a mobile phone terminal; when the APP request received by the http server on the raspberry pi is called by a bottom GPIO port, calling an I2C protocol to communicate with the STM32 singlechip according to GPIO drive provided by the raspberry pi system; the STM32 single chip microcomputer receives a message sent by the raspberry group GPIO, and the message sent by the raspberry group GPIO contains the address of the NRF24L01 module; judging whether the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal; when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal, the NRF24L01 receiving terminal reads message information to control the household appliance; when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving terminal, the message is discarded, a user can conveniently remotely control the household appliance, and the experience of the user in using the household appliance is improved.

Drawings

Fig. 1 is a flow chart illustrating a method of remotely controlling home appliances.

Fig. 2 is a schematic structural view of a remote control home appliance system.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

The following detailed description of specific implementations of the present invention is provided in conjunction with specific embodiments:

the first embodiment is as follows:

fig. 1 shows an implementation flow of a method for remotely controlling a home appliance according to a first embodiment of the present invention, and for convenience of description, only the relevant parts related to the first embodiment of the present invention are shown, and the following details are described below:

in step S101, the raspberry is served by an http server to receive an APP request from a mobile phone;

in the embodiment of the application, the raspberry sending http server receives the APP request of the mobile phone end, is used for receiving the request of the mobile phone web end, and then forwards the request to the internal web server.

Preferably, before the raspberry is sent to the http server to receive the APP request from the mobile phone, the steps further include:

building nginx on the raspberry party;

applying for the peanut shell domain name to penetrate to a corresponding port of the equipment;

and the domain name port corresponding to the APP request of the mobile phone end, and the peanut shell forwards the APP request of the mobile phone end to nginx.

Further preferably, after the peanut shell forwards the APP request of the mobile phone terminal to nginx, the step further includes:

nginx forwards the APP request of the mobile phone end to the http server.

In step S102, when the APP request received by the http server on the raspberry pi is called by a bottom GPIO port, calling an I2C protocol to communicate with an STM32 singlechip according to GPIO drive provided by the raspberry pi system;

in this application embodiment, when the APP request that http server on raspberry group received is that the bottom GPIO mouth calls, then call I2C agreement and STM32 singlechip and carry out the communication according to the GPIO drive that raspberry group system provided, let the instruction that APP end transmitted come transmit the singlechip.

Preferably, before the APP request received by the http server on the raspberry farm is an underlying GPIO port call, the steps further include:

and judging whether the APP request received by the http server on the raspberry pi is timing task configuration or bottom-layer GPIO port call.

Further preferably, after determining whether the APP request received by the http server on the raspberry pi is a timing task configuration or a bottom-layer GPIO port call, the method further includes:

and when the APP request received by the http server on the raspberry pi is the timing task configuration, writing the configuration information into a file system.

In step S103, the STM32 single chip receives a message sent by the raspberry pi GPIO, where the message sent by the raspberry pi GPIO contains an address of the NRF24L01 module;

in the embodiment of the application, the STM32 single chip microcomputer receives the messages sent by the raspberry group GPIO, the messages sent by the raspberry group GPIO contain the address of the NRF24L01 module, the raspberry group does not need to contain the address of the single chip microcomputer, the address is solidified on the single chip microcomputer, and the address is taken out according to the equipment ID when the single chip microcomputer sends the messages.

Preferably, after the STM32 single chip microcomputer receives a message sent by the raspberry pi GPIO, the steps further include:

and the STM32 singlechip sends the message to the NRF24L01 module through the SPI protocol.

Further preferably, after the STM32 single chip sends the message to the NRF24L01 module through the SPI protocol, the steps further include:

the NRF24L01 module receives the message;

the NRF24L01 module sends the address and message information of the receiving end of the NRF24L 01;

the NRF24L01 receiver receives the message.

In step S104, it is determined whether the address received by the NRF24L01 sink from the NRF24L01 module coincides with the address of the NRF24L01 sink;

in the embodiment of the present application, it is determined whether the address received by the NRF24L01 receiving end from the NRF24L01 module is consistent with the address of the NRF24L01 receiving end, and addresses that do not belong to the NRF24L01 receiving end are filtered out.

In step S105, when the NRF24L01 receiving terminal receives the address from the NRF24L01 module and the address of the NRF24L01 receiving terminal are consistent, the NRF24L01 receiving terminal reads the message information to control the home appliance;

in this embodiment, when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal, the NRF24L01 receiving terminal reads the message information to control the home appliance.

Specifically, when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal, the NRF24L01 receiving terminal reads the message information to control the home appliance, and the steps include:

when the address received by the NRF24L01 receiving end from the NRF24L01 module is consistent with the address of the NRF24L01 receiving end, generating an STM32 singlechip interrupt signal;

after the STM32 single chip microcomputer is awakened, the STM32 single chip microcomputer reads message information from the NRF24L01 receiving end through the SPI protocol.

In step S106, when the NRF24L01 receiving end receives an address from the NRF24L01 module that is not consistent with the address of the NRF24L01 receiving end, the message is discarded.

In this embodiment, when the address received by the NRF24L01 receiving end from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving end, the packet is discarded, and the packet not belonging to the NRF24L01 receiving end is directly ignored.

Preferably, when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving terminal, after discarding the packet, the method further includes:

after the STM32 singlechip receives the message, the output of IO voltage is controlled, and the voltage is amplified by a triode or a field effect tube, so that the grid of the IGBT is controlled, and the power supply of the household appliance is controlled.

It will be understood by those skilled in the art that all or part of the steps in the method for implementing the above embodiments may be implemented by relevant hardware instructed by a program, and the program may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc.

Example two:

fig. 2 is a schematic structural diagram of a remote-controlled household appliance system according to a second embodiment of the present invention, and for convenience of description, only the parts related to the second embodiment of the present invention are shown, which are detailed as follows:

a first receiving unit 201, configured to receive an APP request from a mobile phone terminal by using an http server on a raspberry;

the communication unit 202 is used for calling an I2C protocol to communicate with the STM32 singlechip according to GPIO driving provided by the raspberry pi system when the APP request received by the http server on the raspberry pi is called by a bottom GPIO port;

the second receiving unit 203 is used for receiving the messages sent by the raspberry pi GPIO by the STM32 singlechip, wherein the messages sent by the raspberry pi GPIO contain the address of the NRF24L01 module;

a judging unit 204, configured to judge whether an address received by the NRF24L01 receiving end from the NRF24L01 module is consistent with an address of the NRF24L01 receiving end;

a reading unit 205, configured to, when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal, read the message information by the NRF24L01 receiving terminal to control the home appliance;

a discarding unit 206, configured to discard the packet when the address received by the NRF24L01 receiving end from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving end

In the embodiment of the application, an http server is dispatched to the raspberry to receive an APP request of a mobile phone terminal; when the APP request received by the http server on the raspberry pi is called by a bottom GPIO port, calling an I2C protocol to communicate with the STM32 singlechip according to GPIO drive provided by the raspberry pi system; the STM32 single chip microcomputer receives a message sent by the raspberry group GPIO, and the message sent by the raspberry group GPIO contains the address of the NRF24L01 module; judging whether the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal; when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is consistent with the address of the NRF24L01 receiving terminal, the NRF24L01 receiving terminal reads message information to control the household appliance; when the address received by the NRF24L01 receiving terminal from the NRF24L01 module is inconsistent with the address of the NRF24L01 receiving terminal, the message is discarded, a user can conveniently remotely control the household appliance, and the experience of the user in using the household appliance is improved; the detailed implementation of each unit can refer to the description of the first embodiment, and is not repeated herein.

Example three:

the implementation mode is as follows:

an APP application end is developed, various switches are arranged in the APP application end, for example, a main power switch, an air conditioner, a water heater, an ultraviolet lamp and the like are turned on, a periodic task configuration function is achieved, and the APP bottom layer calls services provided by a web server of a raspberry group through an http protocol.

And establishing nginx on raspberry pi hardware, wherein the nginx is mainly used for an http request forwarding function. And applying for penetrating a peanut shell domain name, penetrating the domain name to a port corresponding to the equipment, after the domain name port corresponding to the external request, forwarding the request to nginx by the peanut shell, and then forwarding the access to an internal http server by the nginx.

After receiving an APP request of a mobile phone end, an http server on the raspberry group judges whether a remote request is timing task configuration or bottom-layer GPIO port calling, if the remote request is GPIO calling, the HTTP server calls an I2C protocol through GPIO driving provided by the raspberry group system, and then communicates with an STM32 single chip microcomputer; if only the timer is configured, the configuration information is written to the file system.

The function of the timer is as follows: the device is mainly used for turning on or off household appliances or power supplies at regular time according to a specified time point; the principle is that the I2C pin of the GPIO is called by calling the drive of the raspberry pi, the drive is communicated with an STM32 single chip microcomputer, and then the IGBT is operated.

After receiving a message sent by a raspberry group GPIO (the message contains an address, a device ID and a switching signal of an NRF24L01 receiving end), the STM32 singlechip sends the message to an NRF24L01 module through an SPI protocol, and after receiving the message, the NRF24L01 module sends the address and message information together.

After receiving the message, the NRF24L01 at the receiving end judges whether the transmitted address is consistent with the address itself, if so, an STM32 single chip microcomputer interrupt signal is generated, and after waking up the STM32 single chip microcomputer, the single chip microcomputer reads message information from the NRF24L01 receiving end through an SPI protocol; and if the addresses are not consistent, discarding.

After receiving the message, STM32 controls the gate of IGBT through the voltage output of control IO mouth, then enlargies through triode or field effect transistor, through optoelectronic coupling to control the power with electrical apparatus.

By configuring the address of each receiving end, different household electrical appliances are operated through different addresses each time the mobile phone APP operates the remote control.

Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the embodiments described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation.

Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention. The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:图像显示方法、装置、电子设备以及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类