HomeAutomation.nsm

This is a part of a home automation system which works for the last few years at my home on an old HP computer. The whole diagram is too big – what is shown here is only a part of it. The home devices are controlled with Numato 4 channel USB relay module. (If the Numato device is not presented on your computer, please, delete the Numato2ChannelUSBRepayModule block. Otherwise when the process is started it will raise an error that a device is missing). The block AndroidRemoteControl demonstrates how to control domestic devices through a mobile phone. For this diagram, TCP/IP server has to be started.

Several groups of blocks are available on the diagram:

Controlling the bathroom fan

This is the most difficult to control device at home. The idea is as follows: every working day I leave home around 9.00h AM. A few minutes before that, I am taking a shower. If I switch on the fan, there is no one at home to switch it off after 15 minutes. The purpose of automation control is every working day (without weekend), the fan to be started at 9:05h AM and to be stopped at 9:20h AM. Additionally, I need a computer interface with buttons as sometimes I want to start or stop the fan manually. Another available option is the control of the fan remotely through an android phone.

Starting the fan only at working days for period 9:05h Am .. 9:20h Am is achieved via two blocks: Blk2 from the DayOfWeek and a TimeIntervalFan block from type TimeInterval. The output of the DayOfWeek.WorkDay block becomes at high level at all working days, the output of the TimeIntervalFan block becomes at high level at the period between 9:05;9:20 every day – this is the value of the block’s OnOffInterval parameter which is accessible with a double click over the block. The two outputs pass through an AND block, because both the events need to have occurred in order to start the device.

Manual start from the interface’s button and through a mobile is achieved with the BlkButtonFan block from type Button, and the output FanBath of AndroidRemoteControl block. When one of the two events occurs, the output of the OR block Blk10 becomes at high level for a short period too. This short period is enough to start the timeout process of block Blk12 which has a TimeOutMin parameter of 15 minutes. The user can stop the fan by pressing the button represented by the BlkBtnStopFan block, which is connected with the block’s input Blk12.Stop.

Both processes – starting the fan every day in the period between 9.05 and 9.20 and starting the fan manually or through a mobile device are inputs of one OR block Blk9. The result of this block controls the lamp on diagram through a BlkLampFan block and a Relay2 of Numato device. The same result is connected with a digital input InFanBath of block AndroidRemoteControl, the purpose of which is to show on the phone screen the status of the fan. If the fan is started, on the phone screen the user will see FanBathroom: On, when it is stopped the user will see FanBathroom: Off.

Controlling an electrical boiler.

This device is controlled easy, the block BoilerTimerNight from type TimeInterval has a parameter OnOffInterval with value: 2:50;5:40&17:50;18:10, which means that there are two time intervals in which the output of the block will have high level. The first interval is at night in the period between 2.50 AM and 5.40 AM, when the boiler works only with night low cost energy. The second period is between 17.50 PM and 18.10 PM, the time before my family is back at home. These two periods guarantee enough hot water at my home. The output of the TimeInterval block is an input to the lamp block BlkLampBoiler and Relay0 of Numato device. The relay controls the electrical boiler.

Controlling a bathroom’s heater

The device can be controlled through a mobile phone. For this purpose the output HeatherBath of the block AndroidRemoteControl is connected with Start input of the Blk14 block from the type TimeOut. The timeout period is set to 15 min and when the button for heater in the android application is pressed, the lamp connected to the BlkLampHeatBath block will flash for 15 min and the same signal will switch on the Relay1 of Numato device for the same period. The user can stop the heater before the 15 min period has expired via the button connected to the BlkBtnStopHeatBath block. This button is on the left side of the diagram and has a caption Stop Bath Heater. The output of TimeOut block is connected with InHeatherBath digital input of block AndroidRemoveControl. When the heater is started, the user will see a text on mobile screen Heather bathroom: On, when the heater is stopped - the text on the mobile screen will be Heather bathroom: Off.

Receiving an information about the outside air temperature

Outputs of the block WeatherInfo with parameter ObjectID=1 have values equal to the current weather situation in the nearby areas around my town Varna. The output Temp of the same block is connected with analog input InTempVarna of block AndroidRemoveContol and with a block BlkTempVarna. The actual temperature is shown on diagram above the WeatherInfo block in red color. The same value will be shown on the mobile phone with a text Outside temp is:.

Controlling outdoor lightning

The perfect block for this purpose is SunInfo. Latitude and Longitude parameters of this block have to be set with user's location and the output IsNightTwilight will get high value when the night twilight begins and will gets low value when the morning twilight ends. Its output controls the diagram lamp connected to the BlkLampYard block, Relay3 of Numato device and it status will be shown on the mobile phone with the text Yard lamp: Output YardLamp of block AndroidRemoteControl can start TimeOut block for 1 minutes, this is another way to switch on the lightning from mobile device.