Simple operation collector for multipath alternating current signals
By designing a multi-channel AC signal simple operation collector, using a microcontroller and optocoupler to realize serial port parameter visualization and AC220V power supply status monitoring, the problem of unintuitive serial port parameter identification and limited acquisition paths in mains power detection is solved, and the operation efficiency and reliability of the equipment are improved.
Patent Information
- Application Number
- CN202411693816.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-04-11
AI Technical Summary
In the current technology, in the municipal power detection, there are problems such as unintuitive serial port parameter identification, difficulty in detecting equipment communication abnormalities, and limited collection paths.
A multi-channel AC signal simple operation collector is designed, using a single-chip microcomputer, optocoupler, drive resistor, RS485 transceiver and external dial switch to realize the visualization of serial communication parameters, and real-time monitoring of AC220V power supply status through timer and interrupt processing program.
It solves the problem of unintuitive serial port parameter recognition, realizes intuitive viewing of equipment communication status, supports 24-channel power acquisition, and improves the operating efficiency and reliability of equipment.
Smart Images

Figure HDA0005151635540000011
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of AC signal collection, and in particular to a multi-channel AC signal simple-operation collector. Background Art
[0002] With the development of today's society, people have made extensive use of electric energy, so it is very important to ensure the safety of electricity use. Therefore, the mains detection technology is needed to collect and detect the voltage. The current technology requires the computer to actively find the serial port parameters, which cannot be identified intuitively. The number of mains circuits detected is relatively limited. In places where the 485 communication environment is relatively complex, the signal may be subject to relatively large interference, resulting in abnormal communication. At this time, if the device needs to use a computer to read the serial port parameters, there is no way to judge whether the serial port parameters are wrong or the device has a problem in a more intuitive way. Secondly, when the device is communicating, it is impossible to see whether there is data interaction. In this way, if you are inspecting, you cannot intuitively check whether the device is communicating normally. Summary of the invention
[0003] In order to overcome the above-mentioned defects of the prior art, the present invention provides a multi-channel AC signal simple-operation collector, which has the advantage of visualization of serial port communication parameters. The current serial port parameters can be viewed directly by dialing codes, thus solving the problem of needing to use a computer to query serial port parameters.
[0004] In order to achieve the above-mentioned invention object, the present invention provides a multi-channel AC signal simple operation collector, including a single-chip microcomputer, a photoelectric coupler, a driving resistor, an RS485 transceiver and an external dip switch for setting a communication address and a communication baud rate, wherein the photoelectric coupler is connected to a digital signal acquisition interface of the single-chip microcomputer, the driving resistor is electrically connected to the photoelectric coupler, the driving resistor is electrically connected to AC220V, the external dip switch is connected to a GPIO pin of the single-chip microcomputer, the RS485 transceiver is connected to a universal asynchronous receiver / transmitter transmission interface of the single-chip microcomputer, and the single-chip microcomputer includes a 24-channel digital signal acquisition interface.
[0005] Furthermore, the voltage detection method of the collector includes: when the AC220V power supply is normally supplied, both the positive half-cycle and the negative half-cycle of the alternating current will cause the light-emitting diode of the photoelectric coupler to be turned on and emit light, and the phototransistor of the photoelectric coupler is turned on after receiving the light, so that the output end presents a high level; when the AC220V power supply is disconnected, the light-emitting diode of the photoelectric coupler does not emit light, the phototransistor of the photoelectric coupler does not conduct, and the output end presents a low level;
[0006] The single-chip microcomputer monitors the output state of the phototransistor of the photocoupler through an interrupt pin. When the output state changes, that is, from a high level to a low level or from a low level to a high level, the interrupt processing program of the single-chip microcomputer will be triggered, thereby realizing real-time monitoring of the AC220V power supply state.
[0007] Furthermore, the method for determining the driving resistance is as follows:
[0008] Confirmation of rated power, calculation of voltage value after full-wave rectification. After rectification, due to the conduction voltage drop of the diode, the output voltage peak value (V_{o(p)}) is VP-2*(V_{D}); where (V_{D}) is the conduction voltage drop of the diode, which is 0.7V. For a full-wave rectifier circuit, the average value of the output voltage is:
[0009] (V_{o(avg)})=2 / π*{VP-2*(V_{D})}
[0010] When 220V AC is input, the actual rectified average value is 198V. The rated power of the driving resistor can be determined based on the actual working current and the above average voltage. In combination with actual applications, the loop driving resistor can be designed to be two or more resistors with equal resistance in series to facilitate calculation. Do not blindly select a large resistance value. It is necessary to ensure that the loop current after the resistance value is selected meets the primary drive requirements of the optocoupler, and can ensure that the optocoupler can fully realize the level flip when 220V input comes in.
[0011] Furthermore, it also includes a timer, which sets a time and triggers an interrupt at a certain time interval, then collects the IO status of the microcontroller once and stores it in an array, and then traverses this two-dimensional array in the main loop. If a specified number of conditions are met, it proves that there is AC power access. If the conditions are not met or the number of conditions met is less than the specified number, it is defined as interference and it is judged that there is no AC power access. Then, the level change of the IO port is obtained by judging the state of the dial code, and the corresponding serial port parameters are changed by reading this level change.
[0012] Compared with the prior art, the present invention has the following beneficial effects:
[0013] The collector of this application does not require manual judgment of whether there is strong power access. When the serial port parameters are not remembered, the parameters can be directly judged by dialing the code without connecting to the computer to read the parameters. When there are many routes to be judged, the device of this application only needs one device, unlike other devices with fewer judgment routes. When the device communicates, there will be an indicator light display, which can speed up the troubleshooting when the device cannot communicate. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] Figure 1A schematic block diagram of an embodiment of the present invention. DETAILED DESCRIPTION
[0015] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the invention, rather than all the embodiments. The embodiments of the present invention are described below in conjunction with the drawings.
[0016] In today's society, people have made extensive use of electric energy, so it is very important to ensure the safety of electricity use. Therefore, we have designed a multi-channel AC signal simple operation collector for mains power detection technology. Compared with other devices, our device has the advantage of visualization of serial port communication parameters. You can directly view the current serial port parameters by dialing the code, which solves the problem of needing to use a computer to query the serial port parameters. Secondly, we have a visualized mains power detection. When the mains power is connected, you can intuitively see that the indicator light is on, thus solving the problem of false touch. Finally, we have a multi-channel acquisition and fast detection mechanism. The device supports 24-channel mains power acquisition, which to a certain extent solves the problem of the number of acquisition channels caused by the interruption of the equipment on the market. The acquisition mechanism of the collector of this application is to collect the status of 24 channels at a time by setting a time period inside the timer at a corresponding time interval, and then store it in the main loop in the array. You only need to judge the array to get the current mains power status. This design prevents the device from reducing the number of detection channels due to interrupt limitations, and does not need to circulate the state of the acquisition device in the main loop. The main loop only needs to judge the state, which improves the operation efficiency of the device and increases the reliability of the device operation.
[0017] like Figure 1 As shown, a multi-channel AC signal simple operation collector includes a single-chip microcomputer, a photoelectric coupler, a driving resistor, an RS485 transceiver and an external dial switch for setting a communication address and a communication baud rate. The photoelectric coupler is connected to the digital signal acquisition interface of the single-chip microcomputer, the driving resistor is electrically connected to the photoelectric coupler, the driving resistor is electrically connected to AC220V, the external dial switch is connected to the GPIO pin of the single-chip microcomputer, the RS485 transceiver is connected to the universal asynchronous receiver and transmitter transmission interface of the single-chip microcomputer, and the single-chip microcomputer includes a 24-channel digital signal acquisition interface.
[0018] The collector of this application is powered by AC220V 50HZ mains electricity, supports 24-channel AC 165V~285V 50HZ signal collection, and can set the communication address and communication baud rate through external dial codes. Data transmission can be sent or received through RS485. This product can assist in voltage detection and reporting in places such as computer rooms and industrial sites, making it convenient for users to understand the on-site situation;
[0019] AC220V detection logic: When the external AC220V is disconnected, the microcontroller pin will receive a default and continuous low-level signal. DI AC220V acquisition principle: It consists of a light-emitting diode and a phototransistor. When the light-emitting diode is driven by an electrical signal, it will emit light, which is received by the phototransistor and converted into an electrical signal output. When the phototransistor receives light, it will generate electron-hole pairs, thereby forming a current to realize the transmission of electrical signals;
[0020] When 220v AC is turned on, the positive half cycle of AC will turn on the light emitting diode and emit light. After receiving the light, the phototransistor will turn on, causing the output end to show high voltage changes. The negative half cycle has the same driving principle as the positive cycle. After the microcontroller receives a waveform with high and low changes, it judges the change of signal level through the interrupt pin to identify the trigger. The 24-channel acquisition is an independent detection pin and does not affect each other.
[0021] The voltage detection method of the collector includes: when the AC220V power supply is normally supplied, both the positive half cycle and the negative half cycle of the alternating current will make the light-emitting diode of the photoelectric coupler conduct and emit light, and the photosensitive transistor of the photoelectric coupler conducts after receiving the light, so that the output end presents a high level; when the AC220V power supply is disconnected, the light-emitting diode of the photoelectric coupler does not emit light, the photosensitive transistor of the photoelectric coupler does not conduct, and the output end presents a low level;
[0022] The single-chip microcomputer monitors the output state of the phototransistor of the photocoupler through the interrupt pin. When the output state changes, that is, from a high level to a low level or from a low level to a high level, the interrupt processing program of the single-chip microcomputer will be triggered, thereby realizing real-time monitoring of the AC220V power supply status.
[0023] The driving resistance is determined as follows:
[0024] Confirmation of rated power, calculation of voltage value after full-wave rectification. After rectification, due to the conduction voltage drop of the diode, the output voltage peak value (V_{o(p)}) is VP-2*(V_{D}); where (V_{D}) is the conduction voltage drop of the diode. Due to the conduction voltage drop of the diode, (V_{D}) is 0.7V. For the full-wave rectifier circuit, the average value of the output voltage is:
[0025] (V_{o(avg)})=2 / π*{VP-2*(V_{D})}
[0026] When 220V AC is input, the actual average value obtained by rectification is 198V. Assuming that a resistor with a rated power of 1W is selected, the rated current of a single resistor can be calculated as I=0.005A based on P=U*I. In combination with actual applications, the loop resistor can be designed as two or more resistors with equal resistance in series. The advantages of doing so are: 1. The same resistance value is convenient for calculation. 2. The actual working current needs to be 1 / 10-1 / 20 or even smaller than the rated current of the power resistor. The purpose of doing so is to avoid the heating problem caused by the current usage ratio of the resistor under long-term work. The rated power of the driving resistor can be determined according to the actual working current and the above average voltage. Among them, in combination with actual applications, the loop driving resistor can be designed as two or more resistors with equal resistance in series to facilitate calculation. Do not blindly select a large resistance value. It is necessary to ensure that the loop current obtained after the resistance value is selected meets the requirements of the primary drive of the optocoupler, and can ensure that the optocoupler can fully realize the level flip when the 220V input comes in;
[0027] Selection of Optocoupler
[0028] Optocoupler (Optocoupler for short) is an electronic component that converts electrical signals into optical signals and then converts them back into electrical signals. It is widely used in signal isolation, noise suppression, circuit protection, etc. There are many factors to consider when choosing a suitable optocoupler, including but not limited to operating voltage, current, isolation capability, response speed, etc. The following are the main parameters and application scenarios that need to be considered when selecting an optocoupler:
[0029] 1.CTR:
[0030] CTR refers to the ratio of the current at the output of the optocoupler to the current at the input (LED). A high CTR means that a lower input current can drive the output; CTR is usually between 10% and 600%, and different types of optocouplers have different CTR ranges;
[0031] 2. Isolation Voltage:
[0032] Indicates the maximum voltage difference that the optocoupler can withstand, which is used to ensure electrical isolation between the input and output ends; typical isolation voltages can range from hundreds of volts to thousands of volts;
[0033] 3. Operating temperature range: Different types of optocouplers have different operating temperature ranges. When selecting, you need to ensure that the optocoupler can operate normally in the required working environment;
[0034] 4. Response speed: For applications that require high-speed switching, optocouplers with fast response speeds, such as microsecond or nanosecond response times, should be selected;
[0035] 5. Input / output characteristics: forward voltage (VF) and maximum allowable current (IF) of the LED at the input end; collector-emitter saturation voltage (VCE(sat)) and maximum collector current (IC) of the transistor or phototransistor at the output end;
[0036] Dip switch logic: Both the address dip switch and the baud rate dip switch use 0 / 1 to combine and change to realize functions in different states;
[0037] The collector also includes a timer, which sets a time and triggers an interrupt at a certain time interval. Then, the IO status of the microcontroller is collected and stored in an array. Then, this two-dimensional array is traversed in the main loop. If a specified number of conditions are met, it proves that there is AC power access. If the conditions are not met or the number of conditions met is less than the specified number, it is defined as interference and it is judged that there is no AC power access. Then, the level change of the IO port is obtained by judging the state of the dial code, and the corresponding serial port parameters are changed by reading this level change.
[0038] The collector of this application does not need to manually judge whether there is strong power access. When the serial port parameters are not remembered, it can be directly judged by dialing without connecting to a computer to read the parameters. When there are many routes to be judged, this device only needs one device, unlike other devices that have fewer routes to judge. When the device is communicating, there will be an indicator light to display, which can speed up the troubleshooting when the device cannot communicate.
[0039] The technical solution of the present invention is described above in conjunction with specific implementation methods, but it should be noted that the above descriptions are only for explaining the solution of the present invention and cannot be interpreted in any way as a specific limitation on the scope of protection of the invention. Based on the explanation here, those skilled in the art can think of other specific implementation methods or equivalent replacements of the present invention without creative work, and they will all fall within the scope of protection of the present invention.
Claims
1. A multi-channel AC signal simple operation collector, characterized in that: The invention comprises a single-chip microcomputer, a photoelectric coupler, a driving resistor, an RS485 transceiver and an external dial switch for setting a communication address and a communication baud rate. The photoelectric coupler is connected to a digital signal acquisition interface of the single-chip microcomputer, the driving resistor is electrically connected to the photoelectric coupler, the driving resistor is electrically connected to AC220V, the external dial switch is connected to a GPIO pin of the single-chip microcomputer, the RS485 transceiver is connected to a universal asynchronous receiver-transmitter transmission interface of the single-chip microcomputer, and the single-chip microcomputer comprises a 24-channel digital signal acquisition interface.
2. A multi-channel AC signal simple operation collector according to claim 1, characterized in that: The voltage detection method of the collector includes: when the AC220V power supply is normally supplied, both the positive half cycle and the negative half cycle of the alternating current will make the light-emitting diode of the photoelectric coupler conduct and emit light, and the photosensitive transistor of the photoelectric coupler conducts after receiving the light, so that the output end presents a high level; when the AC220V power supply is disconnected, the light-emitting diode of the photoelectric coupler does not emit light, the photosensitive transistor of the photoelectric coupler does not conduct, and the output end presents a low level; The single-chip microcomputer monitors the output state of the phototransistor of the photocoupler through an interrupt pin. When the output state changes, that is, from a high level to a low level or from a low level to a high level, the interrupt processing program of the single-chip microcomputer will be triggered, thereby realizing real-time monitoring of the AC220V power supply state.
3. A multi-channel AC signal simple operation collector according to claim 1, characterized in that: The method for determining the driving resistance is as follows: Confirmation of rated power, calculation of voltage value after full-wave rectification. After rectification, due to the conduction voltage drop of the diode, the output voltage peak value (V_{o(p)}) is VP-2*(V_{D}); where (V_{D}) is the conduction voltage drop of the diode, which is 0.7V. For a full-wave rectifier circuit, the average value of the output voltage is: (V_{o(avg)})=2 / π*{VP-2*(V_{D})} When 220V AC is input, the actual rectified average value is 198V. The rated power of the driving resistor can be determined based on the actual working current and the above average voltage. In combination with actual applications, the loop driving resistor can be designed to be two or more resistors with equal resistance in series to facilitate calculation. Do not blindly select a large resistance value. It is necessary to ensure that the loop current after the resistance value is selected meets the primary drive requirements of the optocoupler, and can ensure that the optocoupler can fully realize the level flip when 220V input comes in.
4. The multi-channel AC signal simple operation collector according to claim 1, characterized in that: It also includes a timer, which sets a time and triggers an interrupt at a certain time interval, then collects the IO status of the microcontroller once and stores it in an array, and then traverses this two-dimensional array in the main loop. If a specified number of conditions are met, it proves that there is AC power access. If the conditions are not met or the number of conditions met is less than the specified number, it is defined as interference and it is judged that there is no AC power access. Then, the level change of the IO port is obtained by judging the state of the dial code, and the corresponding serial port parameters are changed by reading this level change.