CN113660756A - ZigBee-based light control method and control system and intelligent home system - Google Patents
ZigBee-based light control method and control system and intelligent home system Download PDFInfo
- Publication number
- CN113660756A CN113660756A CN202110893611.3A CN202110893611A CN113660756A CN 113660756 A CN113660756 A CN 113660756A CN 202110893611 A CN202110893611 A CN 202110893611A CN 113660756 A CN113660756 A CN 113660756A
- Authority
- CN
- China
- Prior art keywords
- data
- frequency characteristic
- audio
- lamp
- frequency
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 41
- 230000008859 change Effects 0.000 claims abstract description 29
- 238000001228 spectrum Methods 0.000 claims description 23
- 230000006835 compression Effects 0.000 claims description 7
- 238000007906 compression Methods 0.000 claims description 7
- 238000004590 computer program Methods 0.000 claims description 6
- 230000003111 delayed effect Effects 0.000 claims description 5
- 238000007537 lampworking Methods 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 description 8
- 238000004891 communication Methods 0.000 description 7
- 230000005540 biological transmission Effects 0.000 description 3
- 238000003672 processing method Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 206010033799 Paralysis Diseases 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 210000003128 head Anatomy 0.000 description 1
- 238000005286 illumination Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 239000000779 smoke Substances 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H05—ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
- H05B—ELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
- H05B47/00—Circuit arrangements for operating light sources in general, i.e. where the type of light source is not relevant
- H05B47/10—Controlling the light source
- H05B47/105—Controlling the light source in response to determined parameters
- H05B47/115—Controlling the light source in response to determined parameters by determining the presence or movement of objects or living beings
- H05B47/12—Controlling the light source in response to determined parameters by determining the presence or movement of objects or living beings by detecting audible sound
-
- H—ELECTRICITY
- H05—ELECTRIC TECHNIQUES NOT OTHERWISE PROVIDED FOR
- H05B—ELECTRIC HEATING; ELECTRIC LIGHT SOURCES NOT OTHERWISE PROVIDED FOR; CIRCUIT ARRANGEMENTS FOR ELECTRIC LIGHT SOURCES, IN GENERAL
- H05B47/00—Circuit arrangements for operating light sources in general, i.e. where the type of light source is not relevant
- H05B47/10—Controlling the light source
- H05B47/175—Controlling the light source by remote control
- H05B47/19—Controlling the light source by remote control via wireless transmission
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02B—CLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO BUILDINGS, e.g. HOUSING, HOUSE APPLIANCES OR RELATED END-USER APPLICATIONS
- Y02B20/00—Energy efficient lighting technologies, e.g. halogen lamps or gas discharge lamps
- Y02B20/40—Control techniques providing energy savings, e.g. smart controller or presence detection
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Circuit Arrangement For Electric Light Sources In General (AREA)
Abstract
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.
Description
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. .
Claims (10)
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.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110893611.3A CN113660756B (en) | 2021-08-04 | 2021-08-04 | Light control method, control system and intelligent home system based on ZigBee |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110893611.3A CN113660756B (en) | 2021-08-04 | 2021-08-04 | Light control method, control system and intelligent home system based on ZigBee |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113660756A true CN113660756A (en) | 2021-11-16 |
CN113660756B CN113660756B (en) | 2024-07-30 |
Family
ID=78478393
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110893611.3A Active CN113660756B (en) | 2021-08-04 | 2021-08-04 | Light control method, control system and intelligent home system based on ZigBee |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113660756B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115913428A (en) * | 2022-11-03 | 2023-04-04 | 广州市保伦电子有限公司 | Closed system following user broadcasting |
CN118201163A (en) * | 2024-03-25 | 2024-06-14 | 东莞芯成电子科技有限公司 | Lamp control circuit and lamp |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110306309A1 (en) * | 2009-03-19 | 2011-12-15 | Fujitsu Limited | Receiving apparatus, transmitting apparatus, receiving method, transmitting method, communications system, and communication method |
CN103077684A (en) * | 2013-01-23 | 2013-05-01 | 京东方科技集团股份有限公司 | Backlight adjusting method, device and display screen |
CN104270513A (en) * | 2014-09-22 | 2015-01-07 | 广东欧珀移动通信有限公司 | Mobile terminal screen brightness adjusting method and device |
CN105681920A (en) * | 2015-12-30 | 2016-06-15 | 深圳市鹰硕音频科技有限公司 | Network teaching method and system with voice recognition function |
CN106331955A (en) * | 2016-10-26 | 2017-01-11 | 深圳市米尔声学科技发展有限公司 | Audio signal processing method, device and system, sending equipment and receiving equipment |
CN106376148A (en) * | 2015-07-22 | 2017-02-01 | 炬才微电子(深圳)有限公司 | Control method and system of audio light fixture, and audio light fixture |
CN107889323A (en) * | 2017-09-27 | 2018-04-06 | 杭州古北电子科技有限公司 | The control method and device that a kind of light is shown |
CN109067684A (en) * | 2018-07-03 | 2018-12-21 | 武汉工程大学 | A kind of low frequency 2FSK communication demodulation method, device and computer equipment |
CN109743717A (en) * | 2019-03-06 | 2019-05-10 | 深圳市飞比电子科技有限公司 | Data processing method, device, terminal device and storage medium |
US20190182932A1 (en) * | 2017-12-12 | 2019-06-13 | Michael Weibin Zhang | Musical beat detection system and method for lighting control |
CN110461077A (en) * | 2019-08-27 | 2019-11-15 | 合肥惠科金扬科技有限公司 | A kind of lamp light control method, Light Control Unit and readable storage medium storing program for executing |
CN111432537A (en) * | 2020-04-09 | 2020-07-17 | 安徽诺星信息科技有限公司 | Intelligent light management system |
-
2021
- 2021-08-04 CN CN202110893611.3A patent/CN113660756B/en active Active
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110306309A1 (en) * | 2009-03-19 | 2011-12-15 | Fujitsu Limited | Receiving apparatus, transmitting apparatus, receiving method, transmitting method, communications system, and communication method |
CN103077684A (en) * | 2013-01-23 | 2013-05-01 | 京东方科技集团股份有限公司 | Backlight adjusting method, device and display screen |
CN104270513A (en) * | 2014-09-22 | 2015-01-07 | 广东欧珀移动通信有限公司 | Mobile terminal screen brightness adjusting method and device |
CN106376148A (en) * | 2015-07-22 | 2017-02-01 | 炬才微电子(深圳)有限公司 | Control method and system of audio light fixture, and audio light fixture |
CN105681920A (en) * | 2015-12-30 | 2016-06-15 | 深圳市鹰硕音频科技有限公司 | Network teaching method and system with voice recognition function |
CN106331955A (en) * | 2016-10-26 | 2017-01-11 | 深圳市米尔声学科技发展有限公司 | Audio signal processing method, device and system, sending equipment and receiving equipment |
CN107889323A (en) * | 2017-09-27 | 2018-04-06 | 杭州古北电子科技有限公司 | The control method and device that a kind of light is shown |
US20190182932A1 (en) * | 2017-12-12 | 2019-06-13 | Michael Weibin Zhang | Musical beat detection system and method for lighting control |
CN109067684A (en) * | 2018-07-03 | 2018-12-21 | 武汉工程大学 | A kind of low frequency 2FSK communication demodulation method, device and computer equipment |
CN109743717A (en) * | 2019-03-06 | 2019-05-10 | 深圳市飞比电子科技有限公司 | Data processing method, device, terminal device and storage medium |
CN110461077A (en) * | 2019-08-27 | 2019-11-15 | 合肥惠科金扬科技有限公司 | A kind of lamp light control method, Light Control Unit and readable storage medium storing program for executing |
CN111432537A (en) * | 2020-04-09 | 2020-07-17 | 安徽诺星信息科技有限公司 | Intelligent light management system |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115913428A (en) * | 2022-11-03 | 2023-04-04 | 广州市保伦电子有限公司 | Closed system following user broadcasting |
CN115913428B (en) * | 2022-11-03 | 2024-02-13 | 广东保伦电子股份有限公司 | Closed system following user broadcasting |
CN118201163A (en) * | 2024-03-25 | 2024-06-14 | 东莞芯成电子科技有限公司 | Lamp control circuit and lamp |
Also Published As
Publication number | Publication date |
---|---|
CN113660756B (en) | 2024-07-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113660756B (en) | Light control method, control system and intelligent home system based on ZigBee | |
US20190394597A1 (en) | Multi-channel audio over a wireless network | |
CN110572481A (en) | intelligent electromechanical equipment data interaction method and system based on LoRa communication | |
US9081265B2 (en) | Decentralized intelligent nodal lighting system | |
KR20140127908A (en) | System and methods for differentiated association service provisioning in wifi networks | |
CN103518416B (en) | Wireless LAN traffic device and wireless LAN traffic method | |
CN1694559A (en) | Dynamic channel assignment in wireless local area networks | |
US20140328484A1 (en) | Method and device for synchronizing sound sources | |
CN113490315B (en) | Lighting device control method, lighting device control device and storage medium | |
CN110972120A (en) | Low-power-consumption Bluetooth device multilink management method, system and device | |
CN113677071A (en) | Lamp control method and device, electronic equipment and storage medium | |
CN110609534A (en) | Intelligent household control method and system | |
CN104704924B (en) | Apparatus and method for explaining the control command received | |
CN105828253A (en) | Wireless connection control method and device in audio playing system | |
WO2024036891A1 (en) | Message sending parameter setting method, electronic device, and storage medium | |
GB2496384A (en) | Placing some of the circuitry for sending and receiving data, in a wireless device, in a low power state and buffering data for a time period | |
CN104205986B (en) | Data routing method, the equipment for constituting network node and the system comprising the equipment | |
Parker et al. | The λMAC framework: redefining MAC protocols for wireless sensor networks | |
US10027592B1 (en) | System to facilitate data transfer in wireless networks | |
CN114466411A (en) | Wireless private networking communication method based on beacon classification | |
CN111356158A (en) | Communication method and system for smart home and communication base station | |
WO2023226923A1 (en) | Method for controlling plc device, and electronic device | |
WO2023226989A1 (en) | Node scheduling method and device based on plc, and plc system | |
CN115002866B (en) | Networking method and vital sign monitoring system | |
CN116782404B (en) | Data receiving method and device, base station and relay terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |