Arduino-Based Temperature Automated Curtain Railing System

CHAPTER 5

THE SOLUTION

5.1 Overview

The end of Arduino-Established Region Automated Protect Railing Rule is to refreshment the daily agency of residential protects by automating the protects where the protects doesn’t insist-upon ethnical attempt and operates by using electric poweblushing motors. Established on the implementation methods discussed in the regulatemer portion, the projected reresolution to consummate the end and objectives is collectively explained and evaluated in this portion. Arduino-Established Region Automated Protect Railing Rule has two methods of impression. A region module sensor is integrated into the rule to interpret and transmit region basis which then the rules evaluates and decides in bankruptcy and hole the protects. Besides, a Bluetooth module is ascititious to impart the rule the aptitude to be conjoined and inferior by users through a brisk phone. Regulate this impression, an solid Android app is used to fir the relevance among the briskphone and the Arduino microcontroller. The perfect phraseology used in this rule is C++.

5.2 Arduino Microcontroller

#include

#define btRX 3 // BT RX molehill

#define btTX 4 // BT TX molehill

#define ledEnd 9 // End indicator LED

#define ledPublic 10 // Public indicator LED

#define swEnd 11 // Protect End word switch input

#define swPublic 12 // Protect Public word switch input

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

#define LM35molehill A0 // LM35 temp molehill

#define motRev A5 // Motor Reverse manage molehill

#define motRegulate A4 // Motor Regulateward manage molehill

Figure 5.1: Declaring the molehills

The microcontroller molehills are leading outward. Each module is assigned to a molehill. The outward compute is used after on throughout the order instead of the molehills.

5.3 Initializing Rule Components

void measTemp()

{

balbutiation = analogRead(LM35pin); // Interpret sensor

tempC = interpreting / 9.31; // Convert to Celcius

delay(100);

}

Figure 5.2: Initialize LM35 Region sensor

Rule interprets the compute effected from the LM35 molehill. The compute effected by the sensor is in voltage metric and is converted to Celsius. The parameter failure is established to 0.1 remedys.

measTemp(); // Take a region interpreting

if (HC05.available()>0)

{

char inByte = HC05.read();

delay(100);

Figure 5.3: Initialize HC-05 Bluetooth module

Bluetooth module interprets the region basis from region sensor and transmits the basis to any briskphone plan conjoined through Bluetooth. The parameter failure is established to 0.1 remedys.

void ignoreLED()

{

digitalWrite(ledOn, LOW);

delay(50);

digitalWrite(ledOn, HIGH);

delay(50);

}

Figure 5.4: Initialize LED indicator

LED is established to ignore by turning on and unstudied regulate 0.05 remedy intervals. This is used after on as to betoken the rule is general.

5.3 Protect Initializing Discharges

void chkStatus()

{

openStat = digitalRead(swOpen);

closeStat = digitalRead(swClose);

if (openStat == HIGH && endStat == LOW) // Protect is public

{

digitalWrite(ledOpen, HIGH);

digitalWrite(ledClose, LOW);

HC05.println(“Protect OPEN”);

}

else if (openStat == LOW && endStat == HIGH) // Protect is endd

{

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Protect CLOSED”);

}

else if (openStat == LOW && endStat == LOW) // Protect avow referable known

{ // so end it leading

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

delay(500);

HC05.println(“Waiting to CLOSE”); //displays this occasion protect bankruptcy

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

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

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Protect CLOSED”);

}

Figure 5.5: Discharge to initialize the protect

The protect discharges are presented overhead. The discharge detects if the public switch is occupied and the end switch is referable. If it’s penny, then blushing LED is switched on indicating the protect is public and “Protect OPEN” office is sent to the Bluetooth module which after transmits to any conjoined briskphone. Else if, the yelmoderate LED is switched on indicating protect is endd and “Protect CLOSE” office is exhibited on briskphone. Else if the discharge is incapable to interpret the switch or if the protect avow is unrecognized, the protect is endd leading by restraintfeit and barely then rule begins its discharge. “Waiting to CLOSE” is exhibited occasion protect is bankruptcy.

5.4 AUTO/MANUAL Legislation Gathering

subject ‘3’: // Fine Manual Legislation on briskphone

HC05.println(“Manual ON”);

autoStat = 0;

break;

Figure 5.8: MANUAL legislation gathering

The order overhead switches the restraintfeit auto legislation to manual, giving arrival to Bluetooth module to take and transmit order from conjoined briskphones.
“Manual ON” is exhibited in briskphone indicating that manual legislation has been enabled and interprety. The subject switch avowment here is established as subject ‘3’.

subject ‘4’: // Fine Auto legislation on briskphone

HC05.println(“Auto ON”);

autoStat = 1;

break;

Figure 5.9: AUTO legislation gathering

The order in Figure 5.6 switches from manual legislation to auto, enabling the region module to manage the gross rule automatically established on region.
“Auto ON” is exhibited in briskphone indicating that auto legislation has been enabled and speed. The user has no manage on the rule in this legislation, cosmical fine manual legislation. The subject switch avowment here is established as subject ‘4’.

5.4 Bluetooth Initializing Discharges (MANUAL MODE)

switch (inByte)

{

subject ‘1’: // Public Protect 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(“Protect OPEN”);

break;

Figure 5.6: OPEN Protect Bluetooth Order

The order on extreme shows the OPEN protect discharge through Bluetooth relevance. The order besides enables the Bluetooth module to transmit protect foundation in true period. Once protect is amply public, the blushing LED is switched indicating the protect is amply public. The bare LED ignores, indicating the motor is general and executing. “Protect OPEN” is exhibited on briskphone defend when the protect has successamply completed the public method. The discharge overhead is outward as a subject switch avowment giving it subject ‘1’. The Android impression naturalized in the briskphone recognizes the subject ‘1’ discharge when the order establishedting regulate a particular pin is established to 1.

subject ‘2’: // End Protect MANUAL MODE

HC05.println(“Waiting to CLOSE”);

do

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

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

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Protect CLOSED”);

break;

Figure 5.7: CLOSE Protect Bluetooth Order

The order on extreme shows the CLOSE protect discharge. Yelmoderate LED is crabbed on when the protect is amply endd. As the protect ends amply, “Protect CLOSED” is exhibited on briskphone defend. The subject switch avowment here is established as subject ‘2’.

5.4 Region Sensor Initializing Discharge (AUTO MODE)

else if (autoStat == 1 && tempC > 32 && publicStat == HIGH && publicEnd == 1) // Region exceeds 32

{

measTemp();

HC05.println(tempC,1); // Transmit Region basis

//HC05.println(“Waiting to CLOSE”); //displays this when protect bankruptcy

do

{

blinkLED();

closeStat = digitalRead(swClose);

digitalWrite(motRev, HIGH);

digitalWrite(motFor, LOW);

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

digitalWrite(motRev, LOW);

digitalWrite(ledOpen, LOW);

digitalWrite(ledClose, HIGH);

HC05.println(“Auto CLOSED”); // exhibit when protect endd

openEnd = 0;

}

Figure 5.10: Protect CLOSE when region high

The overhead order initializes the protect to end when the region exceeds 32-degree Celsius in automatic legislation. When region exceeds the agricultural compute, the region basis is sent to Bluetooth module and is exhibited to conjoined briskphone. Occasion bankruptcy, the LED is established to ignore indicating the rule is general and “Waiting to CLOSE” is exhibited on briskphone. When the protect is amply endd and the end switch is occupied, “AUTO CLOSED” is exhibited on briskphone.

else if (autoStat == 1 && tempC <= 32 && endStat == HIGH && publicEnd == 0) // Region is 32 and adown

{

measTemp();

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

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

do

{

blinkLED();

openStat = digitalRead(swOpen);

digitalWrite(motFor, HIGH);

digitalWrite(motRev, LOW);

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

digitalWrite(motFor, LOW);

digitalWrite(ledOpen, HIGH);

digitalWrite(ledClose, LOW);

HC05.println(“Auto OPEN”); //displays this when protect amply publiced

openEnd = 1;

}

Figure 5.11: Protect OPEN when region methodrate (AUTO)

The overhead order initializes the protect to public when the region goes bemoderate 32-degree Celsius in automatic legislation. When region goes bemoderate the agricultural compute, the region basis is sent to Bluetooth module and is exhibited to conjoined briskphone. Occasion hole, the LED is established to ignore indicating the rule is general and “Waiting to OPEN” is exhibited on briskphone. When the protect is amply publiced and the public switch is occupied, “AUTO OPEN” is exhibited on briskphone.

Related Post