Summary of the invention
For overcome the deficiencies in the prior art, the present invention provide a kind of miniature simple MCU of structure it is controllable it is automatic too
Positive energy tracing system.The purpose of the present invention is systems to automatically track sunlight by adjusting the orientation of solar receiving panel
The photoelectric conversion efficiency and space utilization rate of solar receiving panel are improved in most intense light source direction, avoid largely using fixed
Solar panel, can reduce the cost of entire solar power system, while realizing the high-precision of system control using MCU
Degree, the low-power consumption of system increase the flexibility of system extension.
The technical solution adopted by the present invention to solve the technical problems is:
A kind of miniature solar automatic tracking system based on MCU, including MCU module, A/D converter, solar energy orientation
Detection module, intensity of illumination detection module, motor-drive circuit and motor and mechanical driving device, solar energy orientation detection mould
Block is physically connected to motor and mechanical driving device, and motor and mechanical driving device are that the Twin-shaft machinery of Belt Driven by Double Motor is driven dress
It sets, solar energy orientation detection module will be passed to by the light intensity data in the space detected in the circuit of solar energy orientation detection module
A/D converter and MCU module control motor-drive circuit by MCU module, so that motor and mechanical driving device be made to be turned
It is dynamic, until solar energy orientation detection module is towards space largest light intensity position, meanwhile, intensity of illumination detection module judges Real-Time Optical
According to situation, by testing result judged after be input in the form of low and high level at the interruptive port of MCU, the judgement
For real-time lighting intensity size and the intensity of illumination threshold value of setting are compared, when intensity of illumination be higher than given threshold, then export
High level, when intensity of illumination be lower than given threshold, then low level is exported, to make entire solar-tracking system in operating mode
When switching between sleep pattern, i.e. intensity of illumination are higher than given threshold, whole system is operating mode;Intensity of illumination is lower than
When given threshold, whole system is suspend mode, to reduce whole system power consumption.
The motor uses two motors and corresponding mechanical device respectively in azimuth and height to mechanical driving device
The motor-drive circuit of the mechanical device that angle both direction is rotated, driving motor and mechanical driving device is divided into two-way, and one
Road is motor-drive circuit 1, is in addition all the way motor-drive circuit 2, wherein motor-drive circuit 1 drives mechanical driving device
The variation of deflection, motor-drive circuit 2 are used to drive the variation of the height of mechanical driving device;Azimuth and elevation angle two
The motor rotation axis in direction is connected with corresponding mechanical shaft respectively, while entire motor and mechanical driving device include a bottom
Entire motor is fixed with mechanical driving device for seat, pedestal, in the fixed solar energy in the top of motor and mechanical driving device
Orientation detection module, solar energy orientation detection module and MCU module acquire the Orientation differences of solar energy in real time, and locate to obtain current
The azimuth information of solar energy, angle and height to mechanical driving device control.
The MCU module uses microcontroller chip STC89C52, realizes the automatic control to whole system.
The A/D converter uses the chip TLC1543 with serial communication interface.
The solar energy orientation detection module is a bridge voltage comparison circuit, and bridge voltage comparison circuit includes four fortune
The electric bridge that amplifier OP1, OP2, OP3, OP4 and photo resistance R1, R2, R3, R4 and resistance R5~R10 are constituted is calculated, in height
It is utilized respectively sensing element of two photo resistance as position of sun when angle and Bearings tracking, four photo resistance R1, R2,
R3, R4 are spaced one from partition, and two partitions are intersected with 90 degree of angles to be placed, and R1, R2, R3, R4 are individually positioned in baffle interval
Four regions in, and with partition crosspoint central symmetry placement, bridge voltage comparison circuit is by two groups of electric bridges and four
Operational amplifier composition, first group of electric bridge are put by two photo resistance R1 and R2, two reference resistance R5, R6 and two operation
Big device OP1 and OP2 composition, the negative terminal of diode D1 connect photo resistance R1 and R2 to GND, and R1 connects fortune with the common node of R2
The dividing point of the anode of calculation amplifier OP1 and the negative terminal of operational amplifier OP2, resistance R5 and resistance R6 are separately connected amplifier
The negative terminal of OP1 negative terminal and operational amplifier OP3, provides the reference voltage of operational amplifier, and the resistance value of photo resistance R1 and R2 become
Change respectively compared with the resistance value of R5 and R6, comparison result is exported by operational amplifier OP1 and OP2.
Second group of electric bridge is by two photo resistance R3 and R4, two reference resistance R7, R8 and two operational amplifier
The negative terminal of OP3 and OP4 composition, diode D1 connects photo resistance R3 and R4 to GND, and R3 connects operation with the common node of R4 and puts
The dividing point of the anode of big device OP3 and the negative terminal of operational amplifier OP4, resistance R5 and resistance R6 after series resistance R7 by connecting
The anode of operational amplifier OP2 is connected to provide reference voltage, the dividing point of resistance R5 and resistance R6 pass through after series resistance R8
The anode of operational amplifier OP4 is connected to provide reference voltage, the change in resistance of photo resistance R3 and R4 are respectively with R5's and R6
Resistance value compares, and exports comparison result by operational amplifier OP3 and OP4.
Specific connection type are as follows: the anode of diode D1 connects power supply VCC, and the negative terminal of diode D1 is sequentially connected photosensitive electricity
R1 and R2 to GND is hindered, the dividing point for constituting the R1 and R2 of partial-pressure structure connects the anode and operation amplifier of operational amplifier OP1
The negative terminal of device OP2;Likewise, the negative terminal of diode D1 also connects photo resistance R3 and R4 to G ND, partial-pressure structure is constituted, point
Pressure point connects the anode of operational amplifier OP3 and the negative terminal of operational amplifier OP4, and diode D1 negative terminal connects resistance R5 and R6
Tie point to GND, resistance R5 and R6 provides benchmark comparison voltage, resistance for four operational amplifiers OP1, OP2, OP3, OP4
The dividing point of R5 and resistance R6 are separately connected the negative terminal of amplifier OP1 negative terminal and operational amplifier OP3, and resistance R5 and resistance R6
Dividing point by being connected to the anode of operational amplifier OP2 after series resistance R7, the dividing point of resistance R5 and resistance R6 pass through
The anode of operational amplifier OP4 is connected after series resistance R8;The output end of operational amplifier OP1 and operational amplifier OP2's is defeated
The indirect resistance R9 of outlet;The indirect resistance R10 of the output end of the output end and operational amplifier OP4 of operational amplifier OP3;
The four tunnels output of four operational amplifiers OP1, OP2, OP3, OP4 respectively constitute the four tunnels output letter of solar energy orientation detection module
Number SIGNAL OUTPUT1, SIGNAL OUTPUT2, SIGNAL OUTPUT3 and SIGNAL OUTPUT4, photo resistance R1 and R2
Tie point connect the non-inverting input terminal of operational amplifier OP1 and the inverting input terminal of OP2, the tie point of photo resistance R3 and R4 connect
The non-inverting input terminal of operational amplifier OP3 and the inverting input terminal of OP4, when the solar panels and sunlight of solar tracking system
When line is vertical, the sensitive volume of four photo resistance is equal, the output voltage at photo resistance end and the output voltage at reference resistance end
Identical, two groups of electric bridges are in equilibrium state, and four operational amplifier output levels are equal, when the position of the sun changes,
Since tracking system is no longer directly toward the position of the sun, partition can block a part of light emission and enter some transistor, electric bridge due to
Photosensitive resistance value it is different without rebalancing, in circuit respectively each two photo resistance of controlling party parallactic angle and elevation angle due to resistance
The difference of value causes the same phase in voltage comparator with inverting input terminal there are pressure difference, and the amplifier of open loop application compares as voltage
Device, to be output to motor after result is handled by MCU, can reach control motor according to the positive negative output low and high level of pressure difference
The purpose accordingly rotated.
The intensity of illumination detection module is made of a photodiode, operational amplifier and three reference resistances,
Photodiode and three reference resistances constitute an electric bridges, and when daytime, the photodiode resistance value of reversal connection is less than reference resistance,
Therefore through operational amplifier relatively after export high level, system should be in working condition at this time for judgement, and system does not have interrupt requests, MCU
Program in processor continues to run;When night, the photodiode resistance value of reversal connection is higher than reference resistance, therefore through operational amplifier
After export low level, system should be sleep state at this time for judgement, and when one of input pin of MCU, INT0 is used to examine
External interrupt is surveyed, when detecting low level, i.e. INT0=0 issues interrupt requests to single-chip microcontroller, after single-chip microcontroller is connected to interrupt requests
External interrupt 0 is activated, into 0 processing routine of external interrupt, hence into wait state.
The motor-drive circuit is H-bridge drive circuit, by four triodes and motor form H bridge structure, carries out electricity
The rotation of motor is realized in machine driving by the triode on conducting H bridge on diagonal line, just by two ports of input
Negative level controls the triode ON of different location, meanwhile, the forward and reverse of motor can be by flowing through the current direction of motor
It determines, different pairs of triode, which is connected, can determine to flow through the current direction of motor, to control the main story or reversion of motor.?
In this system, due to there are two motors, thus it is corresponding, each motor respectively corresponds to a H-bridge drive circuit.
The beneficial effects of the present invention are:
(1) present invention realizes the high-precision of system, the flexibility of low-power consumption and system extension using MCU.
(2) present invention uses the solar-tracking detection pattern based on bridge voltage comparative structure, high sensitivity, cost
It is low.
(3) present invention use photodiode and amplifier intensity of illumination detection pattern, realize whole system work with
The switching for double mode of sleeping reduces system power dissipation.
Specific embodiment
Present invention will be further explained below with reference to the attached drawings and examples.
Automatic sun energy tracing system of the invention includes MCU module, A/D converter, solar energy orientation detection module, light
According to intensity detection module, motor-drive circuit and motor and mechanical driving device, as shown in Figure 1, solar energy orientation detection mould
Block is physically connected to motor and mechanical driving device, and motor and mechanical driving device are that the Twin-shaft machinery of Belt Driven by Double Motor is driven dress
It sets, solar energy orientation detection module will be passed to by the light intensity data in the space detected in the circuit of solar energy orientation detection module
A/D converter and MCU module control motor-drive circuit by MCU module, so that motor and mechanical driving device be made to be turned
It is dynamic, until solar energy orientation detection module is towards space largest light intensity position, meanwhile, intensity of illumination detection module judges Real-Time Optical
According to situation, by testing result judged after be input in the form of low and high level at the interruptive port of MCU, the judgement
For real-time lighting intensity size and the intensity of illumination threshold value of setting are compared, when intensity of illumination be higher than given threshold, then export
High level, when intensity of illumination be lower than given threshold, then low level is exported, to make entire solar-tracking system in operating mode
When switching between sleep pattern, i.e. intensity of illumination are higher than given threshold, whole system is operating mode;Intensity of illumination is lower than
When given threshold, whole system is suspend mode, to reduce whole system power consumption.
The motor uses two motors and corresponding mechanical device respectively in azimuth and height to mechanical driving device
The motor-drive circuit of the mechanical device that angle both direction is rotated, driving motor and mechanical driving device is divided into two-way, and one
Road is motor-drive circuit 1, is in addition all the way motor-drive circuit 2, wherein motor-drive circuit 1 drives mechanical driving device
The variation of deflection, motor-drive circuit 2 are used to drive the variation of the height of mechanical driving device;Azimuth and elevation angle two
The motor rotation axis in direction is connected with corresponding mechanical shaft respectively, while entire motor and mechanical driving device include a bottom
Entire motor is fixed with mechanical driving device for seat, pedestal, in the fixed solar energy in the top of motor and mechanical driving device
Orientation detection module, solar energy orientation detection module and MCU module acquire the Orientation differences of solar energy in real time, and locate to obtain current
The azimuth information of solar energy, angle and height to mechanical driving device control.
The MCU module uses microcontroller chip STC89C52, this module realizes the automatic control to whole system.
The A/D converter uses the chip TLC1543 with serial communication interface.
The solar energy orientation detection module is a bridge voltage comparison circuit, and bridge voltage comparison circuit includes LM324
The electric bridge that chip and photo resistance R1, R2, R3, R4 and resistance R5~R10 are constituted, wherein LM324 chip includes four operations
Amplifier OP1, OP2, OP3, OP4 are utilized respectively two photo resistance in elevation angle and Bearings tracking as position of sun
Sensing element, four photo resistance R1, R2, R3, R4 are spaced one from partition, according to position in Fig. 4 place two partitions with
90 degree of angles, which intersect, to be placed, and R1, R2, R3, R4 are individually positioned in four regions of baffle interval, and in partition crosspoint
The heart is symmetrically placed.Bridge voltage comparison circuit is made of two groups of electric bridges and four operational amplifiers, and first group of electric bridge is by two
Photo resistance R1 and R2, two reference resistance R5, R6 and two operational amplifier OP1 and OP2 composition, the negative terminal of diode D1
Photo resistance R1 and R2 to GND is connected, R1 connects the anode and operational amplifier of operational amplifier OP1 with the common node of R2
The dividing point of the negative terminal of OP2, resistance R5 and resistance R6 are separately connected the negative terminal of amplifier OP1 negative terminal and operational amplifier OP3, provide
The reference voltage of operational amplifier, the change in resistance of photo resistance R1 and R2 compared with the resistance value of R5 and R6, pass through operation respectively
Amplifier OP1 and OP2 export comparison result.
Second group of electric bridge is by two photo resistance R3 and R4, two reference resistance R7, R8 and two operational amplifier
The negative terminal of OP3 and OP4 composition, diode D1 connects photo resistance R3 and R4 to GND, and R3 connects operation with the common node of R4 and puts
The dividing point of the anode of big device OP3 and the negative terminal of operational amplifier OP4, resistance R5 and resistance R6 after series resistance R7 by connecting
The anode of operational amplifier OP2 is connected to provide reference voltage, the dividing point of resistance R5 and resistance R6 pass through after series resistance R8
The anode of operational amplifier OP4 is connected to provide reference voltage, the change in resistance of photo resistance R3 and R4 are respectively with R5's and R6
Resistance value compares, and exports comparison result by operational amplifier OP3 and OP4.
Specific connection type is that the anode of diode D1 connects power supply VCC, and the negative terminal of diode D1 is sequentially connected photosensitive electricity
R1 and R2 to GND is hindered, the dividing point for constituting the R1 and R2 of partial-pressure structure connects the anode and operation amplifier of operational amplifier OP1
The negative terminal of device OP2;Likewise, the negative terminal of diode D1 also connects photo resistance R3 and R4 to G ND, partial-pressure structure is constituted, point
Pressure point connects the anode of operational amplifier OP3 and the negative terminal of operational amplifier OP4, and diode D1 negative terminal connects resistance R5 and R6
Tie point to GND, resistance R5 and R6 provides benchmark comparison voltage, resistance for four operational amplifiers OP1, OP2, OP3, OP4
The dividing point of R5 and resistance R6 are separately connected the negative terminal of amplifier OP1 negative terminal and operational amplifier OP3, and resistance R5 and resistance R6
Dividing point by being connected to the anode of operational amplifier OP2 after series resistance R7, the dividing point of resistance R5 and resistance R6 pass through
The anode of operational amplifier OP4 is connected after series resistance R8;The output end of operational amplifier OP1 and operational amplifier OP2's is defeated
The indirect resistance R9 of outlet;The indirect resistance R10 of the output end of the output end and operational amplifier OP4 of operational amplifier OP3;
The four tunnels output of four operational amplifiers OP1, OP2, OP3, OP4 respectively constitute the four tunnels output letter of solar energy orientation detection module
Number SIGNAL OUTPUT1, SIGNAL OUTPUT2,
The tie point of SIGNAL OUTPUT3 and SIGNAL OUTPUT4, photo resistance R1 and R2 meet operational amplifier OP1
Non-inverting input terminal and OP2 inverting input terminal, the tie point of photo resistance R3 and R4 connects the homophase input of operational amplifier OP3
The inverting input terminal at end and OP4, when the solar panels of solar tracking system are vertical with sunray, four photo resistance
Sensitive volume is equal, and the output voltage at photo resistance end is identical as the output voltage at reference resistance end, and two groups of electric bridges are in equilibrium-like
State, four operational amplifier output levels are equal, when the position of the sun changes, since tracking system is no longer directly toward
The position of the sun, partition can block a part of light emission and enter some transistor, and electric bridge is different without rebalancing due to photosensitive resistance value,
Each two photo resistance of controlling party parallactic angle and elevation angle are caused in voltage comparator due to the difference of resistance value respectively in circuit
Same phase and inverting input terminal there are pressure differences, the amplifier of open loop application can be according to the positive negative output height of pressure difference as voltage comparator
Low level achievees the purpose that controlling motor is accordingly rotated to be output to motor after result is handled by MCU.
The intensity of illumination detection module is made of a photodiode, operational amplifier and three reference resistances,
Photodiode and three reference resistances constitute an electric bridges, and when daytime, the photodiode resistance value of reversal connection is less than reference resistance,
Therefore through operational amplifier relatively after export high level, system should be in working condition at this time for judgement, and system does not have interrupt requests, MCU
Program in processor continues to run;When night, the photodiode resistance value of reversal connection is higher than reference resistance, therefore through operational amplifier
After export low level, system should be sleep state at this time for judgement, and when one of input pin of MCU, INT0 is used to examine
External interrupt is surveyed, when detecting low level, i.e. INT0=0 issues interrupt requests to single-chip microcontroller, after single-chip microcontroller is connected to interrupt requests
External interrupt 0 is activated, into 0 processing routine of external interrupt, hence into wait state.
The motor-drive circuit is H-bridge drive circuit, by four triodes and motor form H bridge structure, carries out electricity
The rotation of motor is realized in machine driving by the triode on conducting H bridge on diagonal line, just by two ports of input
Negative level controls the triode ON of different location, meanwhile, the forward and reverse of motor can be by flowing through the current direction of motor
It determines, different pairs of triode, which is connected, can determine to flow through the current direction of motor, to control the main story or reversion of motor.?
In this system, due to there are two motors, thus it is corresponding, each motor respectively corresponds to a H-bridge drive circuit.
Referring to Fig. 2, motor of the present invention and mechanical driving device are one and use two motors 3,4 and corresponding mechanical device
Carry out the mechanical device at azimuth and the rotation of elevation angle both direction.The motor rotation axis in each direction connects with corresponding mechanical shaft
It connects, while there are a pedestals 2, and device is fixed for entire mechanical driving device.An orientation inspection is fixed at the top of device
Module 1 is surveyed, the module and MCU acquire in real time and handle the light intensity of current spatial and direction and the operating to following mechanical device
It is controlled.
Referring to Fig. 3, solar energy orientation detection module of the present invention by LM324 four operational amplifiers (OP1-OP4), two pairs
Photo resistance (R1-R4) and multiple reference resistance (R5-R10) constitute bridge voltage comparison circuit realize.As shown in figure 4, its
In two couples of 1 (R of photo resistance1-R4) separated to carry out light position judgement by a cross partition 2, space maximum light is judged respectively
The elevation angle and horizontal angle of strong position.Meanwhile the photo resistance of horizontal angle and elevation angle walking direction respectively corresponds two
Single operational amplifier in LM324.When the orientation of the tracking system face sun, the sensitive volume of four photo resistance is equal, this
When each electric bridge be in equilibrium state.Pressure difference is not present in amplifier positive-negative input end.It exports when the position of the sun changes, due to
Tracking system is not correctly towards the position of the sun, and partition can block a part of light emission and enter some transistor, and electric bridge is due to light
Quick resistance value it is different without rebalancing, in circuit respectively each two photo resistance of controlling party parallactic angle and elevation angle due to resistance value
Difference cause same phase in voltage comparator with inverting input terminal there are pressure differences, the amplifier of open loop application is as voltage comparator
Can according to the positive negative output low and high level of pressure difference, to be output to motor after result is handled by MCU, reach control motor into
The purpose that row accordingly rotates.
A/D converter 3 described in Fig. 5, TLC1543 be 20 foot DIP dress 10 bit switch capacitor of CMOS gradually A/D approaches mould
Number converter, wherein A0~A10 (1~9,11,12 foot) is 11 analog input ends, and REF+ (14 foot) and REF- (13 foot) are base
Quasi- voltage positive and negative terminal, CS (15 foot) are chip select terminal, and ADDRESS (17 foot) is serial data input, and DATAOUT is A/D conversion
Terminate 3 state serial output terminals, the serial-port communication of it and microprocessor or periphery, when CLOCK data input/output provides synchronous
Clock, system clock in piece by generating.In this example, four tunnel analog signals of solar energy orientation detection circuit output connect respectively
The A0-A3 foot of TLC1543, the address in this four channels are 0000B, 0001B, 0010B, 0011B.In the output of TLC1543,
CLK is connected with the P1.0 of STC89C52, and ADDR is connected with P1.1, and DATAOUT is connected with P1.2, and CS is connected with P1.3.Two bases
Quasi- voltage pin REF+ and REF- connects 5V power supply and ground respectively.
Referring to Fig. 5, the input terminal of the MCU chip 4STC89C52 and the part pin connection type of A/D conversion chip 3
With reference to above-mentioned introduction.In addition, STC89C52 chip needs external crystal oscillating circuit 1 and reset circuit 2.Crystal oscillating circuit 1 is connected to MCU core
The XTAL1 (19 foot) and XTAL2 (18 foot) of piece 4, reset circuit 2 are connected to the RET (9 foot) of chip 4.The Vcc (40 of STC89C52
Foot) with Vss (20 foot) be feeder ear, connect respectively 5V power supply and ground.Pass through DATAOUT pin input serial data in A/D chip
Afterwards, MCU chip 4 divides four roads from I/O mouthfuls of output treated signals, and output pin is P2.0-P2.3 (21-24 foot).Output
Signal is accordingly rotated by driving circuit driving motor, to achieve the effect that real-time tracking largest light intensity orientation.
Referring to Fig. 6, the intensity of illumination detection circuit is by photodiode D1, single operational amplifier and conventional, electric-resistance
(R1-R3) composition.Meanwhile the INT0 (12 foot) of detection circuit output termination MCU chip, apply light-sensitive element real-time to reach
Environmental light intensity is judged, to make system in the purpose of work and sleep pattern switching.Photodiode D1With three reference resistances
R1-R3Constitute an electric bridge, when daytime, the photodiode D of reversal connection1Resistance value is less than reference resistance R1, therefore through operational amplifier ratio
After export high level, system should be in working condition at this time for judgement, and system does not have interrupt requests, and program continues to run;When night,
The photodiode D of reversal connection1Resistance value is higher than reference resistance R1, therefore through operational amplifier relatively after export low level, judgement is at this time
System should be sleep state, and when INT0 detects low level, i.e. INT0=0 issues interrupt requests to single-chip microcontroller, and single-chip microcontroller is connected to
External interrupt 0 is activated after interrupt requests, into 0 processing routine of external interrupt, hence into wait state.
Referring to Fig. 7, two motor-drive circuits of described this system are that (Fig. 7 is one of electricity to H-bridge drive circuit structure
Road schematic diagram).Primary structure is four triode Q1-Q4The full-bridge circuit of (and its driving circuit) and motor form.Due to
The output electric current of the I/O pin of MCU is too small, is unable to drive motor normal work, it is necessary to use motor-drive circuit.Driving electricity
The main operational principle on road are as follows: the rotation that motor is realized by the triode on diagonal line on conducting H bridge changes conducting
Triode can be achieved the goal by the change of the positive negative level of two ports of input.Meanwhile the forward and reverse of motor
It can determine that different pairs of triode, which is connected, can determine how electric current flows through motor by flowing through the current direction of motor.Such as circuit
Middle Q1With Q4When conducting, motor obtains electric current from left to right;And Q2With Q3When conducting, the electric current that motor passes through is then opposite.
A kind of miniature solar automatic tracking system based on MCU of the invention has control precision height, solar energy conversion
High-efficient, system cost is low.Simultaneity factor has the characteristics that operating mode and sleep pattern double mode automatically switch, and can drop
Low system power dissipation.