Welcome! This chapter will explore the basics of PLCs, frequency converters, stepper drivers, and sensors. We’ll also dive into the design and remote control processes of an automatic production line for fireworks. Here are the key points:
- PLCs: We’ll cover the structure and operating principles of PLCs, and based on the S7-200 system selection principles, we’ll choose 2 CPU 244s, 1 CPU 226, and various digital and analog expansion modules.
- Frequency Converters: We’ll analyze the working principles of frequency converters and their related parameters and design the main circuit of the frequency converter like the circuit for a home.
- Stepper Drivers: We’ll also analyze the working principles of stepper drivers and design the main circuit and relevant parameters of the stepper driver.
- Double-Acting Cylinders: We’ll analyze the working principle of double-acting cylinders and design a pneumatic control circuit of LED starburst.
- Sensors: We’ll explore the main technical parameters and characteristics of temperature sensors, photoelectric sensors, proximity sensors, and other sensors and select models of temperature sensors and photoelectric sensors.
Now, let’s move on to some information about the design and control processes of the automatic production line for led firework:
- Remote Control Processes: Based on the process flow, overall plan, and control requirements of the automatic production line, we’ll design the remote control processes for the batching system, mixing system, granulation system, screening and crushing system, safety interlocking explosion-proof device, temperature control alarm system, and humidity alarm system.
- I/O Addresses: We’ll assign I/O addresses and write programs based on the control processes.
- PLC Wiring Diagrams: We’ll draw PLC wiring diagrams to represent the remote control processes visually.
By following these steps, we’ll have a solid foundation for the automatic production line for fireworks. Let’s get started!
An automatic control system is a method that simulates manual control. It uses detecting instruments, controllers, actuators, and other devices to replace the operator’s eyes, ears, hands, and brain functions to achieve automated production. The design of an automatic control system mainly includes hardware design, software design, on-site debugging, and other aspects. The control system of the Fireworks Starbursts automation production line has undergone hardware and software design.
1 Scheme design of the Firework Control System
1.1 Remote Control requirement
1. Manual/Automatic operation function:
Manual operation is mainly used for equipment debugging and maintenance. When the CPU is powered up and set to RUN mode (8 or 8 modes dimmable only), the Fireworks Starbursts automated production line automatically runs according to the program downloaded to the CPU. The switch is used to switch between manual and automatic operation.
2. Over-temperature alarm function:
The temperature sensor detects the ambient temperature of each process in real-time. When the temperature of a certain process exceeds 34℃, the control system sends out a sound and light alarm signal, and the automated production line stops running.
3. Humidity alarm function:
The humidity sensor detects the relative humidity of each process in real time. When the relative humidity of a certain process is lower than 60%, the control system sends out a sound and light alarm signal, and the operator sprays water to increase the air humidity of that process.
4. Fault alarm function:
The control system sends a sound and light alarm signal when the equipment fails and the automated production line stops running. After the fault is eliminated, press the reset button, and the automated production line will run automatically.
5. “Pre-stop” function:
When the led Firework Starbursts automated production line needs to stop running under normal working conditions, the batching system, mixing system, screening and crushing system, and safety interlock explosion-proof device can complete one work cycle, and all electrical and mechanical equipment will stop running automatically after returning to the initial position.
6. Emergency stop function:
In case of an emergency during the led Firework Starbursts automated production line operation, pressing the emergency stop button or cutting off the connection between the emergency stop button and the PLC immediately stops the production line.
1.2 Electrical schematic design of Firework Control System
The electrical control schematic diagram for the automated production line of fireworks and luminous beads is shown in Figure 4.1.”

Figure 4.1: Electrical Control Schematic Diagram
1. Air circuit breaker QF is the main switch for the power supply, providing short circuit protection for the main circuit.
2. Fast-acting fuses FU1-FU15 provide short circuit protection for each load circuit.
3. AC contactors KM1-KM6 on the input side, respectively, control inverter 1-6. They turn on the power during automatic control and cut off the power during inverter failure.
4. Inverter 1-6 respectively control three-phase asynchronous motors M1-M6, which are used for a double screw cone mixer motor, an electromagnetic vibration screen motor, a disc granulator motor, an inertia linear vibration screen motor 1, an inertia linear vibration screen motor 2, and a single roll crusher motor.
5. Switching power supplies U1-U6, respectively, control stepper drivers 1-6, which control stepper motors M1-M6. The stepper motors M1-M6 are used for the motors of double-screw feeders for hoppers A-F.
6. Switching power supplies U7-U9 respectively control CPU224-1, CPU226, and CPU224-2. CPU224-1 and CPU226 are responsible for the control of the batching system. At the same time, CPU224-2 is responsible for the control of the mixing system, granulation system, screening, and crushing system, and safety interlock explosion-proof device.
2 Control System Hardware Design
2.1 PLC System
The International Electrotechnical Commission defines a Programmable Controller (PLC) as an electronic system designed for industrial environments that performs digital arithmetic operations. It uses a program storage area to store instructions for logical operations, sequential control, timing, counting, and comparison. It also uses a data storage area to store input and output signals in digital or analog mode (8 or 8 modes dimmable), controlling various types of machinery or production processes. The associated peripheral devices should be designed according to easy integration with industrial systems and easy expansion of their functionality. PLCs are powerful, easy to use, highly reliable, and capable of strong interference resistance. They require less installation, debugging, and maintenance work. PLCs have been widely used in various mechanical equipment and automatic control systems for production processes. Their broad application and high level of popularity are unmatched by other computer control devices [65].
The automatic production line for Fireworks and Firecrackers (for Christmas and other events) includes five systems: the batching system, mixing system, granulating system, screening and crushing system, and safety interlocking and explosion-proof device. During the production process, it is necessary to automatically complete the accurate batching of raw materials, thoroughly mixing led firework, spherical granulation of fireworks, and screening and crushing bright beads. Based on the harsh production conditions of the Fireworks and Firecrackers automatic production line (such as machine vibration causing noise and flying dust causing occupational diseases), the process involves multiple movements and complex motion; the Siemens S7-200 series small PLC is selected to achieve smooth operation of the Fireworks and Firecrackers (for Christmas and other events) automatic production line.
10 Things You Need to Know About PLCs and Automatic Production Lines for Fireworks:
1. Discover the basic structure and operating principles of PLCs.
2. Learn about the S7-200 system and the chosen CPUs and expansion modules (8 modes).
3. Find and get an in-depth analysis of the working principles of frequency converters and stepper drivers.
4. Find out how to design the main circuit and relevant parameters for frequency converters and stepper drivers.
5. Find and understand the working principle of double-acting cylinders and how to design a pneumatic control circuit for industry or home business.
6. Explore the main technical parameters and characteristics of temperature, photoelectric, proximity, and other sensors.
7. Learn how to select the right models of temperature sensors and photoelectric sensors.
8. Discover how to design control processes for automatic production lines, batching, mixing, granulation, and more.
9. Get an overview of safety interlocking explosion-proof devices, temperature control alarm systems, and humidity alarm systems.
10. Learn how to assign I/O addresses, write programs, and draw PLC wiring diagrams based on the control processes.
2.1.1 Basic Structure of PLC
The basic structure of a PLC is shown in Figure 4.2 and mainly consists of a CPU module out of 8 modes, input module, output module, and programming software. Its special function modules are used to accomplish tasks such as force measurement, temperature measurement, humidity measurement, pressure measurement, and so on [66].
The CPU module consists mainly of a CPU chip and memory. In the control system, the CPU module acts as the brain and heart of the system. It continuously collects input signals, executes user programs, and updates the system’s outputs. The data and program storage areas are used to store data and programs, respectively.

