A kind of intelligent electric meter and its data encryption and transmission methodTechnical field
The present invention relates to electric-power metering fields, more particularly, to a kind of intelligent electric meter and its data encryption and transmission method.
Background technique
In electric instrument industry, traditional motor meter is eliminated by electronic electricity meter.Electronic instrument currently on the marketTechnology maturation, precision are high, good reliability, can telecommunication, be widely used space, with the need of power industry and marketIt asks, instrument just develops towards intelligent, high-precision, multi-functional, radio meter register direction.Since electronic instrument exists in all fieldsPlurality of advantages, especially can telecommunication, can be realized electric power monitoring centralization, therefore electronic instrument substitution heritage is answeredFormula instrument is inexorable trend.
Now with electronic instrument be usually directly to upload data in the form of plaintext, safe coefficient is not high enough, depositsIn the risk that data are trapped, distort.
Summary of the invention
The present invention is mainly to solve the technology that intelligence degree is not high enough, safety is weaker present in the prior art to askTopic provides the intelligent electric meter and its data encryption and transmission method of a kind of precision height, good reliability, high safety.
What the present invention was mainly addressed by following technical proposals in view of the above technical problems: a kind of intelligent electric meter,Including MCU module, display module, key module, communication module, current acquisition module, voltage acquisition module, electric-power metering moduleWith the power module powered for entire intelligent electric meter, the display module, key module, communication module and electric-power metering module are allIt is connect with MCU module, the current acquisition module and voltage acquisition module are connected to electric-power metering module.
MCU module is to control the work of other modules.Display module shows the parameter and state of intelligent electric meter.Key moduleFor carrying out setting control.Communication module realizes the communication between intelligent electric meter and host computer.Current acquisition module acquisition is currentElectric current, voltage acquisition module acquire current voltage, output of the electric-power metering module to current acquisition module and voltage acquisition moduleData are sent to MCU module after being handled.Entire electric-power metering process is completed by intelligent electric meter completely, does not need manually to joinWith.
Preferably, the MCU module includes STC12C5A40AD chip.STC12C5A40AD chip interior carries dataMemory, power down can be reserved for data.STC12C5A40AD is 8051 kernel MCU, and more traditional 8051 kernel operating rate is fast, processingAbility is stronger.
Preferably, the display module include two 3 Digital sum pipes, the triode of 7 model S9012,7 shineDiode and several resistance;8 feet, 9 feet and 12 feet of 3 Digital sum pipes respectively connect the collector of a triode, remaining foot is allMCU module is connected to by resistance;The anode of 7 light emitting diodes is all connected to the collector of a triode;Cathode is all logicalIt crosses resistance and is connected to MCU module;The emitter of triode all connects power supply+5V, and base stage all passes through resistance and is connected to MCU module.
MCU module drives 3 Digital sum pipes and light emitting diode by triode.
Preferably, the key module include 5 microswitches and 5 pull-up resistors, the first of each microswitchEnd is all connected to MCU module, and second end is all grounded, and the first end of each pull-up resistor respectively connects the first of a microswitchEnd, the second end of pull-up resistor all connect power supply+5V.
Display module and key module cooperation can intuitively show different parameters, using charactron and LED lightDisplay is affected by temperature small.
Preferably, the communication module includes opto-coupler chip, MAX485 chip and Transient Suppression Diode, the optocouplerChip is TLP521-3-D chip, and 2 feet and 6 feet of opto-coupler chip connect MCU module by resistance, and 10 feet are directly connected to MCU mouldBlock, 1 foot and 5 feet connect power supply VCC, and 3 feet connect power supply VCC_D, and 4 feet connect 1 foot of MAX485 chip by resistance;Optocoupler core4 feet of the 12 feet connection MAX485 chip of piece, 2 feet and 3 feet of the 8 feet connection MAX485 chip of opto-coupler chip;The 7 of opto-coupler chipFoot and 11 feet connect power supply GND_D, 9 feet ground connection;12 feet of opto-coupler chip also connect power supply VCC_D by resistance, and 10 feet are also logicalResistance connection power supply VCC is crossed, 8 feet also connect power supply VCC_D by resistance;8 feet of MAX485 chip connect power supply VCC_D, 7 feetIt is the output port of communication module with 6 feet, 5 feet connect power supply GND_D;Transient Suppression Diode is connected across the 6 of MAX485 chipBetween foot and 7 feet, resistance R22 is also serially connected between 6 feet and 7 feet of MAX485 chip;8 feet of MAX485 chip also pass through capacitorC23 connection power supply GND_D, 7 feet also pass through resistance R24 connection power supply GND_D, and 6 feet also pass through resistance R21 connection power supply VCC_D;The one end resistance R25 connects power supply GND_D, other end ground connection.
It is communicated between communication module and host computer by RS485 agreement.
Preferably, the current acquisition module includes current transformer, resistance R27, resistance R31, resistance R35, resistanceR36, resistance R38, resistance R40, resistance R43, resistance R46, variable resistance R28, capacitor C32, capacitor C34 and capacitor C35, it is describedCurrent transformer is HWCT-20A/20mA mutual inductor, and 5 feet and 6 feet of current transformer are alternating current incoming end, the connection of 2 feetThe convertible tip of variable resistance R28 and the first definite value end, 1 foot pass through the second definite value end of resistance R35 connection variable resistance R28;ElectricityHinder 2 feet of the first end connection current transformer of R31, second end ground connection;The 1 of the first end connection current transformer of resistance R36Foot, second end ground connection;2 feet of the first end connection current transformer of resistance R27;The first end of resistance R38 connects Current Mutual Inductance1 foot of device, the second end of resistance R27 and the second end of resistance R38 are alternating current output end;The first end of capacitor C32 connectsThe second end of resistance R27, the second end ground connection of capacitor C32;The second end of the first end connection resistance R38 of capacitor C35, capacitorThe second end of C35 is grounded;Capacitor C34 is connected across between the second end of resistance R27 and the second end of resistance R38;The two of resistance R43End is DC current incoming end, the first end of the first end connection resistance R43 of resistance R40;The first end of resistance R46 connects resistanceThe second end of R43, the second end of resistance R40 and the second end of resistance R46 are DC current output end.
Preferably, the voltage acquisition module includes voltage transformer, resistance R26, resistance R30, resistance R32, resistanceR33, resistance R34, resistance R37, resistance R39, resistance R41, resistance R42, resistance R44, resistance R45, variable resistance R29, capacitorC31, capacitor C33 and capacitor C36, the voltage transformer are TV1005 mutual inductor;2 feet of voltage transformer are the first alternating currentIncoming end is pressed, 1 foot passes through resistance R32 connection the second alternating voltage incoming end;4 feet of voltage transformer connect variable resistance R29Convertible tip and the first definite value end, 3 feet pass through the second definite value end of resistance R33 connection variable resistance R29;The first of resistance R304 feet of end connection voltage transformer, second end ground connection;3 feet of the first end connection voltage transformer of resistance R34, the second terminationGround;4 feet of the first end connection voltage transformer of resistance R26,;3 feet of the first end connection voltage transformer of resistance R37, electricityThe second end of the second end and resistance R37 that hinder R26 is ac voltage output;The of the first end connection resistance R26 of capacitor C31Two ends, the second end ground connection of capacitor C31;The second end of the first end connection resistance R37 of capacitor C36, the second termination of capacitor C36Ground;Capacitor C33 is connected across between the second end of resistance R26 and the second end of resistance R37;The first end of resistance R39 is first straightGalvanic electricity presses incoming end, and second end passes through the first end of resistance R41 connection resistance R42;The first end of resistance R45 is the second direct currentIncoming end is pressed, the second end of resistance R42 and the second end of resistance R45 are DC voltage output end;Resistance R44 is connected across resistanceBetween the first end of R42 and the first end of resistance R45.
This intelligent electric meter can measure alternating current or direct current.When measuring alternating current, the alternating current of current acquisition moduleIt flows incoming end and accesses test line, alternating current output end is connected to electric-power metering module, DC current incoming end and direct currentIt is hanging to flow output end;First alternating voltage incoming end of voltage measurement module and the access of the second alternating voltage incoming end are by survey lineRoad, ac voltage output connect electric-power metering module, the first DC voltage incoming end, the second DC voltage incoming end and direct currentVoltage output end is all hanging.When measuring direct current, the DC current incoming end of current acquisition module accesses test line, direct currentCurrent output terminal is connected to electric-power metering module, and alternating current incoming end and alternating current output end are hanging;Voltage measurement moduleThe first DC voltage incoming end and the second DC voltage incoming end access test line, DC voltage output end connect kilowatt meterModule is measured, the first alternating voltage incoming end, the second alternating voltage incoming end and ac voltage output are all hanging.
Preferably, the electric-power metering module includes ATT7053BU chip, 6 feet of ATT7053BU chip and 7 feet connectConnect the ac voltage output or DC voltage output end of voltage acquisition module, the friendship of 10 feet and 11 feet connection current acquisition moduleFlow current output terminal or DC current output end.
Current acquisition module and voltage acquisition module share ATT7053BU.The MCU module is adopted with the ATT7053BUWith SPI serial communication, the difference letter of the current acquisition module and the output of voltage acquisition module mutual inductor after capacitance-resistance filterNumber send a day ATT7053BU chip pin.
ATT7053BU is professional electric energy computation chip, it can be achieved that alternating voltage, electric current, active power, reactive power, viewThe measurement of DC voltage, electric current and power can be also realized in function, power factor and electric energy, chip detection accuracy height, stabilityGood, high reliablity, external devices are few, so that circuit design is greatly simplified.
Data in ATT7053BU can be read by connection ATT7053BU metering chip, calculate electricity by MCU moduleThe parameters such as pressure, electric current, power.
Preferably, intelligent electric meter further includes temperature sensing module, the temperature sensing module is connect with MCU module.
Temperature sensing module temperature collection information is sent to MCU module.
A kind of data encryption and transmission method based on above-mentioned intelligent electric meter, comprising the following steps:
A, host computer generates one 0 to 8 random integers N, is sent to intelligent electric meter;
B, intelligent electric meter stores and uploads the maximum temperature K1 that the previous day detects at No. 2+N of this metering cycle, in 11+No. N stores and uploads the maximum temperature K2 detected the previous day, the maximum temperature detected on the day before storing and upload at No. 20+NK3 is spent, the target side of upload is host computer;
C, intelligent electric meter is reading maximum current in electricity consumption degree W1 and this metering cycle in this metering cycle meter reading dayI1 is encrypted after being packaged two data, and key is electricity consumption degree W0, a upper metering cycle for a upper metering cycleMaximum current I0 and this metering cycle in upload K1, K2 and K3;
D, encrypted data are uploaded to host computer by intelligent electric meter;
E, host computer is decrypted after receiving data using corresponding data key, and the data after decryption are depositedStorage, subsequently into step A.
Each component part of key is in (K1, K2 and K3 are in plain text, WO and I0 are encryption data) in different waysIt passes, and uplink time is random determination, and it is very big to be trapped difficulty, highly-safe.
The intelligent electric meter of this programme can be measured when being inputted using mutual inductor the voltage of alternating current, electric power, power, power becauseNumber, active power and reactive power, DC voltage, electric current can be measured when inputting using pure resistance can support 485 communications, hardwareVersatility obtained good utilization.
Bring substantial effect of the present invention is, intelligence degree and precision are high, good reliability, the data of upload be not easy byIt cracks, safety coefficient is high.
Detailed description of the invention
Fig. 1 is a kind of system module figure of the invention;
Fig. 2 is a kind of circuit structure diagram of MCU module of the invention;
Fig. 3 is a kind of circuit structure diagram of display module of the invention;
Fig. 4 is a kind of circuit structure diagram of key module of the invention;
Fig. 5 is a kind of circuit structure diagram of communication module of the invention;
Fig. 6 is a kind of circuit structure diagram of current acquisition module of the invention;
Fig. 7 is a kind of circuit structure diagram of voltage acquisition module of the invention;
Fig. 8 is a kind of circuit structure diagram of electric-power metering module of the invention;
In figure: 1, MCU module, 2, power module, 3, display module, 4, key module, 5, communication module, 6, current acquisitionModule, 7, voltage acquisition module, 8, electric-power metering module, 9, temperature sensing module.
Specific embodiment
Below with reference to the embodiments and with reference to the accompanying drawing the technical solutions of the present invention will be further described.
Embodiment: a kind of intelligent electric meter of the present embodiment, as shown in Figure 1, including MCU module 1, power module 2, display mouldBlock 3, key module 4, communication module 5, current acquisition module 6, voltage acquisition module 7, electric-power metering module 8 and temperature sensing mouldBlock 9.Display module 3, key module 4, communication module 5, electric-power metering module 8 and temperature sensing module 9 all connect with MCU module 1It connects, current acquisition module 6 and voltage acquisition module 7 are connected to electric-power metering module 8.
MCU module includes STC12C5A40AD chip, the included data storage in inside.Electric-power metering module includesATT7053BU chip.Current acquisition module includes single-phase current transformer and copper-manganese sampling resistor, and current transformer is used to examineAlternating current is surveyed, copper-manganese sampling resistor is used to detect DC current, copper-manganese sampling resistor is installed when acquisition acquires DC current,Current transformer is installed, collected current signal connects by capacitance-resistance filter and difference sample circuit correspondence when detecting alternating currentEnter 10~11 feet of ATT7053BU chip.Voltage acquisition module includes single-phase potential transformer and divider resistance, in detection listVoltage transformer is installed when phase alternating voltage, divider resistance is installed when detecting DC voltage, collected voltage signal passes through resistance6~7 feet of corresponding access ATT7053BU chip after capacitor filter.
ATT7053BU integrated chip electrical energy measurement, reliable operation, superior performance is low in cost, and module is abundant, inside collectionThe detection of the signals such as electric current, voltage can be easily realized at high-precision A/D and the cooperation of RMS-DC converter and MCU.It include EEPROM function inside STC12C5A40AD, power failure data can continue to save;Electric current that ATT7053BU is connected, electricityInternal register is stored in after the signal processing that pressure acquisition module will test, MCU reads ATT7053BU by SPI serial line interfaceInternal register can obtain the data such as electric current, voltage, and the data handled through MCU can be communicated by communication line with PC, in PCUpper monitoring parameters of electric power.
Power module is designed as through step-down transformer decompression, rectification, filtering, pressure stabilizing supplying single-phase voltage to system againElectricity.To simplify power supply design, MCU module and electric current, voltage acquisition module select 5V power supply chip, STC12C5A40AD power supplyPin 38 plus C26 filter capacitor, ATT7053BU digital power pin 1 plus C17 filter capacitor, analog power add R19, C24 to constituteRC filter, the simulation of ATT7053BU with digitally carry out single-point altogether.
Fig. 3 is display module, drives CPS05631BR model LED charactrons and light emitting diode, circuit letter using S9012It is single reliable, electric current, voltage, active power, reactive power, apparent energy, power factor can be shown when doing ac power meter, andWhat data of the thing of display can be intuitively found out on charactron, so that more convenient to use, LED light can display instrumentState, can simply determine is automatic/hand range and is presently in range ability.
Fig. 4 is key module, using microswitch, adds external pull-up resistor to improve interference free performance.
Fig. 5 is communication module, carries out electrical specification conversion using MAX485, MAX485 uses independent power supply, MCU Serial Port LineRX/TX realizes by light-coupled isolation and connect with MAX485 that MAX485 differential lines A/B is protected using P6KE6.8CA, RS485 communicationData transfer direction is controlled using individual MCU pin, to guarantee to do certain time-delay in reception/transmission data mode switching,Guarantee that data transmission is reliable and stable.It is communicated using RS485 and remote reading instrumented data can be achieved, it can be in parallel multiple on data lineInstrument, the address of settable each instrument.
Fig. 6 is current acquisition module, uses current transformer, the output signal of current transformer for alternating current detectionGarbage signal is filtered out by a RC filter network, the signal exported after filtering is differential signal, and differential signal is connected toThe pin 10~11 of ATT7053BU, the adjustable resistance by adjusting RC filter network can realize the adjustment of output signal size,Calibration when by adjust the potentiometer can easily realize calibration;The detection of DC current is examined using copper-manganese sampling resistorIt surveys, pin 10~11 of the resistance sampling signal through the filtered differential signal access ATT7053BU of RC, collected data existIt is automatically processed inside ATT7053BU as virtual value;The acquisition of alternating current and DC current signal can only be chosen one of two, becauseSelective Soldering need to be carried out when this hardware realization.
Fig. 7 is voltage acquisition module, uses voltage transformer, the output signal of voltage transformer for alternating voltage detectionGarbage signal is filtered out by a RC filter network, the signal exported after filtering is differential signal, and differential signal is connected toThe pin 6~7 of ATT7053BU, the adjustable resistance by adjusting RC filter network can realize the adjustment of output signal size, in schoolCalibration can be easily realized by adjusting the potentiometer when quasi-;R39, R41, R44 metal are used for the detection of DC voltageFilm resistance carries out partial pressure detection, and potential-divider network makes input impedance > 1Mohm, R34 resistance sampling signal through the filtered difference of RCSub-signal accesses the pin 6~7 of ATT7053BU, and collected data are automatically processed inside ATT7053BU as virtual value;It is rightIt can only be chosen one of two in the acquisition of alternating current and d. c. voltage signal, therefore selective weldering need to be carried out when hardware realizationIt connects.
Fig. 8 is electric-power metering module, and the reset of the ATT7053BU uses external RC electrification reset, digital power DVCCIt is connect with analog power AVCC using RC filter, internal reference output pin VREF is carried out using the capacitor of 10uF and 0.1uFIt filters to increase the reliability of benchmark.The digital circuits section of ATT7053BU and analog portion (contain electric current, electricity in the present embodimentSource acquisition module) use single-point altogether, to improve system stability.
The data encryption and transmission method of intelligent electric meter the following steps are included:
A, host computer generates one 0 to 8 random integers N, is sent to intelligent electric meter;
B, intelligent electric meter stores and uploads the maximum temperature K1 that the previous day detects at No. 2+N of this metering cycle, in 11+No. N stores and uploads the maximum temperature K2 detected the previous day, the maximum temperature detected on the day before storing and upload at No. 20+NK3 is spent, the target side of upload is host computer;
C, intelligent electric meter is reading maximum current in electricity consumption degree W1 and this metering cycle in this metering cycle meter reading dayI1 is encrypted after being packaged two data, and key is electricity consumption degree W0, a upper metering cycle for a upper metering cycleMaximum current I0 and this metering cycle in upload K1, K2 and K3;
D, encrypted data are uploaded to host computer by intelligent electric meter;
E, host computer is decrypted after receiving data using corresponding data key, and the data after decryption are depositedStorage, subsequently into step A.
Host computer generates random number after receiving encrypted data and successful decryption and is sent to intelligent electric meter.Such asMeter reading day is No. 10 of every month, and host computer receives intelligent electric meter after March 10 read and encrypted the data of upload, logarithmAccording to decryption, successful decryption then generates random number, if the random number generated is 4, intelligent electric meter is in March 15 upload March 14Number maximum temperature K2, March 24 upload March 23 maximum temperature K3, April 6 upload April 5 maximum temperatureK1.Temperature data is collected by temperature sensing module.
Time of one metering cycle between two adjacent meter reading days, this metering week after intelligent electric meter reading terminatesPhase terminates, into next metering cycle.
When to April 10, intelligent electric meter is read after meter reading on March 10 to electricity and this section used when current meter readingMaximum current in time, is then encrypted using key.Following manner completion can be used in encryption: by W0, I0, K1, K2 and K3Cascade, the character string that cascade is obtained carry out MD5 operation, and first 56 of operation result is taken to be used as secondary key, close using second levelData after the electricity consumption degree W1 and maximum current I1 that key obtains meter reading on April 10 by des encryption algorithm are packaged addIt is close.
Intelligent electric meter uploads encrypted data, and host computer transfers W0, I0, K1, K2 and K3 from database, it is corresponding intoRow decryption obtains W1 and I1, then stores W1 and I1, and regenerate random number and be sent to intelligent electric meter, as April 10To the N of this metering cycle on the 10th in May.
Specific embodiment described herein is only an example for the spirit of the invention.The neck of technology belonging to the present inventionThe technical staff in domain can make various modifications or additions to the described embodiments or replace by a similar methodIn generation, however, it does not deviate from the spirit of the invention or beyond the scope of the appended claims.
Although the terms such as MCU, electric-power metering are used more herein, the possibility using other terms is not precludedProperty.The use of these items is only for be more convenient to describe and explain essence of the invention;It is construed as any oneAdditional limitation is disagreed with spirit of that invention.