Summary of the invention
The technical problem that the present invention solves is, a kind of visible light communication method based on spread spectrum is provided, the method can obviously improve efficiency, the reduction transmission error rates of transmission of visible light, improve the reliability of visible light communication, the present invention also provides a kind of visible light communication system based on spread spectrum, this system configuration is simple, is easy to realize the fail safe that greatly improves visible light communication system.
The technical solution adopted for the present invention to solve the technical problems is, a kind of visible light communication method based on spread spectrum is provided, and comprises the following steps:
S 1. is sent to frequency multiplier by base band data, and frequency multiplier, by the spectrum width expansion of base band data, obtains the base band data after spread spectrum, and the PN code sequence of the base band data after spread spectrum and the generation of transmitting terminal PN code generator is sent to convolution coder jointly;
S2. the base band data after the spread spectrum in convolution coder and PN code sequence are carried out to logical operation, obtain the data after computing, the data after computing are sent to modulator and carry out signal modulation, the signal after being modulated;
S3. the signal after modulation is sent to visible light generator, visible light generator is sent to the visible ray receiver of receiving terminal by the signal after modulation with visible light signal form;
S4. visible ray receiver is converted into binary digital signal by the visible light signal receiving, and binary digital signal is sent to demodulator;
S5. demodulator is by after binary digital signal demodulation, and the PN code sequence producing with receiving terminal PN code generator is sent to convolution decoder jointly;
S6. the binary digital signal after demodulation and PN code sequence are carried out logical operation in convolution decoder, obtain the signal after computing, and the signal after computing is sent to despreader;
S7. despreader is the data despreading after computing in step S6, and the data after computing are carried out to Soft decision decoding, obtains the data identical with transmitting terminal base band data, and receiving terminal is correctly decoded.
Preferably, in step S2 and step S6, logical operation is identical logical operation.
Preferably, logical operation is XOR.
Preferably, logical operation is NOR-operation.
Preferably, logical operation is same exclusive disjunction.
Preferably, in step S3, visible light generator is LED.
Preferably, in step S4, visible ray receiver is photodiode.
Preferably, the PN code sequence that transmitting terminal PN code generator produces is identical with the PN code sequence that receiving terminal PN code generator produces.
The present invention also provides a kind of visible light communication system based on spread spectrum, comprises following part,
Transmitting terminal: base band data is sent to frequency multiplier, and frequency multiplier, by the spectrum width expansion of base band data, obtains the base band data after spread spectrum, and the PN code sequence of the base band data after spread spectrum and the generation of transmitting terminal PN code generator is sent to convolution coder jointly;
Base band data after spread spectrum in convolution coder and PN code sequence are carried out to logical operation, obtain the data after computing, data after computing are sent to modulator and carry out signal modulation, signal after being modulated, signal after modulation is sent to visible light generator, and visible light generator is sent to the visible ray receiver of receiving terminal by the signal after modulation with visible light signal form;
Receiving terminal: visible ray receiver is converted into binary digital signal by the visible light signal receiving, binary digital signal is sent to demodulator, demodulator is by after binary digital signal demodulation, and the PN code sequence producing with receiving terminal PN code generator is sent to convolution decoder jointly;
Binary digital signal after demodulation and PN code sequence are carried out logical operation in convolution decoder, obtain the signal after computing, signal after computing is sent to despreader, despreader is by the data despreading after computing, and the data after computing are carried out to Soft decision decoding, obtain the data identical with transmitting terminal base band data, receiving terminal is correctly decoded.
Preferably, base band data is sequence of binary digits.
Beneficial effect of the present invention is, a kind of visible light communication method based on spread spectrum is provided, the method is simple, strong operability, obviously improve efficiency, the reduction transmission error rates of transmission of visible light, and then improved the reliability of visible light communication, and the present invention also provides a kind of visible light communication system based on spread spectrum, and this system configuration is simple, be easy to realize the fail safe that has greatly improved visible light communication system.
Embodiment
Below in conjunction with drawings and the specific embodiments, the present invention will be further described.
Referring to Fig. 1, the present invention is based on the visible light communication method flow schematic diagram of spread spectrum, the invention provides a kind of visible light communication method based on spread spectrum, comprise the following steps:
S1. base band data is sent to frequency multiplier 101, frequency multiplier 101 is by the spectrum width expansion of base band data, obtain the base band data after spread spectrum, the PN code sequence of the base band data after spread spectrum and 102 generations of transmitting terminal PN code generator is sent to convolution coder 103 jointly;
S2. the base band data after the spread spectrum in convolution coder 103 and PN code sequence are carried out to logical operation, obtain the data after computing, the data after computing are sent to modulator 104 and carry out signal modulation, the signal after being modulated;
S3. the signal after modulation is sent to visible light generator 105, visible light generator 105 is sent to the visible ray receiver 201 of receiving terminal by the signal after modulation with visible light signal form;
S4. visible ray receiver 201 is converted into binary digital signal by the visible light signal receiving, and binary digital signal is sent to demodulator 202;
S5. demodulator 202 is by after binary digital signal demodulation, and the PN code sequence producing with receiving terminal PN code generator 204 is sent to convolution decoder 203 jointly;
S6. the binary digital signal after demodulation and PN code sequence are carried out logical operation in convolution decoder 203, obtain the signal after computing, and the signal after computing is sent to despreader 205;
S7. despreader 205 is the data despreading after computing in step S6, and the data after computing are carried out to Soft decision decoding, obtains the data identical with transmitting terminal base band data, and receiving terminal is correctly decoded.
Should be appreciated that, in step S2 and step S6, logical operation is the logical operation that algorithm is identical, this logical operation is XOR, NOR-operation, with exclusive disjunction etc.
In step S3, visible light generator is LED, launches the visible ray that comprises unlocking cipher by LED.
In step S4, visible ray receiver is photodiode, and photodiode is converted to binary code by visible ray information.
The PN code sequence that should be appreciated that the generation of transmitting terminal PN code generator is identical with the PN code sequence that receiving terminal PN code generator produces.
The present invention also provides a kind of visible light communication system based on spread spectrum, comprises following part,
Referring to Fig. 2, the present invention is based on the visible light communication system transmitting terminal schematic diagram of spread spectrum,
Transmitting terminal: base band data is sent to frequency multiplier 101, frequency multiplier 101 is by the spectrum width expansion of base band data, obtain the base band data after spread spectrum, the PN code sequence of the base band data after spread spectrum and 102 generations of transmitting terminal PN code generator is sent to convolution coder 103 jointly;
Base band data after spread spectrum in convolution coder 103 and PN code are carried out to logical operation, obtain the data after computing, data after computing are sent to modulator 104 and carry out signal modulation, signal after being modulated, signal after modulation is sent to visible light generator 105, and visible light generator 105 is sent to the visible ray receiver 201 of receiving terminal by the signal after modulation with visible light signal form;
Referring to Fig. 3, the present invention is based on the visible light communication system receiving terminal schematic diagram of spread spectrum,
Receiving terminal: visible ray receiver 201 is converted into binary digital signal by the visible light signal receiving, binary digital signal is sent to demodulator 202, demodulator 202 is by after binary digital signal demodulation, and the PN code sequence producing with receiving terminal PN code generator is sent to convolution decoder 203 jointly;
Binary digital signal after demodulation and PN code sequence are carried out logical operation in convolution decoder, obtain the signal after computing, signal after computing is sent to despreader 205, despreader 205 is by the data despreading after computing, and the data after computing are carried out to Soft decision decoding, obtain the data identical with transmitting terminal base band data, receiving terminal is correctly decoded.
Meanwhile, base band data is sequence of binary digits, can be the Serial No.s such as PN code, Turbo code, Walsh code, Barker code, can be also user-defined sequence of binary digits.
Referring to Fig. 4, spectrum spreading method schematic diagram of the present invention, with 4 times, spread to example, if spread spectrum front signal is 10100011, by each bit, split, obtaining 1,0,1,0,0,0,1,1, is 4 identical bits by above each bit expanded, obtains 11110000111100000000000011111111.Therefore by above-mentioned rule, by 10100011, undertaken after 4 times of spread spectrums, the signal obtaining is 11110000111100000000000011111111, and base band data of the present invention is all used said method spread spectrum, does not repeat them here.
Embodiment 1
If the PN code that the PN code that base band data is 1010, transmitting terminal PN code generator 102 produces and receiving terminal PN code generator 204 produce is 1100110110011001, spread spectrum multiple is 4 times, there are following steps:
S1. base band data 1010 is sent to frequency multiplier 101, frequency multiplier 101 is expanded base band data by 4 times of spectrum widths, the base band data after expansion is 1111000011110000, and the PN code sequence of the base band data after spread spectrum and 102 generations of transmitting terminal PN code generator is sent to convolution coder 103 jointly;
S2. the base band data after the spread spectrum in convolution coder 103 and PN code sequence are carried out to XOR:
Base band data after spread spectrum |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
PN code sequence |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
XOR result |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
0 |
0 |
1 |
Obtain the data 0011110101101001 after computing, the data after computing are sent to modulator 104 and carry out signal modulation, the signal after being modulated;
S3. the signal after modulation is sent to visible light generator 105, visible light generator 105 is sent to the visible ray receiver 201 of receiving terminal by the signal after modulation with visible light signal form;
S4. visible ray receiver 201 is converted into binary digital signal by the visible light signal receiving, and binary digital signal is sent to demodulator 202;
S5. demodulator 202 will export 0011110101101001 after binary digital signal demodulation, and the PN code sequence 1100110110011001 producing with receiving terminal PN code generator 204 is sent to convolution decoder 203 jointly;
S6. the binary digital signal after demodulation and PN code sequence 1100110110011001 are carried out XOR in convolution decoder 203:
Signal after demodulation |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
0 |
0 |
1 |
PN code sequence |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
XOR result |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
Obtain the signal 1111000011110000 after computing, identical with signal after spread spectrum in step S1, the signal after this computing is sent to despreader 205;
S7. despreader 205 is by the data despreading after computing in step S6, despreading multiple is 4 times, obtain 1111000011110000, by every 4 bits, it is one group, be divided into 1111000011110000, and these data are carried out to Soft decision decoding, and obtain the data 1010 identical with transmitting terminal base band data, receiving terminal is correctly decoded.
In visible light communication transmitting procedure, when the communication distance of transmitting terminal and receiving terminal increases to certain limit, the error rate can raise greatly, signal error rate in transmitting procedure is increased greatly, if receiving terminal is directly modulated and be sent to base band data, after receiving terminal modulation, be easy to receive wrong signal, reduce the fail safe of visible light communication.
The present invention is based on the method for the visible light communication of spread spectrum, in step S4, if signal makes a mistake in transmitting procedure, in step S5, demodulator 202 will export 1011110101101000 after binary digital signal demodulation, the PN code sequence 1100110110011001 producing with receiving terminal PN code generator 204 is sent to convolution decoder 203 jointly, and in step S6, the binary digital signal after demodulation and PN code sequence 1100110110011001 are carried out XOR in convolution decoder 203:
Bit error signal |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
1 |
0 |
1 |
1 |
0 |
1 |
0 |
0 |
0 |
PN code sequence |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
XOR result |
0 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
1 |
Obtaining the signal 0111000011110001 after computing, these data are sent to despreader, is one group by every 4 bits, is divided into 0111000011110001, and these data are carried out to Soft decision decoding, obtains 1010, and receiving terminal will reduce by base band data, is correctly decoded.
Therefore, utilize the method for the visible light communication the present invention is based on spread spectrum to communicate, even transmitting procedure generation error code, receiving terminal still can correct decoding, and spread spectrum multiple is higher, and transmission gain reliability, fail safe larger, that transmit is higher.
Embodiment 2
If the PN code that the PN code that base band data is 1010, transmitting terminal PN code generator 102 produces and receiving terminal PN code generator 204 produce is 1100110110011001, spread spectrum multiple is 4 times, there are following steps:
S1. base band data 1010 is sent to frequency multiplier 101, frequency multiplier 101 is expanded base band data by 4 times of spectrum widths, the base band data after expansion is 1111000011110000, and the PN code sequence of the base band data after spread spectrum and 102 generations of transmitting terminal PN code generator is sent to convolution coder 103 jointly;
S2. the base band data after the spread spectrum in convolution coder 103 and PN code sequence are carried out to NOR-operation:
Base band data after spread spectrum |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
PN code |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
NOR-operation result |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
Obtain the data 0000001000000110 after computing, the data after computing are sent to modulator 104 and carry out signal modulation, the signal after being modulated;
S3. the signal after modulation is sent to visible light generator 105, visible light generator 105 is sent to the visible ray receiver 201 of receiving terminal by the signal after modulation with visible light signal form;
S4. visible ray receiver 201 is converted into binary digital signal by the visible light signal receiving, and binary digital signal is sent to demodulator 202;
S5. demodulator 202 will export 0000001000000110 after binary digital signal demodulation, and the PN code sequence 1100110110011001 producing with receiving terminal PN code generator 204 is sent to convolution decoder 203 jointly;
S6. the binary digital signal after demodulation and PN code sequence 1100110110011001 are carried out NOR-operation in convolution decoder 203:
Signal after demodulation |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
PN code sequence |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
NOR-operation result |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
Obtain the signal 0011000001100000 after computing, the signal after this computing is sent to despreader 205;
S7. despreader 205 is by the data despreading after computing in step S6, despreading multiple is 4 times, obtain 0011000001100000, by every 4 bits, it is one group, be divided into 0011000001100000, and these data are carried out to Soft decision decoding, and obtain the data 1010 identical with transmitting terminal base band data, receiving terminal is correctly decoded.
Embodiment 3
If the PN code that the PN code that base band data is 1010, transmitting terminal PN code generator 102 produces and receiving terminal PN code generator 204 produce is 1100110110011001, spread spectrum multiple is 4 times, there are following steps:
S1. base band data 1010 is sent to frequency multiplier 101, frequency multiplier 101 is expanded base band data by 4 times of spectrum widths, the base band data after expansion is 1111000011110000, and the PN code sequence of the base band data after spread spectrum and 102 generations of transmitting terminal PN code generator is sent to convolution coder 103 jointly;
S2. the base band data after the spread spectrum in convolution coder 103 and PN code sequence are carried out to same exclusive disjunction:
Base band data after spread spectrum |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
PN code |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
With exclusive disjunction result |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
0 |
Obtain the data 1100001010010110 after computing, the data after computing are sent to modulator 104 and carry out signal modulation, the signal after being modulated;
S3. the signal after modulation is sent to visible light generator 105, visible light generator 105 is sent to the visible ray receiver 201 of receiving terminal by the signal after modulation with visible light signal form;
S4. visible ray receiver 201 is converted into binary digital signal by the visible light signal receiving, and binary digital signal is sent to demodulator 202;
S5. demodulator 202 will export 1100001010010110 after binary digital signal demodulation, and the PN code sequence 1100110110011001 producing with receiving terminal PN code generator 204 is sent to convolution decoder 203 jointly;
S6. the binary digital signal after demodulation and PN code sequence 1100110110011001 are carried out same exclusive disjunction in convolution decoder 203:
Signal after demodulation |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
0 |
PN code |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
With exclusive disjunction result |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
Obtain the signal 1111000011110000 after computing, the signal after this computing is sent to despreader 205;
S7. despreader 205 is by the data despreading after computing in step S6, despreading multiple is 4 times, obtain 1111000011110000, by every 4 bits, it is one group, be divided into 1,111 0,000 1,111 0000, and these data are carried out to Soft decision decoding, and obtain the data 1010 identical with transmitting terminal base band data, receiving terminal is correctly decoded.
Embodiment 4
If the PN code that the PN code that base band data is 1010, transmitting terminal PN code generator 102 produces and receiving terminal PN code generator 204 produce is 110011011001100111001100, spread spectrum multiple is 6 times, there are following steps:
S1. base band data 1010 is sent to frequency multiplier 101, frequency multiplier 101 is expanded base band data by 6 times of spectrum widths, the base band data after expansion is 111111000000111111000000, and the PN code sequence of the base band data after spread spectrum and 102 generations of transmitting terminal PN code generator is sent to convolution coder 103 jointly;
S2. the base band data after the spread spectrum in convolution coder 103 and PN code sequence are carried out to XOR:
Base band data after spread spectrum |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
PN code |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
XOR result |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
Obtain the data 001100011001011000001100 after computing, the data after computing are sent to modulator 104 and carry out signal modulation, the signal after being modulated;
S3. the signal after modulation is sent to visible light generator 105, visible light generator 105 is sent to the visible ray receiver 201 of receiving terminal by the signal after modulation with visible light signal form;
S4. visible ray receiver 201 is converted into binary digital signal by the visible light signal receiving, and binary digital signal is sent to demodulator 202;
S5. demodulator 202 will export 001100011001011000001100 after binary digital signal demodulation, and the PN code sequence 110011011001100111001100 producing with receiving terminal PN code generator 204 is sent to convolution decoder 203 jointly;
S6. the binary digital signal after demodulation and PN code sequence 110011011001100111001100 are carried out XOR in convolution decoder 203:
Signal after demodulation |
0 |
0 |
1 |
1 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
0 |
0 |
PN code |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
1 |
1 |
0 |
0 |
1 |
1 |
0 |
0 |
XOR result |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
1 |
1 |
1 |
0 |
0 |
0 |
0 |
0 |
0 |
Obtain the signal 111111000000111111000000 after computing, the signal after this computing is sent to despreader 205;
S7. despreader 205 is by the data despreading after computing in step S6, despreading multiple is 4 times, obtain 111111000000111111000000, by every 6 bits, it is one group, be divided into 111,111 000,000 111111000000, and these data are carried out to Soft decision decoding, and obtain the data 1010 identical with transmitting terminal base band data, receiving terminal is correctly decoded.
In sum, the invention provides a kind of visible light communication method based on spread spectrum, the method is simple, workable, can obviously improve the efficiency of transmission of visible light, the error rate in reduction transmitting procedure, the reliability that improves visible light communication, the present invention also provides a kind of visible light communication system based on spread spectrum, and this system configuration is simple, be easy to realize the fail safe that has greatly improved visible light communication system.
By reference to the accompanying drawings embodiments of the invention are described above; but the present invention is not limited to above-mentioned embodiment; above-mentioned embodiment is only schematic; rather than restrictive; those of ordinary skill in the art is under enlightenment of the present invention; not departing from the scope situation that aim of the present invention and claim protect, also can make a lot of forms, within these all belong to protection of the present invention.