# **PLC Playground Crowd Monitoring System Training Steps**## **1. Training Preparation Phase**### 1. **Clarify Training Objectives**- Design a crowd counting system based on PLC- Implement functions for counting entries and exits, over-limit alarms, and data display### 2. **Equipment and Tools Preparation**| Equipment/Tool | Quantity | Purpose ||———–|——|——|| PLC Controller (e.g., Siemens S7-1200) | 1 unit | Core control of the system || Infrared Photoelectric Sensors | 2 pairs | Direction detection for entries and exits || HMI Touch Screen | 1 unit | Data display and parameter settings || Sound and Light Alarm | 1 set | Over-limit alarm indication || Connecting Cables | Several | Inter-device connections || Programming Computer | 1 unit | PLC program writing and downloading || TIA Portal Software | 1 set | PLC programming and simulation |### 3. **System Architecture Design**Draw a system structure diagram to clarify: – Sensor installation locations (entry and exit) – PLC I/O allocation scheme – HMI display interface layout## **2. Hardware Installation and Wiring**### 1. **Sensor Installation**- Install two pairs of infrared sensors at the entry and exit of the simulated passage- Ensure reasonable sensor spacing (recommended 30-50cm)- Adjust sensor height (approximately 1.2m, simulating adult waist level)### 2. **PLC Wiring**“`plaintextInput Wiring: I0.0 → Entry Sensor Signal Line I0.1 → Exit Sensor Signal Line Output Wiring: Q0.0 → Sound and Light Alarm Control Line Q0.1 → Turnstile Control Signal Line (optional)“`### 3. **HMI Connection**- Connect PLC and HMI using RS485 or Ethernet- Ensure communication parameters are consistent (baud rate, station number, etc.)## **3. Software Programming Phase**### 1. **PLC Program Design (TIA Portal)**#### (1) Create a New Project- Select the correct PLC model- Configure the I/O address table#### (2) Write Ladder Logic Program“`lad// Main Program Logic Network1: Entry Count LD I0.0 // Entry Sensor CTU C1 // Counter (Total People +1) Network2: Exit Count LD I0.1 // Exit Sensor CTD C2 // Counter (Total People -1) Network3: People Calculation SUB C1-C2 → MW10 // Store Current People Network4: Over-limit Judgment LDW>= MW10, 100 // Assume threshold is 100= Q0.0 // Trigger Alarm“`#### (3) Add Data Block- Create DB1 to store historical data- Set power failure retention function### 2. **HMI Interface Design**#### (1) Main Monitoring Interface- Real-time people count display (digital + bar chart)- Entry and exit direction indicator lights- Current time display#### (2) Parameter Settings Interface- Crowd flow threshold settings- Alarm method selection- Data reset button#### (3) Alarm Record Interface- Historical alarm event list- Alarm timestamp records## **4. System Debugging Phase**### 1. **Unit Testing**1. Test each sensor individually to ensure it triggers the PLC input points correctly2. Verify that the counter instructions execute correctly3. Check if the HMI can read PLC data normally### 2. **Integration Testing**1. Simulate visitor passage (obscuring sensors) – Verify if the entry and exit direction judgment is correct – Check if the people count is accurate2. Test alarm function – Check if the sound and light alarm triggers when the number exceeds the threshold3. Test turnstile control (if applicable) – Check if the turnstile closes automatically when over-limit### 3. **Troubleshooting**| Problem Phenomenon | Possible Cause | Solution ||———|———|———|| Sensor false trigger | Environmental light interference | Adjust sensitivity/add light shield || HMI display data delay | Communication baud rate mismatch | Check communication parameter settings || Counter not working | Incorrect instruction usage | Check CTU/CTD instruction parameters |## **5. Training Summary and Report**1. **Data Recording** – Record crowd flow test data at different times – Screenshot key program segments and HMI interfaces2. **Performance Analysis** – Calculate system response time – Calculate detection accuracy3. **Improvement Suggestions** – Consider adding facial recognition to improve accuracy – Add WiFi module for mobile monitoring## **6. Safety Precautions**1. Always disconnect power before wiring2. Avoid direct sunlight on sensors3. After modifying the program, re-download for testing4. Keep the work environment clean and orderly—**Appendix: Suggested Training Schedule**| Phase | Time | Task ||——|——|——|| Day 1 | Morning | Scheme design, hardware preparation || | Afternoon | Hardware installation and wiring || Day 2 | All day | PLC programming and HMI configuration || Day 3 | Morning | System joint debugging || | Afternoon | Performance testing and report writing |This step-by-step guide can be flexibly adjusted according to actual training equipment and class hours, and it is recommended to arrange teacher demonstration sessions at key steps.