smart window blind. My first leap towards a 100℅ smart home. Concluding post.

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@daniel-itunu·
0.000 HBD
smart window blind. My first leap towards a 100℅ smart home. Concluding post.
Check background/introduction to this project in previous post [here](https://steemit.com/utopian-io/@daniel-itunu/smart-window-blind-my-first-leap-towards-a-100-smart-home)

#### MATERIALS

##### Blind
![IMG_20180223_145846_610.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519394505/gkvn5epygbzv6s0xfbdt.jpg)

##### Microcontroller (Atmega328)
![IMG_20180223_145953_782.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519394717/pvzjkxtk3rp4jrqktwrb.jpg)

##### Light dependent resistor (LDR)
![IMG_20180223_150808_681.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519394954/tpeilycjnlikxwmq200m.jpg)

##### Temperature sensor (LM35)
![IMG_20180223_151130_579.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519395174/t1jg6fm45egs18qwxi7x.jpg)

##### Rainfall sensor
![IMG_20180219_002013_086.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519395549/sf3mwmxnob3z4kqyj1xi.jpg)

##### -Motor driver IC (L293D)
![IMG_20180223_183151_394.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519408161/ebmljlee7v1jigedwt2t.jpg)

##### -Crystal oscillator
![IMG_20180223_182703_880.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519408227/bk3zgs1ggesqvhdwjhd9.jpg)

##### -Voltage regulator (7805)
![IMG_20180223_182719_498.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519408318/fwgrhyctilwpgjtdcnjh.jpg)

##### -Stepper motor
![IMG_20180223_183455_799.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519408425/ldqptlho4arc5c9qdsec.jpg)

##### -Arduino uno
![IMG_20180223_183753_411.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519408458/cnuaivexls0syusy5ygh.jpg)

##### -Power Adapter (12V)
![IMG_20180223_182732_423.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519408495/vyr0am9yejwzxifedmyx.jpg)


#### METHODOLOGY
##### BACKGROUND TO METHODOLOGY
This covers the methodology and design analysis of this project. It describes how the project is organized and the work-flow. The implementation of this work is divided into two distinct phases and document from these two points:

•	The hardware phase.

•	The software development.

##### SYSTEM PRINCIPLE OF OPERATION
The system operates in two basic modes which is the manual and the automatic mode.
In manual mode, the blind is put into action by activating any of two push buttons on a remote controller for the tilting control.
In automatic mode, the blind opens or closes depending on the variability of environmental parameters detected by the different sensors.
System function will include;

•	Timing to open and shut the window blind.

•	Analyzing of environmental parameters collected by sensors, setting upper and lower limits of environmental parameters, reasonably controlling of window blind.

•      Setting manual and automatic switch buttons.
![IMG_20180223_190833_230.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519409346/mhbmhd71x3buckfyx5uy.jpg)

#####  DESIGN CONSIDERATION AND SPECIFICATIONS
The system was designed with the following design consideration and specifications in mind.

	Blind size for a standard room window: 6” by 8”

	Standard room light intensity: 500lumen/m2

	Standard room temperature: 27ᵒC

##### HARDWARE DESIGN AND CIRCUITRY
![IMG_20180223_191213_377.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519409572/yul2faen7hhdmrg5zyxr.jpg)
The microcontroller serves as the brain of the system in managing and controlling all operations. The crystal oscillator helps in generating pulses for the microcontroller. The voltage regulator (7805) takes in 12V DC and supplies 5V DC to the system. The motor driver IC (L293D) makes it possible to drive the motor since the microcontroller cannot sufficiently drive the motor. The comparator makes it possible for varying degree of wetness to be measured by the rainfall sensor.
##### NOTE
To avoid complexities of the above circuit. You can use an arduino board for your circuit board.

##### SOFTWARE DESIGN AND ALGORITHM
C++ based arduino programming language was used to program the atmega328 microcontroller on the arduino uno control board platform. The arduino IDE and the basic sensors libraries was used to utilize and write the program in the microcontroller.
The lux, temperature and rainfall sensors measure analog value of between 0 to 1023. To achieve a reasonable reading, all sensor values were mapped to percentages in the software algorithm according to the following arithmetic below.
                                                   (Sensor reading*100)/1023

The program inputs were based on the luminance, temperature, rainfall and the IR remote. Manual operation was dependent on the IR demodulator for the input. Automatic operation was dependent on the lux, temperature and rainfall sensor. This operation can be interrupted by the input received by the IR remote.
All sensors boundary parameter set in the algorithm are as listed below.

	Luminance sensor: upper boundary = 49
                                 Lower boundary = 40

	Temperature sensor: upper boundary = 25
                                                 Lower boundary = 23

	Rainfall sensor: upper boundary = 45
                                        Lower boundary = 25

The used motor makes 48 steps per revolution. The motor movement was with the following program code to achieve different movement pattern.

int motoStep = 48;//Number of step per revolution NB: the used motor makes 5.625 degree per step

int openSlightlyToOpenFully = 12; //make 1/2 complete revolution

int openSlightlyToCloseFully = -openSlightlyToOpenFully;//make 1/2 complete revolution

int openSlightly = 12; //make 1/2 complete revolution

int reverseOpenSlightly = -openSlightly; //make 1/2 complete revolution

int openFully = 24; //make 1 complete revolution

int closeFully = -openFully;//make 1 complete revolution

int manualStep = 12;//make 1 complete revolution per press of remote control

Flow chart of the system operation is below.
![IMG_20180223_191756_625.JPG](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519409907/vjecouve8qpdaapqazf4.jpg)


##### TESTING AND OBSERVATION
Three major tests were carried out on the system which include;
i.	Automatic mode test
ii.	Manual mode test
iii.	Real time condition test


#####	AUTOMATIC MODE SENSOR TEST
Test was conducted as to observe whether the blind can perform accurately well the three states (lux, temperature and rainfall sensing).
All the lighting of the room was put on and the blind became fully closed immediately the illumination level passed the set upper illumination boundary of 49. The blind also opened up fully immediately the illumination level dropped below the set lower illumination boundary of 40.
The system was tested for the room temperature sensing performance by providing an external source of heat toward the temperature sensor. As soon as the temperature was above the set upper boundary, the blind opened fully to allow inflow of air while as soon the temperature senses a temperature below the lower set boundary, the blind closed fully. 
The rain sensor was wet with sufficient water and the blind opened and closed correspondingly with the set algorithm.

##### MANUAL MODE TEST
The system was put into manual mode and was tested using the remote. The system responded as expected.

##### REAL TIME CONDITION TEST
The blind was then subjected to real time conditions in accordance with the set algorithm given by the following programmed cases given below:

CASE 1: is the case at which the blind closes
if(lux<luxLB && temp<tempLB && moist<moistLB || lux<luxLB && temp<tempLB && moist>moistUB || lux>luxUB && temp<tempLB && moist<moistLB || lux>luxUB && temp<tempLB && moist>moistUB)
{
 autoCloseFullyCase();
}

CASE 2: is the case at which the blind opens
if(lux<luxLB && temp>tempUB && moist<moistLB || lux>luxUB && temp>tempUB && moist<moistLB)
{
 autoOpenFullyCase();
}

CASE 3: is the case at which the blind opens slightly
if(lux<luxLB && temp>tempUB && moist>moistUB || lux>luxUB && temp>tempUB && moist>moistUB)
{
 autoOpenSlightlyCase();
}

From the real time test, the blind system has proved to work properly and adapt to real time situations.
For a whole day, the light level detected by the sensor for each hour is recorded and opening of the blind is observed.
The testing was done on both dry and rainy days. Then, the effectiveness of the blind adjusting the opening and closing by itself in real time condition was confirmed. 
The first test was conducted on a dry and high temperature day. The blind’s opening and closing durations were observed. 

##### Exterior view
![IMG_20180223_093734.jpg](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519410894/vkvcuylkm5j7aiy8pidq.jpg)

##### Internal view
![IMG_20180223_093936.jpg](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519411458/ygbg9fwkfn9ihaxvuh9e.jpg)

##### Complete setup
![IMG_20180223_112201.jpg](https://res.cloudinary.com/hpiynhbhq/image/upload/v1519411629/jswbwokazyvx7q9ytgus.jpg)

 [Introduction to this project found here](https://steemit.com/utopian-io/@daniel-itunu/smart-window-blind-my-first-leap-towards-a-100-smart-home)

[My complete source code can be found on my github link here](https://github.com/daniel-itunu/smart-window-blind)

<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@daniel-itunu/smart-window-blind-my-first-leap-towards-a-100-smart-home-concluding-post">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
👍 , , , ,