ZigBee-based light control method and control system and intelligent home system

文档序号:1850200 发布日期:2021-11-16 浏览:33次 中文

阅读说明:本技术 一种基于ZigBee的灯光控制方法、控制系统、智能家居系统 (ZigBee-based light control method and control system and intelligent home system ) 是由 谢斌 刘伯通 于 2021-08-04 设计创作,主要内容包括:本申请涉及一种基于ZigBee的灯光控制方法、控制系统、智能家居系统;其中,一种基于ZigBee的灯光控制方法包括在播放音频的状态下,向灯具的控制器发送工作模式指令,所述工作模式指令用于控制相应的灯具进入与所述工作模式指令相匹配的工作模式;基于播放的所述音频得到若干频率特征值;采集第一预设时长的频率特征值,并将采集的频率特征值发送至数组列表;以及,将数组列表中的数据通过MAC层广播至灯具的控制器,使得灯具依据频率特征值产生亮度变化;所述数组列表中的数据包含频率特征值。本申请具有减少网络堵塞的可能性的效果。(The application relates to a ZigBee-based light control method, a ZigBee-based light control system and an intelligent home system; the ZigBee-based light control method comprises the steps of sending a working mode instruction to a controller of a lamp in an audio playing state, wherein the working mode instruction is used for controlling the corresponding lamp to enter a working mode matched with the working mode instruction; obtaining a plurality of frequency characteristic values based on the played audio; acquiring a frequency characteristic value of a first preset duration, and sending the acquired frequency characteristic value to an array list; broadcasting the data in the array list to a controller of the lamp through an MAC layer, so that the lamp generates brightness change according to the frequency characteristic value; the data in the array list includes frequency characteristic values. The present application has the effect of reducing the likelihood of network congestion.)

1. A light control method based on ZigBee is characterized by comprising the following steps:

sending a working mode instruction to a controller of a lamp in a state of playing audio, wherein the working mode instruction is used for controlling the corresponding lamp to enter a working mode matched with the working mode instruction;

obtaining a plurality of frequency characteristic values based on the played audio;

acquiring a frequency characteristic value of a first preset duration, and sending the acquired frequency characteristic value to an array list; and the number of the first and second groups,

broadcasting the data in the array list to a controller of the lamp through an MAC layer, so that the lamp generates brightness change according to the frequency characteristic value; the data in the array list includes frequency characteristic values.

2. A light control method based on ZigBee according to claim 1, wherein the frequency characteristic value obtaining method comprises:

in the first preset time length, according to a second preset time length as a calculated time length, every section of audio with the second preset time length is read, and the audio is converted into an audio frequency domain signal; the second preset time length is less than the first preset time length; and the number of the first and second groups,

and calculating to obtain a frequency characteristic value according to the obtained audio frequency domain signal.

3. The ZigBee-based light control method according to claim 2, wherein the read audio is delayed audio.

4. The ZigBee-based light control method according to claim 1, wherein: the control method further comprises the step of differentially compressing the data in the array list: the differential compression comprises:

s1061, receiving a frequency characteristic value, obtaining a corresponding audio amplitude from the frequency characteristic value, obtaining a brightness amplitude from the audio amplitude, and performing rounding processing on the brightness amplitude to obtain a rounded amplitude;

s1062, taking the rounding amplitude obtained at the first moment as a judgment value;

s1063, judging whether the difference value between the rounding amplitude value obtained at the next moment and the judgment value is within a preset difference value range, and if so, entering S1064; if not, entering S1065-1 and S1065-2;

s1064, judging the rounding amplitude and the judgment value of the next moment to be continuous brightness values, and entering S1063;

s1065-1, taking the rounding amplitude value obtained at the next moment as a judgment value, and entering S1063;

s1065-2, outputting the total times and the amplitude of the continuous brightness values, and arranging the total times and the amplitude to obtain a characteristic numerical value; and the number of the first and second groups,

and S1066, converting the characteristic numerical value into hexadecimal data and outputting the hexadecimal data.

5. A ZigBee-based light control method according to any one of claims 1-4, wherein: the working mode instruction comprises a spectrum broadcasting mode instruction, and the spectrum broadcasting mode instruction is used for controlling all lamps in the spectrum broadcasting mode to generate brightness change along with the frequency characteristic value.

