Lighting system with presence detector
Couldn't load pickup availability
Description
This compact function block automatically controls lighting based on brightness, motion, and follow-up time – including manual override. The code, written in Structured Control Language (SCL), is ready for immediate use in the Siemens TIA Portal and is suitable for energy-efficient lighting in residential, office, or industrial environments.
Note: All modules are designed exclusively as a learning and optimization basis and are not approved for live operation. System modules, in particular, must be finally tested and commissioned by qualified personnel before productive use.
How it works
Initially, the module checks the plausibility of the brightness sensor. If invalid values are detected (outside the 0–10,000 lux range), an alarm is triggered, the light is turned off, and the module is deactivated.
In manual mode , on/off buttons have priority:
- Keystrokes are processed via edge detection
- The last switching state is saved
- The light remains in the selected state until it is switched manually again
In automatic mode the light switches on automatically,
- when movement is detected and
- the current brightness value is below the set threshold.
After the movement has ended, a run-on timer keeps the light active for a defined period of time.
Manual mode always takes priority – regardless of whether movement is detected or not.
Technical details
- Sensor testing by comparing brightness against valid limits (0–10,000 lux)
- Manual control with edge trigger and marker for the light status
- Automatic follow-up time via TON timer
- Light output (BOOL) and status output for visualization or actuator control
- All parameters (limit values, times) can be set centrally in the header area
Possible applications
Ideal for:
- Corridors, stairwells, toilet facilities
- Storage or ancillary rooms
- Smart home applications with central lighting control
- Training environments on sensors, timers and control logic
compatibility
Runs on Siemens S7-1200 and S7-1500 controllers
Compatible with TIA Portal from version V13
Recommended: TIA V16+ for simulation with PLCSIM and HMI visualization
Scope of delivery
You will receive an .scl file with:
- Declaration of all inputs/outputs, timers and triggers
- Comments on the parameterization of brightness, follow-up time and logic
The download link is available immediately after purchase.
Support
I'd be happy to help you adjust thresholds, integrate additional sensors (e.g., presence or twilight sensors), or implement a suitable HMI interface. Simply contact me via email or via the shop support.