With the continuous development of a single-chip microcomputer, the counting equipment tends to be automatic. It needs an automatic technical device with real-time, high efficiency, and accuracy to meet the counting requirements of the modern production line. Through the design of esp32 MCU as the core processor to meet the above requirements, in addition to the application of infrared sensor and smoke alarm function, it has the characteristics of small size, strong function, high reliability, and high-cost performance.
The design idea of this application is that the infrared transmitting tube emits infrared rays, and the infrared receiving tube receives the infrared ray. When the infrared receiving tube is irradiated by infrared rays, the resistance will change, and the single-chip microcomputer can collect this change; so is the smoke sensor. When the smoke concentration in the surrounding environment fluctuates, it will produce a level change, and the single-chip microcomputer can also collect it, The system uses a stone TFT LCD serial port screen, which is very convenient to develop. It only needs to complete the communication through the serial port. The MCU naturally adopts esp32.
This application can help the production line to realize the automatic piece counting function, and has the function of fire recording. When there is a fire, the number of occurrences is recorded, and this function can expand the alarm function.
Project Overview
Here we do the production line counting application, after boot, stone TFT The LCD serial port screen will have a start interface. After a short stay, it will jump to the specified page 1 and display the time setting. At this time, it is necessary to set the current time. Another option is to have a record of the number of fires, which will be added one each time, which can be used as the basis for fire control on the production line. After the time setting is completed, it will be displayed on the next interface, and click OK Enter the set production target as the assessment basis. After setting, click OK to enter the counting interface. Here, the data uploaded to esp32 through the sensor, and then transmitted to the stone TFT LCD serial port screen through esp32. One will be added each time. The current output rate will be calculated according to the target quantity, and the data will be updated every time an object is detected.
The communication functions are as follows:
The serial port screen of stone TFT LCD realizes the function of button switching interface;
The serial port screen of stone TFT LCD realizes the function of an automatic jump when starting up;
The serial port screen of stone TFT LCD realizes time setting;
The serial port screen of stone TFT LCD realizes data variable distribution;
STONE TFT LCD serial port screen realizes serial command communication.
Modules required for the project:
STONE TFT LCD;
Arduino ESP32;
Infrared detection module;
④ Smoke detection module.
Block diagram
Hardware introduction and principle
STVC101WT-01
10.1 inch 1024×600 industrial grade TFT panel and 4-wire resistance touch screen;
brightness is 300cd / m2, LED backlight;
RGB color is 65K;
visual area is 222.7mm * 125.3mm;
visual angle is 70 / 70 / 50 / 60;
working life is 20000 hours. 32-bit cortex-m4 200Hz CPU;
CPLD epm240 TFT-LCD controller;
128MB (or 1GB) flash memory;
USB port (U disk) download;
toolbox software for GUI design, simple and powerful hex instructions.
Basic functions
Touch screen control / display image / display text / display curve / read and write data / play video and audio. It is suitable for various industries.
UART interface is RS232 / RS485 / TTL;
voltage is 6v-35v;
power consumption is 3.0w;
working temperature is – 20 ℃ / + 70 ℃;
air humidity is 60 ℃ 90%.
STVC101WT-01 module communicates with MCU through a serial port, which needs to be used in this project. We only need to add the designed UI picture through the upper computer through the menu bar options to buttons, text boxes, background pictures, and page logic, then generate the configuration file, and finally download it to the display screen to run.
In addition to the data manual, there are user manuals, common development tools, drivers, some simple routine demos, video tutorials, and some for testing projects.
HC-SR501 Module
Product features
It is an automatic control module based on infrared technology. It is designed with a lhi778 probe imported from Germany. It has high sensitivity, strong reliability, and ultra-low voltage working mode. It is widely used in all kinds of automatic induction electrical equipment, especially the automatic control products powered by a dry battery. A high level is an output when an object is detected passing by.
Electrical parameters
Model Number
HC–SR501 induction module
Operating voltage range
DC voltage 4.5-20V
quiescent current
<50uA
Level output
High 3.3 V / Low 0V
trigger method
L Non-repeatable trigger / H Repeat trigger
Board Outline Dimensions
32mm*24mm
sensory angle
<100 degrees cone angle
working temperature
-15-+70 degrees
ESP32 EVB
Esp32 is a single-chip scheme integrated with 2.4 GHz Wi-Fi and Bluetooth dual-mode. It adopts TSMC’s ultra-low power consumption 40 nm technology, with ultra-high RF performance, stability, versatility, and reliability, as well as ultra-low power consumption, which meets different power consumption requirements and is suitable for various applications scenarios. At present, the product models of esp32 series include esp32-d0wd-v3, esp32-d0wdq6-v3, esp32-d0wd, esp32-d0wdq6, esp32-d2wd, esp32-s0wd and esp32-u4wdh. Esp32-d0wd-v3, esp32-d0wdq6-v3 and esp32-u4wdh are chip models based on Eco v3.
Wi-Fi
802.11 b/g/n
802.11 n (2.4 GHz) up to 150 Mbps
wireless multimedia (WMM)
frame aggregation (TX / RX A-MPDU, Rx A-MSDU)
immediate block ACK
defragmentation
beacon automatic monitoring (hardware TSF)
4x virtual Wi-Fi interface
Bluetooth
Bluetooth v4.2 complete standard, including traditional Bluetooth (BR / EDR) and low power Bluetooth (BLE)
supports standard class-1, class-2, and class-3 without an external power amplifier
enhanced power control
Output power up to +12 dBm
Nzif receiver has – 94 DBM BLE reception sensitivity
adaptive frequency hopping (AFH)
standard HCI based on SDIO / SPI / UART interface
high-speed UART HCI up to 4 Mbps
Support for Bluetooth 4.2 BR / EDR and BLE dual-mode controller
synchronous connection-oriented/extended synchronous connection-oriented (SCO / ESCO)
CVSD and SBC audio codec algorithms
piconet and scatternet
multi-device connection with traditional Bluetooth and low power Bluetooth
support simultaneous broadcast and scanning
MQ-2 Alarm
Product features
Wide detection range;
High sensitivity / fast response recovery;
Excellent stability / long life;
Simple driving circuit.
Structure and Application
The sensing element, which is composed of micro Al2O3 ceramic tube, SnO2 sensitive layer, measuring electrode, and heater, is fixed in the cavity made of plastic or stainless steel. The heater provides the necessary working conditions for the gas sensor. When a concentration change is detected, a low level is output.
Development steps
Arduino ESP32
Download IDE
To complete the code development of esp32, Arduino is used for developing and compiling. First, you need to install the environment and enter the Arduino official website:
https://www.arduino.cc/en/Main/Software, and download the version for your own platform.
Install Arduino
Double click automatic installation. It should be noted here that Arduino ide relies on the Java development environment and requires PC to install Java JDK and configure variables. If double-click fails to start, it may be that the PC does not have JDK support.
code
“ReceivedTemp” is mainly used to receive commands from the serial port screen of stone TFT LCD
“CurrentOutput” is used to output the current output to the stone TFT LCD
“current rate” is used to output the current production rate to the stone TFT LCD
“FireTimes” is used to output the total fire records to the stone TFT LCD
Then compile, download the code to the esp32 EVB board, and click the button as shown in the figure below.
TOOL 2019
New Project
After installing the tool 2019, click the new project and change the resolution, project name, and save path.
First of all, make some configurations for the screen settings, such as setting the header, starting interface, etc., as follows:
Add picture
The initial state will be a blue screen.
Select it, right-click to remove, and then right-click add in the same way to add the interface you need. Here I have added a total of 10 interfaces:
The setting of a selection interface
First, find the RTC control and add a time display.
Because you want to enter the keyboard, you need to do a text input control here and configure the pop-up keyboard.
When making a keyboard, we can select the corresponding key value for the given button.
Setting the production target also requires input, and the following processing is done. The variable address here will be used when esp32 communicates with LCD.
The OK key to achieving a page jump function.
Here display the value reported by MCU, we distinguish the address, the other can be the same, in the alarm configuration is the same.
Key command setting
The Command is:
uint8_t CurrentOutput[8] = {0xA5, 0x5A, 0x05, 0x82, 0x00, 0x34, 0x00, 0x00};
uint8_t CurrentRate[8] = {0xA5, 0x5A, 0x05, 0x82, 0x00, 0x38, 0x00, 0x00};
uint8_t FireTimes[8] = {0xA5, 0x5A, 0x05, 0x82, 0x00, 0x3D, 0x00, 0x00};
This completes the setting, and then compiles, downloads, and upgrades to the U disk.
Connection
Code
Please contact us if you need a complete procedure:
We will reply to you within 12 hours.
Appendix
Related posts:
STONE STVC070WT-01 HMI Screen+Arduino+Musical Metronome
Bluetooth communication DEMO: NRF51822 UART communicate with STONE HMI display
The Structure and Display Principle of High Brightness LCD
Raspberry Pi GUI using STONE HMI Touch Screen Display Module
The Benefits of Looking for Chinese TFT LCD manufacturers
Raspberry PI Pico and STONE Display Dazzling Light Control System
Man-Machine Touch Demonstration of Multi Function Automobile Service Equipment
Control WS2812B_RGB Lamp by STONE Display Module
Intelligent Display for Energy Project
Application case of TFT LCD Module in Medical Industry