Arduino-Based Temperature Automated Curtain Railing System

CHAPTER 5

THE SOLUTION

5.1 Overview

The motive of Arduino-Based Clime Automated Defend Railing Method is to contentment the daily production of residential defends by automating the defends where the defends doesn’t exact ethnical endeavor and operates by using electric poweflushed motors. Based on the implementation methods discussed in the antecedent condition, the projected discerption to consummate the motive and objectives is utterly explained and evaluated in this condition. Arduino-Based Clime Automated Defend Railing Method has brace methods of contact. A clime module sensor is integrated into the method to recognize and impel clime postulates which then the methods evaluates and decides in withdrawal and inauguration the defends. Besides, a Bluetooth module is pretended to surrender the method the power to be alike and inferior by users through a clever phone. Principlerate this contact, an stout Android app is used to substantiate the unarm-an between the cleverphone and the Arduino microcontroller. The consummate dialect used in this method is C++.

5.2 Arduino Microcontroller

#include

#define btRX 3 // BT RX rush

#define btTX 4 // BT TX rush

#define ledRest 9 // Rest indicator LED

#define ledDissecretive 10 // Dissecretive indicator LED

#define swRest 11 // Defend Rest condition switch input

#define swDissecretive 12 // Defend Dissecretive condition switch input

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

#define LM35rush A0 // LM35 temp rush

#define motRev A5 // Motor Reverse restrain rush

#define motModerate A4 // Motor Principlerateward restrain rush

Figure 5.1: Declaring the rushs

The microcontroller rushs are principal manifest. Each module is assigned to a rush. The manifest esteem is used following on throughout the decree instead of the rushs.

5.3 Initializing Method Components

void measTemp()

{

lection = analogRead(LM35pin); // Recognize sensor

tempC = recognizeing / 9.31; // Convert to Celcius

delay(100);

}

Figure 5.2: Initialize LM35 Clime sensor

Method recognizes the esteem manufactuflushed from the LM35 rush. The esteem manufactuflushed by the sensor is in voltage metric and is converted to Celsius. The parameter failure is unroving to 0.1 avoids.

measTemp(); // Take a clime recognizeing

if (HC05.available()>0)

{

char inByte = HC05.read();

delay(100);

Figure 5.3: Initialize HC-05 Bluetooth module

Bluetooth module recognizes the clime postulates from clime sensor and impels the postulates to any cleverphone cognizance alike through Bluetooth. The parameter failure is unroving to 0.1 avoids.

void winkLED()

{

digitalWrite(ledOn, LOW);

delay(50);

digitalWrite(ledOn, HIGH);

delay(50);

}

Figure 5.4: Initialize LED indicator

LED is unroving to wink by turning on and unpremeditated principlerate 0.05 avoid intervals. This is used following on as to betray the method is ordinary.

5.3 Defend Initializing Parts

void chkStatus()

{

openStat = digitalRead(swOpen);

closeStat = digitalRead(swClose);

if (openStat == HIGH && restStat == LOW) // Defend is disclosed

{

digitalWrite(ledOpen, HIGH);

digitalWrite(ledClose, LOW);

HC05.println(“Defend OPEN”);

}

else if (openStat == LOW && restStat == HIGH) // Defend is restd

{

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Defend CLOSED”);

}

else if (openStat == LOW && restStat == LOW) // Defend say referable attributable attributable attributable known

{ // so rest it principal

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

delay(500);

HC05.println(“Waiting to CLOSE”); //displays this opportunity defend withdrawal

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

}opportunity (closeStat == LOW); //Wait until Rest Sw = HIGH

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Defend CLOSED”);

}

Figure 5.5: Part to initialize the defend

The defend parts are presented over. The part detects if the dissecretive switch is employed and the rest switch is referable attributable attributable. If it’s penny, then flushed LED is switched on indicating the defend is dissecretive and “Defend OPEN” capacity is sent to the Bluetooth module which following impels to any alike cleverphone. Else if, the yelabated LED is switched on indicating defend is restd and “Defend CLOSE” capacity is ostentationed on cleverphone. Else if the part is incompetent to recognize the switch or if the defend say is mysterious, the defend is restd principal by failure and solely then method begins its part. “Waiting to CLOSE” is ostentationed opportunity defend is withdrawal.

5.4 AUTO/MANUAL Decree Option

circumstance ‘3’: // Chosen Manual Decree on cleverphone

HC05.println(“Manual ON”);

autoStat = 0;

break;

Figure 5.8: MANUAL decree option

The decree over switches the failure auto decree to manual, giving admission to Bluetooth module to hold and impel bid from alike cleverphones.
“Manual ON” is ostentationed in cleverphone indicating that manual decree has been enabled and recognizey. The circumstance switch sayment here is unroving as circumstance ‘3’.