6. A ZigBee-based light control method according to any one of claims 1-4, wherein: the working mode instructions comprise medium-high and low-frequency spectrum working mode instructions, and the medium-high and low-frequency spectrum modes are used for setting lamps working in a first frequency band, a second frequency band and a third frequency band; the medium-high and low frequency spectrum working mode instruction is used for judging the frequency section where the frequency characteristic value is located under the condition that the controller of the lamp receives data in the array list, and controlling the lamp working in the corresponding frequency section to generate brightness change along with the frequency characteristic value.

7. A light control system, comprising:

the mode sending module (201) is used for sending a working mode instruction to the lamp;

a data processing module (202) for obtaining a plurality of frequency characteristic values based on the played audio;

the data acquisition module (203) is used for acquiring a frequency characteristic value of a first preset duration and sending the acquired frequency characteristic value to the array list; and the number of the first and second groups,

and the data sending module (204) is used for sending the data in the array list to a controller of the lamp through the MAC layer, so that the lamp generates brightness change according to the frequency characteristic value.

8. A smart home system based on the light control system of claim 7, comprising the light control system and a lamp, wherein the lamp is capable of receiving data including characteristic frequency and generating brightness change according to the frequency characteristic value.

9. A computer device, characterized by: comprising a memory and a processor, the memory having stored thereon a computer program for a method according to any of claims 1-6, when loaded and executed by the processor.

10. A computer-readable storage medium, in which a computer program is stored which can be loaded by a processor and which executes the method according to any one of claims 1 to 6.

Technical Field

The application relates to the field of smart home, in particular to a light control method, a light control system and a smart home system based on ZigBee.

Background

The intelligent home is characterized in that a home is used as a platform, facilities related to home life are integrated by utilizing technologies such as a comprehensive wiring technology, a network communication technology, a safety precaution technology, an automatic control technology, an audio and video technology and the like, and an efficient management system for home facilities and family schedule affairs is constructed, so that the home safety, convenience, comfortableness and artistry are improved.

ZigBee is one of the very important technologies in wireless communication technology, and has the advantages of low power consumption, low equipment cost, large networking quantity and the like, so that the ZigBee is widely applied to intelligent homes. ZCL (ZigBee Cluster library) is an important part in the ZigBee protocol.

In the related art, a controller of the lamp communicates with a gateway through a ZigBee network, when audio is played, the frequency of the audio is extracted, the frequency of the audio is sent to the controller of the lamp through a ZCL layer, and the controller controls the lamp to generate brightness change along with the frequency of the audio.

With respect to the related art in the above, the inventors found that: when the control lamp in the related art generates brightness change along with the frequency of audio, the problem of network blockage is easy to occur.

Disclosure of Invention

In order to reduce the possibility of network congestion, the application provides a light control method based on ZigBee.

The light control method based on ZigBee adopts the following technical scheme.

A light control method based on ZigBee comprises the following steps:

sending a working mode instruction to a controller of a lamp in a state of playing audio, wherein the working mode instruction is used for controlling the corresponding lamp to enter a working mode matched with the working mode instruction;

obtaining a plurality of frequency characteristic values based on the played audio;

acquiring a frequency characteristic value of a first preset duration, and sending the acquired frequency characteristic value to an array list; and the number of the first and second groups,

broadcasting the data in the array list to a controller of the lamp through an MAC layer, so that the lamp generates brightness change according to the frequency characteristic value; the data in the array list includes frequency characteristic values.

By adopting the technical scheme, the MAC layer is used for transmitting and receiving data, compared with the ZCL layer for transmitting and receiving data, the load in each data frame can occupy more bytes, and the number of the data frames which need to be transmitted and received is reduced for the data with the same transmitted information amount, so that the possibility of collision or collision between the transmitted data frames and the data frames transmitted by other intelligent equipment is reduced, and the possibility of network paralysis is further reduced.

Optionally, the method for obtaining the frequency characteristic value includes:

in the first preset time length, according to a second preset time length as a calculated time length, every section of audio with the second preset time length is read, and the audio is converted into an audio frequency domain signal; the second preset time length is less than the first preset time length; and the number of the first and second groups,

and calculating to obtain a frequency characteristic value according to the obtained audio frequency domain signal.