Figure 4.2: Schematic diagram of the PLC control system
The I/O module mainly consists of input and output modules. In a control system, the I/O module acts as the eyes, ears, hands, and feet of a person. It serves as a bridge between external field devices and the CPU module. The input module receives and collects switch input signals and analog current and voltage signals. In contrast, the output module controls output devices such as solenoid valves, alarm devices, and frequency converters.
STEP 7-Micro/Win programming software for S7-200 PLC can generate and edit ladder diagrams or instruction table programs directly on a computer screen. Communication between the computer and PLC is achieved using a USB/PPI cable. The compiled program can be downloaded to the PLC, or the PLC’s program can be uploaded to the computer.
2.1.2 Working Principle of PLC
The translation is accurate and captures the original meaning. However, some improvements can be made for better readability and grammar:
As shown in Figure 4.3, once the CPU is operational, it carries out a series of tasks in a repetitive manner, with each cycle of execution known as a scanning cycle [67-69]. During a scanning cycle, the S7-200 CPU performs some or all of the following tasks:
1. Read the input status.
2. Control the execution of the logical program.
3. Handle communication.
4. Conduct self-diagnosis to verify the proper functioning of the CPU, modules, and other components.
5. Write the output status.
During the input sampling phase, the PLC sequentially reads all states and data in a scanning manner and stores them in the corresponding unit in the I/O image area [70-71]. Even if the input status and data change during the user program execution and output refresh phase, the state and data of the corresponding unit in the I/O image area will remain unchanged.

Figure 4.3: CPU program architecture diagram
2.1.3 Selection of S7-200 system
The selection of the S7-200 system mainly considers the quantity and type of input/output (I/O) of the control system, and the number of I/O that the CPU can carry is mainly determined by the following factors in order:
1. The size of the CPU’s input/output process image area.
2. The number of I/Os on the CPU itself.
3. The number of expansion modules that the CPU can support.
4. The load capacity of the CPU’s +5VDC power supply.
5. The occupation of I/O is addressed by the intelligent modules that the CPU supports.
In selecting the PLC control system for the automated production line of fireworks, the number of I/O points is accurately counted based on the process control conditions. On this basis, a 10% to 30% margin is added to determine the total number of points. A general calculation formula is then used to estimate it:
Number of I/O in the process image area 2 Number of system I/O + number of I/O occupied by the module — (4.1)
Current supply current demand —(4.2)
After the analysis mentioned above and the calculation, the automated production line of fireworks requires 3 CPU controls. The batching system requires 6 digital input signals, 28 digital output signals, and 1 analog input signal, which needs 2 CPUs (CPU 224 and CPU 226) for control. The mixing system, granulating system, screening and crushing system, and safety interlocking explosion-proof device require 32 digital input signals, 41 digital output signals, and 3 analog input signals, which require 1 CPU (CPU 224) for control. The CPU and module parameters for the automated production line of fireworks are shown in Table 4.1.

