Group 1 Illumin-IT

Group members:

Scenario and motivation:

In Northern countries, summer have longer days and the sun rarely shines on dark winters. Our idea is to maximize the use of natural light by complementing the light.

SUSTAINABILITY

  • Save energy using automatic control with presence and movement sensors
  • Dim and control light intensity with response to natural light
  • Extend product life cycles for light bulbs
  • Improve productivity and well-being of people in rooms

PROOF OF CONCEPT

  • Using the DHS HomeManager and FS20 sensor/ control modules. Our group plans to control the lighting inside rooms based on natural light intensity outside.
  • To maximize the use the natural light, we dim the indoor lighting when the sun shines brightly and so on.
  • Using a movement/ presence sensors, lights will only turn on/ off.

Project Timeline

Equipments

Home automation protocol

ZigBee Protocol Overview

What is ZigBee protocol?

  1. Emerging standardized protocol for Ultra Low Power Wireless Personal Area Networks (WPANs);
  2. an established set of specifications for wireless personal area networking (WPAN) i.e, digital radio connections between computers and related devices;
  3. ZigBee is targeted at radio-frequency (RF) applications which require a low data rate, long battery life, and secure networking;

How ZigBee works?

  • The following figure depicts zigbee protocol stack,which consists of four layers:
    1. The application layer: highest-level layer defined by the specification and is the effective interface of the ZigBee system to its end users;
  1. The network&security layer: enables the correct use of the MAC sublayer and provide a suitable interface for use by the next upper layer and provides 128 bit AES encryption key for communication on PAN(Personal Area Network);
  2. MAC layer: used by zigbee devices to establish connection to the PAN by exchanging system information;
  3. Physical layer: ZigBee builds on this layer and media access control defined in IEEE standard 802.15.4 for low-rate WPANs.

Why ZigBee?

Advanteges Disadvantages
Open Standards Interference with other devices
Low cost Slow market expansion
Easily deployable and global
Reliable, secured and self healing
Supports large number of nodes
Very long battery life

Application Sectors:

Li-Fi technology

Introduction

  • Li-Fi is a wireless optical networking technology that uses light-emitting diodes (LEDs) for data transmission.
  • Li-Fi is designed to use LED light bulbs similar to those currently in use in many energy-conscious homes and offices.
  • However, Li-Fi bulbs are outfitted with a chip that modulates the light imperceptibly for optical data transmission.
  • Li-Fi data is transmitted by the LED bulbs and received by photoreceptors.
Advanteges Disadvantages
Sufficient usage of RF BW Light can't pass through objects
High data transmission rate (10Gbps) Internet can't be used without a light source
High level of privacy & security
Low implementation and maintenance costs

Code package

Logic control for the Motion Detector and Twilight Sensors

define lamp_move4 notify moveGroup1 { 

if ((ReadingsVal ("twi1Group1", "state","") eq "off" ) && (ReadingsVal ("twi2Group1", "state","") eq "off" )) {fhem "set lamp1 dim100%"} 

if ((ReadingsVal ("twi1Group1", "state","") eq "on" ) && (ReadingsVal ("twi2Group1", "state","") eq "off" )) {fhem "set lamp1 dim50%"} 

if ((ReadingsVal ("twi1Group1", "state","") eq "on" ) && (ReadingsVal ("twi2Group1", "state","") eq "on" )) {fhem "set lamp1 dim18%"} 

}



define lamp_thr1 notify tw1Group1 { 

if ((ReadingsVal ("twi1Group1", "state","") eq "off" ) && (ReadingsVal ("twi2Group1", "state","") eq "off"  ) 
&& (ReadingsVal ("moveGroup1", "state","") eq "on")) {fhem "set lamp1 dim100%"} 

if ((ReadingsVal ("twi1Group1", "state","") eq "on" ) && (ReadingsVal ("twi2Group1", "state","") eq "off" ) 
&& (ReadingsVal ("moveGroup1", "state","") eq "on" )) {fhem "set lamp1 dim50%"} 

if ((ReadingsVal ("twi1Group1", "state","") eq "on" ) && (ReadingsVal ("twi2Group1", "state","") eq "on" ) 
&& (ReadingsVal ("moveGroup1", "state","") eq "on" )) {fhem "set lamp1 dim18%"} 

}

define lamp_thr2 notify tw2Group1 { 

if ((ReadingsVal ("twi1Group1", "state","") eq "off" ) && (ReadingsVal ("twi2Group1", "state","") eq "off"  ) 
&& (ReadingsVal ("moveGroup1", "state","") eq "on")) {fhem "set lamp1 dim100%"} 

if ((ReadingsVal ("twi1Group1", "state","") eq "on" ) && (ReadingsVal ("twi2Group1", "state","") eq "off" ) 
&& (ReadingsVal ("moveGroup1", "state","") eq "on"  )) {fhem "set lamp1 dim50%"} 

if ((ReadingsVal ("twi1Group1", "state","") eq "on" ) && (ReadingsVal ("twi2Group1", "state","") eq "on" ) 
&& (ReadingsVal ("moveGroup1", "state","") eq "on"  )) {fhem "set lamp1 dim18%"} 

}