By adopting the technical scheme, the played audio is read according to the second preset time length, the audio frequency domain signal is obtained by an analog-to-digital processing method, and the frequency characteristic value is obtained through the audio frequency domain signal.

Optionally, the read audio is delayed audio.

By adopting the technical scheme, due to the fact that time delay exists when the ZigBee is used for communication between the gateway and the controller of the lamp, brightness change of the lamp is easily inconsistent with audio change, the read audio is the audio after the time delay, the time delay of communication can be offset, and therefore the brightness change of the lamp is more consistent with the audio change.

Optionally, the control method further includes:

the control method further comprises the step of differentially compressing the data in the array list: the differential compression comprises:

s1071, receiving the frequency characteristic value, obtaining a corresponding audio amplitude from the frequency characteristic value, obtaining a brightness amplitude from the audio amplitude, and carrying out rounding processing on the brightness amplitude to obtain a rounded amplitude;

s1072, taking the rounding amplitude value obtained at the first moment as a judgment value;

s1073, judging whether the difference value between the rounding amplitude value obtained at the next moment and the judgment value is within a preset difference value range, and if so, entering S1074; if not, entering S1075-1 and S1075-2;

s1074, judging the rounding amplitude and the judgment value of the next moment to be continuous brightness values, and entering S1073;

s1075-1, taking the rounding amplitude value obtained at the next moment as a judgment value, and entering S1073;

s1075-2, outputting the total times and the amplitude of the continuous brightness values, and arranging the total times and the amplitude to obtain a characteristic numerical value; and the number of the first and second groups,

and S1076, converting the characteristic numerical value into hexadecimal data and outputting the hexadecimal data.

By adopting the technical scheme, the data in the array list is compressed differentially, so that the data volume can be further reduced, and the data transmission rate and the data processing efficiency can be improved.

Optionally, the operating mode instruction includes a spectrum broadcasting mode instruction, and the spectrum broadcasting mode instruction is used to control all the lamps in the spectrum broadcasting mode to generate brightness change along with the frequency characteristic value.

Optionally, the working mode instruction includes a middle-high and low-frequency spectrum working mode instruction, and the middle-high and low-frequency spectrum mode is used for setting lamps working in a first frequency band, a second frequency band and a third frequency band; the medium-high and low frequency spectrum working mode instruction is used for judging the frequency section where the frequency characteristic value is located under the condition that the controller of the lamp receives data in the array list, and controlling the lamp working in the corresponding frequency section to generate brightness change along with the frequency characteristic value.

In a second aspect, the present application provides a light control system comprising:

the mode sending module is used for sending a working mode instruction to the lamp;

the data processing module is used for obtaining a plurality of frequency characteristic values based on the played audio;

the data acquisition module is used for acquiring a frequency characteristic value of a first preset duration and sending the acquired frequency characteristic value to the array list; and the number of the first and second groups,

and the data sending module is used for sending the data in the array list to a controller of the lamp through the MAC layer so that the lamp generates brightness change according to the frequency characteristic value.

In a third aspect, the application provides an intelligent home system, which is based on the light control system, and comprises a light control system and a lamp, wherein the lamp can receive data containing characteristic frequency and generate brightness change according to a frequency characteristic value.

In a fourth aspect, the present application provides a computer device comprising a memory and a processor, the memory having stored thereon a computer program of any of the above methods loaded and executed by the processor.

In a fifth aspect, the present application provides a computer readable storage medium storing a computer program that can be loaded by a processor and executed to perform any of the methods described above.

Drawings

Fig. 1 is a schematic diagram of an exemplary system architecture to which a ZigBee-based light control method of the present application is applied.

Fig. 2 is a flowchart of a ZigBee-based light control method according to an embodiment of the present application.

FIG. 3 is a flow chart of one embodiment of differential compression in the present application.

Fig. 4 is a block diagram of a light control system according to an embodiment of the present disclosure.

Description of reference numerals: 201. a mode transmitting module; 202. a data processing module; 203. a data acquisition module; 204. and a data sending module.

Detailed Description

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

Referring to fig. 1, fig. 1 shows an exemplary system architecture to which the ZigBee-based light control method of the present application may be applied, and the system architecture may include a smart home device, a gateway, a cloud, and a terminal device. It should be understood that the numbers of terminal devices, gateways, smart home devices in fig. 1 are merely illustrative; according to actual needs, any number of terminal devices, gateways and intelligent household equipment can be selected.

