CN108694826A - A kind of infrared coding-decoding method - Google Patents

A kind of infrared coding-decoding method Download PDF

Info

Publication number
CN108694826A
CN108694826A CN201810686679.2A CN201810686679A CN108694826A CN 108694826 A CN108694826 A CN 108694826A CN 201810686679 A CN201810686679 A CN 201810686679A CN 108694826 A CN108694826 A CN 108694826A
Authority
CN
China
Prior art keywords
value
infrared
data
coding
pwm
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
Application number
CN201810686679.2A
Other languages
Chinese (zh)
Other versions
CN108694826B (en
Inventor
张亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
JIAKE ELECTRONICS CO Ltd ZHEJIANG
Original Assignee
JIAKE ELECTRONICS CO Ltd ZHEJIANG
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by JIAKE ELECTRONICS CO Ltd ZHEJIANG filed Critical JIAKE ELECTRONICS CO Ltd ZHEJIANG
Priority to CN201810686679.2A priority Critical patent/CN108694826B/en
Publication of CN108694826A publication Critical patent/CN108694826A/en
Application granted granted Critical
Publication of CN108694826B publication Critical patent/CN108694826B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G08SIGNALLING
    • G08CTRANSMISSION SYSTEMS FOR MEASURED VALUES, CONTROL OR SIMILAR SIGNALS
    • G08C23/00Non-electrical signal transmission systems, e.g. optical systems
    • G08C23/04Non-electrical signal transmission systems, e.g. optical systems using light waves, e.g. infrared

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Optical Communication System (AREA)

Abstract

The present invention relates to infrared communication technique field, specifically a kind of method of infrared data coding and decoding.This method carries out coding and decoding by finding characteristic value to the regular optimization of infrared data, by characteristic value, and this method is based on waveform coding, and compression ratio is high, has evaded specific agreement, it is not necessary to specifically parse data type, and decoding process is simple and efficient.

Description

A kind of infrared coding-decoding method
Technical field
The present invention relates to infrared communication technique field, encoding and decoding in specifically a kind of infrared data transmission control Method.
Background technology
The electric appliance and digital class science and technology product being equipped with advances in technology with the development of society, family are more and more no matter It is conventional television, air-conditioning, water heater, the DVD of digital class, projecting apparatus or smart television of today, box are equipped with one by one Corresponding conventional hand IR remote controller, a remote controler can only generally control a kind of equipment, poor compatibility, and user uses It is inconvenient.
Nowadays the universal maturation of Internet technology, the big heat of Internet of Things, before making smart home market that wide market be presented There are the various home intelligent infrared remote control terminals using controls such as mobile phones in scape, market, and number will be transmitted using mobile phone control According to, and especially Japanese brands air-conditioning is different from general television set remote control, original infrared data just has 1k multibytes, more There are the more data informations of 3k, very high want is proposed to transmission bandwidth if initial data encodes directly transmission without processing It asking, WIFI perhaps can be competent at, and in the smart home field of Internet of Things more using as the low bandwidth low-power consumption such as Zigbee Transport protocol just seems unable to do what one wishes.And although the infrared data of each electric appliance manufacturer is generally in accordance with PPM (RC-5 codes), PWM (NEC codes) agreement is in the majority, but is substantially and has carried out derivative extension on this basis, so to the infrared waves of specific manufacturer Shape is all different, can not directly apply mechanically existing agreement.Therefore, there is an urgent need for a kind of decoding method of infrared data, the party Infrared initial data can be carried out compression processing and be conducive to transmission by method, also will be to the infrared waveform of nearly all producer in the market It is applicable in.
Invention content
The problem to be solved in the present invention is to provide a kind of infrared coding-decoding method, and this method can be by infrared initial data It carries out compressed encoding and is conducive to transmission, be transferred to terminal device and be decoded transmitting or upload background devices decoding matching waveform.
Technical solution is used by the present invention solves the above problems:The infrared coding-decoding method, includes the following steps:
(1), original infrared data is obtained:Corresponding original pulsewidth Value Data is captured using infrared waveform analysis device;
(2), regular optimization processing:After original pwm value rounding, use first pwm value after rounding in data as Compare successively with each pwm value thereafter with value, as ratio 0.9~1.1 and electrical level polar unanimously if replace with matching Value, no person maintain initial value, until then regular optimization is completed for the first time after completing the last one pwm value relatively;Then with after regular Second pwm value of data is handled as matching value using identical method, is completed second of regularization, is so analogized, Until completing last regularization;
(3), number statistics and sequence:The number that various pulsewidths occur and sequence are counted in data after regular optimization, Find out the pwm value that occurrence number is more than 5 times;
(4), characteristic value is found out:In the pwm value that step (3) is selected characteristic value is found out with " approximate greatest common divisor " method T1;
(5), binary coding:The data optimized after will be regular in step (2) remove characteristic value T1, find out each pwm value Including characteristic value number, and indicated respectively with " 1 " of corresponding number, " 0 ", number uses round after being divided by, To the direct removal less than 0.5,1 byte is supplied with " 0 " to last less than 8;
(6), coding is completed:The coding that step (5) is completed is changed into corresponding system and takes characteristic value T1 and can provided It is used to application protocol;
(7), it decodes:After completing coding, relevant device is transferred to by Zigbee or wifi etc. and is decoded, basis is only needed The binary value of characteristic value T1 and data, you can completion parses original waveform.
Further, " approximate greatest common divisor " method in the step (4) carries out as follows:It finds out wherein minimum Pwm value t1 makees denominator and is divided by respectively with all values, using t1 as feature if times number interval is all in ± 20% range of integral multiple Value T1, and most infrared waveform all meets this feature, and to individual special waveforms, it goes beyond the scope, then will if any more than one T1/2 makees denominator and all values are divided by, using t1/2 as characteristic value T1 if times number interval is all in ± 20% range of integral multiple, If any more than one go beyond the scope then t1/4 directly as characteristic value T1.
Further, the infrared waveform analysis device in the step (1) includes infrared waveform analyzer etc..
Further, the step (2) further includes that second pwm value of regular rear data is direct if with front equivalence The step of next matching value, is selected in jump.
Compared with prior art, the present invention having the advantages that:Using minimum pulse width as characteristic value come to infrared Data carry out soft coding, eliminate the interference signals such as burr, compression is also achieved to the coding of overlength, such as Japanese class air-conditioning waveform Length some can reach 500ms, close compared to initial data with the method for the present invention coded data about 120Byte or so 3000Byte, compression ratio have reached 1:25;And this method is based on waveform coding, has evaded specific agreement, it is not necessary to specific solution It is guidance code, address code or function code etc. to analyse these data, and decoding process is simple and efficient.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with Obtain other attached drawings according to these attached drawings.
Fig. 1 is the infrared original waveform figure of the embodiment of the present invention.
Fig. 2 is the coding step flow chart of the embodiment of the present invention.
Specific implementation mode
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art The every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
Embodiment 1.
As shown in Fig. 1 to 2, a kind of infrared coding-decoding method in the embodiment of the present invention includes the following steps:
S1, original infrared data is obtained:Infrared original waveform and right is captured using equipment such as infrared waveform analyzers The original pulsewidth Value Data answered, " H " " L " before pwm value indicate high level and low level pulse respectively.
S2, regular optimization processing:After original pwm value rounding, use first pwm value after rounding in data as matching Value compares with each pwm value thereafter successively, as ratio 0.9~1.1 and electrical level polar unanimously if replace with matching value, No person maintains initial value, until the relatively rear optimization regular for the first time of the last one pwm value is completed;Then with the data after regular Second pwm value is directly jumped under choosing in selected matching value if the front matching value of used equivalence as matching value One matching value, is handled in the same way, is completed second of normalized, is so analogized, until completing last normalizing Change is handled, and as shown in S2 in Fig. 2, uses H4472 as matching value first, the first suboptimization, which gets off 3 to be worth, to be normalized to H4472, data after the completion of regular optimization are referring in Fig. 2 shown in S2 right frames.
S3, number statistics and sequence:The number that various pulsewidths occur and sequence are counted in data after regular optimization, are looked for Go out the pwm value that occurrence number is more than 5 times.
S4, characteristic value is found out:Characteristic value T1 is found out with " approximate greatest common divisor " method in the pwm value that step S3 is selected, " approximate greatest common divisor " method use following steps, find out wherein minimum pulse width value t1 make denominator respectively with all values phase It removes, using t1 as characteristic value T1 if times number interval is all in ± 20% range of integral multiple, most infrared waveform all meets This feature, and to individual special waveforms, it goes beyond the scope if any more than one, then t1/2 is made into denominator and all values are divided by, such as multiple Section all in ± 20% range of integral multiple then using t1/2 as characteristic value T1, it is direct if any the more than one then t1/4 that goes beyond the scope As characteristic value T1;Meet ± 20% range of integral multiple after being divided by such as minimum value t1=530 in the present embodiment and other 2, therefore T1=t1;To more special waveform, such as H600, L410, then characteristic value is used as by 205.
S5, binary coding:Data after will be regular in step S2 remove characteristic value T1, and finding out each pwm value includes Characteristic value number, and indicated respectively with " 1 " of corresponding number, " 0 ", number is (infrared using round after being divided by The long pwm value such as guidance code be divided by after there are decimal, round does not influence infrared property, and numeric data code should use Characteristic matching, error very little), to the direct removal less than 0.5, should be the interference signals such as some burrs, to last less than 8 1 byte is supplied with " 0 " in position (1 byte).
S6, coding is completed:The coding completed in step S5, which is changed into corresponding system, and takes characteristic value T1 to provide It is used to application protocol.
S7, decoding:After completing coding, relevant device is transferred to by Zigbee or wifi etc. and is decoded, basis is only needed The binary code value of characteristic value T1 and data, you can completion parses original waveform.Such as the present embodiment T1=530us, pass The defeated data to come are { 0xFF, 0x00,0xA2 ... ... }, and the corresponding binary systems of 0xFF are BIN:11111111, therefore first is High level and length are 530us*8=4240us, and second 0x00 is decoded as low level L4240, third 0xA2 (BIN: 10100010), Xie Mawei [H530,L530,H530,L1590,H530,L530]6 pwm values.First H4240 and original number It is H4240/H4472=95% according to similarity, each pwm value decoded back rate specifically participates in table 1.
Original waveform length of the embodiment of the present invention reaches nearly 140ms, real data 31Byte after being encoded with the method for the present invention, It (is calculated with 4 Byte of a pwm value) compared to initial data 328Byte, the present embodiment compression ratio is 1:11.This method is based on Waveform coding, to RC-5 codes, NEC codes or other special formats can all realize coding compression, and crushing rate is low, and decoding process is simply bright .
Original value H4472.1 L4486.7 L530.5 H568.2 L1620.9
Decoded back value H4240 L4240 L530 H530 L1590
Similarity 95% 94% 99% 93% 98%
Table 1:The pwm value reduction rate computational chart of the embodiment of the present invention
It should be pointed out that the detailed description carried out above to technical scheme of the present invention by preferred embodiment is schematical And not restrictive.Those skilled in the art can be to recorded in embodiment on the basis of reading description of the invention Technical solution modify or equivalent replacement of some of the technical features, and these modifications or replacements, not The essence of corresponding technical solution is set to be detached from the range of technical solution of the embodiment of the present invention.

Claims (4)

1. a kind of infrared coding-decoding method, which is characterized in that include the following steps:
(1), original infrared data is obtained:Corresponding original pulsewidth Value Data is captured using infrared waveform analysis device;
(2), regular optimization processing:After original pwm value rounding, use first pwm value after rounding in data as matching value Compare successively with each pwm value thereafter, as ratio 0.9~1.1 and electrical level polar unanimously if replace with matching value, it is no Person maintains initial value, until then regular optimization is completed for the first time after completing the last one pwm value relatively;Then with regular rear data Second pwm value as matching value using identical method handle, complete second of regularization, so analogize, until Complete last regularization;
(3), number statistics and sequence:The number that various pulsewidths occur and sequence are counted in data after regular optimization, are found out Occurrence number is more than 5 pwm values;
(4), characteristic value is found out:In the pwm value that step (3) is selected characteristic value T1 is found out with " approximate greatest common divisor " method;
(5), binary coding:The data optimized after will be regular in step (2) remove characteristic value T1, and finding out each pwm value includes Characteristic value number, and indicated respectively with " 1 " of corresponding number, " 0 ", number uses round after being divided by, to small In 0.5 direct removal, 1 byte is supplied with " 0 " to last less than 8;
(6), coding is completed:The coding that step (5) is completed is changed into corresponding system and takes characteristic value T1 and be provided to and is answered It is used with agreement;
(7), it decodes:After completing coding, relevant device is transferred to by Zigbee or wifi etc. and is decoded, it only need to be according to feature The binary value of value T1 and data, you can completion parses original waveform.
2. a kind of infrared coding-decoding method according to claim 1, which is characterized in that in the step (4) " approximate most Big common divisor " method carries out as follows:It finds out wherein minimum pulse width value t1 and makees denominator and be divided by respectively with all values, such as multiple area Between all in ± 20% range of integral multiple then using t1 as characteristic value T1, and most infrared waveform all meets this feature, and It to individual special waveforms, goes beyond the scope if any more than one, then t1/2 is made into denominator and all values are divided by, a such as times number interval all exists Then using t1/2 as characteristic value T1 in ± 20% range of integral multiple, if any more than one go beyond the scope then t1/4 directly as feature Value T1.
3. a kind of infrared coding-decoding method according to claim 1, which is characterized in that the infrared waves in the step (1) Conformal analysis equipment includes infrared waveform analyzer etc..
4. a kind of infrared coding-decoding method according to claim 1, which is characterized in that the step (2) further includes regular Second pwm value of data directly jumps the step of selecting next matching value if with front equivalence afterwards.
CN201810686679.2A 2018-06-28 2018-06-28 Infrared encoding and decoding method Active CN108694826B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810686679.2A CN108694826B (en) 2018-06-28 2018-06-28 Infrared encoding and decoding method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810686679.2A CN108694826B (en) 2018-06-28 2018-06-28 Infrared encoding and decoding method

Publications (2)

Publication Number Publication Date
CN108694826A true CN108694826A (en) 2018-10-23
CN108694826B CN108694826B (en) 2020-06-05

Family

ID=63851301

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810686679.2A Active CN108694826B (en) 2018-06-28 2018-06-28 Infrared encoding and decoding method

Country Status (1)

Country Link
CN (1) CN108694826B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111260910A (en) * 2020-02-24 2020-06-09 珠海荣邦智能科技有限公司 Control method, device and circuit of infrared transmitting tube
CN111817725A (en) * 2020-08-21 2020-10-23 济南赛英立德电子信息股份有限公司 High-efficiency compression algorithm for infrared remote control code library of universal air conditioner
CN112330948A (en) * 2021-01-04 2021-02-05 杭州涂鸦信息技术有限公司 Infrared remote control code matching method and device, computer equipment and readable storage medium
CN113850988A (en) * 2020-12-24 2021-12-28 广东朝歌智慧互联科技有限公司 Key value correction method, device, equipment and computer readable medium
CN114120466A (en) * 2021-11-22 2022-03-01 浙江嘉科电子有限公司 Coding and decoding device and method for polling information exchange

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100141472A1 (en) * 2008-12-09 2010-06-10 Mstar Semiconductor, Inc. Decoding Method and Apparatus for Infrared Remote Control Commands
CN105070035A (en) * 2015-08-25 2015-11-18 无锡力芯微电子股份有限公司 Real-time compression method and device for infrared remote control code stream
CN105306062A (en) * 2015-11-23 2016-02-03 青岛海信电器股份有限公司 Encoding and storing method and device for infrared data, and decoding method
CN105654707A (en) * 2016-01-22 2016-06-08 宁波三星医疗电气股份有限公司 Infrared code identification method
CN107564266A (en) * 2017-08-25 2018-01-09 广东美的制冷设备有限公司 A kind of remote controller codes learning method and remote control learning device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100141472A1 (en) * 2008-12-09 2010-06-10 Mstar Semiconductor, Inc. Decoding Method and Apparatus for Infrared Remote Control Commands
CN105070035A (en) * 2015-08-25 2015-11-18 无锡力芯微电子股份有限公司 Real-time compression method and device for infrared remote control code stream
CN105306062A (en) * 2015-11-23 2016-02-03 青岛海信电器股份有限公司 Encoding and storing method and device for infrared data, and decoding method
CN105654707A (en) * 2016-01-22 2016-06-08 宁波三星医疗电气股份有限公司 Infrared code identification method
CN107564266A (en) * 2017-08-25 2018-01-09 广东美的制冷设备有限公司 A kind of remote controller codes learning method and remote control learning device

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111260910A (en) * 2020-02-24 2020-06-09 珠海荣邦智能科技有限公司 Control method, device and circuit of infrared transmitting tube
CN111260910B (en) * 2020-02-24 2021-08-27 珠海荣邦智能科技有限公司 Control method, device and circuit of infrared transmitting tube
CN111817725A (en) * 2020-08-21 2020-10-23 济南赛英立德电子信息股份有限公司 High-efficiency compression algorithm for infrared remote control code library of universal air conditioner
CN113850988A (en) * 2020-12-24 2021-12-28 广东朝歌智慧互联科技有限公司 Key value correction method, device, equipment and computer readable medium
CN112330948A (en) * 2021-01-04 2021-02-05 杭州涂鸦信息技术有限公司 Infrared remote control code matching method and device, computer equipment and readable storage medium
US11984021B2 (en) 2021-01-04 2024-05-14 Hangzhou Tuya Information Technology Co., Ltd. Infrared remote control code matching method and apparatus, computer device, and readable storage medium
CN114120466A (en) * 2021-11-22 2022-03-01 浙江嘉科电子有限公司 Coding and decoding device and method for polling information exchange

Also Published As

Publication number Publication date
CN108694826B (en) 2020-06-05

Similar Documents

Publication Publication Date Title
CN108694826A (en) A kind of infrared coding-decoding method
RU2367087C2 (en) Coding information without loss with guaranteed maximum bit speed
CN103745590B (en) A kind of infrared remote coding method
CN104320669A (en) Video transmission method and apparatus
CN103931202A (en) Information processing device, information processing method, information provision device, and information provision system
CN113034886A (en) Remote control method and device
CN103559787A (en) Household appliance control method and terminal
CN105791527A (en) Method and device for transmitting contacts of mobile terminal
US9312920B2 (en) Wireless communication device and method for identifying the type of modulation among a plurality of modulation types in a near filed communication device
US7177288B2 (en) Simultaneous transmission and reception of signals in different frequency bands over a bus line
CN107564266B (en) Remote controller code learning method and remote controller learning device
CN105336152A (en) Infrared emitter and infrared remote control method
CN109002001A (en) Voice interaction management system and method
CN203368574U (en) Mobile communication device with voice and text output selection function
CN108448877A (en) A kind of communication means of Switching Power Supply and its secondary side to primary side
CN107026707B (en) Adaptive sampling rate channel coding and decoding method and device
CN110149631B (en) Method and system suitable for cloud loudspeaker box connection establishment
CN100417068C (en) Ethernet signal processor and Ethernet signal processing method
CN102082590B (en) Data transmission method
CN113132759A (en) Method, device, server, system and storage medium for determining video playing time delay
CN213302791U (en) Intelligent household appliance system with voice control function
CN103516775B (en) A kind of method and system realizing equipment room Fast synchronization
CN106817371A (en) Radio-frequency apparatus control method, terminal, radio frequency main frame and radio-frequency apparatus control system
CN113162628B (en) Data encoding method, data decoding method, terminal and storage medium
CN1301127A (en) Remote control receiver and control method

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