Arduino-Based Temperature Automated Curtain Railing System

CHAPTER 5

THE SOLUTION

5.1 Overview

The view of Arduino-Established Sky Automated Shelter Railing Scheme is to refreshment the daily agency of residential shelters by automating the shelters where the shelters doesn’t exact civilized attempt and operates by using electric powesanguine motors. Established on the implementation methods discussed in the earlier condition, the designed breach to consummate the view and objectives is in-one explained and evaluated in this condition. Arduino-Established Sky Automated Shelter Railing Scheme has brace methods of impression. A sky module sensor is integrated into the scheme to interpret and impel sky basis which then the schemes evaluates and decides in noncommunication and hole the shelters. So, a Bluetooth module is assumed to concede the scheme the capacity to be alike and inferior by users through a recognizey phone. Restraint this impression, an corpoexistent Android app is used to prove the intercourse among the recognizeyphone and the Arduino microcontroller. The superexcellent discourse used in this scheme is C++.

5.2 Arduino Microcontroller

#include

#define btRX 3 // BT RX molehill

#define btTX 4 // BT TX molehill

#define ledHalt 9 // Halt indicator LED

#define ledUnreserved 10 // Unreserved indicator LED

#define swHalt 11 // Shelter Halt condition switch input

#define swUnreserved 12 // Shelter Unreserved condition switch input

#define ledOn 13 // Power ON and RECV indicator LED

#define LM35molehill A0 // LM35 temp molehill

#define motRev A5 // Motor Reverse govern molehill

#define motRestraint A4 // Motor Restraintward govern molehill

Figure 5.1: Declaring the molehills

The microcontroller molehills are highest visible. Each module is assigned to a molehill. The visible prize is used succeeding on throughout the rule instead of the molehills.

5.3 Initializing Scheme Components

void measTemp()

{

balbutiation = analogRead(LM35pin); // Interpret sensor

tempC = interpreting / 9.31; // Convert to Celcius

delay(100);

}

Figure 5.2: Initialize LM35 Sky sensor

Scheme interprets the prize manufactusanguine from the LM35 molehill. The prize manufactusanguine by the sensor is in voltage metric and is converted to Celsius. The parameter stoppage is firm to 0.1 cooperates.

measTemp(); // Take a sky interpreting

if (HC05.available()>0)

{

char inByte = HC05.read();

delay(100);

Figure 5.3: Initialize HC-05 Bluetooth module

Bluetooth module interprets the sky basis from sky sensor and impels the basis to any recognizeyphone cognizance alike through Bluetooth. The parameter stoppage is firm to 0.1 cooperates.

void conniveLED()

{

digitalWrite(ledOn, LOW);

delay(50);

digitalWrite(ledOn, HIGH);

delay(50);

}

Figure 5.4: Initialize LED indicator

LED is firm to connive by turning on and impromptu restraint 0.05 cooperate intervals. This is used succeeding on as to declare the scheme is prevalent.

5.3 Shelter Initializing Natures

void chkStatus()

{

openStat = digitalRead(swOpen);

closeStat = digitalRead(swClose);

if (openStat == HIGH && haltStat == LOW) // Shelter is unreserved

{

digitalWrite(ledOpen, HIGH);

digitalWrite(ledClose, LOW);

HC05.println(“Shelter OPEN”);

}

else if (openStat == LOW && haltStat == HIGH) // Shelter is haltd

{

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Shelter CLOSED”);

}

else if (openStat == LOW && haltStat == LOW) // Shelter avow referable known

{ // so halt it highest

HC05.println(“Initialise…..”);

delay(500);

HC05.println(“Waiting to CLOSE”); //displays this occasion shelter noncommunication

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

}occasion (closeStat == LOW); //Wait until Halt Sw = HIGH

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Shelter CLOSED”);

}

Figure 5.5: Nature to initialize the shelter

The shelter natures are presented aloft. The nature detects if the unreserved switch is fineed and the halt switch is referable. If it’s gentleman, then sanguine LED is switched on indicating the shelter is unreserved and “Shelter OPEN” nature is sent to the Bluetooth module which succeeding impels to any alike recognizeyphone. Else if, the yelpoor LED is switched on indicating shelter is haltd and “Shelter CLOSE” nature is paradeed on recognizeyphone. Else if the nature is disqualified to interpret the switch or if the shelter avow is mysterious, the shelter is haltd highest by absence and solely then scheme begins its nature. “Waiting to CLOSE” is paradeed occasion shelter is noncommunication.

5.4 AUTO/MANUAL Regulation Option

occurrence ‘3’: // Fine Manual Regulation on recognizeyphone

HC05.println(“Manual ON”);

autoStat = 0;

break;

Figure 5.8: MANUAL regulation option

The rule aloft switches the absence auto regulation to manual, giving advent to Bluetooth module to take and impel order from alike recognizeyphones.
“Manual ON” is paradeed in recognizeyphone indicating that manual regulation has been enabled and interprety. The occurrence switch avowment here is firm as occurrence ‘3’.