The intelligent household equipment can comprise products such as lamps, smoke concentration sensors, air purifiers, audio-video players and the like.

The terminal device may be hardware or software. When the terminal device is hardware, it may be various electronic devices with communication function, including but not limited to smart phones, tablets, and notebook computers. When the terminal device is software, the terminal device can be installed in the electronic devices listed above.

The gateway is used for realizing the functions of information acquisition, information input, information output, centralized control, remote control, linkage control and the like, can be controlled by terminal equipment or remote control equipment, and can also be directly controlled by a user in a human-computer interaction (voice identification, gesture action recognition and image recognition) mode.

The terminal device, the gateway and the intelligent home device communicate through the network, wherein the communication can be that the terminal device communicates with the gateway, the gateway communicates with the intelligent home device, the terminal device directly communicates with the intelligent home device, and the terminal device communicates with the gateway through the cloud. The network may be various media providing a communication link, and may include bluetooth, WIFI, cellular, ZigBee, ethernet, etc.

The ZigBee has the advantages of low power consumption, low equipment cost and the like, and is widely applied to intelligent homes. ZCL is an important part of the ZigBee protocol. In an application scenario of an intelligent home in the related art, a controller of a lamp communicates with a gateway through a ZigBee network, when audio is played, the frequency of the audio is extracted, the frequency of the audio is sent to the controller of the lamp through a ZCL layer, and the controller controls the lamp to generate brightness change along with the frequency of the audio. However, when the brightness of the lamp changes along with the frequency of the audio in the application scene of the smart home in the related art, the problem of network congestion is easily caused.

In order to reduce the possibility of network congestion, the embodiment of the application discloses a light control method based on ZigBee.

Referring to fig. 2, as an embodiment of a ZigBee-based light control method, a ZigBee-based light control method includes the steps of:

and S101, sending a working mode instruction to a controller of the lamp in the audio playing state, wherein the working mode instruction is used for controlling the corresponding lamp to enter a working mode matched with the working mode instruction.

Specifically, the audio can be played by a terminal device, a gateway, or a video device in an intelligent home. The audio can be downloaded from the cloud or obtained by directly reading a local memory. When the audio is played by the terminal equipment or the audio and video equipment, the audio can be sent to the gateway. And under the state of playing the audio, the gateway sends a working mode instruction to the controller of the lamp in the form of a ZCL command, and the controller of the lamp controls the corresponding lamp to enter a working mode matched with the working mode instruction. The terminal equipment or the remote control equipment can send corresponding instructions to the gateway and then the gateway sends working mode instructions to the controller of the lamp; or the user sends a corresponding instruction to the gateway in a man-machine interaction mode and then sends a working mode instruction to the controller of the lamp through the gateway.

And S102, in the first preset time period, according to the second preset time period as the calculated time period, every section of audio with the second preset time period is read, and the audio is converted into an audio frequency domain signal.

Specifically, the audio may be read by the terminal device or may be read by the gateway. Because the light flicker is inconvenient to see by human eyes when the time exceeds 60fps, the second preset time length can be 16.67ms or other time lengths, and only the human eyes can observe the flicker of the lamp without feeling obvious blockage. The audio frequency domain signal can be obtained by processing the read audio frequency through DFT (discrete fourier transform) or FFT (fast fourier transform) or the like.

And step S103, calculating to obtain a frequency characteristic value according to the obtained audio frequency domain signal.

Specifically, after the audio frequency domain signal is obtained, the audio frequency domain signal may be subjected to certain processing, for example, the maximum and minimum frequency portions of the audio frequency domain signal are removed, and then the frequencies of the remaining audio frequency domain signals are added to obtain an average value to obtain a frequency characteristic value; or reserving audio frequency domain signals of a preset frequency band, wherein the preset frequency band can be 100HZ-15000HZ, and then adding the reserved audio frequency domain signals to obtain a frequency characteristic value by averaging; the median or mode of the reserved audio frequency domain signal may also be used as the frequency characteristic value, and of course, the frequency characteristic value may also be obtained by other data error processing methods and data processing methods.

And S104, collecting a frequency characteristic value of a first preset duration, and sending the collected frequency characteristic value to an array list.

