STM32-based assembly line infrared piece counter system
By designing a STM32-based assembly line infrared piece meter system, combined with multiple modules, the existing infrared counter functions are solved, and multifunctionalization and intelligence are realized, reducing costs and installation difficulties.
Patent Information
- Application Number
- CN202510106583.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-23
- Publication Date
- 2025-05-30
AI Technical Summary
The existing infrared counter has a single function, insufficient intelligence, high installation difficulty, high power consumption and high cost.
Design a pipeline infrared piece meter system based on STM32, combining infrared counter-angle sensors, OLED display modules, key input modules, Bluetooth modules and buzzer modules to form a multifunctional counter system to improve intelligence and human-computer interaction effects.
It realizes the multifunctionalization and intelligence of infrared counter systems, reduces system design costs, improves product stability, real-time performance and cost-effectiveness, simplifies the installation process, and supports long-distance control.
Smart Images

Figure CN120068914A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of automatic counters, and particularly to a pipeline infrared counting device system based on STM32. Background Art
[0002] With the progress of electronic technology and manufacturing, counters play a key role in digital systems. A counter consists of a basic counting unit and a control gate, and the counting unit is composed of flip-flops with information storage capabilities. These flip-flops ensure that the counter accurately counts when receiving a pulse signal, providing a basis for the stable operation of the digital system. At the same time, in order to solve the following problems: First, mechanical counters cannot meet the requirements of automated production due to their low degree of automation; Second, electronic counters consume more power and have higher costs because they require a large number of electronic components. Photoelectric counters have been proposed. They can not only achieve the counting function alone but also be combined with a single-chip microcomputer processing system to achieve multi-functional counting, improving the stability, real-time performance, cost performance of products, and saving costs. However, the infrared transmissive counter on the market currently emits infrared rays at the transmitting end, and the receiving end needs to be precisely aligned to work properly. Slight deviation during the installation process will cause it to fail, increasing the installation difficulty. In addition, existing infrared counters have a single function and insufficient intelligence. Therefore, it is necessary to add function modules to achieve diversified functions and better human-computer interaction effects. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to propose a pipeline infrared counting device system based on STM32 to solve the problems of single function and insufficient intelligence of existing infrared counters.
[0004] Based on the above purpose, the present invention provides a pipeline infrared counting device system based on STM32, including a core chip, an infrared transmissive sensor, an OLED display module, a key input module, a Bluetooth module, and a buzzer module. Connect the remaining five modules to the corresponding pins of the chip to form a counting device system, where:
[0005] The infrared transmissive sensor is used to convert the collected optical information into an electrical signal and then transmit it to the core chip. The OLED display module is used to receive the signal output by the core chip and display it.
[0006] Preferably, the core chip includes a single-chip microcomputer of the STM32-F4 series.
[0007] Preferably, the infrared transmissive sensor includes an infrared transmitting end and an infrared receiving end.
[0008] Preferably, the OLED display module includes a 0.96-inch OLED display screen with 4 pins, and the driving chip is SSD1306.
[0009] Preferably, the button input module includes a 4*4 matrix keyboard.
[0010] Preferably, the Bluetooth module includes HC-05 Bluetooth. The TX pin of the core chip is connected to the RX pin of the Bluetooth module, and the RX pin of the core chip is connected to the TX pin of the Bluetooth.
[0011] Preferably, the buzzer module is driven by a triode, and the buzzer module is triggered by a high level.
[0012] Advantages of the present invention:
[0013] 1. The combination of the infrared counter system and the STM32 single-chip microcomputer reduces the design cost of the system. Combining the advantages of the single-chip microcomputer itself improves the stability, real-time performance, cost performance of the product and saves costs.
[0014] 2. For the traditional infrared counter, in order to meet the application scenario of controlling the counter at a long distance, a Bluetooth module is added to realize the control of the counter system at a certain distance, which further improves the intelligence and multifunction of the infrared counter system. At the same time, adding a button module increases the functions of the counter system and improves the user experience. Description of the Drawings
[0015] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only those of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0016] Figure 1 It is the overall hardware circuit diagram of the embodiment of the present invention;
[0017] Figure 2 It is the circuit diagram of the receiving end and the transmitting end of the infrared transmissive sensor of the embodiment of the present invention;
[0018] Figure 3 It is the schematic diagram of the installation positions of the receiving end and the transmitting end of the infrared transmissive sensor of the embodiment of the present invention. Detailed Embodiments
[0019] In order to make the purpose, technical solutions and advantages of the present invention more clear, the following further details the present invention in combination with specific embodiments.
[0020] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention shall have the ordinary meanings understood by those with ordinary skills in the field to which the present invention pertains. The "first", "second" and similar terms used in the present invention do not denote any order, quantity or importance, but are only used to distinguish different components. Words such as "including" or "comprising" mean that the elements or objects appearing before this word cover the elements or objects listed after this word and their equivalents, without excluding other elements or objects. Words such as "connected" or "linked" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right", etc. are only used to indicate relative position relationships. When the absolute position of the object being described changes, the relative position relationship may also change accordingly.
[0021] As Figure 1 shown, the present invention provides a pipelined infrared counter system based on STM32. The system includes: an STM32-F4 series single-chip microcomputer, an infrared transmissive sensor, an OLED display module, a key input module, a Bluetooth module, and a buzzer module. Connecting the remaining five modules to the corresponding pins of the chip forms a counter system, which can achieve a variety of counting functions. Among them, the infrared transmissive sensor is responsible for collecting counting information. After the photocurrent is converted into an electrical signal and processed by the single-chip microcomputer, the counting information is displayed on the OLED screen; through the control and selection of the keys, the system enters different function modes. For example, setting the fault alarm quantity, clearing the count, querying the last count number, and turning off the fault alarm. When the counting quantity reaches the preset counting quantity, the buzzer generates an alarm; finally, the Bluetooth module realizes remote control of the counter system.
[0022] The specific model of the STM32-F4 series single-chip microcomputer is STM32F407VET6, which includes a power supply circuit, a clock circuit, a debugging and downloading circuit, a reset circuit, and an STM32 chip. The power supply system has two power supply methods. One is to input 5V voltage through the USB interface and convert it into 3.3V voltage, and the other is to directly connect 3.3V voltage through the SW downloader interface. The reset circuit consists of a key switch. Pressing the key performs a reset operation. When the system is running, STM32 can be connected to two crystal oscillators as clock sources, namely a high-speed external clock source and a low-speed external clock source. The crystal oscillator circuit is composed of capacitors and resistors to assist the crystal in generating a stable sine wave. The STM32 chip serves as the main control board to connect each sub-module to itself, thus forming a complete counter system.
[0023] The infrared pair - emission sensor is installed by screwing. Before installation, it is calibrated and measured to ensure that the receiving end and the transmitting end of the infrared pair - emission sensor are on the same straight line, ensuring the stable progress of counting. The infrared transmitting end includes resistor R1, resistor R2, triode Q1, and diode D1. One end of resistor R1 is connected to the 5V power supply, and the other end is connected to the collector of triode Q1. Resistor R2 is connected to the base of triode Q1. One end of diode D1 is connected to the emitter of triode Q1, and the other end is grounded. The infrared receiving end includes resistor R3, resistor R4, resistor R5, resistor R6, resistor R7, diode D2, and voltage comparator U1. Resistor R3 and diode D1 are in series. One end of R3 is connected to the 5V power supply, and the other end of D1 is connected to the ground. Resistor R4 and resistor R6 are in series. One end of R4 is connected to the 5V power supply, and the other end of R6 is connected to the ground. The 1st pin of voltage comparator U1 is connected to resistor R7, and the other end of resistor R7 is connected to the PB9 pin of the single - chip microcomputer.
[0024] The OLED display module uses a four - pin display screen. The 4 - pin connection method is to connect its GND to the GND of the single - chip microcomputer, VCC to the 3.3V of the single - chip microcomputer, the SCL pin to the PE2 pin of the single - chip microcomputer, and the SDA pin to the PE3 pin of the single - chip microcomputer. Its working principle is that during the driving process of the OLED screen, it is necessary to realize the functions of reading and writing commands and data, and perform the initialization of the OLED. The ultimate goal is to write data to a specific position on the OLED. First, prepare the data to be written to the SSD1306 in the memory of the STM32. These data are usually in bytes. The STM32 single - chip microcomputer writes the data into the internal GRAM of the SSD1306 (used to store the data to be displayed). After all the data is written, the SSD1306 processes these data to realize the OLED display.
[0025] The button input module has a total of 8 pins, including four column pins: column 0, column 1, column 2, column 3, and four row pins: row 0, row 1, row 2, row 3. Connect row 0, row 1, row 2, row 3 to the PA0 - PA3 pins of the chip, and column 0, column 1, column 2, column 3 to the PA4 - PA7 pins of the chip. Specifically, the button input module mainly has the following function selections: 1) Input the system password; 2) Complete the count clearing; 3) Query the previous counting number; 4) Set the fault alarm quantity; 5) Turn off the fault alarm.
[0026] For the described Bluetooth module, after completing the hardware connection, use a mobile phone to search for Bluetooth devices, enter the corresponding pairing password, and finally complete the connection between the mobile phone and the Bluetooth. During information transmission, the transmitter TX sends data to the microcontroller. The microcontroller processes the input level and then receives the data to execute corresponding functions. After the wiring is completed, use the corresponding Bluetooth debugging assistant to connect to HC-05 and perform the following steps to implement the functions of the Bluetooth module; Initialization settings: At the beginning of the program, it is necessary to perform initialization settings on the HC-05 Bluetooth module, including setting parameters such as baud rate, working mode, and pairing password. Data transmission: Once the HC-05 Bluetooth module is initialized, data transmission can start. In the STM32 program, corresponding code needs to be written to process the data received from HC-05 and send data to HC-05, and relevant code for serial communication configuration and data processing needs to be completed. Error handling: It is necessary to ensure the generation and solution of errors such as Bluetooth connection interruption, and ensure the correctness of the transmitted data.
[0027] For the described buzzer module, connect the I / O port of the buzzer to the PB8 pin of the microcontroller. During the specific process of controlling the buzzer to sound, corresponding programming for the buzzer should be carried out. First, the GPIOB clock should be configured, and the sound of the buzzer is controlled by the level of the GPIOB pin. The sounding duration of the buzzer is determined by the timer. The buzzer module uses the triode S8050 as an intermediate component. When the GPIO port PB8 outputs a high level, a bias current is provided for the base of the S8050 triode through a current-limiting resistor, making the triode in a conducting state. When the triode conducts, the resistance between its collector and emitter becomes smaller, allowing a larger current to pass through, thereby driving the buzzer. Due to the current amplification effect of the triode, when the current output by the GPIO port is very small, it can also drive the buzzer to produce a louder sound. At the same time, the sounding duration of the buzzer is controlled by writing corresponding program statements.
[0028] Those of ordinary skill in the art should understand that: The discussion of any above embodiment is only exemplary and is not intended to imply that the scope of the present invention is limited to these examples; Under the concept of the present invention, the technical features in the above embodiments or different embodiments can also be combined, and the steps can be implemented in any order, and there are many other variations in different aspects of the present invention as described above, which are not provided in detail for the sake of brevity. Any omission, modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A pipeline infrared piece counter system based on STM32, characterized in that: It includes a core chip, an infrared beam sensor, an OLED display module, a key input module, a Bluetooth module, and a buzzer module. The remaining five modules are connected to the corresponding pins of the chip to form a piece counter system, wherein: The infrared radiation sensor is used to convert the collected light information into an electrical signal and then transmit it to the core chip. The OLED display module is used to receive the signal output by the core chip and display it.
2. The STM32-based pipeline infrared piece counter system according to claim 1 is characterized in that: The core chip includes an STM32-F4 series single-chip microcomputer.
3. The STM32-based pipeline infrared piece counter system according to claim 1 is characterized in that: The infrared radiation sensor comprises an infrared transmitting end and an infrared receiving end.
4. The STM32-based pipeline infrared piece counter system according to claim 1, characterized in that: The OLED display module includes a 4-pin 0.96-inch OLED display screen, and the driving chip is SSD1306.
5. The STM32-based pipeline infrared piece counter system according to claim 1 is characterized in that: The key input module includes a 4*4 matrix keyboard.
6. The STM32-based pipeline infrared piece counter system according to claim 1, characterized in that: The Bluetooth module includes HC-05 Bluetooth, the TX pin of the core chip is connected to the RX pin of the Bluetooth module, and the RX pin of the core chip is connected to the TX pin of the Bluetooth.
7. The STM32-based pipeline infrared piece counter system according to claim 1 is characterized in that: The buzzer module is driven by a triode, and the buzzer module is a high-level triggered buzzer.