A kind of electric tool infrared distance measuring method
Technical field
The present invention relates to a kind of method of utilizing infrared ray to find range.
Background technology
Along with the development of technology, need the service range of testing tool in a lot of fields, particularly in field of power tools, such as the drilling depth of electric drill and the length or the like that screws of electric screw driver.Aspect electric drill control, the method for traditional keyhole degree of depth is to use mechanical hook-up, and mechanical hook-up is set to suitable position at present, and when drilling depth reached, mechanical hook-up blocked drill bit, finished boring; Also utilize ultrasonic reflections intensity, when reaching predetermined strength, allow electric drill stop automatically, the keyhole degree of depth.Above first kind of mode since now technology more and more to the electronic type development, incompatibility trend, second way measuring distance is stable, accurately, but its cost is higher, promoting the use of for it has increased difficulty.
Summary of the invention
The objective of the invention is to overcome deficiency of the prior art, a kind of system that utilizes the service range of infrared rays survey electric tool is provided, comprise at least one MCU (microprocessor), the ADC of MCU (A-D converter) interface, connect filter capacitor, one the 3rd resistance respectively, filter capacitor other end ground connection, the 3rd resistance other end connects infrared receiving tube, and the infrared receiving tube other end connects the 4th resistance; The PWM of MCU (pulse-length modulation) interface connects transistor base, and transistor emitter connects first resistance, and transistor collector connects infrared transmitting tube; MCU one common I/O mouth connects second resistance, and the second resistance other end connects a pilot lamp.
For reaching goal of the invention, the present invention also provides a kind of method of utilizing the service range of infrared rays survey electric tool, comprises step: the MCU initialization is provided with; MCU makes the infrared transmitting tube emission have the infrared ray of carrier wave by the PWM interface; MCU judges whether the filter capacitor both end voltage reaches mxm. VD; MCU control pilot lamp is bright, recording voltage mxm. VD; The boring of MCU control electric drill; MCU judges whether the filter capacitor both end voltage reaches mxm. VD, if reached mxm. VD, range finding finishes.
Description of drawings
Fig. 1 is the circuit diagram of a kind of electric tool infrared ranging system of the present invention and method embodiment;
Fig. 2 is the survey of a kind of electric tool infrared ranging system of the present invention and method embodiment filter capacitor both end voltage variation diagram when vertical;
Fig. 3 for the range finding of a kind of electric tool infrared ranging system of the present invention and method embodiment from the time filter capacitor both end voltage change synoptic diagram;
Fig. 4 is the software processes process flow diagram for a kind of electric tool infrared ranging system of the present invention and method embodiment.
Embodiment
Above-mentioned technical matters of the present invention is solved like this, electric controller with electric drill is an example: controller ranging unit hardware circuit as shown in Figure 1, the ADC interface 13 of MCU10, connect filter capacitor 41, resistance 23 respectively, filter capacitor 41 other end ground connection, resistance 23 other ends connect infrared receiving tube 32, and infrared receiving tube 32 other ends connect resistance 24; The PWM interface 11 of MCU10 connects triode 51 base stages, and triode 51 emitters connect resistance 21, triode 51 collectors connect infrared transmitting tube 31; MCU10 one common I/O mouth 12 connects resistance 22, and resistance 22 other ends connect a pilot lamp 61.Other I/O mouths of the MCU10 that does not identify among Fig. 1 can be used as other controls mouthful use of electric controller.
As shown in Figure 4, be the software processes process flow diagram of of the present invention a kind of electric tool infrared ranging system and method.At first, in step 310, the carrier frequency and vertical decision condition of ADC function, infrared transmitting tube 31 is set in the initialization of MCU10; In step 320, MCU10 makes infrared transmitting tube 31 emissions have the infrared ray of carrier wave by PWM interface 11, the infrared ray of launching is reflected when running into tested surface, the infrared ray of launching and the angle of tested surface and infrared reflection intensity are as shown in Figure 2, when the drill bit of electric drill is vertical with tested surface, infrared reflection intensity is the strongest, and this moment, infrared receiving tube 32 conduction voltage drops were extremely minimum, and this moment, filter capacitor 41 both end voltage were the highest; In step 330, MCU10 changes by ADC interface 13 record filter capacitors 41 both end voltage, and judges whether filter capacitor 41 both end voltage reach mxm. V
DIf filter capacitor 41 both end voltage do not reach mxm. V
D, return step 320; If filter capacitor 41 both end voltage have reached mxm. V
D, then in step 340, MCU10 is bright by common I/O interface 12 control pilot lamp 61, and the drill bit of expression electric drill is vertical with tested surface, and MCU10 writes down filter capacitor 41 two ends ceiling voltage V when vertical
D, this moment, the position of infrared transmitting tube 31 and infrared receiving tube 32 was B as shown in Figure 3, the ceiling voltage above the filter capacitor 41 of MCU10 record is V
DThe electric drill operator with one above the electric drill vertical with tested surface, can before and after allow infrared transmitting tube 31 and infrared receiving tube 32 move mechanical hook-up make infrared transmitting tube 31 and infrared receiving tube 32 move to position A, the ceiling voltages above this moment filter capacitor 41 are V
C, in step 350, MCU10 control electric drill begins boring, and in step 360, MCU10 detection filter electric capacity 41 both end voltage are if filter capacitor 41 both end voltage have reached mxm. V
D, then range finding is finished, and drill bit drilling depth is the range difference of A position and B position, otherwise returns step 350.
The present invention is not limited to preferred forms and the various ins and outs in this instructions.Therefore, the innovation and creation in the scope of any innovation and creation thought that does not break away from claims records and various equivalents thereof all belong in the protection domain of claims.