Specifically, the first preset time is longer than the second preset time, and the first preset time may be 1S, or may be other times; the number of the collected frequency characteristic values can be changed by changing the first preset time length, and the array list stores the frequency characteristic values according to the collection sequence.

Step S105, broadcasting the data in the array list to a controller of the lamp through the MAC layer, so that the lamp generates brightness change according to the frequency characteristic value.

Specifically, the data in the array list can be directly sent to the gateway by the terminal device and then broadcasted to the controller of the lamp through the MAC layer by the gateway; the terminal device sends the processed data to the cloud end and then to the gateway, and the gateway sends the data to the controller of the lamp; or the data in the array list obtained by the gateway through processing can be broadcasted to the controller of the lamp through the MAC layer, and the controller controls the lamp to generate brightness change according to the frequency characteristic value.

Each data frame consists of a frame head, a load and a frame tail. When the data is received and sent through the ZCL layer, the frame header occupies 48 bytes in each data frame, and when the gateway and the lamp send the data through the ZCL layer, the occupation ratio of the frame header in the whole data frame is high.

If data is transmitted and received through the MAC layer, the header of each data frame only occupies 10 bytes, so that the duty ratio of the load in each data frame is improved. Compared with data transceiving through a ZCL layer, data transceiving through an MAC layer can occupy more bytes, the number of data frames needing to be transceived is reduced for data with the same information sending quantity, and the frequency of transmitting the data frames is reduced in the same time, so that the possibility of collision or collision between the transmitted data frames and data frames transmitted by other intelligent devices is reduced. The physical layer of the IEEE 802.15.4 protocol provides the capability of CCA (Clear Channel Assessment) in the collision avoidance mechanism, i.e., if it is found that there is data to be transmitted, it randomly avoids for a period of time and retries to transmit new data again; ZigBee is based on an IEEE 802.15.4 protocol, ZigBee has the same specific CCA capability, and if the frequency of data transmitted to a controller of a lamp by a gateway through ZigBee is too high, other intelligent household devices cannot transmit data for a long time. According to the method and the device, the possibility of collision or collision between the sent data frame and the data frame sent by other intelligent equipment is reduced, and further when the lamp changes in brightness along with the frequency of the audio, the other intelligent household equipment can normally receive and send data.

The Zigbee alliance sets an NWK Broadcast Delivery Time, which is used to limit the maximum valid Time of a data frame, and places the data frame in a table within the maximum valid Time. When data is continuously transmitted, when the table is full, a new data frame cannot be transmitted, and new data can be transmitted only after the original data is expired. Therefore, ZigBee limits the number of broadcasts, for example, the number of broadcasts is limited to 8 times in 9S at most. When the data frame is broadcasted to the controller of the lamp through the MAC layer, the data is not limited by the NWK Broadcast Delivery Time without passing through the network layer (NWK) and the application layer (APL), and thus is not limited by the Broadcast.

Meanwhile, the Zigbee protocol stack specifies that broadcast data is not suitable for continuous transmission. After the broadcast data is sent out, other nodes with the broadcast capability can forward the data after receiving the data, and therefore the data can be transmitted layer by layer backwards to ensure that the whole network can receive the data. Meanwhile, when any node transmits or forwards the data, it monitors whether its neighboring node forwards the data, and if the data is not forwarded, it indicates that the neighboring node may not receive the data, and retransmits the data. Therefore, when the data frame is broadcasted to the controller of the lamp through the ZCL layer, the data frame is waiting for acknowledgement and retransmission, so that the data volume of the network is increased, and the network is likely to break down due to too large data volume, so that other smart home devices cannot be used. When the data frame is broadcasted to the controller of the lamp through the MAC layer, the data frame does not wait for response and retransmission, and the data volume of the network is reduced.

As another embodiment of the ZigBee-based light control method, a ZigBee-based light control method further includes:

and S106, performing differential compression on the data in the array list to obtain compressed data, wherein the compressed data comprises a frequency characteristic value.

Referring to fig. 3, differential compression includes the steps of:

s1061, receiving the frequency characteristic value, obtaining a corresponding audio amplitude from the frequency characteristic value, obtaining a brightness amplitude from the audio amplitude, and performing rounding processing on the brightness amplitude to obtain a rounded amplitude;

