STONE HMI ESP32 Line Count and Alarm

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:

  1. The serial port screen of stone TFT LCD realizes the function of button switching interface;
  2. The serial port screen of stone TFT LCD realizes the function of an automatic jump when starting up;
  3. The serial port screen of stone TFT LCD realizes time setting;
  4. The serial port screen of stone TFT LCD realizes data variable distribution;
  5. STONE TFT LCD serial port screen realizes serial command communication.

Modules required for the project:

  1. STONE TFT LCD;
  2. Arduino ESP32;
  3.  Infrared detection module;
  4. ④ Smoke detection module.

Block diagram

ESP32-Line-Count-Alarm-lcd

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.

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.

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

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.

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.

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.

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.

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.

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.

Install Arduino

ESP32-Line-Count

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

ESP32-Line-Count-Alarm-lcd

“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.

ESP32-Line-Count-Alarm-lcd

TOOL 2019

New Project

After installing the tool 2019, click the new project and change the resolution, project name, and save path.

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.

First of all, make some configurations for the screen settings, such as setting the header, starting interface, etc., as follows:

ESP32-Line-Count-Alarm-lcd

Add picture

The initial state will be a blue screen.

ESP32-Line-Count-Alarm-lcd

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:

ESP32-Line-Count-Alarm-lcd

The setting of a selection interface

First, find the RTC control and add a time display.

ESP32-Line-Count-Alarm-lcd

Because you want to enter the keyboard, you need to do a text input control here and configure the pop-up keyboard.

ESP32-Line-Count-Alarm-lcd

When making a keyboard, we can select the corresponding key value for the given button.

ESP32-Line-Count-Alarm-lcd

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.ESP32-Line-Count-Alarm-lcd

The OK key to achieving a page jump function.

ESP32-Line-Count-Alarm-lcd

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.

m-4-ESP32-Line-Count-Alarm-lcd(23)

Connection

ESP32-Line-Count-Alarm-lcd

ESP32-Line-Count-Alarm-lcd

Code

/*
Button
Turns on and off a light-emitting diode(LED) connected to digital pin 13,
when pressing a pushbutton attached to pin 2.
The circuit:
- LED attached from pin 13 to ground
- pushbutton attached to pin 2 from +5V
- 10K resistor attached to pin 2 from ground
#NAME?
attached to pin 13.
created 2005
by DojoDave
modified 30 Aug 2011
by Tom Igoe
This example code is in the public domain.
http://www.arduino.cc/en/Tutorial/Button
*/
//#include
#include "stdlib.h"
#include
uint8_t i = 0;
// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0;        // will store last time LED was updated
// constants won't change:
const long interval = 200;           // interval at which to blink (milliseconds)
// constants won't change. They're used here to set pin numbers:
const int IRPin = 13;     // the number of the pushbutton pin
int IRNewState = 0;         // variable for reading the pushbutton status
int IROldState = 0;         // variable for reading the pushbutton status
unsigned short IRCount = 0;
unsigned short Targetvalue = 100;//Important
unsigned short CompleteRate = 0;
uint8_t RecievedTemp[9] = {0};//A5 5A 06 83 00 28 01 00 0C //A5 5A 06 83 00 28 01 FF FA
uint8_t CurrentOutput[8] = {0xA5, 0x5A, 0x05, 0x82, 0x00, 0x34, 0x00, 0x00};
uint8_t CurrentRate[8] = {0xA5, 0x5A, 0x05, 0x82, 0x00, 0x38, 0x00, 0x00};
const int MQ2Pin = 4;     // the number of the pushbutton pin
int MQ2NewState = 0;         // variable for reading the pushbutton status
int MQ2OldState = 0;         // variable for reading the pushbutton status
unsigned short MQ2Count = 0;
uint8_t FireTimes[8] = {0xA5, 0x5A, 0x05, 0x82, 0x00, 0x3D, 0x00, 0x00};
void setup()
{
Serial.begin(115200);
//  Serial.print("Project start\r\n");
//  Serial2.begin(115200);
//  Serial2.print("Serial2.begin");
// initialize the pushbutton pin as an input:
pinMode(IRPin, INPUT);//IR
pinMode(MQ2Pin, INPUT_PULLUP);//MQ2
//digitalWrite(IRPin,LOW);
//srand(0);
}
......

Please contact us if you need a complete procedure:
We will reply to you within 12 hours.

Appendix

ESP32-Line-Count-Alarm-lcd

ESP32-Line-Count-Alarm-lcd

ESP32-Line-Count-Alarm-lcd

ESP32-Line-Count-Alarm-lcd

ESP32-Line-Count-Alarm-lcd

滚动至顶部