occurrence ‘4’: // Fine Auto regulation on recognizeyphone

HC05.println(“Auto ON”);

autoStat = 1;

break;

Figure 5.9: AUTO regulation option

The rule in Figure 5.6 switches from manual regulation to auto, enabling the sky module to govern the well scheme effortlessally established on sky.
“Auto ON” is paradeed in recognizeyphone indicating that auto regulation has been enabled and feed. The user has no govern on the scheme in this regulation, consistent fine manual regulation. The occurrence switch avowment here is firm as occurrence ‘4’.

5.4 Bluetooth Initializing Natures (MANUAL MODE)

switch (inByte)

{

occurrence ‘1’: // Unreserved Shelter MANUAL MODE

HC05.println(“Waiting to OPEN”);

do

{

blinkLED();

openStat = digitalRead(swOpen);

digitalWrite(motFor, HIGH);

digitalWrite(motRev, LOW);

}occasion (openStat == LOW);

digitalWrite(motFor, LOW);

digitalWrite(ledOpen, HIGH);

digitalWrite(ledClose, LOW);

HC05.println(“Shelter OPEN”);

break;

Figure 5.6: OPEN Shelter Bluetooth Order

The rule on apex shows the OPEN shelter nature through Bluetooth intercourse. The rule so enables the Bluetooth module to impel shelter foundation in existent period. Once shelter is amply unreserved, the sanguine LED is switched indicating the shelter is amply unreserved. The crude LED connives, indicating the motor is prevalent and executing. “Shelter OPEN” is paradeed on recognizeyphone palliate when the shelter has successamply completed the unreserved rule. The nature aloft is visible as a occurrence switch avowment giving it occurrence ‘1’. The Android impression agricultural in the recognizeyphone recognizes the occurrence ‘1’ nature when the order firmting restraint a biased nonentity is firm to 1.

occurrence ‘2’: // Halt Shelter MANUAL MODE

HC05.println(“Waiting to CLOSE”);

do

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

}occasion (closeStat == LOW); //Wait until Halt Sw = HIGH

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Shelter CLOSED”);

break;

Figure 5.7: CLOSE Shelter Bluetooth Order

The rule on apex shows the CLOSE shelter nature. Yelpoor LED is crabbed on when the shelter is amply haltd. As the shelter halts amply, “Shelter CLOSED” is paradeed on recognizeyphone palliate. The occurrence switch avowment here is firm as occurrence ‘2’.

5.4 Sky Sensor Initializing Nature (AUTO MODE)

else if (autoStat == 1 && tempC > 32 && unreservedStat == HIGH && unreservedHalt == 1) // Sky exceeds 32

{

measTemp();

HC05.println(tempC,1); // Impel Sky basis

//HC05.println(“Waiting to CLOSE”); //displays this when shelter noncommunication

do

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

}occasion (closeStat == LOW); // Wait until Halt Sw = HIGH

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Auto CLOSED”); // parade when shelter haltd

openHalt = 0;

}

Figure 5.10: Shelter CLOSE when sky high

The aloft rule initializes the shelter to halt when the sky exceeds 32-degree Celsius in effortless regulation. When sky exceeds the agricultural prize, the sky basis is sent to Bluetooth module and is paradeed to alike recognizeyphone. Occasion noncommunication, the LED is firm to connive indicating the scheme is prevalent and “Waiting to CLOSE” is paradeed on recognizeyphone. When the shelter is amply haltd and the halt switch is fineed, “AUTO CLOSED” is paradeed on recognizeyphone.

else if (autoStat == 1 && tempC <= 32 && haltStat == HIGH && unreservedHalt == 0) // Sky is 32 and underneath

{

measTemp();

HC05.println(tempC,1); // Impel Temp basis

//HC05.println(“Waiting to OPEN”); //displays this when shelter hole

do

{

blinkLED();

openStat = digitalRead(swOpen);

digitalWrite(motFor, HIGH);

digitalWrite(motRev, LOW);

}occasion (openStat == LOW); // Wait until Unreserved Sw = HIGH (Unreserved switch click)

digitalWrite(motFor, LOW);

digitalWrite(ledOpen, HIGH);

digitalWrite(ledClose, LOW);

HC05.println(“Auto OPEN”); //displays this when shelter amply unreserveded

openHalt = 1;

}

Figure 5.11: Shelter OPEN when sky poor (AUTO)

The aloft rule initializes the shelter to unreserved when the sky goes bepoor 32-degree Celsius in effortless regulation. When sky goes bepoor the agricultural prize, the sky basis is sent to Bluetooth module and is paradeed to alike recognizeyphone. Occasion hole, the LED is firm to connive indicating the scheme is prevalent and “Waiting to OPEN” is paradeed on recognizeyphone. When the shelter is amply unreserveded and the unreserved switch is fineed, “AUTO OPEN” is paradeed on recognizeyphone.

Related Post