s1062, taking the rounding amplitude obtained at the first moment as a judgment value;

s1063, judging whether the difference value between the rounding amplitude value obtained at the next moment and the judgment value is within a preset difference value range, and if so, entering S1064; if not, entering S1065-1 and S1065-2;

s1064, judging the rounding amplitude and the judgment value of the next moment to be continuous brightness values, and entering S1063;

s1065-1, taking the rounding amplitude value obtained at the next moment as a judgment value, and entering S1063;

s1065-2, outputting the total times and the amplitude of the continuous brightness values, and arranging the total times and the amplitude to obtain a characteristic numerical value; and the number of the first and second groups,

and S1066, converting the characteristic numerical value into hexadecimal data and outputting the hexadecimal data.

The following examples are given.

TABLE 1 schematic table for obtaining rounded amplitude values from frequency eigenvalues

Referring to Table 1, after obtaining the frequency characteristic 2980Hz, the audio amplitude is obtained from the frequency characteristic, and the audio amplitude is calculated as audio amplitude = frequency characteristic/(15000- > 100), where 15000 and 100 correspond to the predetermined frequency band (100 Hz-15000 Hz) in step S104, and the audio amplitude 20 is obtained, in other embodiments, the audio amplitude can be obtained through HSV color space model and/or H-step SL color space model. Then, the brightness amplitude is obtained from the audio amplitude, and the calculation formula of the brightness amplitude can be as follows: luminance amplitude = audio amplitude (63/100), resulting in a luminance amplitude of 12.6, since 1 byte =8 bits, the last 6 bits of the byte are used to characterize the luminance, so that the maximum value of the value characterizing the luminance is 63.

And then rounding the luminance amplitude to obtain a rounded amplitude, in this embodiment, rounding up is used to obtain a rounded amplitude 13, and in other embodiments, rounding down may be used to obtain the rounded amplitude. Thereafter, the frequency characteristic value 3427HZ transmitted at the next moment is received, so that the rounded amplitude value 14 at the next moment is obtained. In this embodiment, the preset difference is ± 3, and the difference between the determination value 13 and the rounding amplitude 14 at the next moment is within the preset difference range, so as to determine that the rounding amplitude 14 at the next moment and the determination value 13 are continuously read values, thereby continuing to execute step S1063. When the received frequency characteristic value of the next moment is 4470HZ, the obtained rounded amplitude value is 19, the difference value between the rounded amplitude value 19 and the judgment value 13 is not within the range of the preset difference value, the total times and the amplitude value of continuous brightness values are output at the moment, the amplitude value adopts the judgment value, the total times and the amplitude value are arranged to obtain a characteristic value so as to obtain data 313, wherein the first 3 represents the occurrence of 4 times, the amplitude value 13 represents the amplitude value, the 313 is converted into hexadecimal data 0xCD, and the 0xCD is output.

Thereafter, the rounded amplitude value 19 is used as a determination value, step S1063 is continuously performed to obtain hexadecimal data 0x13 and 0x73, and the original 7 bytes of data can be compressed into 3 bytes of data through differential compression, so that the data amount can be reduced, and the data transmission and processing efficiency can be improved.

As another embodiment of the ZigBee-based light control method, a ZigBee-based light control method further includes:

the read audio is delayed audio.

Specifically, because there is a certain delay when the controller of the gateway and the lamp is communicated through the ZigBee, when the gateway or the terminal device or the audio-visual device plays audio, the gateway reads the delayed audio through another thread, and the time length of the delay can be 1S. For example, the audio plays to 00: 35, the read audio is 00:36 audio, data containing frequency characteristic values are obtained through the audio, and when the data are sent to a controller of the lamp through ZigBee, 1S of time delay is used for offsetting 1S of network time delay, so that the brightness change and the audio frequency change of the lamp are more real-time.

As another embodiment of the ZigBee-based light control method, the operating mode instruction includes a spectrum broadcasting mode instruction, and the spectrum broadcasting mode instruction is used to control all the luminaires in the spectrum broadcasting mode to generate brightness change along with the frequency characteristic value.

The above method is further described below with reference to specific scenarios:

