We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you've provided to them or that they've collected from your use of their services.

Controlling the blinds with Building_common.lib

Controlling the blinds gives our PLC a possiblity to earn a few points in the area of being an 'intelligent' installation.  There is simply so much more that can be done with the blinds than with the lights or sockets.

In my house the blinds are controlled with simple wall-mounted switches, through a visualization and with a smartphone.  Additionally they open/clos automatically depending on the time schedule and the times of sunset and sunrise.u słońca.

A simple blind-controlling program looks as follows:

VAR
	Blind1 : FbSunblind;
END_VAR

* * *

Blind1(xSunblindSwitchUp:= IN1 OR VIS_Blind1_UP, xSunblindSwitchDown:=IN2 OR VIS_Blind1_DN);

OUT1:=Blind1.xDoSunblindUp;
OUT2:=Blind1.xDoSunblindDown;

where:

  • IN1 i IN2 - DI inputs connected with the buttons,
  • VIS_Blind1_UP i .._DN - BOOL variables used for visualization controll,
  • OUT1 i OUT2 - DO outputs controlling the blind' motor.

 

The above-presented code can be extended and modified by:

  1. Placing the functions block definition in VAR RETAIN PERSISTENT so that after a power fialure the controller knew the position of the blind.
  2. Defining the basic parameters already in the definitions: for example the time neede for the full up/down movement of the blind (in 0.1 sec).
  3. Adding additional sources sending controling signals to the blind: for example timers, sun position calculators etc.

So, for xeample:

VAR RETAIN PERSISTENT
	Blind1 : FbSunblind:=( uiT_WholePosTimeIn10telSec:=300, uiT_MoveShadowPosIn10telSec:=100);
END_VAR

* * *

Blind1(
    xSunblindSwitchUp:= IN1 OR VIS_Blind1_UP OR Timer_Blind1_UP OR Sunrise_Signal, 
    xSunblindSwitchDown:=IN2 OR VIS_Blind1_DN OR Timer_Blind1_DN OR Sunset_Signal
	);

OUT1:=Blind1.xDoSunblindUp;
OUT2:=Blind1.xDoSunblindDown;

where:

  • Timer_Blind1_UP, ..._DN - are variables signaling the pre-scheduled times of the blinds going up/down, 
  • Sunrise_Signal, Sunset_Signal - are variables signaling when the sun croses the lines of sunset and sunrise.

The visualization example presented below shows such a functionality.  At the very top you can see the position of the sun.  One can set the thresholds at which the blinds should act (move up, if the sun rises above the position -7° and to move down, if the sun sets below -6° from the horizon).  For each of the movement: up and down it is possible to set if it should be triggered according to the schedule (clock), according to sun position or only manually.  In the example below the blinds will move up at 06:55 on weekdays and at 08:00 on weekends, and they will move down at the moment of (corrected) sunset.

Blind Visu 

More complex functions related to blind control have been described in the article: Blind control with OSCAT libraries.