define lamp_alone notify moveGroup1 { 

if (ReadingsVal ("moveGroup1", "state","") eq "off" ) {fhem "set lamp1 on-old-for-timer 120"} 

}

config file: fhem.cfg

attr global userattr cmdIcon devStateIcon devStateStyle fp_HMTouch fp_HMTouch_Setup fp_TouchPad icon sortby webCmd widgetOverride
attr global autoload_undefined_devices 1
attr global exclude_from_update 00_CUL.pm
attr global logfile ./log/fhem-%Y-%m.log
attr global modpath .
attr global motd SecurityCheck:\
\
HM_TouchScreen,WEB,WEBphone has no associated allowed device with basicAuth.\
telnetPort has no associated allowed device with password/globalpassword.\
\
Restart FHEM for a new check if the problem is fixed,\
or set the global attribute motd to none to supress this message.\

attr global statefile ./log/fhem.save
attr global updateInBackground 1
attr global verbose 3

define telnetPort telnet 7072 global

define WEB FHEMWEB 8083 global
attr WEB editConfig 1
attr WEB longpoll 1

define WEBphone FHEMWEB 8084 global
attr WEBphone stylesheetPrefix smallscreen

define HM_TouchScreen FHEMWEB 8085 global
attr HM_TouchScreen longpoll 1
attr HM_TouchScreen room hidden

# Fake FileLog entry, to access the fhem log from FHEMWEB 

define autocreate autocreate
attr autocreate autosave 1
attr autocreate disable 1
attr autocreate filelog ./log/%NAME-%Y.log

define eventTypes eventTypes ./log/eventTypes.txt

# Disable this to avoid looking for new USB devices on startup
#define initialUsbCheck notify global:INITIALIZED usb create
define CSM CUL /dev/ttyS1@38400 0000
define CSM433 CUL /dev/ttyS2@38400 0000

define Logfile FileLog ./log/fhem-%Y-%m.log fakelog

define HMTouch FLOORPLAN
attr HMTouch fp_arrange 0
attr HMTouch fp_backgroundimg HomeManager.png
attr HMTouch fp_noMenu 1
attr HMTouch room hidden
attr HMTouch stylesheet homemanagerstyle.css

define Heartbeat dummy
attr Heartbeat devStateIcon on:heart-on:off off:heart-off:on
attr Heartbeat fp_HMTouch 85,140,1, Heartbeat
attr Heartbeat room System
attr Heartbeat setList on off
attr Heartbeat webCmd on:off

define N_Heartbeat DOIF ([Heartbeat:state] =~ "on") ("sudo modprobe ledtrig_heartbeat") DOELSE ("sudo rmmod ledtrig_heartbeat")
attr N_Heartbeat room hidden

define BackLight dummy
attr BackLight devStateIcon on:backlight-on:off off:backlight-off:on
attr BackLight fp_HMTouch 85,6,1,
attr BackLight room System
attr BackLight setList on off
attr BackLight webCmd on:off

define N_BackLight DOIF ([BackLight:state] =~ "on") (deleteattr WL_DispOn fp_HMTouch ;; set Pagereload 1 ;; "echo 0 | sudo cp /dev/stdin /sys/class/backlight/fb_ili9341/bl_power") DOELSE ({fhem "attr WL_DispOn fp_HMTouch 0,0,1"} ;; set Pagereload 1 ;;  "echo 1 | sudo cp /dev/stdin /sys/class/backlight/fb_ili9341/bl_power")
attr N_BackLight room hidden

define Power dummy
attr Power devStateIcon on:power-on:off off:power-off:on
attr Power fp_HMTouch 85,227,1, Power
attr Power room System
attr Power setList on off
attr Power webCmd on:off

define N_Power notify Power "sudo shutdown -h now"
attr N_Power room hidden

define Restart dummy
attr Restart devStateIcon on:restart-on:off off:restart-off:on
attr Restart fp_HMTouch 85,297,1, Restart
attr Restart room System
attr Restart setList on off
attr Restart webCmd on:off

define N_Restart notify Restart "sudo shutdown -r now"
attr N_Restart room hidden

define IP_address dummy
attr IP_address fp_HMTouch 266,18,0
attr IP_address room System