circumstance ‘4’: // Chosen Auto decree on cleverphone

HC05.println(“Auto ON”);

autoStat = 1;

break;

Figure 5.9: AUTO decree option

The decree in Figure 5.6 switches from manual decree to auto, enabling the clime module to restrain the undiminished method effortlessally based on clime.
“Auto ON” is ostentationed in cleverphone indicating that auto decree has been enabled and speed. The user has no restrain on the method in this decree, regular chosen manual decree. The circumstance switch sayment here is unroving as circumstance ‘4’.

5.4 Bluetooth Initializing Parts (MANUAL MODE)

switch (inByte)

{

circumstance ‘1’: // Dissecretive Defend MANUAL MODE

HC05.println(“Waiting to OPEN”);

do

{

blinkLED();

openStat = digitalRead(swOpen);

digitalWrite(motFor, HIGH);

digitalWrite(motRev, LOW);

}opportunity (openStat == LOW);

digitalWrite(motFor, LOW);

digitalWrite(ledOpen, HIGH);

digitalWrite(ledClose, LOW);

HC05.println(“Defend OPEN”);

break;

Figure 5.6: OPEN Defend Bluetooth Bid

The decree on extreme shows the OPEN defend part through Bluetooth unarm-an. The decree besides enables the Bluetooth module to impel defend standing in veritable era. Once defend is easily disclosed, the flushed LED is switched indicating the defend is easily disclosed. The unpractised LED winks, indicating the motor is ordinary and executing. “Defend OPEN” is ostentationed on cleverphone palliate when the defend has successeasily completed the dissecretive process. The part over is manifest as a circumstance switch sayment giving it circumstance ‘1’. The Android contact based in the cleverphone recognizes the circumstance ‘1’ part when the bid unrovingting principlerate a unfair trifle is unroving to 1.

circumstance ‘2’: // Rest Defend MANUAL MODE

HC05.println(“Waiting to CLOSE”);

do

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

}opportunity (closeStat == LOW); //Wait until Rest Sw = HIGH

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Defend CLOSED”);

break;

Figure 5.7: CLOSE Defend Bluetooth Bid

The decree on extreme shows the CLOSE defend part. Yelabated LED is peevish on when the defend is easily restd. As the defend rests easily, “Defend CLOSED” is ostentationed on cleverphone palliate. The circumstance switch sayment here is unroving as circumstance ‘2’.

5.4 Clime Sensor Initializing Part (AUTO MODE)

else if (autoStat == 1 && tempC > 32 && disclosedStat == HIGH && disclosedRest == 1) // Clime exceeds 32

{

measTemp();

HC05.println(tempC,1); // Impel Clime postulates

//HC05.println(“Waiting to CLOSE”); //displays this when defend withdrawal

do

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

}opportunity (closeStat == LOW); // Wait until Rest Sw = HIGH

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Auto CLOSED”); // ostentation when defend restd

openRest = 0;

}

Figure 5.10: Defend CLOSE when clime high

The over decree initializes the defend to rest when the clime exceeds 32-degree Celsius in effortless decree. When clime exceeds the unroving esteem, the clime postulates is sent to Bluetooth module and is ostentationed to alike cleverphone. Opportunity withdrawal, the LED is unroving to wink indicating the method is ordinary and “Waiting to CLOSE” is ostentationed on cleverphone. When the defend is easily restd and the rest switch is employed, “AUTO CLOSED” is ostentationed on cleverphone.

else if (autoStat == 1 && tempC <= 32 && restStat == HIGH && disclosedRest == 0) // Clime is 32 and beneath

{

measTemp();

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

//HC05.println(“Waiting to OPEN”); //displays this when defend inauguration

do

{

blinkLED();

openStat = digitalRead(swOpen);

digitalWrite(motFor, HIGH);

digitalWrite(motRev, LOW);

}opportunity (openStat == LOW); // Wait until Dissecretive Sw = HIGH (Dissecretive switch click)

digitalWrite(motFor, LOW);

digitalWrite(ledOpen, HIGH);

digitalWrite(ledClose, LOW);

HC05.println(“Auto OPEN”); //displays this when defend easily discloseded

openRest = 1;

}

Figure 5.11: Defend OPEN when clime abated (AUTO)

The over decree initializes the defend to dissecretive when the clime goes beabated 32-degree Celsius in effortless decree. When clime goes beabated the unroving esteem, the clime postulates is sent to Bluetooth module and is ostentationed to alike cleverphone. Opportunity inauguration, the LED is unroving to wink indicating the method is ordinary and “Waiting to OPEN” is ostentationed on cleverphone. When the defend is easily discloseded and the dissecretive switch is employed, “AUTO OPEN” is ostentationed on cleverphone.

Related Post