Wednesday, April 3, 2019

Arduino-Based Temperature Automated Curtain Railing System

Arduino-Based temporary workererature machine-driven chimneypiece Railing bodyCHAPTER 5THE resultant5.1OverviewThe goal of Arduino-Based Temperature Automated Curtain Railing System is to ease the unremarkable operation of residential winding-clothess by automating the renders w present the curtains doesnt require human effort and operates by using electric powered tugs. Based on the implementation methods discussed in the previous chapter, the proposed solution to achieve the goal and objectives is thoroughly explained and evaluated in this chapter. Arduino-Based Temperature Automated Curtain Railing System has two methods of use. A temperature faculty sensor is integrated into the organisation to read and orchestrate temperature data which then the systems evaluates and decides in finish and looseing the curtains. Also, a Bluetooth faculty is added to give the system the potentiality to be affiliated and check up onled by users through a smart phone. For this application, an animate Android app is used to establish the connection between the smartphone and the Arduino microcontroller. The prime linguistic communication used in this system is C++.5.2Arduino Microcontrollerinclude go down btRX 3 // BT RX signal flagdefine btTX 4 // BT TX pindefine led stopping point 9 // Close indicator light-emitting diodedefine led escaped 10 // untied indicator LEDdefine swClose 11 // Curtain Close limit assemble remarkdefine swOpen 12 // Curtain Open limit switch insertdefine ledOn 13 // Power ON and RECV indicator LEDdefine LM35pin A0 // LM35 temp pindefine motRev A5 // Motor Reverse control pindefine motFor A4 // Motor Forward control pin view 5.1 Declaring the pinsThe microcontroller pins argon first declared. Each faculty is assigned to a pin. The declared nurture is used later on throughout the commandment instead of the pins.5.3Initializing System Componentsvoid measTemp()reading = analogRead(LM35pin) // Read sensortempC = reading / 9. 31 // Convert to Celciusdelay(100) haoma 5.2 determine LM35 Temperature sensorSystem reads the value produced from the LM35 pin. The value produced by the sensor is in voltage metric and is converted to Celsius. The parameter delay is restrict to 0.1 seconds.measTemp() // Take a temperature readingif (HC05.available()0)char inByte = HC05.read()delay(100)Figure 5.3 Initialize HC-05 Bluetooth moduleBluetooth module reads the temperature data from temperature sensor and sends the data to any smartphone device connected through Bluetooth. The parameter delay is set to 0.1 seconds.void flauntLED()digitalWrite(ledOn, LOW)delay(50)digitalWrite(ledOn, HIGH)delay(50)Figure 5.4 Initialize LED indicatorLED is set to blink by twist on and off for 0.05 second intervals. This is used later on as to indicate the system is trial.5.3Curtain Initializing component parts void chkStatus()openStat = digitalRead(swOpen) abuttingStat = digitalRead(swClose)if (openStat == HIGH closeStat == LOW) // C urtain is opendigitalWrite(ledOpen, HIGH)digitalWrite(ledClose, LOW)HC05.println(Curtain uncovered)else if (openStat == LOW closeStat == HIGH) // Curtain is disagreeabledigitalWrite(ledOpen, LOW)digitalWrite(ledClose, HIGH)HC05.println(Curtain unappealing)else if (openStat == LOW closeStat == LOW) // Curtain state non known // so close it firstHC05.println(Initialise..)delay(500)HC05.println( hold to CLOSE) //displays this while curtain closingblinkLED()closeStat = digitalRead(swClose)digitalWrite(motRev, HIGH)digitalWrite(motFor, LOW)while (closeStat == LOW) // abide until Close Sw = HIGHdigitalWrite(motRev, LOW)digitalWrite(ledOpen, LOW)digitalWrite(ledClose, HIGH)HC05.println(Curtain CLOSED)Figure 5.5 Function to initialize the curtainThe curtain functions are presented higher up. The function detects if the open switch is engaged and the close switch is not. If its true, then red LED is switched on indicating the curtain is open and Curtain OPEN character is sent to the B luetooth module which later sends to any connected smartphone. Else if, the yellow LED is switched on indicating curtain is closed and Curtain CLOSE character is displayed on smartphone. Else if the function is inefficient to read the switch or if the curtain state is unknown, the curtain is closed first by default and only then system begins its function. Waiting to CLOSE is displayed while curtain is closing.5.4AUTO/MANUAL Mode survival of the fittestcase 3 // Select Manual Mode on smartphoneHC05.println(Manual ON)autoStat = 0breakFigure 5.8 MANUAL mode selection The work out above switches the default auto mode to manual(a), giving access to Bluetooth module to clear and send command from connected smartphones. Manual ON is displayed in smartphone indicating that manual mode has been enabled and ready. The case switch statement here is set as case 3.case 4 // Select Auto mode on smartphoneHC05.println(Auto ON)autoStat = 1breakFigure 5.9 AUTO mode selectionThe code in Figure 5.6 switches from manual mode to auto, enabling the temperature module to control the whole system automatically based on temperature.Auto ON is displayed in smartphone indicating that auto mode has been enabled and live. The user has no control on the system in this mode, unless select manual mode. The case switch statement here is set as case 4.5.4Bluetooth Initializing Functions (MANUAL MODE)switch (inByte)case 1 // Open Curtain MANUAL MODEHC05.println(Waiting to OPEN)doblinkLED()openStat = digitalRead(swOpen)digitalWrite(motFor, HIGH)digitalWrite(motRev, LOW)while (openStat == LOW)digitalWrite(motFor, LOW)digitalWrite(ledOpen, HIGH)digitalWrite(ledClose, LOW)HC05.println(Curtain OPEN)breakFigure 5.6 OPEN Curtain Bluetooth CommandThe code on top shows the OPEN curtain function through Bluetooth connection. The code also enables the Bluetooth module to send curtain status in real time. Once curtain is amply open, the red LED is switched indicating the curtain is fully open. The green LED blinks, indicating the motor is running and executing. Curtain OPEN is displayed on smartphone screen when the curtain has successfully completed the open process. The function above is declared as a case switch statement giving it case 1. The Android application installed in the smartphone recognizes the case 1 function when the command setting for a specific button is set to 1.case 2 // Close Curtain MANUAL MODEHC05.println(Waiting to CLOSE)doblinkLED()closeStat = digitalRead(swClose)digitalWrite(motRev, HIGH)digitalWrite(motFor, LOW)while (closeStat == LOW) //Wait until Close Sw = HIGHdigitalWrite(motRev, LOW)digitalWrite(ledOpen, LOW)digitalWrite(ledClose, HIGH)HC05.println(Curtain CLOSED)breakFigure 5.7 CLOSE Curtain Bluetooth CommandThe code on top shows the CLOSE curtain function. Yellow LED is glum on when the curtain is fully closed. As the curtain closes fully, Curtain CLOSED is displayed on smartphone screen. The case switch statement here is set as case 2.5.4T emperature Sensor Initializing Function (AUTO MODE)else if (autoStat == 1 tempC 32 openStat == HIGH openClose == 1) // Temperature exceeds 32measTemp()HC05.println(tempC,1) // Send Temperature data//HC05.println(Waiting to CLOSE) //displays this when curtain closingdoblinkLED()closeStat = digitalRead(swClose)digitalWrite(motRev, HIGH)digitalWrite(motFor, LOW)while (closeStat == LOW) // Wait until Close Sw = HIGHdigitalWrite(motRev, LOW)digitalWrite(ledOpen, LOW)digitalWrite(ledClose, HIGH)HC05.println(Auto CLOSED) // display when curtain closedopenClose = 0Figure 5.10 Curtain CLOSE when temperature highThe above code initializes the curtain to close when the temperature exceeds 32-degree Celsius in automatic mode. When temperature exceeds the fixed value, the temperature data is sent to Bluetooth module and is displayed to connected smartphone. While closing, the LED is set to blink indicating the system is running and Waiting to CLOSE is displayed on smartphone. When the curtai n is fully closed and the close switch is engaged, AUTO CLOSED is displayed on smartphone.else if (autoStat == 1 tempC measTemp()HC05.println(tempC,1) // Send Temp data//HC05.println(Waiting to OPEN) //displays this when curtain openingdoblinkLED()openStat = digitalRead(swOpen)digitalWrite(motFor, HIGH)digitalWrite(motRev, LOW)while (openStat == LOW) // Wait until Open Sw = HIGH (Open switch click)digitalWrite(motFor, LOW)digitalWrite(ledOpen, HIGH)digitalWrite(ledClose, LOW)HC05.println(Auto OPEN) //displays this when curtain fully openedopenClose = 1Figure 5.11 Curtain OPEN when temperature low (AUTO)The above code initializes the curtain to open when the temperature goes below 32-degree Celsius in automatic mode. When temperature goes below the fixed value, the temperature data is sent to Bluetooth module and is displayed to connected smartphone. While opening, the LED is set to blink indicating the system is running and Waiting to OPEN is displayed on smartphone. When the curta in is fully opened and the open switch is engaged, AUTO OPEN is displayed on smartphone.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.