define Output dummy
attr Output devStateIcon lcd:output-lcd:hdmi hdmi:output-hdmi:lcd
attr Output fp_HMTouch 85,73,1,Output
attr Output room System
attr Output setList lcd hdmi
attr Output webCmd lcd:hdmi

define Time dummy
attr Time event-on-change-reading state
attr Time fp_HMTouch 266,287,0
attr Time fp_HMTouch_Setup 55,86,0, ,Time
attr Time room System

define Time_Update at +*00:00:30 { fhem 'set Time '.strftime('%d.%m.%Y %H:%M', localtime) }
attr Time_Update disable 0
attr Time_Update room hidden

define NET_mask dummy
attr NET_mask fp_HMTouch 266,127,0
attr NET_mask room System

define Pageswap dummy
attr Pageswap devStateIcon .*:Transparent
attr Pageswap fp_HMTouch 50,200,0
attr Pageswap fp_HMTouch_Setup 50,200,0
attr Pageswap room hidden
define N_Pageswap notify Pageswap { \
   my $ps_Val = (Value("Pageswap"));;\
   if ($ps_Val ne "none") { \
      fhem("define reset_pageswap at +00:00:01 set Pageswap none");;\
   }\
}
attr N_Pageswap room hidden

define LogHistory readingsHistory (?!N_*)(?!Time_*)(?!Pageswap*)(?!Pagereload*)(?!back*)(?!set_Time*).*:*
attr LogHistory fp_HMTouch 173,12,5, LogHistory
attr LogHistory noheading 1
attr LogHistory nolinks 1
attr LogHistory room hidden
attr LogHistory rows 4
attr LogHistory style style="font-size:10px"
attr LogHistory valueFormat {return undef if( $VALUE =~m/WL_DispOn/ );; return $VALUE}

define WL_DispOn weblink htmlCode <a href="/fhem?cmd=set%20BackLight%20on"><img src="/fhem/icons/Transparent.png" width=396px height=296px/></a>

define Pagereload dummy
attr Pagereload devStateIcon .*:Transparent
attr Pagereload fp_HMTouch 50,200,0,
attr Pagereload fp_HMTouch_Setup 50,200,0
attr Pagereload room hidden
define N_Pagereload notify Pagereload {my $ps_Val = (Value("Pagereload"));; if ($ps_Val ne "none") {fhem("define reset_pagereload at +00:00:01 set Pagereload none");;} }
attr N_Pagereload room hidden

define N_Output DOIF ([Output:state] =~ "hdmi") ("sudo /etc/init.d/lightdm stop" ;; "echo display=hdmi | sudo cp /dev/stdin /etc/tuxradio3/config" ;; sleep 3.0 ;; define A_Pageswap at +00:00:15 set Pageswap /fhem?room=all ;; "sudo /etc/init.d/lightdm start") DOELSE ("sudo /etc/init.d/lightdm stop" ;; "echo display=fbtft | sudo cp /dev/stdin /etc/tuxradio3/config" ;; sleep 3.0 ;; "sudo /etc/init.d/lightdm start")
attr N_Output room hidden

define HMTouch_Setup FLOORPLAN
attr HMTouch_Setup fp_arrange 0
attr HMTouch_Setup fp_backgroundimg HomeManager_Setup.png
attr HMTouch_Setup fp_noMenu 1
attr HMTouch_Setup room hidden
attr HMTouch_Setup stylesheet homemanagerstyle.css

define TimeDate dummy
attr TimeDate fp_HMTouch_Setup 68,6,7, ,DateTime
attr TimeDate room hidden
attr TimeDate setList state:datetime,inline:true,theme:default,lang:en,step:1,format:mdHiY
attr TimeDate webCmd state

define check_date at +*00:03:00 {if (strftime('%Y', localtime) == 2000) {fhem "set Pageswap /fhem/floorplan/HMTouch_Setup" } else {fhem ("attr check_date disable 1;; set check_date modifyTimeSpec 00:03:00;; set Time_Update modifyTimeSpec 00:00:30")}}
attr check_date disable 1
attr check_date room hidden

define set_Time dummy
attr set_Time devStateIcon set:set-time:set
attr set_Time event-on-update-reading state
attr set_Time fp_HMTouch_Setup 69,301,0, ,set_Time
attr set_Time room hidden
attr set_Time setList set
attr set_Time webCmd set

define back dummy
attr back devStateIcon back:back-btn:back
attr back fp_HMTouch_Setup 256,301,0, ,back
attr back room hidden
attr back setList back
attr back webCmd back

define N_Back notify back set Pageswap /fhem/floorplan/HMTouch ;; attr check_date disable 0
attr N_Back room hidden

define N_SetTime notify set_Time {my $t=ReadingsVal("TimeDate","state","000000");; `sudo date $t`;; fhem "set Time_Update execNow;; set Time_Update modifyTimeSpec 00:00:30" }
attr N_SetTime room hidden

