Light control in the smart home (variation)
Couldn't load pickup availability
Description
The FB_LightControl_AutoManual function block controls lighting with integrated sensor monitoring, manual operation with a fallback time, and automatic movement control including overrun. It is suitable for energy-efficient applications with a simultaneous focus on user convenience.
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
The block operates in three logically consecutive steps, supplemented by a status output for HMI or diagnostics:
1. Plausibility check of the brightness sensor
First, the current brightness value is checked. If it is outside the valid range of zero to ten thousand lux, a sensor error is detected.
– In this case, AlarmSensor is set to True, the light is turned off, and the rest of the logic is skipped.
– If the value is valid, AlarmSensor is set to False and operation continues.
2. Manual operation with fallback time
Manual control is carried out via separate on and off buttons, the edges of which are detected by trigger modules.
– When the On button is pressed, MemManual is set to True and the light is switched on.
– When the Off button is pressed, MemManual is also set to True, but the light is turned off.
As long as MemManual is active, a fallback timer runs. After this time (reset time) has elapsed, the system automatically returns to automatic mode.
– While MemManual is active, manual operation takes priority: the status takes over the current light value and the automatic mode is skipped completely.
3. Automatic operation with follow-up control
Once the module is in automatic mode, a run-on timer monitors the light conditions.
– The light switches on when movement is detected and the brightness value is below the defined threshold.
– After the movement has ended, the light remains switched on for the configured follow-up time.
4. Status output
Regardless of the operating mode, the light status is transferred to the status variable at the end – for display on an HMI or for further processing.
Summary
– Brightness check with safe fault shutdown in case of invalid sensor value
– Manual light operation with automatic return to automatic after a defined time
– Automatic light control in case of movement and darkness with time-delayed switch-off
– Simple status display of the current light state
The module thus combines manual operation, energy-saving automatic operation and integrated safety logic for sensor errors – ideal for modern lighting controls in smart home or industrial environments.