the spectrum broadcasting mode is to control all the lamps in the mode to generate brightness change along with the frequency of the audio. Taking the example of playing audio by the gateway, the lamp can be used for common household illumination under normal conditions. When the gateway executes the spectrum broadcasting mode, the gateway issues a ZCL command to inform the lamps in the scene to enter the spectrum broadcasting mode. When the gateway plays audio, the audio is played at a normal speed, meanwhile, the gateway reads the audio delayed by 1S every 16.67ms through another thread, frequency domain signals of the audio are calculated through FFT after the audio is read out, amplitudes of 100HZ-15000HZ in the frequency domain signals are added to obtain a frequency characteristic value, the obtained frequency characteristic value is stored in an array list, after the array list collects data of 1S, data in one second are compressed differently to obtain data smaller than 50 Byte, then the data are sent to a controller of a lamp through MAC layer broadcasting, and the lamp in the mode generates brightness change along with the frequency of the audio.

As another embodiment of the light control method based on ZigBee, the operating mode instruction includes a middle-high and low-frequency spectrum operating mode instruction, and the middle-high and low-frequency spectrum mode is used for setting the lamps operating in the first frequency band, the second frequency band, and the third frequency band; the medium-high and low frequency spectrum working mode instruction is used for judging the frequency section where the frequency characteristic value is located and controlling the lamp working in the corresponding frequency section to generate brightness change along with the frequency characteristic value under the condition that the controller of the lamp receives data in the array list.

The above method is further described below with reference to specific scenarios:

when the gateway executes the cinema mode scene, the gateway issues a ZCL command to inform the high-low frequency spectrum mode of the lamps in the scene. In the middle and low frequency spectrum mode, the lamps can be set to operate in that frequency band, the first frequency band can be set to be 100HZ to 5000HZ, the second frequency band is 5000HZ to 10000HZ, and the third frequency band is 10000HZ to 15000HZ, for example, 30 lamps in total can be set, 10 lamps can be set to operate in the first frequency band, 10 lamps operate in the second frequency band, and 10 lamps operate in the third frequency band. Taking the example of playing audio by the gateway, when the gateway plays audio, the audio is played at a normal speed when the gateway plays audio, meanwhile, the gateway reads the audio after the time delay of 1S every 16.67ms through another thread, calculates a frequency domain signal of the audio through FFT after reading the audio, adds the amplitudes of 100HZ-15000HZ in the frequency domain signal to obtain a frequency characteristic value, stores the obtained frequency characteristic value into the array list, performs differential compression on data in one second after the data of 1S is collected by the array list to obtain data of less than 50 Byte, and then broadcasts the data to the lamps in the mode through the MAC layer. The controller of the lamp receives the data and then judges which frequency band the data belongs to, if the received data is located in the working frequency band of the controller, brightness change is generated according to the received data, namely only 10 lamps in 30 lamps are lighted at each moment.

Referring to fig. 4, based on the light control method, the application discloses a light control system, including:

a mode sending module 201, configured to send a working mode instruction to a lamp;

the data processing module 202 is used for obtaining a plurality of frequency characteristic values based on the played audio;

the data acquisition module 203 is used for acquiring a frequency characteristic value of a first preset duration and sending the acquired frequency characteristic value to the array list; and the number of the first and second groups,

the data sending module 204 sends the data in the array list to the controller of the lamp through the MAC layer, so that the lamp generates a brightness change according to the frequency characteristic value.

The application also provides an intelligent home system, which comprises the lamplight control system and the lamp, wherein the lamp can receive data containing characteristic frequency and generate brightness change according to the frequency characteristic value.

The embodiment of the application also discloses computer equipment.

Specifically, the device comprises a memory and a processor, wherein the memory stores a computer program which can be loaded by the processor and executes any one of the ZigBee-based light control methods.

The embodiment of the application also discloses a computer readable storage medium.

Specifically, the computer readable storage medium stores a computer program that can be loaded by a processor and executes any one of the ZigBee-based light control methods as described above, and includes, for example: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.

The foregoing is a preferred embodiment of the present application and is not intended to limit the scope of the application in any way, and any features disclosed in this specification (including the abstract and drawings) may be replaced by alternative features serving equivalent or similar purposes, unless expressly stated otherwise. That is, unless expressly stated otherwise, each feature is only an example of a generic series of equivalent or similar features. .

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于人群活动大数据的社区照明系统及方法

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!