define StartChecks notify global:INITIALIZED setstate Power,Restart on ;; set Heartbeat,BackLight on ;; {sub getip {return `hostname -I |awk '{print \$1}'`};;;; my $b=getip ;;;; fhem "set IP_address $b"} ;; {sub getmask {return `ifconfig eth0 | grep -sw "inet" | tr ":" " " | awk {'print \$7'}`};;;; my $m=getmask ;;;; fhem "set NET_mask $m"} ;; { fhem("set Pageswap none")} ;; { fhem("set Pagereload none")} ;; { fhem("attr check_date disable 0")} ;; define check_ip_once at +00:02:00  {{sub getip {return `hostname -I |awk '{print \$1}'`};;;; my $b=getip ;;;; fhem "set IP_address $b"} ;;;; {sub getmask {return `ifconfig eth0 | grep -sw "inet" | tr ":" " " | awk {'print \$7'}`};;;; my $m=getmask ;;;; fhem "set NET_mask $m" ;;;; fhem "define refresh_ip at +00:00:02 set Pageswap /fhem/floorplan/HMTouch"}}
attr StartChecks room hidden
define twi1Group1 FS20 6ce1 00
attr twi1Group1 IODev CSM433
attr twi1Group1 room FS20
define FileLog_twi1Group1 FileLog ./log/twi1Group1-%Y.log twi1Group1
attr FileLog_twi1Group1 logtype text
attr FileLog_twi1Group1 room FS20
define twi2Group1 FS20 6ce1 01
attr twi2Group1 IODev CSM433
attr twi2Group1 room FS20
define FileLog_twi2Group1 FileLog ./log/twi2Group1-%Y.log twi2Group1
attr FileLog_twi2Group1 logtype text
attr FileLog_twi2Group1 room FS20
define FileLog_FS20_815a00 FileLog ./log/FS20_815a00-%Y.log FS20_815a00
attr FileLog_FS20_815a00 logtype text
attr FileLog_FS20_815a00 room FS20
define lamp1 FS20 1234 56
attr lamp1 IODev CSM
attr lamp1 model fs20di
define FileLog_FS20_256800 FileLog ./log/FS20_256800-%Y.log FS20_256800
attr FileLog_FS20_256800 logtype text
attr FileLog_FS20_256800 room FS20
define FileLog_FS20_256802 FileLog ./log/FS20_256802-%Y.log FS20_256802
attr FileLog_FS20_256802 logtype text
attr FileLog_FS20_256802 room FS20
define FileLog_FS20_256803 FileLog ./log/FS20_256803-%Y.log FS20_256803
attr FileLog_FS20_256803 logtype text
attr FileLog_FS20_256803 room FS20
define FileLog_FS20_ff2a01 FileLog ./log/FS20_ff2a01-%Y.log FS20_ff2a01
attr FileLog_FS20_ff2a01 logtype text
attr FileLog_FS20_ff2a01 room FS20
define moveGroup1 FS20 4d7b 00
attr moveGroup1 IODev CSM433
attr moveGroup1 room FS20
define FileLog_moveGroup1 FileLog ./log/moveGroup1-%Y.log moveGroup1
attr FileLog_moveGroup1 logtype text
attr FileLog_moveGroup1 room FS20
define SVG_HMS100TF_a090 SVG FileLog_HMS100TF_a090:SVG_HMS100TF_a090:CURRENT
attr SVG_HMS100TF_a090 label "HMS100TF_a090 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_HMS100TF_a090 room Plots
define FileLog_FS20_ff2a00 FileLog ./log/FS20_ff2a00-%Y.log FS20_ff2a00
attr FileLog_FS20_ff2a00 logtype text
attr FileLog_FS20_ff2a00 room FS20
define SVG_CUL_TX_74 SVG FileLog_CUL_TX_74:SVG_CUL_TX_74:CURRENT
attr SVG_CUL_TX_74 label "CUL_TX_74 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_CUL_TX_74 room Plots
define FileLog_FS20_256801 FileLog ./log/FS20_256801-%Y.log FS20_256801
attr FileLog_FS20_256801 logtype text
attr FileLog_FS20_256801 room FS20
define SVG_FHT_5012 SVG FileLog_FHT_5012:SVG_FHT_5012:CURRENT
attr SVG_FHT_5012 label "FHT_5012 Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr SVG_FHT_5012 room Plots

Future work

As a future work we can propose a novel approach which controls electric indoor lighting, such as LED lights using photo-voltaic system integrated into an office building.Based on the amount of available daylight, we can calculate the amount of artificial illumination required with the reference indoor illumination, and we can also control the indoor lighting without the need for indoor photo-sensors.

Documentation

References