Immersive exhibition hall environment joint control system based on STM32 and Unity 3D
The immersive exhibition hall environment control system built with STM32 and Unity3D enables real-time data exchange and intelligent adjustment between physical and virtual devices, solving the problem of disconnect between sensors and device control, and improving the intelligence and management efficiency of the exhibition hall.
Patent Information
- Application Number
- CN202511161402.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-19
- Publication Date
- 2026-01-16
AI Technical Summary
In existing technologies, the control of physical and virtual exhibition hall equipment is disconnected, making it impossible to achieve real-time data exchange. Sensor data is not linked to the equipment control logic, resulting in equipment adjustment relying on manual operation and failing to achieve immersive interaction and intelligent adjustment.
An STM32 microcontroller is used as the main control module, combined with Unity3D to build an immersive exhibition hall environment control system. The system collects data in real time through the environmental perception module, executes equipment control, and realizes two-way data binding and real-time feedback between virtual reality and physical equipment through the data interaction module.
It achieves comprehensive perception and intelligent adjustment of the exhibition hall environment, provides an immersive remote and manual control experience, improves the intelligence level and visitor comfort of the exhibition hall, eliminates the logical isolation between sensors and equipment, and ensures the consistency between the virtual model and the real environment.
Smart Images

Figure CN121348827A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of intelligent exhibition hall environmental control technology, and specifically relates to an immersive exhibition hall environment joint control system based on STM32 and Unity3D. Background Technology
[0002] The following technical solutions already exist in the field of intelligent exhibition hall environmental control:
[0003] Traditional exhibition hall equipment is controlled independently: PLCs or industrial computers are used to control equipment such as lighting and air conditioning, but this has the drawbacks of large system size, high deployment cost, and inability to link with virtual scenes.
[0004] Virtual exhibition hall one-way interactive system: The three-dimensional exhibition hall model is built using Unity3D. It only supports visual operation of the interface and does not realize real-time data communication between physical devices and virtual models.
[0005] The IoT-based smart exhibition hall system uses WiFi / Bluetooth modules to achieve network control of devices, but it does not combine virtual reality technology to achieve immersive interaction, and its data fusion processing capability between infrared sensors and human body sensors is insufficient.
[0006] Limitations of existing technology: ① Separation of physics and virtuality: There is no binding relationship between device control and Unity model actions. For example, the fan speed cannot be represented on the model according to the actual value.
[0007] ② One-way communication bottleneck: WiFi transmission delay causes the virtual interface operation and device response to be out of sync, and real-time interaction such as automatic dimming triggered by human infrared sensor cannot be realized.
[0008] ③ Sensor data is only displayed on a separate monitoring panel and is not associated with the equipment control logic.
[0009] ④ Unable to trigger actions based on preset thresholds, such as being unable to automatically adjust based on preset temperature and humidity thresholds, requiring manual monitoring of data before the fan can be turned on or off manually.
[0010] ⑤ The infrared counter data was not used for dynamic control, such as automatic alarm when the flow of people exceeds the limit. Summary of the Invention
[0011] To address the problems existing in the prior art, the present invention aims to provide an immersive exhibition hall environment control system based on STM32 and Unity3D. The core objective is to achieve comprehensive perception, intelligent adjustment, and visitor flow statistics of the exhibition hall environment, as well as to provide an immersive remote manual control experience, thereby improving the exhibition hall's intelligence level, visitor comfort, and management efficiency.
[0012] To achieve the above objectives, the technical solution of the present invention is as follows:
[0013] The immersive exhibition hall environment control system based on STM32 and Unity3D consists of a main control module, an environment perception module, an environment execution module, and a data interaction module, as detailed below:
[0014] 1) Main control module: STM32 microcontroller
[0015] As the core processing unit of the system, it collects data from various sensors in real time, executes environmental judgment and decision-making logic, controls the status of actuator devices: fans / curtains / lights; maintains the exhibition hall's visitor count and stores the data; directly connects to all sensor modules: SHT30, GY-30, HC-SR501, and infrared phototransistors; directly connects to all actuator modules: fans, curtains, and exhibition lights; and interacts with the Unity3D host computer.
[0016] 2) Environmental Perception Module
[0017] ① SHT30 temperature and humidity module: Real-time monitoring of exhibition hall temperature and humidity, and data output to the main control module for threshold judgment.
[0018] Input: Environmental physical parameters
[0019] Output: I²C / serial port digital signal → STM32 main controller
[0020] ② GY-30 Lighting Module: Detects ambient light intensity and provides decision-making basis for curtain control.
[0021] Input: Ambient Lighting
[0022] Output: I²C digital signal → STM32 main controller
[0023] ③ HC-SR501 Human Body Detection Module: Detects whether someone is approaching in front of the display case and triggers the automatic switching of the display case lights.
[0024] Input: Human infrared pyroelectric signal
[0025] Output: High / low level signal → STM32 main controller
[0026] ④ Infrared pair counting module: Dual infrared pairs (entrance + exit) work together to count the number of people entering and exiting and calculate the number of people in the venue in real time.
[0027] Input: Human body blocking infrared beam
[0028] Output: Pulse signal → STM32 main controller (logic processing and counting)
[0029] 3) Environment Execution Module
[0030] ① L9110 Fan Control Module: Receives main control commands to drive the fan and perform cooling / dehumidification operations (when temperature or humidity exceeds the threshold).
[0031] Input: STM32 PWM / GPIO control signals
[0032] Output: Drives the motor forward / reverse → Connects to the fan
[0033] ② SG90 Curtain Control Module: Adjusts the opening and closing of the curtains according to the light intensity, and closes the curtains to block light when the light intensity exceeds the threshold;
[0034] Input: STM32's PWM angle control signal;
[0035] Output: Servo motor rotation → Mechanical connection to curtain device;
[0036] ③ Display Light Control Module: Controls the LED lights on / off of the display case; they turn on when people approach and turn off when they leave.
[0037] Input: STM32 GPIO switch signals;
[0038] Output: Drives the relay → connects to the LED light group;
[0039] 4) Data Interaction Module: The display module shows the core data of the exhibition hall in real time: the current number of people in the hall, temperature and humidity values, and light intensity values;
[0040] Input: Sensor data packets processed by STM32;
[0041] Output: LCD display of a visual user interface.
[0042] Furthermore, the system operation begins with the Unity3D computer establishing a connection with the STM32 microcontroller via serial communication; the STM32 then enters the main loop detection process, executing the environmental perception and device control logic in the following order:
[0043] (1) Temperature and humidity control module
[0044] Automatic mode: Detects whether the ambient temperature and humidity exceed the preset threshold; if they exceed the threshold, the L9110 fan is activated to adjust the environment; if they do not exceed the threshold, the fan remains off.
[0045] Manual mode: If a manual fan start command is received from Unity, the fan will start immediately;
[0046] (2) Lighting and curtain control module
[0047] Automatic mode: Detects whether the light intensity exceeds a preset threshold; if it exceeds the threshold, it activates the SG90 servo to simulate closing the curtains to block light; if it does not exceed the threshold, it controls the servo to simulate opening the curtains.
[0048] Manual mode: If a manual servo activation command is received from Unity, the curtain control action will be executed immediately;
[0049] (3) Display case lighting control module
[0050] Automatic mode: Detects human body sensor signals; if someone is detected approaching the display case, the display case LED lights are turned on; if no one is present, the display case lights remain off.
[0051] Manual mode: If a manual light-opening command is received from Unity, the display case lights will be switched on and off immediately;
[0052] (4) Main light control module in the lobby
[0053] Automatic mode: Detects real-time number of visitors in the exhibition hall: counts visitors via infrared sensors at the entrance / exit; if the number of visitors > 0, the main hall lights are turned on; if no one is present, the number of visitors = 0, and the main hall lights are turned off.
[0054] Manual mode: If you receive a manual command from Unity to turn on the main light, immediately control the main light's state.
[0055] Furthermore, in this system, manual mode has higher priority, and if a manual command is received, it will override the automatic decision.
[0056] Furthermore, the main control module uses an STM32F103C8T6 system board, powered by a dual 3.3V / 5V power supply.
[0057] Sensor module:
[0058] ① SHT30 temperature and humidity sensor, I2C interface
[0059] ② GY-30 light sensor, I2C interface
[0060] ③ HC-SR501 human infrared sensor, GPIO input
[0061] ④ TCRT5000 infrared LED pair × 2, GPIO input, 1 set each for inlet and outlet
[0062] Implementing agency:
[0063] ① L9110 fan module, GPIO output, PA1 / PA2 control forward and reverse rotation
[0064] ② SG90 servo motor, PWM control, TIM4_CH4, PA7 pin
[0065] ③ LED light, GPIO output, PC13 controls on / off state.
[0066] Communication module: USB to TTL module, CH340G, connected to STM32 USART1.
[0067] Furthermore, the workflow is as follows:
[0068] The system collects data from each sensor using a while loop and stores it in the microcontroller for use as a judgment condition and for real-time display. After system startup, the STM32 microcontroller first initializes the sensor data and device status. Subsequently, the system enters a continuously running loop, repeatedly executing the following core steps:
[0069] Environmental data collection:
[0070] Temperature and humidity monitoring: Read data from the SHT30 sensor to obtain the accurate temperature and humidity values of the current exhibition hall;
[0071] Light intensity monitoring: Read data from the GY-30 sensor to obtain the current ambient light intensity value of the exhibition hall;
[0072] Personnel detection at the display case: Reads the status data of the HC-SR501 human body sensor module to determine if someone is approaching the display case;
[0073] People flow statistics: Collect data from TCRT5000 infrared photocells, calculate and update the real-time number of people in the exhibition hall;
[0074] Data storage and display:
[0075] The collected light intensity data, temperature and humidity data, and the calculated real-time number of visitors in the exhibition hall are stored in memory to prepare for real-time updates on the display screen.
[0076] Automatic environmental adjustment:
[0077] ① Fan control: Determines whether the current temperature or humidity exceeds the preset safety or comfort threshold;
[0078] Yes: Start the L9110 fan motor to ventilate, cool, or dehumidify;
[0079] No: Keep the fan off;
[0080] ② Curtain control: Determines whether the current light intensity exceeds a preset threshold.
[0081] Yes: Drive the SG90 servo to rotate to a specific angle to simulate the action of "closing the curtains" in order to reduce the amount of light entering the room;
[0082] No: Drive the SG90 servo to rotate to the initial angle to simulate the action of "opening the curtains";
[0083] ③ Display case lighting control:
[0084] Based on the readings of HC-SR501, determine whether anyone is approaching the display case;
[0085] Yes: Turn on the LED lights of the corresponding display case to provide a better display effect;
[0086] No: Turn off the LED lights in the display case to save energy;
[0087] Information feedback:
[0088] The real-time visitor information of the exhibition hall updated in the loop, as well as the environmental data stored in the preparation area, are sent to the Unity exhibition hall modeling interface to achieve intuitive visualization of visitor flow and environmental parameters.
[0089] (2) Unity3D PC Control Logic
[0090] Unity3D primarily sends manual control commands via serial port, requiring no operation in automatic mode; the status of external devices is displayed in real time in Unity3D; if the physical exhibition hall lights up, the lights in the 3D exhibition hall also turn on; this feature allows operators to obtain equipment information in the exhibition hall without needing to observe the physical exhibition hall, making management more convenient.
[0091] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0092] (1) Eliminate the logical isolation between sensors and devices
[0093] To address the issue that existing technologies use sensor data only for independent monitoring and cannot drive automatic device responses, this paper establishes a direct logical link between sensor data and device actions by using localized threshold judgment and real-time control command issuance via embedded terminals. This solves the problems of low efficiency and insufficient reliability in environmental control that relies on manual relay.
[0094] (2) Achieve dynamic compatibility between manual control and automatic regulation.
[0095] To address the issue that existing technologies only support one-way manual operations (such as adjusting device parameters through the Unity interface) and cannot verify the execution results, a two-way data binding between Unity and physical devices is implemented. For example, manually adjusted parameters are sent to the device in real time, and the device status is synchronously transmitted back to update the model. This ensures the consistency between the virtual model and the real environment while retaining the flexibility of manual operation, and allows automatic adjustment of threshold triggers as a safety boundary constraint for manual operations.
[0096] (3) Break the asynchronous state between virtual models and physical devices
[0097] To address the issue that existing virtual models merely serve as preset animation displays and fail to reflect the dynamics of real equipment, this paper constructs a closed-loop feedback mechanism between the physical environment and the digital twin model by real-time fusion of multi-source sensor data and equipment status. This ensures that the lighting intensity, fan speed, and actual number of people in reality are consistent with the model, thus mitigating the risk of misoperation due to inaccurate status updates. Attached Figure Description
[0098] Figure 1 System block diagram;
[0099] Figure 2 SHT30 module schematic diagram;
[0100] Figure 3 GY-30 module schematic diagram;
[0101] Figure 4 HC-SR501 module schematic diagram;
[0102] Figure 5 L91100 motor fan schematic diagram;
[0103] Figure 6 Schematic diagram of SG90 servo module;
[0104] Figure 7 PWM duty cycle diagram;
[0105] Figure 8 Connection diagram of SG90 servo module and STM32;
[0106] Figure 9 TCRT5000 infrared phototransistor schematic diagram;
[0107] Figure 10 Connection diagram at the inlet of TCRT5000 infrared photodiode;
[0108] Figure 11 Connection diagram of the outlet of TCRT5000 infrared diode;
[0109] Figure 12 Unity3D exhibition hall model;
[0110] Figure 13 Overall system block diagram;
[0111] Figure 14 Overall system circuit connection diagram;
[0112] Figure 15 Data acquisition and storage flowchart;
[0113] Figure 16 Unity3D PC version flowchart. Detailed Implementation
[0114] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:
[0115] like Figure 1-16 As shown, this is an immersive exhibition hall environment control system based on STM32 and Unity3D. The entire system consists of two main parts: a field hardware subsystem based on an STM32 microcontroller and a remote virtual monitoring and interaction subsystem built with a 3D model using Unity3D. The two are connected via a serial communication interface. Typically, the STM32's UART TX / RX pins are connected to the USB port of the computer running the Unity3D application via a USB-to-TTL serial port module.
[0116] System Flowchart
[0117] This system is an intelligent 3D exhibition hall based on STM32 and Unity. It uses Unity3D to send and receive data to achieve intelligent control and operation of the exhibition hall. The overall system flowchart is as follows. Figure 1 As shown. System operation begins with the Unity3D computer establishing a connection with the STM32 microcontroller via serial communication. The STM32 enters the main loop detection process, executing the environmental perception and device control logic in the following order:
[0118] (1) Temperature and humidity control module
[0119] Automatic mode: Detects whether the ambient temperature and humidity exceed preset thresholds. If they exceed the thresholds, the L9110 fan will start to adjust the environment; if they do not exceed the thresholds, the fan will remain off.
[0120] Manual mode (higher priority): If a manual fan start command is received from Unity, start the fan immediately (overriding automatic decision).
[0121] (2) Lighting and curtain control module
[0122] Automatic mode: Detects whether the light intensity exceeds a preset threshold. If it exceeds the threshold, the SG90 servo motor is activated to simulate closing the curtains to block light; if it does not exceed the threshold, the servo motor is controlled to simulate opening the curtains.
[0123] Manual mode (higher priority): If a manual servo activation command is received from Unity, immediately execute the curtain control action (overriding automatic decision-making).
[0124] (3) Display case lighting control module
[0125] Automatic mode: Detects human body sensor (HC-SR501) signal. If someone is detected approaching the display case, the display case LED lights will turn on; if no one is present, the display case lights will remain off.
[0126] Manual mode (higher priority): If a manual light-opening command is received from Unity, immediately turn the display case lights on or off (overriding automatic decision-making).
[0127] (4) Main light control module in the lobby
[0128] Automatic mode: Detects real-time visitor numbers in the exhibition hall (counted by infrared sensors at the entrance / exit). If the number of visitors > 0, the main hall lights are turned on; if no one is present (number of visitors = 0), the main hall lights are turned off.
[0129] Manual mode (higher priority): If a manual main light activation command is received from Unity, the main light status is immediately controlled (overriding automatic decision-making).
[0130] Hardware system design
[0131] (1) Interface design and analysis of STM32F103C8T6 module
[0132] This system utilizes the STM32103C8T6 minimum chip system, a microcontroller chip based on the ARM Cortex-M3 architecture, manufactured by STMicroelectronics. It can reach a maximum clock speed of 168MHz and supports both FPU and DSP instructions. It provides 37 pins and 37 GPIO ports for developers. The chip has 64KB of Flash memory for storing program code and data, and 20KB of Static Random-Access Memory (SRAM). It offers rich peripheral interfaces and powerful functionality, making it suitable for various embedded system applications. With appropriate peripheral components, a minimal embedded system can be built.
[0133] (2) Interface design and analysis of SHT30, module schematic diagram as follows Figure 2 As shown
[0134] The electrical parameters are as follows:
[0135] ① Operating voltage: 2.4V-5.5V (3.3V recommended)
[0136] ② Operating temperature: -40-125℃
[0137] ③ Storage temperature: -40-150℃
[0138] ④ Temperature measurement range: 5-60℃
[0139] ⑤ Humidity range: 20%RH-80%RH
[0140] ⑥ Humidity accuracy: ±2%RH
[0141] ⑦ Temperature accuracy: ±0.3℃
[0142] ⑧ Temperature measurement time: <2 seconds
[0143] ⑨ RH response time: <2S
[0144] ⑩ Temperature resolution: 0.015℃
[0145] 11. Communication Interface: IIC (up to 1MHz) Default IIC Address: 0x44
[0146] Table 1 SHT30 Module Wiring Table
[0147]
[0148] (3) Interface design and analysis of GY-30 illumination sensing module
[0149] The GY-30 has the following characteristics:
[0150] ① IIC bus interface
[0151] ② Spectral sensitivity characteristics approaching visual sensitivity
[0152] ③ Output the digital value corresponding to the brightness.
[0153] ④ High resolution (0~65535 lx)
[0154] ⑤ Achieve low current by reducing power consumption.
[0155] ⑥ 50Hz / 60Hz optical noise suppression function
[0156] ⑦ Two types of I2C slave addresses can be selected.
[0157] ⑧ Minimum error variation is ±20%
[0158] 9. Minimal impact from infrared radiation
[0159] The schematic diagram of the GY-30 module is as follows: Figure 3 As shown
[0160] illustrate:
[0161] ① PD — A photodiode that closely approximates the response of the human eye.
[0162] ② AMP — Integrated operational amplifier (converts PD current to PD voltage)
[0163] ③ ADC — Analog-to-digital conversion to acquire 16-bit digital data
[0164] ④ Logic + IC Interface
[0165] ⑤ OSC — Internal Oscillator (This clock is an internal logic clock, with a typical clock frequency of 320kHz)
[0166] (4) Interface design and analysis of the HC-SR501 human infrared module. The schematic diagram of the HC-SR501 module is shown below. Figure 4 As shown,
[0167] The HC-SR501 infrared human body sensor uses passive infrared (PIR) technology, which determines the presence of a human body by comparing the differences in infrared radiation received by two pyroelectric infrared sensors.
[0168] The electrical parameters of the human infrared sensor are as follows:
[0169] Table 2 Electrical Parameters of HC-SCR501
[0170]
[0171] Table 3 Connection table between HC-SCR501 and STM32
[0172]
[0173] The HC-SCR501 requires no instruction operation; it can detect infrared radiation emitted by the human body simply by connecting it to the microcontroller according to the connection diagram, making system debugging more convenient.
[0174] (5) Interface design and analysis of L9110 fan module
[0175] The L9110 fan module connects to the STM32F103's built-in GPIO port. Since this fan design only requires forward rotation and doesn't need speed adjustment, simply connecting the L9110 fan module's INA channel to a general-purpose IO port of the STM32F103 is sufficient; PWM configuration is not required. Therefore, the L9110's INA is connected to PA1 of the STM32F103, and INB is connected to PA2. When PA1 GPIO outputs a high level and PA2 GPIO outputs a low level, the fan will rotate. Figure 5 This is the schematic diagram of the L9110 fan module.
[0176] The STM32F103 can drive the fan by controlling the I / O port to output a high level after judging the environment.
[0177] (6) Interface design and analysis of SG90 servo module
[0178] The SG90 servo module is a component that integrates an SG90 servo motor and control circuitry. It typically operates from 4.8V to 6V, provides approximately 1.2 to 1.6 kg of torque, and the newer models offer a rotation angle of approximately 360 degrees. Precise adjustment of the servo motor position and angle is possible via PWM signal control. It boasts stable performance, a compact design, and high cost-effectiveness, meeting a variety of user needs.
[0179] like Figure 6-8 As shown, in this intelligent exhibition hall system design, the SG90 servo motor is mainly responsible for opening and closing the curtains.
[0180] Its functional characteristics are as follows:
[0181] ① Operating voltage range is 4.8V to 6V
[0182] ② The angle is adjustable and the rotation range is wide.
[0183] ③ Supports large-angle rotation
[0184] When the ambient light intensity is too high, the STM32's GPIOA7 pin controls the pulse PWM wave through Timer 4 (TIM4) channel 4 to control the servo motor to rotate and open the curtain.
[0185] (7) TCRT5000 infrared photocell detector for detecting the number of people in the exhibition hall
[0186] like Figure 9-11 As shown, real-time visitor counts in the exhibition hall can be achieved using two infrared photocells. One photocell is installed at the entrance and one at the exit of the exhibition hall. If an obstruction is detected, it indicates that someone has passed through. By storing the obstruction counts from both photocells and subtracting them, the real-time number of visitors in the exhibition hall can be obtained.
[0187] (8) Communication methods between Unity3D and STM32
[0188] In Unity3D, the System.IO.Ports.all namespace provides communication functionality with serial ports (COM ports), allowing connection to hardware devices such as Arduino and STM32 via USB-to-TTL modules. Data transmission and reception with the microcontroller are implemented through the SerialPort class. Typical application scenarios include game peripheral control (controlling game character movements via Arduino) and data acquisition (reading sensor data). This design utilizes data acquisition and data transmission / reception functions.
[0189] (9) Modeling of the exhibition hall using Unity3D
[0190] like Figure 12As shown, using Unity3D to create a precise one-to-one model of the exhibition hall allows for more immersive control of the equipment on the computer, thereby simplifying various complex operating interfaces and making it easy for managers to get started.
[0191] The overall system principle block diagram is as follows Figure 13 As shown, the innovation of this application lies in the serial communication between Unity3D and STM32, which uses Unity3D to send commands to control the microcontroller and thus control external devices.
[0192] Exhibition Hall Environment Dynamic Control System
[0193] System hardware architecture and connectivity
[0194] Main control unit: STM32F103C8T6 minimum system board (3.3V / 5V dual power supply)
[0195] Sensor module:
[0196] ① SHT30 temperature and humidity sensor (I2C interface)
[0197] ② GY-30 light sensor (I2C interface)
[0198] ③ HC-SR501 Human Infrared Sensor (GPIO Input)
[0199] ④ TCRT5000 infrared LED pair × 2 (GPIO input, 1 set for inlet / 1 set for outlet)
[0200] Implementing agency:
[0201] ① L9110 fan module (GPIO output, PA1 / PA2 control forward and reverse rotation)
[0202] ② SG90 servo motor (PWM control, TIM4_CH4, PA7 pin)
[0203] ③ LED light (GPIO output, PC13 controls on / off state)
[0204] Communication module: USB to TTL module (CH340G, connected to STM32 USART1)
[0205] System Workflow and Methods
[0206] (1) Embedded terminal control logic
[0207] The flowchart for the embedded end is as follows Figure 15As shown, a while loop collects data from each sensor and stores it in the microcontroller for use as a judgment condition and for real-time display. After system startup, the STM32 microcontroller first initializes the sensor data and device status. Subsequently, the system enters a continuously running loop, repeatedly executing the following core steps:
[0208] 1. Environmental data collection:
[0209] Temperature and humidity monitoring: Read data from the SHT30 sensor to obtain the accurate temperature and humidity values of the current exhibition hall.
[0210] Light intensity monitoring: Read data from the GY-30 sensor to obtain the current ambient light intensity value of the exhibition hall.
[0211] Personnel detection at the display case: Reads the status data of the HC-SR501 human body sensor module to determine if someone is approaching the display case.
[0212] People flow statistics: Collect data from TCRT5000 infrared photocells (entrance and exit), calculate and update the real-time number of people in the exhibition hall (by subtracting the number of people leaving from the cumulative number of people entering).
[0213] 2. Data storage and display:
[0214] The collected light intensity data, temperature and humidity data, and the calculated number of visitors in the exhibition hall are stored in memory to prepare for real-time updates on the display screen.
[0215] 3. Automatic environmental adjustment:
[0216] ④ Fan control: Determines whether the current temperature or humidity exceeds the preset safety or comfort threshold.
[0217] Yes: Start the L9110 fan motor to ventilate, cool or dehumidify.
[0218] No: Keep the fan off (if it was on previously, then turn it off).
[0219] ⑤ Curtain control: Determines whether the current light intensity exceeds a preset threshold.
[0220] Yes: Drive the SG90 servo to rotate to a specific angle to simulate the action of "closing the curtains" in order to reduce the amount of light entering the room.
[0221] No: Drive the SG90 servo to rotate to the initial angle to simulate the action of "opening the curtain".
[0222] ⑥ Display case lighting control:
[0223] Based on the readings of HC-SR501, determine whether anyone is approaching the display case.
[0224] Yes (Someone): Turn on the LED lights of the corresponding display case to provide a better display effect.
[0225] No (No one): Turn off the LED lights in the display case to save energy.
[0226] 4. Information Feedback:
[0227] The real-time visitor information of the exhibition hall updated in the loop, as well as the environmental data stored in the preparation area, are sent to the Unity exhibition hall modeling interface to achieve intuitive visualization of visitor flow and environmental parameters.
[0228] (2) Unity3D PC Control Logic
[0229] Unity3D primarily sends manual control commands via serial port; no operation is required in automatic mode. Furthermore, the status of external devices is displayed in real-time within Unity3D. For example, if the physical exhibition hall's lights are on, the lights in the 3D exhibition hall will also turn on. This functionality allows operators to obtain equipment information from the exhibition hall without needing to observe the physical space, making management more convenient.
[0230] (3) Overall hardware connection comparison table
[0231] Table 4 Overall Circuit Wiring Table
[0232]
[0233]
[0234] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions conceived without inventive effort should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.
Claims
1. An immersive exhibition hall environment joint control system based on STM32 and Unity3D, characterized in that, The system is composed of a master module, an environment sensing module, an environment executing module, and a data interaction module, and specifically as follows: 1) The master module: an STM32 microcontroller As the core processing unit of the system, it collects sensor data in real time, executes environment judgment and decision logic, and controls the state of the actuator device: fan / curtain / light; maintains the exhibition hall visitor count and stores data; directly connects all sensor modules: SHT30, GY-30, HC-SR501, and infrared pair tube; directly connects all actuator modules: fan, curtain, and exhibition light; and interacts with the Unity3D upper computer; 2) The environment sensing module ① SHT30 temperature and humidity module: monitors the temperature and humidity of the exhibition hall in real time, and outputs data to the master module for threshold judgment; Input: environmental physical parameters Output: I²C / serial digital signal→STM32 master control ② GY-30 light module: detects environmental light intensity to provide a basis for curtain control; Input: environmental light Output: I²C digital signal→STM32 master control ③ HC-SR501 human body sensing module: detects whether anyone is approaching in front of the showcase, and automatically turns on / off the showcase light; Input: human body infrared pyroelectric signal Output: high / low level signal→STM32 master control ④ Infrared pair tube counting module: two infrared pair tubes (entrance+exit) work together to count the number of people entering and leaving, and calculate the real-time number of visitors in the museum; Input: human body blocking infrared light beam Output: pulse signal→STM32 master control (logic processing count) 3) The environment executing module ① L9110 fan control module: receives master control instructions to drive the fan to perform cooling / desiccation operations (when the temperature or humidity exceeds the threshold) Input: STM32 PWM / GPIO control signal Output: drive motor forward / reverse→connect fan ② SG90 curtain control module: adjusts the opening and closing of the curtain according to the light intensity, and closes the curtain when the threshold is exceeded; Input: STM32 PWM angle control signal Output: steering engine rotation→mechanically connect curtain device ③ Exhibition light control module: controls the on / off of the showcase LED light, which is on when people are near and off when people are away; Input: STM32 GPIO switch signal Output: drive relay→connect LED light group 4) Data interaction module: the display module displays the core data of the exhibition hall in real time: current number of visitors, temperature and humidity values, and light intensity values; Input: sensor data package processed by STM32 Output: liquid crystal display visual operation interface.
2. The system of claim 1, wherein, The system operation starts with the Unity3D computer establishing a connection with the STM32 microcontroller through serial communication; the STM32 enters the main loop detection process and executes the environment sensing and device control logic in the following order: (1) Temperature and humidity control module Automatic mode: detect whether the environmental temperature and humidity exceed the preset threshold; If the threshold is exceeded, start the L9110 fan to adjust the environment; if the threshold is not exceeded, keep the fan off; Manual mode: if a manual fan start instruction is received from Unity, immediately start the fan; (2) Light and curtain control module Automatic mode: detect whether the light intensity exceeds the preset threshold; If the threshold is exceeded, the SG90 rudder motor is started to simulate closing the window curtain; if the threshold is not exceeded, the rudder motor is controlled to simulate opening the window curtain; Manual mode: If a manual open rudder command from Unity is received, immediately execute the curtain control action; (3) Showcase light control module Automatic mode: Detect human sensor signals; if someone is detected approaching the showcase, start the showcase LED light; if no one is present, keep the showcase light off; Manual mode: If a manual open light command from Unity is received, immediately turn on the showcase light; (4) Hall main light control module Automatic mode: Detect the real-time number of people in the exhibition hall: count through the entrance / exit infrared pair; if the number of people in the exhibition hall > 0, start the main hall light; if no one stays, the number of people = 0, turn off the main hall light; Manual mode: If a manual open light command from Unity is received, immediately control the main light state.
3. The system of claim 1, wherein, The manual mode priority is higher in this system, and if a manual command is received, it will override the automatic decision.
4. The system of claim 1, wherein, The main control module uses an STM32F103C8T6 system board, with 3.3V / 5V dual power supply Sensor module: ① SHT30 temperature and humidity sensor, I2C interface ② GY-30 light sensor, I2C interface ③ HC-SR501 human infrared sensor, GPIO input ④ TCRT5000 infrared pair ×2, GPIO input, 1 set for entrance / exit Actuator: ① L9110 fan module, GPIO output, PA1 / PA2 control forward / reverse ② SG90 rudder, PWM control, TIM4_CH4, PA7 pin ③ LED light, GPIO output, PC13 controls on / off Communication module: USB to TTL module, CH340G, connected to STM32 USART1.
5. The system of claim 1, wherein, The working process is as follows Through the while loop, collect sensor data and store it in the single-chip microcomputer for judgment conditions and real-time display; after the system starts, the STM32 microcontroller first initializes the sensor data and device state; then, the system enters a continuous running loop, constantly executing the following core steps: Environmental data collection: Temperature and humidity monitoring: read the data of SHT30 sensor to get the accurate temperature and humidity value of the current exhibition hall; Light intensity monitoring: read the data of GY-30 sensor to get the ambient light intensity value of the current exhibition hall; Showcase personnel perception: read the state data of HC-SR501 human sensor module to determine whether someone is approaching the showcase; People flow statistics: collect TCRT5000 infrared pair data to calculate and update the real-time number of people in the current exhibition hall; Data storage and display: Store the collected light intensity data, temperature and humidity data, and calculated real-time exhibition hall population in memory to prepare for real-time updating on the display screen; Environmental automatic adjustment: ① Fan control: determine whether the current temperature or humidity exceeds the pre-set safety or comfort threshold; Yes: start the L9110 fan motor to run for ventilation, cooling or dehumidification; No: keep the fan off; ② Curtain control: judge whether the current light intensity exceeds the preset threshold Yes: drive SG90 steering gear to rotate to a specific angle, simulate the action of "closing the curtain" to reduce the amount of light; No: drive SG90 steering gear to rotate to the initial angle, simulate the action of "opening the curtain"; ③ Showcase light control: According to the reading of HC-SR501, judge whether someone is close to the showcase; Yes: turn on the LED lighting lamp corresponding to the showcase to provide better display effect; No: turn off the LED lighting lamp of the showcase to save energy; Information feedback: The updated real-time number of visitors in the exhibition hall in the loop and the environmental data stored in the preparation area are sent to the Unity exhibition modeling interface to realize the intuitive visualization of the number of visitors and environmental parameters; (2) Unity3D computer control logic Unity3D mainly sends manual control instructions through the serial port, and does not need to be operated in automatic mode. The status of external devices will be displayed in Unity3D in real time. If the entity light of the exhibition hall is on, the light of the 3D exhibition hall will also be on. Such a function can make the operator obtain the device information of the exhibition hall even without observing the entity exhibition hall, making the management more convenient.