Table 4.1: CPU and module parameters
The batching system’s CPU 224 is connected to 1 SIWAREX MS, 1 EM 231, and 1 EM 222, while CPU 226 is connected to 2 SIWAREX MS, 1 EM 222, and 3 EM 253. The other CPU, 224, is connected to 1 EM 223 and 1 EM 231.
2.1.4 EM 231 Analog Input RTD Module
The analog module within the PLC is a number ranging from -32000 to +32000 or 0 to 32000. To correspond this number with the process variable, a general conversion formula is required for conversion:
Ov = [(Osh-Osl) Jupp (Iv-ISL) + (Ish – Isl) + Osl — (4.3)
Where:
Ov – Conversion result
Iv – Conversion object
Osh – High limit of the conversion result
Osl – Low limit of the conversion result
Ish – High limit of the conversion object
Isl – Low limit of the conversion object
The thermistor module within the PLC is a number ranging from -27648 to +27648. For a Pt 100 thermistor, the resistance range corresponding to the working temperature range of -30℃ to +300℃ is 88.22Ω to 212.02Ω. According to the general conversion formula for the analog module, the general conversion formula for the thermistor module is obtained:
Ov = [(212. 02 – 88. 22) ② (Iv – 11504) + (27648 – 11504)] + 88. 22 — (4.4)
Where:
Ov – Conversion result is the resistance value of the Pt 100 thermistor
Iv – Conversion object is the AIW value obtained after the resistance value of the Pt 100 thermistor is converted into a digital value and stored inside the PLC.
2.1.5 Weighing Module SIWAREX MS
The weighing module SIWAREX MS is an extension module for the S7-200 CPU, which has all the functions of a weighing instrument. The weighing accuracy can reach 0.05%; the internal resolution is 65,535, the sampling frequency can reach 50 times/second, and the working temperature is between 0 and +55℃. The signal from the weighing sensor is directly integrated into the S7-200 CPU through the weighing module SIWAREX MS. The signal from the weighing sensor does not need to be converted (unable) into a standard signal through a weighing transmitter and integrated into the S7-200 CPU, greatly improving the data transmission speed and weighing accuracy between the weighing sensor and the control system [72].
1. Factors affecting weighing accuracy
The weighing module SIWAREX MS directly collects the 2mV/V or 4mV/V signal output (via copper wire) by the weighing sensor, and the signal transmission becomes the main factor affecting the weighing accuracy passing through copper wire. A shielded twisted pair cable connects the sensor to the weighing module to avoid signal distortion.
1. SIWAREX MS “Getting Started” software
The SIWAREX MS “Getting Started” software package includes two program blocks, as shown in Figure 4.4, namely MicroScale and MicroScale_additional, which conveniently integrate the weighing module into the S7-200 CPU. STEP-7 Micro/Win programming is divided into two steps: the first step calls the MicroScale_additional program library to set the weight of the weight, the number of decimal places, the characteristic sensor values, the range, etc., and the second step calls the MicroScale program block to collect the signal, and the weight is stored in VW202.

Figure 4.4: Getting Started Software
2.2 Inverter System
An inverter is a control device that utilizes the on-off action of power semiconductor devices to convert the frequency of the AC power supply into another frequency of electrical energy. It is known as the “modern industrial vitamin,” and by controlling the speed of electric motors with high-quality precision, it improves the level of industrial processes and effectively saves electricity. Inverters are currently the most ideal and promising energy-saving equipment for electric motors. The fireworks and bright pearls automatic production line uses the SINAMICS V20 series inverter to control the speed of the three-phase asynchronous motor.
2.2.1 Working Principle of AC-DC-AC Variable Frequency Drive
The basic structure of an AC-DC-AC variable frequency drive is shown in Figure 4.5. Its main circuit comprises rectifiers, DC intermediate circuits, and inverters. The rectifier converts the AC power supply into a DC power supply, the DC intermediate circuit filters the output of the rectifier to reduce the fluctuation of DC voltage or current, and the inverter converts the DC power supply into a three-phase AC power supply with adjustable frequency and voltage. First, the AC power supply is transformed into a DC power supply through the rectifier, and the DC power supply is stabilized by filtering through the intermediate DC link. Then, the inverter transforms it into AC power with a different frequency. [73].

Figure 4.5 shows the basic structure diagram of an AC-DC-AC variable frequency drive.
2.2.2 Main Circuit Design of AC-DC-AC Variable Frequency Drive
The main circuit of the AC-DC-AC variable frequency drive is shown in Figure 4.6, which consists of the inverter (UF), air circuit breaker (Q), input contactor (KM), fast-acting fuse (FU), and explosion-proof three-phase asynchronous motor. The main function of the air circuit breaker is to quickly cut off the power supply when there is a circuit failure. The main function of the input contactor is to cut off the power supply when the inverter trips due to a fault. The main function of the fast-acting fuse is to quickly cut off the current when there is an overcurrent in the inverter.

Figure 4.6 shows the wiring diagram of the main circuit of the AC-DC-AC variable frequency drive. The laboratory control inverter main circuit device diagram is shown in Figure 4.7.

Figure 4.7: Main Circuit Device Diagram of AC-DC-AC Variable Frequency Converter
2.2.3 Setting Parameters of the Variable Frequency Converter
The control of the variable frequency converter by the PLC involves three parts:
- Hardware wiring
- The setting of the variable frequency converter parameters
- Writing of the control program
Before hardware wiring, the signal source, control mode, and other parameters must be set using the one click BOP operation panel on the variable frequency converter. The setting of the variable frequency converter parameters is shown in Table 4.2.

Table 4.2: V20 Variable Frequency Converter Parameter Settings
2.3 Stepper Driver System
2.3.1 Working Principle of the Stepper Driver
The stepper motor control system is shown in Figure 4.8. The stepper driver receives pulse signals from the upper computer, and the power components of the power amplifier are triggered in a certain order by the circular distributor inside the driver, controlling the continuous switching of the winding of the stepper motor with direct current to make the motor rotate [74].

Figure 4.8: Stepper Motor Control System Diagram
2.3.2 Main Circuit Design of Stepper Driver
The wiring diagram of the main circuit of the stepper driver is shown in Figure 4.9, which is composed of the stepper driver, air circuit breaker (Q), quick-acting fuse (FU), switch power supply (U), and stepper motor (M). The main function of the air circuit breaker is to quickly cut off the power supply when a circuit failure occurs; the main function of the quick-acting fuse is to quickly cut off the current when overcurrent occurs in the stepper driver; the main function of the switch power supply is to control the time ratio of turning on and off the switching tube and maintain a stable output voltage.

Figure 4.9: Wiring Diagram of the Main Circuit of Stepper Driver
The device diagram for controlling the stepper driver in the laboratory is shown in Figure 4.10.

Figure 4.10: Main Circuit Device Diagram of Stepper Driver
2.3.3 Setting of Stepper Driver Parameters
PLC control of the stepper driver includes three parts: hardware wiring, stepper driver parameter setting, and control program writing. Before hardware wiring, the parameters of the stepper driver must be set using the dip switch on the stepper driver. The stepper driver settings are shown in Table 4.3.

2.4 Pneumatic Transmission System
2.4.1 Working Principle of Double-acting Cylinder
The structure of the double-acting cylinder is shown in Figure 4.11, which consists of a cylinder barrel, piston, piston rod, front cover, rear cover, and seals. The inside of the double-acting cylinder is divided into two chambers by the piston, with the chamber containing the piston rod referred to as the rod-end chamber and the chamber without the piston rod referred to as the cap-end chamber. When compressed air is input from the cap-end chamber and exhausted from the rod-end chamber, the pressure difference between the two chambers acts on the piston to push it, causing the piston rod to extend; when air is input from the rod-end chamber and exhausted from the cap-end chamber, the piston rod retracts. When the rod-end chamber and the cap-end chamber alternately intake and exhaust air, the piston achieves reciprocating linear motion. [75]

Figure 4.11: Diagram of a double-acting cylinder

2.4.2 Pneumatic Control Circuit Design
Figure 4.12 shows the schematic diagram of the pneumatic system for the hybrid system, which consists of a feeding section and a discharging section. The execution components are composed of two double-acting cylinders, A and B. In contrast, the control components comprise stroke, speed, and directional control elements. Four limit switches are placed on the cylinder’s left and right extreme positions to detect if the piston is in place. Four air intake throttles control the running speed of the cylinder. Two 2/5-way double-control solenoid valves control the direction of the cylinder by controlling the compressed air flow.
In the pneumatic control circuit shown in Figure 4.12, when solenoid valve YV1 in cylinder A1 is energized, the cylinder moves to the right until it contacts limit switch SQ2 on the extreme right position. Only after limit switch SQ2 shows that the cylinder has reached, the position can solenoid valve YV2 actuate, causing the cylinder to move to the left until it contacts limit switch SQ1 on the left extreme position. After the limit switch, SQ1 shows that the cylinder has reached the position, and cylinder A1 completes one feeding process. The working process of cylinder B is basically the same as that of cylinder A.
2.5 Selection of Sensors
GB/T 7665-2005 defines a sensor as a device or system that can sense a specified quantity and convert it into a usable output signal according to a certain rule, usually consisting of a sensing element and a conversion element. The sensors commonly used in industrial automation include proximity sensors, photoelectric sensors, and temperature sensors.
2.5.1 Proximity Sensor
Proximity sensors can detect the passage or position of the measured object without the need for mechanical contact between the sensor and the object. According to the detection principle, they are divided into inductive and capacitive proximity sensors. Capacitive proximity sensors mainly detect non-metallic objects, while inductive proximity sensors mainly detect metallic objects.
1. Main Technical Parameters
The main technical parameters that characterize the performance of proximity sensors are the detection distance and response frequency. The detection distance refers to the distance at which the proximity sensor “perceives” the approaching object and triggers the switch. The response frequency refers to the number of times the output is generated per second when the standard test object is approached repeatedly.
2. Selection of Proximity Sensors
In the automatic fireworks and firecrackers production line (for Christmas and other events), the mechanical arm removes the raw material bucket from the safety interlock explosion-proof device. It pours the raw material into the mixing system for mixing. In the granulation system, the mechanical arm removes the firework powder bucket from the safety interlock explosion-proof device and pours the firework powder into the granulation system for granulation. The mechanical arm removes the sparkler bucket from the safety interlock explosion-proof device in the crushing and screening system. It pours the sparklers into the crushing and screening system for screening and crushing. Therefore, capacitive proximity sensors are used to detect the signal of the buckets and are used as the feeding signal for the mixing, granulation, crushing, and screening systems. The technical parameters are shown in Table 4.4.

2.5.2 Photoelectric Sensor
A photoelectric sensor is a sensor that uses various properties of light to convert light signals into electrical signals to detect the presence of an object. It consists of a light-projecting unit and a light-receiving unit. There are five types of photoelectric sensors based on different detection methods: through-beam, retro-reflective, diffuse reflective, limited-reflective, and distance-set types.
1. Main Technical Parameters and Characteristics
The main technical parameters that characterize the performance of photoelectric sensors are the detection distance and response frequency. The five types of photoelectric sensors have different characteristics. Through-beam sensors have a long detection distance and stable operation (one click), and the light axis is not easily aligned. Retro-reflective sensors have a long detection distance, convenient adjustment of the light axis, and are suitable for transparent objects. Diffuse reflective sensors have a long detection distance but poor stability. Limited-reflective sensors have a short detection distance, and distance-set sensors can only detect objects at a fixed distance.
2. Selection of Photoelectric Sensors
In the automatic production line of fireworks, all raw materials for a single batch are loaded into the medicine barrel, which is then placed in the safety interlock explosion-proof device by a mechanical arm. In the mixing system, the mechanical arm takes out the medicine barrel from the safety interlock explosion-proof device and completes the transportation of the medicine barrel. The other processes in the safety interlock explosion-proof device are the same. Therefore, a through-beam photoelectric sensor is selected to detect the signal of the mechanical arm. This signal is used to open and close the safety interlock explosion-proof door in the safety interlock explosion-proof device. The technical parameters are shown in Table 4.5.

2.5.3 Temperature Sensor
A temperature sensor is a sensor that can sense temperature and convert it into an available output signal. It is indirectly measured by changing some characteristics of an object with temperature. Common contact-type temperature sensors include thermocouples, thermal resistors, and thermistors.
1. Main technical parameter
The main technical parameters that characterize the performance of temperature sensors are measuring range, thermal response speed, and allowable temperature deviation. Among them, thermocouples have a wide temperature measuring range, fast thermal response speed, and an allowable temperature deviation of ±1.5 to 2.5℃. Thermal resistors are widely used in the field of normal temperature, with good linearity, stable performance, slow thermal response speed, and an allowable temperature deviation of ±(0.15+0.0020|t|)℃. The measuring temperature range of thermistors is narrow, with fast thermal response speed and an allowable temperature deviation of ±1℃.
1. Selection of temperature sensors
GB 11652-2012 “Safety Technical Regulations for Fireworks and Firecracker Operations” stipulates that when the operating temperature of direct contact with gunpowder exceeds 34℃ or is below 0℃, production should be stopped. During the production process, Pt 100 thermal resistors are used to detect the temperature of each process and the technical parameters are shown in Table 4.6. The corresponding relationship between the temperature and resistance values of Pt 100 thermal resistors is shown in Table 4.7.

Table 4.6: Technical Parameters of Pt 100 Thermal Resistance Temperature Sensor
Measuring environmental temperature using the thermal resistance module EM 231 and temperature sensor involves hardware wiring, DIP switch configuration of the thermal resistance module EM 231, and programming the control program. Based on the model of the temperature sensor, set the DIP switch configuration of the thermal resistance module EM 231. The specific parameter settings are shown in Table 4.8.

3 Control System Program Design
According to the control requirements, the control process of the fireworks automatic production line has been designed, as shown in Figure 4.13. After the system starts running, the operating mode is selected. The operating modes include manual, remote control, and automatic control, controlled by one click. The manual control mode includes ten parts: ingredient preparation, conveying, mixing, conveying, granulating, conveying, screening, crushing, temperature control alarm, humidity alarm, and fault alarm. The automatic control mode includes the same ten parts. After the entire operation is completed, the system stops running (with one click operation). The conveying process includes three stages: raw material conveying, fireworks conveying, and luminous pearl particle conveying. A mechanical arm and a safety interlock explosion-proof device complete these tasks.

Figure 4.13: Control System Flowchart
3.1 Control Process
3.1.1 Weighing System Control Process
Taking the precise formulation of the red light as an example, the schematic diagram of the weighing system is shown in Figure 4.14. The weighing system includes three subsystems: Weighing System A, Weighing System B, and Weighing System C. The weighing system has three weighing hoppers (Weighing Hopper A to Weighing Hopper C) and six storage hoppers (Storage Hopper A to Storage Hopper F). The six storage hoppers contain six raw materials: PVC, paint chips, resin, magnesium-aluminum alloy, potassium chlorate, and strontium carbonate. When the weighing system starts working, Weighing Systems A, B, and C start simultaneously. When Weighing System A starts, the feed valve YV1 of Storage Hopper A opens, the stepper motor M1 starts, and the PLC calculates the weight of the A material in real time based on the weight sensor at the bottom of the weighing hopper. When the weight of material A reaches the preset value, the feed valve YV1 of Storage Hopper A closes, stepper motor M1 stops, the feed valve YV2 of Storage Hopper B opens, and stepper motor M2 starts. The PLC calculates the total weight of A&B material in real-time, and when the total weight of A&B material reaches the preset value, the feed valve YV2 of Storage Hopper B closes, and stepper motor M2 stops. The feed valve YV3 of Storage Hopper C opens, and stepper motor M3 starts. The PLC calculates the total weight of A&B&C material in real time. When the total weight of A&B&C material reaches the preset value, the feed valve YV3 of Storage Hopper C closes, stepper motor M3 stops, and an unloading signal is generated. When the unloading signal of Weighing Hopper A and the proximity sensor SQP1’s barrel-in-place signal are generated simultaneously, the unloading valve YV4 of Weighing Hopper A opens. The PLC calculates the weight of Weighing Hopper A in real-time. When the weight of Weighing Hopper A reaches zero, the unloading valve YV4 of Weighing Hopper A closes. 10 seconds later, the robot arm takes the barrel and places it in Weighing System B for unloading. The weighing process of Weighing Systems B and C is basically the same as that of Weighing System A and is not repeated here. When Weighing Systems A, B, and C have completed unloading, the robot arm takes the barrel and puts it into the safety interlock explosion-proof device.

When the ingredient system operates (battery operated), one operator (click) is assigned to add the corresponding raw materials to hoppers A through F. The process of adding raw materials to hoppers A through F is the same. Taking the example of adding raw materials to hopper A, the principle diagram of adding raw materials to the hopper is shown in Figure 4.15. Hopper A has capacitive proximity sensors SQP1′ and SQP2′, respectively. When the capacitive proximity sensor SQP1′ detects that the material level of hopper A is below position 1, the sound and light alarm HA of hopper A will issue a sound and light alarm signal. The click operator then adds the corresponding raw materials to hopper A. When the capacitive proximity sensor SQP2′ detects that the material level of hopper A is above position 2, the sound and light alarm HA of hopper A will issue another sound and light alarm signal, and the click operator will stop adding raw materials to hopper A. The click operator completes one cycle of adding raw materials.

Analysis of the process control program for the ingredients system:
1. Begin by initializing the program. When robotic arm 1 places an empty drug barrel into the designated position in ingredients system A, a start signal is generated by the capacitive proximity sensor SQP1 located in ingredients system A (battery operated).
When the capacitive proximity sensor SQP1 generates a start signal, ingredients systems A, B, and C start simultaneously. After weighing and unloading, signals A, B, and C are respectively generated. The weighing process of ingredients systems A, B, and C is basically the same. The process of ingredients system A is described as follows:
(1) When ingredients system A starts, the material hopper A’s discharge valve YV1 opens, and the stepper motor M1 starts. The PLC calculates the weight of material A in real time based on the weight sensor at the bottom of the weighing hopper. When the weight of material A reaches the preset value, the discharge valve YV1 of material hopper A closes, and stepper motor M1 stops. At the same time, the discharge valve YV2 of material hopper B opens, and stepper motor M2 starts.
(2) The PLC calculates the total weight of materials A and B in real time. When the total weight of materials A and B reaches the preset value, the discharge valve YV2 of material hopper B closes, and stepper motor M2 stops. At the same time, the discharge valve YV3 of material hopper C opens, and stepper motor M3 starts.
1. (3) The PLC calculates the total weight of materials A, B, and C in real time. When the total weight of materials A, B, and C reaches the preset value, the discharge valve YV3 of material hopper C closes, generating an unloading signal.
2. When the barrel-in-place signal SQP1 and the unloading signal A are generated simultaneously, the unloading valve YV4 of the weighing hopper A opens. The PLC calculates the weight of the weighing hopper A in real time. When the weight of weighing hopper A is zero, the unloading valve YV4 of weighing hopper A closes. 10 seconds later, robotic arm 1 takes away the barrel and places it in ingredients system B for unloading (battery operated).
3. When the barrel-in-place signal SQP2 and the unloading signal B are generated simultaneously, the unloading valve YV2′ of the weighing hopper B opens. The PLC calculates the weight of the weighing and loading hopper B in real time. When the weight of the weighing and loading hopper B is zero, the unloading valve YV2′ of the weighing hopper B closes. Ten seconds later, robotic arm 1 removes the barrel and places it in ingredients system C for unloading.
4. When the barrel-in-place signal SQP3 and the unloading signal C are generated simultaneously, the unloading valve YV3″ of the weighing hopper C opens. The PLC calculates the weight of the weighing hopper C in real-time. When the weight of the weighing hopper C is zero, the unloading valve YV3″ of the weighing hopper C closes. 10 seconds later, robotic arm 1 takes away the barrel and places it in safety interlock explosion-proof device 1. The ingredients system completes one ingredient operation.
If an abnormal situation occurs during the one click operation of the ingredients system, press the emergency stop button or cut off the connection between the emergency stop button and the PLC, and the ingredients system will stop running immediately.
1. The control flowchart of the ingredients system is shown in Figure 4.16, and the program is attached in the appendix.

3.1.2 Mixing System Control Process
According to the provisions of mechanical equipment mixing in GB 11652-2012, “Safety Technical Regulations for Fireworks and Firecracker Operations,” the process flow of the mixing system was designed, as shown in Figure 4.17. When the mixing system starts working, the mechanical arm, double helix cone mixer, and electromagnetic vibration sieve are started simultaneously. The mechanical arm takes the barrel from the safety interlock explosion-proof device 1 and conveys it to the feeding port of the double helix cone mixer. After the barrel arrives at the feeding port, the mechanical arm pours all the raw materials in the barrel into the feeding port. After the feeding, the motor of the double helix cone mixer starts to mix the raw materials. After the raw materials are mixed, the mixed fireworks are poured into the electromagnetic vibration sieve through the discharging port of the double helix cone mixer. The electromagnetic vibration sieve refines the fireworks, and the refined fireworks are poured into an empty barrel through the discharging port of the electromagnetic vibration sieve. After the discharging, the mechanical arm puts the barrel into the safety interlock explosion-proof device 2, and the mixing system completes one cycle of raw material mixing and refining.
Analysis of the process of preparing and controlling the program of a mixed system:
1. Begin by initializing the program. Mechanical arm 2 retrieves the drum from the safety interlock explosion-proof device 1. When the drum approaches the feeding hopper of the double-screw conical mixer, a feeding signal is generated by the capacitive proximity sensor located in the feeding hopper.
2. The feeding cylinder retracts when the capacitive proximity sensor generates the feeding signal. After the feeding cylinder retracts into place, it extends after a delay of 30 seconds, and a mixing signal is generated when the feeding cylinder reaches the designated position. At the same time, mechanical arm 2 places the empty drum in the specified position below the electromagnetic vibrating screen.
3. When the feeding cylinder generates the mixing signal, the double-screw conical mixer rotates in the forward direction to mix the materials. The mixer rotates in the forward direction for 4.8 minutes and generates a discharge signal.
4. When the double-screw conical mixer generates the discharge signal, it reverses direction to discharge the materials. The mixer automatically stops reversing after 30 seconds.
5. The discharge cylinder retracts when the double-screw conical mixer generates the discharge signal. After the discharge cylinder retracts into place, it extends after a delay of 30 seconds and completes one discharge after reaching the designated position.
6. When the double-screw conical mixer generates the discharge signal, the electromagnetic vibrating screen starts to operate in one click. The electromagnetic vibrating screen automatically stops after running for 1 minute, and mechanical arm 2 retrieves the drum and places it in safety interlock explosion-proof device 2. The mixing system completes one mixing operation.
7. In the event of an abnormal situation during the operation of the mixing system, press the emergency stop button (one click) or cut off the wiring between the emergency stop button and the PLC, and the mixing system will immediately stop running.


Figure 4.18: Control Flowchart of the Hybrid System
The control flowchart of the hybrid system is shown in Figure 4.18, and the program is available in the appendix. From the control flow, it can be known that the feeding time of the double-screw conical mixer is 30 seconds, the mixing time of the double-screw conical mixer for raw materials is 4.8 minutes, the time for the electromagnetic vibrating screen to refine the fireworks is 1 minute. The total time for mechanical hand 2 to convey the medicine barrel in a single mixing process is estimated to be 1.7 minutes. Therefore, the mixing time for a single batch of raw materials in the mixing system is 8 minutes.
3.1.3 Granulation System Control Flow
Analyze the process of the granulation system and prepare a control program:
1. Start and initialize the program. The mechanical hand 3 takes the medicine barrel from the safety interlock explosion-proof device 2. When the medicine barrel approaches the feeding hopper of the disc granulator, a feeding signal is generated by the capacitive proximity sensor located at the feeding hopper.
2. When the capacitive proximity sensor generates a feeding signal, the spray device starts to spray. After spraying for T1 time, the spray device automatically stops spraying.
3. When the capacitive proximity sensor generates the first feeding signal, the disc granulator starts to operate.
4. After the feeding is completed, mechanical hand 3 places the empty medicine barrel in the designated position under the disc granulator and places the original medicine barrel under the safety interlock explosion-proof device 3.
5. When the stop button is pressed, the disc granulator and the spray device stop running, and the work is completed.
6. In case of abnormal conditions during the operation of the granulation system, press the emergency stop button or cut off the connection between the emergency stop button and the PLC. The granulation system will immediately stop running.
The control flowchart of the granulation system is shown in Figure 4.19, and the program is available in the appendix.

Figure 4.19: Control Flowchart of the Granulation System
3.1.4 Control Process of Screening and Crushing System
Analyze the process of the screening and crushing system to create a control program:
1. Begin by initializing the program. The mechanical arm 4 retrieves the drum from the safety interlock explosion-proof device 3. When the drum approaches the feeding hopper of the inertia linear vibrating screen, a feeding signal is generated by the capacitive proximity sensor located in the hopper.
2. When the capacitive proximity sensor generates the feeding signal, the two motors of the inertia linear vibrating screen and the motor of the semi-wet material crusher start simultaneously.
3. After the feeding is completed, mechanical arm 4 places the empty drum in the designated position below the inertia linear vibrating screen.
4. The two motors of the inertia linear vibrating screen run for 6 minutes before automatically stopping, and the motor of the semi-wet material crusher runs for 6 minutes before automatically stopping.
5. The mechanical arm 4 sends the drum into the granulation system, completing one cycle of screening and crushing.
6. In case of an abnormal situation during the screening and crushing system operation, press the emergency stop button or cut off the connection between the emergency stop button and the PLC. The screening and crushing system immediately stop running.
The control process of the screening and crushing system is shown in Figure 4.20, and the program is included in the appendix.

Figure 4.20: Control flowchart of the screening and crushing system
3.1.5 Control flow of the safety interlocking explosion-proof device
The working principles, process, and control programs of the three safety interlocking explosion-proof devices used for transporting raw materials, fireworks and firecracker powders (for Christmas and other events), and firework particle granules in the automated production line of fireworks and firecrackers are the same. The safety interlocking explosion-proof device between the batching system and the mixing system is used for the transportation of raw materials, the safety interlocking explosion-proof device between the mixing system and the granulating system is used for the transportation of fireworks and firecracker powders (for Christmas and other events), and the safety interlocking explosion-proof device between the granulating system and the screening and crushing system is used for the transportation of firework particle granules. This article takes the safety interlocking explosion-proof device between the batching system and the mixing system as an example to explain. The principle diagram of the safety interlocking explosion-proof device is shown in Figure 4.21.
When the safety interlocking explosion-proof device starts, the indicator lights (fairy lights) HL1 and HL2 of doors A and B are turned on. When the through-beam photoelectric sensor SQP1 detects the signal from the manipulator, cylinder 1 moves, the indicator light HL1 of door A is turned on, the indicator light HL2 of door B is turned off, door A is opened, and the manipulator places the raw material drum into the safety interlocking explosion-proof device 1. When the through-beam photoelectric sensor SQP1 does not detect a signal from the manipulator, cylinder 1 moves, door A is closed, the indicator light HL1 of door A is turned off, and the indicator light HL2 of door B is turned on. When the through-beam photoelectric sensor SQP2 detects the signal from the manipulator, cylinder 2 moves, the indicator light HL2 of door B is turned on, door B is opened, and the manipulator takes out the drum from the safety interlocking explosion-proof device 1. When the through-beam photoelectric sensor SQP2 does not detect a signal from the manipulator, cylinder 2 moves, door B is closed, the indicator light HL2 of door B is turned off, and the indicator light (fairy lights) HL1 of door A is turned on. Doors A and B open and close in turn to achieve the transportation of raw materials between the batching system and the mixing system.

Figure 4.21: Schematic diagram of safety interlock explosion-proof device
Analyzing the process of the safety interlock explosion-proof device and writing the information into a remote control program:
1. Initially, initialize the process, and the robotic arm transports the drum containing raw materials to the safety interlock explosion-proof device 1. The door is opened when the photoelectric sensor SQP1 produces an opening signal.
2. When the photoelectric sensor SQP1 produces an opening signal, cylinder 1 retracts. When cylinder 1 reaches the limit position, it stops running, and door A of the safety interlock explosion-proof device 1 is opened. The robotic arm places the drum into the safety interlock explosion-proof device 1.
3. When the opening signal produced by the photoelectric sensor SQP1 disappears, cylinder 1 extends. When cylinder 1 reaches the limit position, it stops running and produces a movable signal for cylinder 2. Door, A of the safety interlock explosion-proof device 1 is closed.
4. The robotic arm takes the drum from the safety interlock explosion-proof device 1 in the mixing system, and the photoelectric sensor SQP2 produces an opening signal.
5. When the photoelectric sensor SQP2 produces an opening signal, cylinder 2 retracts. When cylinder 2 reaches the limit position, it stops running, and door B of the safety interlock explosion-proof device 1 is opened. The robotic arm removes the drum from the safety interlock explosion-proof device 1.
6. When the opening signal produced by the photoelectric sensor SQP2 disappears, cylinder 2 extends. When cylinder 2 reaches the limit position, it stops running and produces a movable signal for cylinder 1. Door B of the safety interlock explosion-proof device 1 is closed.
The control flowchart of the safety interlock explosion-proof device is shown in Figure 4.22, and the program is included in the appendix.

Figure 4.22: Control Flowchart of Safety Interlock Explosion-proof Device
3.1.6 Temperature Control Alarm System Control Process
Temperature sensors are installed in the batching system, mixing system, granulation system, and screening and crushing system of the fireworks and firecrackers (for Christmas and other events) automatic production line to detect the ambient temperature of each system in real-time, ensuring the safe operation of the automatic production line. The control program of the temperature control alarm process is analyzed as follows:
1. Start and initialize the program. The sensors of each system detect the ambient temperature in real-time and used in many applications such as bedroom and industries.
2. When the ambient temperature detected by the sensor is between 0℃ and 34℃, the automatic production line operates normally.
3. When the sensor detects that the ambient temperature of a certain system is lower than 0℃ or higher than 34℃, the system will emit an audible and visual alarm signal, and the system will automatically stop running.
4. Suppose the system does not automatically stop running after the audible and visual alarm signal is emitted. In that case, the emergency stop button must be manually pressed, or the wiring of the emergency stop button must be cut to stop the system.
The control flowchart of the temperature control alarm system is shown in Figure 4.23.

Figure 4.23: Temperature Control and Alarm System Control Flowchart
3.2 I/O Allocation Table
3.2.1 I/O Allocation Table A
Using the example of the batching system’s subsystem, batching system C, controlled by a CPU 224 and automated with 1 SIWAREX MS, 1 EM 231, and 1 EM 222, the I/O allocation table is shown in Table 4.9.

Table 4.9 shows the allocation of input/output devices in the batching system C.
3.2.2 I/O Allocation Table B
The mixing system, granulation system, screening and crushing system, and safety interlocking explosion-proof device are connected to one CPU 224, 1 EM 223, and 1 EM 231. The control process and program of the three safety interlocking explosion-proof devices in the fireworks automatic production line are the same. This article uses the safety interlocking explosion-proof device that transports between the batching system and the mixing system as an example. The I/O allocation table is shown in Table 4.10.
Table 4.10 shows the allocation of input/output devices in safety interlocking explosion-proof devices between the batching and mixing systems.


3.3 PLC Wiring Diagram
3.3.1 PLC Wiring Diagram A
This article uses the subsystem batching system C of the batching system as an example to explain. The batching system C is connected to one SIWAREX MS, one EM 231, and one EM 222 by CPU 224 to achieve automatic control. The wiring diagram is shown in Figures 4.24 to 4.26.

Figure 4.24: Wiring Diagram for CPU224

Figure 4.25: Wiring Diagram for SIWAREX MS

Figure 4.26: Wiring Diagram for EM231 & EM 222

3.3.2 PLC Wiring Diagram B
The mixing system, granulation system, screening and crushing system, and safety interlock explosion-proof device are connected to one EM 223 and one EM231 by a CPU 224. The wiring diagram is shown in Figures 4.27 to 4.29.

Figure 4.28: Wiring Diagram for EM223

Figure 4.29: Wiring Diagram for EM231
4 Automated Production Line Control for Firework Sparkler Pearls
When the automated production line for firework sparkler pearls is running, one operator controls the system.
At the beginning of work, the operator presses the start button, and the batching system, mixing system, granulation system, and screening crushing system start running sequentially. The automated production line control process is as follows:
1. When the first empty medicine barrel is placed in the designated position of the batching system by mechanical hand 1, the batching system starts to run. The batching system runs for 6 minutes to complete a batching, waits for 2 minutes, and then enters the next batching.
2. When mechanical hand 2 takes out the medicine barrel from the safety interlock explosion-proof device 1 for the first time, the mixing system starts to run. The mixing system runs for 8 minutes to complete mixing and then enters the next mixing.
3. When mechanical hand 3 takes out the medicine barrel from the safety interlock explosion-proof device 2 for the first time, the granulation system starts to run. The disc granulator machine runs continuously, and every 8 minutes, mechanical hand 3 places the medicine barrel containing semi-finished sparkler pearls under the safety interlock explosion-proof device 3.
When mechanical hand 4 takes out the medicine barrel from the safety interlock explosion-proof device 3 for the first time, the crushing screening system starts to run. The screening crushing system runs for 6 minutes to complete a screening crushing, waits for 2 minutes, and then enters the next screening crushing.
1. At the end of work, the operator presses the stop button, and the batching system, mixing system, granulation system, and screening crushing system stop running in sequence. The automated production line control process is as follows:
2. After the batching system completes batching, mechanical hand, 1 will no longer place empty medicine barrels into the batching system, and the batching system stops running.
3. Assuming that the last batch of raw materials prepared by the batching system is placed in medicine barrel A after the mixing system completes mixing the raw materials in medicine barrel A, the mixing system stops running.
4. After the granulation system completes the granulation of the fireworks in medicine barrel A, the operator manually presses the stop button of the disc granulator machine, and the granulation system stops running.
After the screening crushing system completes the screening crushing of the semi-finished sparkler pearls in medicine barrel A, the screening crushing system stops running.
1. The production efficiency of the automated production line for firework sparkler pearls is determined by the subsystem with the minimum amount of medicine and the longest operation time during a single operation. The control program shows that the mixing system, with a single operation time of 8 minutes and a single operation medicine amount of 10kg, determines the production efficiency of the automated production line for firework sparkler pearls. Therefore, the output of the automated production line for firework sparkler pearls is 70kg per hour.
Summary
This chapter analyzes the basic structure and operating principles of PLCs. Based on the selection principles of the S7-200 system, 2 CPU 244s, 1 CPU 226, and various digital and analog expansion modules are chosen. The working principles of frequency converters and their related parameters are also analyzed, and the main circuit of the frequency converter is designed. The working principles of stepper drivers are also analyzed, and the main circuit and relevant parameters of the stepper driver are designed. The working principle of double-acting cylinders is also analyzed, and a pneumatic control circuit is designed. The main technical parameters and characteristics of temperature, photoelectric, proximity, and other sensors are analyzed, and the models of temperature sensors and photoelectric sensors are selected.
Based on the process flow, overall plan, and control requirements of the automatic production line for fireworks, the control processes for the automatic production line, batching system, mixing system, granulation system, screening and crushing system, safety interlocking explosion-proof device, temperature control alarm system, and humidity alarm system are designed. I/O addresses are assigned, programs are written, and PLC wiring diagrams are drawn based on the control processes. This system is useful for all types of events such as national event, parties, wedding, etc.
If you are a professional in the firework industry seeking reliable and practical firing equipment for parties, wedding, or any event, PyroEquip can provide you with top-of-the-line solutions. Our equipment is designed with both show designers and technicians in mind, ensuring that it meets the needs of all parties involved. Additionally, we are proud to offer a selection of high-quality products from industry leaders such as iFire, PyroDigit, Europla, Quickclips, and Plasticos Gamon. If you refuse to compromise on quality, contact us today to learn more about our innovative products and exceptional service for our customers.
References
[1] 9 Things You Probably Don’t Know about Fireworks.
[2] Dynamic search in fireworks algorithm.
[3] Decomposition flame propagation limits of ethylene and mixtures with other gasses.
[4] Incendiary Art: The Representation of Fireworks in Early Modern Europe.
[5] Solving sets covering problems with fireworks explosions
[6] Fireworks: A formal transformation-based model-driven approach to features in product lines.
[7] Fireworks: a dynamic workflow system designed for high‐throughput applications
[8] Designing like a pro: The automated composition of workflow activities.