Optical sensor detects distance setting circuit
Patent Information
- Application Number
- CN202522556359.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Utility models(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-02
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2035-12-02
AI Technical Summary
[0003]本实用新型的目的在于提供一种光电传感器检测距离设定电路,以解决现有技术中光电传感器检测距离调试困难、耗费时间成本较大的技术问题
[0014]本实用新型的有益效果在于:通过将所述处理器U1的第一引脚与所述霍尔开关调节电路连接,所述处理器U1的第二引脚与所述发射电路连接,所述处理器U1的第三引脚与所述接收电路连接;所述电源稳压电路的输入端与外部电源连接,所述电源稳压电路的输出端分别与所述处理器U1的第四引脚、所述霍尔开关调节电路以及所述接收电路连接;当霍尔开关调节电路未检测到磁铁时,其输出为低电平,当需要设定光电传感器的检测距离范围时,将目标物体放置于预设位置后,霍尔开关调节电路输出高电平信号,主控电路在接收到高电平信号后使发射电路发射第一光信号,接收电路接收经目标物体反射回来的第二光信号,将第二光信号转换为第一电压信号并将第一电压信号放大,得到第二电压信号,所述主控电路接收到第二电压信号后根据所述第二电压信号设定光电传感器的检测距离范围;可以很方便地进行光电传感器检测距离的调试,可以节省调试的时间成本,实现光电传感器检测距离的快速设定。
Smart Images

Figure CN224838991U_ABST
Abstract
Description
Technical Field
[0001] This utility model relates to the field of photoelectric sensor technology, and in particular to a photoelectric sensor detection distance setting circuit. Background Technology
[0002] With the development of industrial automation, more and more enterprises need to improve production efficiency through automated equipment. Automated equipment is also gradually becoming smaller. Photoelectric sensors, as key components of automated equipment, are used to detect the position of objects. An automated device may include multiple photoelectric sensors, each detecting different parts of the body and requiring different detection distance settings, which means that the detection distance may need to be adjusted. Currently, adjusting the detection distance of photoelectric sensors mostly uses a knob adjustment method. This method changes the potentiometer value on the circuit by adjusting the knob, thereby setting the detection distance. If the internal space of the automated equipment is small, this makes adjustment very difficult, possibly requiring stopping the machine and removing other components to set the detection distance, which consumes a significant amount of time. Utility Model Content
[0003] The purpose of this invention is to provide a photoelectric sensor detection distance setting circuit to solve the technical problems of difficult and time-consuming adjustment of photoelectric sensor detection distance in the prior art.
[0004] The technical solution of this utility model is as follows: a photoelectric sensor detection distance setting circuit is provided, including a main control circuit, a Hall switch adjustment circuit, a transmitting circuit, a receiving circuit, and a power supply voltage regulator circuit. The main control circuit includes a processor U1. The first pin of the processor U1 is connected to the Hall switch adjustment circuit, the second pin of the processor U1 is connected to the transmitting circuit, and the third pin of the processor U1 is connected to the receiving circuit. The input terminal of the power supply regulator circuit is connected to an external power source, and the output terminal of the power supply regulator circuit is connected to the fourth pin of the processor U1, the Hall switch adjustment circuit, and the receiving circuit, respectively.
[0005] Furthermore, the Hall switch adjustment circuit is used to send a level signal to the main control circuit after the target object is placed at a preset position and a magnet is detected; the main control circuit is used to cause the transmitting circuit to emit a first light signal after receiving the level signal; the receiving circuit is used to receive a second light signal reflected back by the target object, convert the second light signal into a first voltage signal, and amplify the first voltage signal to obtain a second voltage signal; the main control circuit is also used to set the detection distance range of the photoelectric sensor according to the second voltage signal.
[0006] Furthermore, the main control circuit also includes a resistor R26 and a capacitor C17. The fourth pin of the processor U1 is connected to the output terminal of the power supply regulator circuit through the resistor R26, and the two ends of the capacitor C17 are connected to the fifth pin and the sixth pin of the processor U1, respectively.
[0007] Furthermore, the Hall switch regulating circuit includes a Hall switch U11 and a capacitor C25. The input terminal of the Hall switch U11 is connected to the output terminal of the power supply regulator circuit, the output terminal of the Hall switch U11 is connected to the first pin of the processor U1, the output terminal of the Hall switch U11 is also connected to the first terminal of the capacitor C25, and the second terminal of the capacitor C25 is grounded.
[0008] Furthermore, the photoelectric sensor detection distance setting circuit also includes an analog switch control circuit, which includes an analog switch U8 and a capacitor C22. The first end of the analog switch U8 is connected to the third pin of the processor U1, the second end of the analog switch U8 is connected to the receiving circuit, the first end of the capacitor C22 is connected to the third end of the analog switch U8, and the second end of the capacitor C22 is grounded.
[0009] Furthermore, the receiving circuit includes an operational amplifier U6A, a resistor R9, a capacitor C6, and a photodiode D8; the first terminal of the photodiode D8 is connected to the output terminal of the power supply regulator circuit, the second terminal of the photodiode D8 is connected to the first terminal of the capacitor C6, the second terminal of the capacitor C6 is connected to the first terminal of the resistor R9, the second terminal of the resistor R9 is connected to the first input terminal of the operational amplifier U6A, and the second input terminal of the operational amplifier U6A is connected to the output terminal of the power supply regulator circuit.
[0010] Furthermore, the transmitting circuit includes a laser diode D4, a transistor Q2, resistors R6, R17, and R19. The first terminal of the laser diode D4 is connected to the power supply regulator circuit through the resistor R6, the second terminal of the laser diode D4 is connected to the first terminal of the transistor Q2, the second terminal of the transistor Q2 is grounded through the resistor R19, and the third terminal of the transistor Q2 is connected to the second pin of the processor U1 through the resistor R17.
[0011] Furthermore, the photoelectric sensor detection distance setting circuit also includes an output circuit, which includes resistors R32 and R33 and transistor Q3A. The first terminal of transistor Q3A is connected to the seventh pin of processor U1 through resistor R33, and the second terminal of transistor Q3A is grounded through resistor R32.
[0012] Furthermore, the photoelectric sensor detection distance setting circuit also includes an indicator circuit, which includes a light-emitting diode D10, a light-emitting diode D11, a resistor R45, and a resistor R46. The first end of the light-emitting diode D11 is connected to the eighth pin of the processor U1, and the second end of the light-emitting diode D11 is grounded through the resistor R46. The first end of the light-emitting diode D10 is connected to the ninth pin of the processor U1, and the second end of the light-emitting diode D10 is grounded through the resistor R45.
[0013] Furthermore, the power supply voltage regulator circuit includes a voltage regulator chip U9 and a capacitor C21. The input terminal of the voltage regulator chip U9 is connected to the external power supply, the output terminal of the voltage regulator chip U9 is connected to the first terminal of the capacitor C21, and the second terminal of the capacitor C21 is grounded.
[0014] The beneficial effects of this utility model are as follows: By connecting the first pin of the processor U1 to the Hall switch adjustment circuit, the second pin of the processor U1 to the transmitting circuit, and the third pin of the processor U1 to the receiving circuit; the input terminal of the power supply regulator circuit is connected to an external power supply, and the output terminal of the power supply regulator circuit is connected to the fourth pin of the processor U1, the Hall switch adjustment circuit, and the receiving circuit respectively; when the Hall switch adjustment circuit does not detect a magnet, its output is low level; when it is necessary to set the detection distance range of the photoelectric sensor, after placing the target object at a preset position, the Hall switch adjustment circuit outputs a high-level signal; after receiving the high-level signal, the main control circuit causes the transmitting circuit to emit a first light signal; the receiving circuit receives the second light signal reflected back from the target object, converts the second light signal into a first voltage signal, and amplifies the first voltage signal to obtain a second voltage signal; after receiving the second voltage signal, the main control circuit sets the detection distance range of the photoelectric sensor according to the second voltage signal; the detection distance of the photoelectric sensor can be easily adjusted, saving debugging time and cost, and realizing the rapid setting of the detection distance of the photoelectric sensor. Attached Figure Description
[0015] Figure 1 This is a first structural schematic diagram of the photoelectric sensor detection distance setting circuit provided in an embodiment of the present invention.
[0016] Figure 2 The circuit diagram of the main control circuit provided in the embodiment of this utility model.
[0017] Figure 3 The circuit diagram of the Hall switch adjustment circuit provided in the embodiment of this utility model.
[0018] Figure 4The circuit diagram of the analog switch control circuit provided in the embodiment of this utility model.
[0019] Figure 5 The circuit diagram of the receiving circuit provided in the embodiment of this utility model.
[0020] Figure 6 The circuit diagram of the transmitting circuit provided in the embodiment of this utility model.
[0021] Figure 7 The circuit diagram of the output circuit provided in the embodiment of this utility model.
[0022] Figure 8 The circuit diagram of the power supply regulator circuit provided in the embodiment of this utility model.
[0023] Figure 9 The circuit diagram of the power supply regulator circuit provided in the embodiment of this utility model. Detailed Implementation
[0024] The technical solutions of the present utility model will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present utility model, and not all of them. Based on the embodiments of the present utility model, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present utility model.
[0025] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the present invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0026] Figure 1 This is a schematic diagram of the photoelectric sensor detection distance setting circuit according to an embodiment of the present invention. It should be noted that, if substantially the same result is obtained, the photoelectric sensor detection distance setting circuit of the present invention is not based on... Figure 1 The structures shown are limited. For example... Figure 1 As shown, the photoelectric sensor detection distance setting circuit includes a main control circuit 11, a Hall switch adjustment circuit 12, a transmitting circuit 13, a receiving circuit 14, and a power supply regulator circuit 15. The main control circuit 11 includes a processor U1. The first pin of the processor U1 is connected to the Hall switch adjustment circuit 12, the second pin of the processor U1 is connected to the transmitting circuit 13, and the third pin of the processor U1 is connected to the receiving circuit 14. The input terminal of the power supply regulator circuit 15 is connected to an external power supply, and the output terminal of the power supply regulator circuit 15 is connected to the fourth pin of the processor U1, the Hall switch adjustment circuit 12, and the receiving circuit 14, respectively.
[0027] In some embodiments, the Hall switch adjustment circuit 12 is used to send a level signal to the main control circuit 11 after the target object is placed at a preset position and a magnet is detected; the main control circuit 11 is used to cause the transmitting circuit 13 to emit a first light signal after receiving the level signal; the receiving circuit 14 is used to receive a second light signal reflected back by the target object, convert the second light signal into a first voltage signal and amplify the first voltage signal to obtain a second voltage signal, and the main control circuit 11 is also used to set the detection distance range of the photoelectric sensor according to the second voltage signal.
[0028] In one specific embodiment, when the Hall switch adjustment circuit 12 does not detect a magnet, its output is low. When it is necessary to set the detection distance range of the photoelectric sensor, the target object is placed at a preset position. For example, to set the detection distance range of the photoelectric sensor to within 10cm, the target object can be placed 10cm away from the photoelectric sensor. Then, the magnet is placed at a position that the Hall switch adjustment circuit 12 can sense. The Hall switch adjustment circuit 12 outputs a high-level signal. After receiving the high-level signal, the main control circuit 11 causes the transmitting circuit 13 to emit a first light signal. The receiving circuit 14 receives the second light signal reflected back from the target object, converts the second light signal into a first voltage signal, and amplifies the first voltage signal to obtain a second voltage signal. The main control circuit 11 receives the second... The detection distance range of the photoelectric sensor is set based on the second voltage signal. Specifically, the main control circuit 11 can set a voltage threshold based on the second voltage signal to set the detection distance range of the photoelectric sensor. If the voltage signal received by the main control circuit 11 is less than the voltage threshold, it means that the target object is not within the detection distance range; otherwise, it is within the detection range. For example, if the voltage value of the second voltage signal is 3V and the voltage threshold is set to 2.9V, and the voltage value of the next voltage signal received by the main control circuit 11 is 2.8V, it means that the target object is not within the detection distance range. If the voltage value of the second voltage signal is 3V and the voltage threshold is set to 2.9V, and the voltage value of the next voltage signal received by the main control circuit 11 is 3.1V, it means that the target object is within the detection distance range.
[0029] In some embodiments, the main control circuit 11 further includes a resistor R26 and a capacitor C17. The fourth pin of the processor U1 is connected to the output terminal of the power supply regulator circuit 15 through the resistor R26, and the two ends of the capacitor C17 are connected to the fifth pin and the sixth pin of the processor U1, respectively.
[0030] In one specific embodiment, the processor U1 can be a microcontroller unit, and the circuit schematic of the main control circuit 11 is as follows: Figure 2 As shown, the PA6, PC1, PB4, PA0, VDD, GND, PB2, PB0, and PB1 pins of processor U1 correspond to the first, second, third, fourth, fifth, sixth, seventh, eighth, and ninth pins, respectively; the VDD pin can also be connected to the output of the power supply regulator circuit 15.
[0031] In some embodiments, the Hall switch regulating circuit 12 includes a Hall switch U11 and a capacitor C25. The input terminal of the Hall switch U11 is connected to the output terminal of the power supply regulator circuit 15, the output terminal of the Hall switch U11 is connected to the first pin of the processor U1, the output terminal of the Hall switch U11 is also connected to the first terminal of the capacitor C25, and the second terminal of the capacitor C25 is grounded.
[0032] In one specific embodiment, the circuit diagram of the Hall switch regulating circuit 12 is as follows: Figure 3 As shown, when the Hall switch does not detect a magnet, the output of the Hall switch adjustment circuit 12 is low, for example, the voltage value is 0V. When the Hall switch detects a magnet, the output of the Hall switch adjustment circuit 12 is high, for example, the voltage value is 5V. At this time, the main control circuit 11 enters the detection distance setting mode.
[0033] In some embodiments, the photoelectric sensor detection distance setting circuit further includes an analog switch control circuit, which includes an analog switch U8 and a capacitor C22. The first end of the analog switch U8 is connected to the third pin of the processor U1, the second end of the analog switch U8 is connected to the receiving circuit 14, the first end of the capacitor C22 is connected to the third end of the analog switch U8, and the second end of the capacitor C22 is grounded.
[0034] In one specific embodiment, the circuit schematic of the analog switch control circuit is as follows: Figure 4As shown, the fourth terminal of analog switch U8 is connected to pin PA2 of processor U1. Analog switch U8 is normally open to avoid external signal interference with main control circuit 11. When Hall switch adjustment circuit 12 outputs a high-level signal, main control circuit 11 receives the high-level signal and causes transmitter circuit 13 to emit the first optical signal. At the same time, analog switch U8 is turned on, allowing the second voltage signal to enter main control circuit 11.
[0035] In some embodiments, the receiving circuit 14 includes an operational amplifier U6A, a resistor R9, a capacitor C6, and a photodiode D8; the first terminal of the photodiode D8 is connected to the output terminal of the power supply regulator circuit 15, the second terminal of the photodiode D8 is connected to the first terminal of the capacitor C6, the second terminal of the capacitor C6 is connected to the first terminal of the resistor R9, the second terminal of the resistor R9 is connected to the first input terminal of the operational amplifier U6A, and the second input terminal of the operational amplifier U6A is connected to the output terminal of the power supply regulator circuit 15.
[0036] In one specific embodiment, the circuit schematic of the receiving circuit 14 is as follows: Figure 5 As shown, after receiving the second optical signal, photodiode D8 converts it into an electrical signal. Due to the effect of resistor R11, a first voltage signal can be formed. After filtering, the first voltage signal is amplified by operational amplifier U6A to obtain the second voltage signal.
[0037] In one specific embodiment, the receiving circuit 14 further includes resistors R8 and R13, capacitors C7 and C9. The second terminal of the analog switch U8 is connected to the output terminal of the operational amplifier U6A through the resistor R8. The first terminal of the capacitor C7 is connected to the second terminal of the analog switch U8, and the second terminal of the capacitor C7 is grounded. The two ends of the resistor R13 are connected to the first input terminal and the output terminal of the operational amplifier U6A, respectively. The capacitor C9 is connected in parallel with the resistor R13.
[0038] In one specific embodiment, the first voltage signal is filtered, amplified by operational amplifier U6A, and then filtered by capacitor C7 to obtain the second voltage signal.
[0039] In some embodiments, the transmitting circuit 13 includes a laser diode D4, a transistor Q2, resistors R6, R17, and R19. The first terminal of the laser diode D4 is connected to the power supply regulator circuit 15 through the resistor R6. The second terminal of the laser diode D4 is connected to the first terminal of the transistor Q2. The second terminal of the transistor Q2 is grounded through the resistor R19. The third terminal of the transistor Q2 is connected to the second pin of the processor U1 through the resistor R17.
[0040] In one specific embodiment, the circuit schematic of the transmitting circuit 13 is as follows: Figure 6 As shown, after receiving a high-level signal, the main control circuit 11 causes the laser diode D4 of the transmitting circuit 13 to emit a first optical signal.
[0041] In some embodiments, the photoelectric sensor detection distance setting circuit further includes an output circuit, which includes resistors R32 and R33 and transistor Q3A. The first terminal of transistor Q3A is connected to the seventh pin of processor U1 through resistor R33, and the second terminal of transistor Q3A is grounded through resistor R32.
[0042] In one specific embodiment, the circuit schematic of the output circuit is as follows: Figure 7 As shown, the output circuit also includes a fuse and a varistor RV2. The second terminal of the transistor Q3A is grounded through the fuse, the first terminal of the varistor RV2 is connected to the third terminal of the transistor Q3A, and the second terminal of the varistor RV2 is grounded. Figure 7 The OUT pin of the output circuit can be connected to the client. When the main control circuit 11 sets the voltage threshold according to the second voltage signal to set the detection distance range of the photoelectric sensor, it inputs a high level to the output circuit, and the OUT pin of the output circuit outputs a low level to the client, allowing the client to recognize that the target object is within the detection distance range. When the voltage signal received by the main control circuit 11 is greater than the voltage threshold, the OUT pin of the output circuit also outputs a low level to the client, indicating that the target object is within the detection distance range, and the client can notify the user that the detection distance setting is complete.
[0043] In some embodiments, the photoelectric sensor detection distance setting circuit further includes an indicator circuit, which includes a light-emitting diode D10, a light-emitting diode D11, a resistor R45, and a resistor R46. The first terminal of the light-emitting diode D11 is connected to the eighth pin of the processor U1, and the second terminal of the light-emitting diode D11 is grounded through the resistor R46. The first terminal of the light-emitting diode D10 is connected to the ninth pin of the processor U1, and the second terminal of the light-emitting diode D10 is grounded through the resistor R45.
[0044] In one specific embodiment, the circuit schematic of the indicator circuit is as follows: Figure 8As shown, LED D10 emits red light (i.e., LED D10 is a red light), and LED D11 emits green light (i.e., LED D11 is a green light). After placing the target object in the preset position, the magnet is placed in a position that the Hall switch adjustment circuit 12 can sense. The Hall switch adjustment circuit 12 outputs a high-level signal. After receiving the high-level signal, the main control circuit 11 causes the transmitting circuit 13 to emit a first light signal. The receiving circuit 14 receives the second light signal reflected back from the target object, converts the second light signal into a first voltage signal, and amplifies the first voltage signal to obtain a second voltage signal. After receiving the second voltage signal, the main control circuit 11 sets the detection distance range of the photoelectric sensor according to the second voltage signal. The main control circuit 11 can make the green light of the indicator circuit flash three times to indicate to the user that the detection distance setting is successful. After the detection distance is successfully set, the magnet is removed. If the magnet is removed during the setting process or the set distance exceeds the range of the photoelectric sensor, the main control circuit 11 will make the red light flash three times to indicate to the user that the setting has failed.
[0045] In some embodiments, the power supply regulator circuit 15 includes a voltage regulator chip U9 and a capacitor C21. The input terminal of the voltage regulator chip U9 is connected to the external power supply, the output terminal of the voltage regulator chip U9 is connected to the first terminal of the capacitor C21, and the second terminal of the capacitor C21 is grounded.
[0046] In one specific embodiment, the circuit schematic of the power supply regulator circuit 15 is as follows: Figure 9 As shown, the power supply regulator circuit 15 can receive the voltage provided by the external power supply and convert the voltage into the required voltage, for example, converting 24V voltage into 5V voltage, thereby supplying power to the Hall switch regulation circuit 12 and the receiving circuit 14 of the processor U1.
[0047] It should be noted that the above Figures 2-9 Pins with the same name in the middle indicate that they can be connected.
[0048] The photoelectric sensor detection distance setting circuit provided by this utility model connects the first pin of the processor U1 to the Hall switch adjustment circuit 12, the second pin of the processor U1 to the transmitting circuit 13, and the third pin of the processor U1 to the receiving circuit 14; the input terminal of the power supply regulator circuit 15 is connected to an external power supply, and the output terminal of the power supply regulator circuit 15 is connected to the fourth pin of the processor U1, the Hall switch adjustment circuit 12, and the receiving circuit 14 respectively; when the Hall switch adjustment circuit 12 does not detect a magnet, its output is low; when it is necessary to set the detection distance of the photoelectric sensor... When the target object is placed at a preset position, the Hall switch adjustment circuit 12 outputs a high-level signal. After receiving the high-level signal, the main control circuit 11 causes the transmitting circuit 13 to emit a first light signal. The receiving circuit 14 receives the second light signal reflected back from the target object, converts the second light signal into a first voltage signal, and amplifies the first voltage signal to obtain a second voltage signal. After receiving the second voltage signal, the main control circuit 11 sets the detection distance range of the photoelectric sensor according to the second voltage signal. The detection distance of the photoelectric sensor can be easily adjusted, saving debugging time and cost, and realizing the rapid setting of the detection distance of the photoelectric sensor.
[0049] The photoelectric sensor detection distance setting circuit provided by this utility model allows the target object to be placed at a preset position. A magnetic rod (magnet) can then be placed in the preset area (the position that the Hall switch adjustment circuit 12 can sense). The Hall switch adjustment circuit 12 outputs a high-level signal. Upon receiving the high-level signal, the main control circuit 11 causes the transmitting circuit 13 to emit a first light signal. The receiving circuit 14 receives the second light signal reflected back from the target object, converts the second light signal into a first voltage signal, and amplifies the first voltage signal to obtain a second voltage signal. After receiving the second voltage signal, the main control circuit 11 sets the detection distance range of the photoelectric sensor based on the second voltage signal. This causes the green light of the indicator circuit to flash three times, prompting the user to complete the setting of the detection distance without needing to adjust the knob. The Hall switch adjustment circuit 12 can sense magnetic objects as small as 1mm. Even if the space between the photoelectric sensor and the top of the device is only 1mm or more, the distance can still be set, making it very convenient to adjust the photoelectric sensor detection distance and saving adjustment time. The photoelectric sensor detection distance setting circuit provided by this utility model eliminates the knob, saving on raw material production and assembly time costs. Existing products with knobs typically use waterproof rubber rings to cover the knobs for waterproofing. However, inconsistent production and assembly, aging of the rubber rings, and the influence of the customer's environment can all lead to a decrease in the protection level, thereby reducing product performance. The photoelectric sensor detection distance setting circuit provided by this utility model eliminates the need for a knob, which can greatly improve the protection level.
[0050] The above description is merely an embodiment of this utility model. It should be noted that those skilled in the art can make improvements without departing from the inventive concept of this utility model, but these improvements all fall within the protection scope of this utility model.
Claims
1. A photoelectric sensor detection distance setting circuit, characterized in that, It includes a main control circuit, a Hall switch adjustment circuit, a transmitting circuit, a receiving circuit, and a power supply voltage regulator circuit. The main control circuit includes a processor U1. The first pin of the processor U1 is connected to the Hall switch adjustment circuit, the second pin of the processor U1 is connected to the transmitting circuit, and the third pin of the processor U1 is connected to the receiving circuit. The input terminal of the power supply regulator circuit is connected to an external power source, and the output terminal of the power supply regulator circuit is connected to the fourth pin of the processor U1, the Hall switch adjustment circuit, and the receiving circuit, respectively.
2. The photoelectric sensor detection distance setting circuit according to claim 1, characterized in that, The Hall switch adjustment circuit is used to send a level signal to the main control circuit after the target object is placed at a preset position and a magnet is detected. The main control circuit is used to cause the transmitting circuit to transmit a first optical signal after receiving the level signal; The receiving circuit is used to receive the second light signal reflected back by the target object, convert the second light signal into a first voltage signal, and amplify the first voltage signal to obtain a second voltage signal. The main control circuit is also used to set the detection distance range of the photoelectric sensor according to the second voltage signal.
3. The photoelectric sensor detection distance setting circuit according to claim 1, characterized in that, The main control circuit also includes a resistor R26 and a capacitor C17. The fourth pin of the processor U1 is connected to the output terminal of the power supply regulator circuit through the resistor R26, and the two ends of the capacitor C17 are connected to the fifth pin and the sixth pin of the processor U1, respectively.
4. The photoelectric sensor detection distance setting circuit according to claim 1, characterized in that, The Hall switch regulation circuit includes a Hall switch U11 and a capacitor C25. The input terminal of the Hall switch U11 is connected to the output terminal of the power supply regulator circuit, and the output terminal of the Hall switch U11 is connected to the first pin of the processor U1. The output terminal of the Hall switch U11 is also connected to the first terminal of the capacitor C25, and the second terminal of the capacitor C25 is grounded.
5. The photoelectric sensor detection distance setting circuit according to claim 1, characterized in that, The photoelectric sensor detection distance setting circuit also includes an analog switch control circuit, which includes an analog switch U8 and a capacitor C22. The first end of the analog switch U8 is connected to the third pin of the processor U1, the second end of the analog switch U8 is connected to the receiving circuit, the first end of the capacitor C22 is connected to the third end of the analog switch U8, and the second end of the capacitor C22 is grounded.
6. The photoelectric sensor detection distance setting circuit according to claim 5, characterized in that, The receiving circuit includes an operational amplifier U6A, a resistor R9, a capacitor C6, and a photodiode D8. The first terminal of the photodiode D8 is connected to the output terminal of the power supply regulator circuit, the second terminal of the photodiode D8 is connected to the first terminal of the capacitor C6, the second terminal of the capacitor C6 is connected to the first terminal of the resistor R9, the second terminal of the resistor R9 is connected to the first input terminal of the operational amplifier U6A, and the second input terminal of the operational amplifier U6A is connected to the output terminal of the power supply regulator circuit.
7. The photoelectric sensor detection distance setting circuit according to claim 6, characterized in that, The transmitting circuit includes a laser diode D4, a transistor Q2, resistors R6, R17, and R19. The first terminal of the laser diode D4 is connected to the power supply regulator circuit through the resistor R6. The second terminal of the laser diode D4 is connected to the first terminal of the transistor Q2. The second terminal of the transistor Q2 is grounded through the resistor R19. The third terminal of the transistor Q2 is connected to the second pin of the processor U1 through the resistor R17.
8. The photoelectric sensor detection distance setting circuit according to claim 1, characterized in that, The photoelectric sensor detection distance setting circuit also includes an output circuit, which includes resistors R32 and R33 and transistor Q3A. The first terminal of transistor Q3A is connected to the seventh pin of processor U1 through resistor R33, and the second terminal of transistor Q3A is grounded through resistor R32.
9. The photoelectric sensor detection distance setting circuit according to claim 1, characterized in that, The photoelectric sensor detection distance setting circuit also includes an indicator circuit, which includes a light-emitting diode D10, a light-emitting diode D11, a resistor R45, and a resistor R46. The first end of the light-emitting diode D11 is connected to the eighth pin of the processor U1, and the second end of the light-emitting diode D11 is grounded through the resistor R46. The first end of the light-emitting diode D10 is connected to the ninth pin of the processor U1, and the second end of the light-emitting diode D10 is grounded through the resistor R45.
10. The photoelectric sensor detection distance setting circuit according to claim 1, characterized in that, The power supply regulator circuit includes a voltage regulator chip U9 and a capacitor C21. The input terminal of the voltage regulator chip U9 is connected to the external power supply, the output terminal of the voltage regulator chip U9 is connected to the first terminal of the capacitor C21, and the second terminal of the capacitor C21 is grounded.