Controlling Mechanical Processes in a Modern House (Smart ... · All Arduino boards can be...
Transcript of Controlling Mechanical Processes in a Modern House (Smart ... · All Arduino boards can be...
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
118
Controlling Mechanical Processes in a Modern House (Smart House)
Abdusalam I. Al-khwaji
1, Abdusalam M. Sharf
2, Abdallah O. Hawal
3, Saleh N. Ben
Najim4
1 AL Asmarya Islamic University Mechanical Engineering Department, College of Engineering, [email protected] 2 Mechanical Eng. Department, Elmergib University, Alkhoms, Libya. [email protected]
3 Electrical Eng. Department, Elmergib University, Alkhoms, Libya. [email protected] 4 AL Asmarya Islamic University Mechanical Engineering Department, College of Engineering, [email protected]
ABSTRACT
Comfort, Security and safety are very important factors to consider during design of a modern
house. In fact, automated houses (smart houses) have great impact in maintaining healthy lifestyle
and minimize energy usages. Maintaining all house processes in preciseness, accurately, and
repeatedly manner are very crucial to achieve our goal. Human comforts and safety require
monitoring each sub-dynamic system that is in a daily routine and during 24-hours. As an example of
common domestic controlled processes are watering garden, opening/closing doors, lighting, fire-
alarms, safety-alarms, and air-condition. Without automation these processes that will require a
responsible person to accomplish each task in a reputable schedule- time. The fact is that rarely one
has time to do all of his/her house work or maybe another case where a disable resident needs help
to maintain these mentioned processes.
This research paper covers an available and easy way for everyone to automate his/her house
using an affordable technique which makes use of small microcontroller called Arduino. The
development of smart house, which can automatically open/close doors, watering garden, maintain
security (alarm from dangerous), lighting during dark-time, controlling air-condition and display the
results in an LCD screen. Feedback signals from each of the mentioned five close-loop control system
are collected by the corresponding sensing methods. Soil-wetness, Ultrasonic-distance, Photocells,
electronic thermometer are used as feedback measurement instruments, which were used to control
each of the home-process. All the controlling processes and steps were coded and uploaded to
Arduino- UNO.
Keywords: smart house; soil-wetness sensor; temperature control; Arduino; ultrasonic sensor
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
119
1. INTRODUCTION
The process of maintaining complete control of a dynamic system requires feedback (signal
from a sensors) to direct the system toward doing its required functions. In this paper, the dynamic
system under study is going to be five dynamic processes. A feedback signals are collected from
ultrasonic, photocells, soil-wetness, and electronic thermometer sensors. Then the system will try to
maintain five design parameters by comparing feedback signals versus the specified operation
points. One of the feedback carriers of the five close-loop control system was the piezoelectric
ultrasonic transducer (HC-SR04). The project was zoomed down to a level of 1 m: 1 cm scale, to allow
us to visualize the system, but we still can have the same result, when we built the system in actual
scale. The automated house model is expected to smooth the controlling process and make it easier
to reduce the efforts required to maintain the controlling process during 24 hours.
In this project, an Arduino- microcontroller was used to control all needed activities. Arduino
microcontroller has been used in controlling many mechanical and medical devices. Arduino has
been used to control automatic parking lots [1], gas valve [2], pulse signal detection [3], heart rate
monitoring [4], and other controlling projects.
This project is designed to demonstrate an optimal way to automate a house and to reduce the
energy consumption required to run the house’s activities. The goal of the present research is to
evaluate mechanism of the automated smart house system. The system control, measurements, and
instruments are all tested during operation and a report of their preciseness, sensitivity, and
repeatability was documented in this paper.
2. ARDUINO MICROCONTROLLER The Arduino is name of a company which produces open-source small (microcontroller
boards) hardware and Software. Arduino applications can be seen in many fields, such as; industrial
controllers to control many industrial production processes, or as part of an instrument to measure
specific physical quantity (Temperature, Pressure, etc.). These systems (controller) consist of sensors
which transfer feedback signal (digital- or analog-signals) to an Arduino-board. Arduino boards are
primarily programmed using the C and C++ programming languages [7]. The only limitation of an
Arduino boards is that the sensed voltage range is designed to be between 0 and +5 V which will
require extra work in case a feedback-sensed voltage was negative.
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
120
Programming
All Arduino boards can be programmed with the (Arduino Software (IDE)) using C and C++
programming languages [8-9].
Arduino Uno Hardware
Arduino Uno is a microcontroller board based on the ATmega328P. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz quartz crystal,
a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to
support the microcontroller; simply connect it to a computer with a USB cable or power it with an AC-
to-DC adapter or battery to get started [9]. In this project, sensors-structure was built for each sensing
method. As an example, for HC-SR04 sensors, to get an optimal way to transfer input/output data
from/to Arduino-pins , we introduce the structure as:
Structure Transducer
{ Integer Trigger Pin;
Integer echo Pin;
Float Distance; };
3. DISTANCE MEASUREMENT WITH ULTRASONIC
TECHNIQUES
Ultrasonic measurement instrument is compound of a transmitter (transmits an ultrasound wave)
and a receiver (receives the wave). As an example of an ultrasonic transducer is the model of HC-
RS04 ultrasonic transducer. Each HC-SR04 module has an ultrasonic transmitter, a receiver and a
control circuit. The four transducer’s pins are VCC (Power), Trig (Trigger), Echo (Receive), and GND
(Ground). The basic principles of an ultrasonic transducer are to measure the time between
transmission of an ultrasonic energy from transmitter and receipt of that energy by a receiver. Then,
the distance d can be calculated from the following equation [6]:
(1)
where v is ultrasound velocity and t is the time consumed for the signal to travel between transmitter
and receiver of the sensor. An important systematic error associated with this instrument is the
variability of the ultrasound velocity with environment temperature according to equation (1).
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
121
Timing diagram
The distance through the time interval between sending trig-signal and receiving echo-signal can
be calculated from the following Formula: μS / 58 = centimeters; or: the range = maximum time *
velocity (340 m/sec at 20 Co) / 2; It is recommended to use 60ms measurement cycle [1].
( )
( )
(2)
3.1. CHARACTERIZING ULTERASONIC SENSOR
The ultrasonic wave speed changes depending in the medium through which the wave travels.
Transmission speeds in common media are given in Table 1. When the media is air, the speed of
ultrasound is affected by environmental factors such as temperature, humidity and air turbulence. Of
these, temperature has the largest effect. The velocity of sound through air varies with temperature
according to:
( ) (3)
where T is the temperature in °C. Thus, even for a relatively small temperature change of 20 degrees
from 0°C to 20°C, the velocity changes from 331.6m/s to 343.6m/s.
Humidity changes have negligible effect. When the relative humidity increases by 20%, the
corresponding increase in the sound velocity is 0.07% (corresponding to an increase from 331.6m/s to
331.8m/s at 0°C). Changes in air pressure itself have also negligible effect on the velocity. Similarly,
air turbulence normally has no effect (though note that air turbulence may deflect waves away from
their traveling direction). However, if turbulence involves currents of air at different temperatures,
then random changes in ultrasound velocity occur according to equation (3). Wind also can alter the
traveling direction of the waves. For an air flow with speed of 10 km/h, the deflection of the traveling
wave can be by 8mm over a distance of 1m.
Table 1 Speed of sound through different environments
Medium Velocity (m/s)
Air 331.6
Water 1440
Wood (pine) 3320
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
122
Calibrating HC-SR04, TMP36, and Soil Moisture Transducers
Experimental measurements were obtained using a HCSR04 Ultrasonic transducer to
recalibrate and test the instrument at 20 C0 and for different known measurement inputs of {0, 5, 10,
15, 20 25, and 30 centimeters} as in figure 1-a. After that another sets of known measurement inputs
of {0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5 and 5.0 meters} are collected as illustrated in figure 1-
b. Relation between measurement inputs and instrument outputs can be seen as a linear for the
range between 3 cm and 5 meters. The sensitivity is K = μS / 58 centimeters [1].
Figure 1 Calibration of the HC-SR04 for input range (a) between 0 & 30 cm at 20 C
o (b) Between 0 & 5 meters at 20 C
o
Analyzing sensitivity drift Caused by ambient temperatures change
To analyze and quantify how much drift there is for each change in medium’s temperatures, as
indicated in section 3.1 equation 3. The speed of sound in air at each temperatures of {0, 20, 60, 80,
and 100 Co} was calculated from equation 3, and each calculated speed of sound at each temperature,
was used to measure range of known measurement inputs. The corresponding instrument outputs can
be seen in y-axis, and the known measurement inputs are clarified in the x-axis of figures (2-a) and (2-
b) [1].
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
123
Figure 2 Sensitivity drift of HC-SR04 transducer to different ambient temperatures (Measurement instrument outputs versus
known inputs between (a) 0 & 30 cm, (b) 0 & 5 meters
The calibration process of the soil-moisture transducer was made by reading an analog signal from
Arduino-analog pin A0 for four simulated signal inputs which are generated by introducing the soil-
moisture transducer to four simulated soil conditions. The first condition represents a case of 0%
water (dry soil). While the second simulates a case of %100 water (Soil saturated with water), and
then come the rest of two cases which are %20 and %50 water in the soil. The signal output was
about 5 volts for dry soil, 0.5 volts for %100 water (soil saturated with water represents uneconomic
case). From the curve in figure 3, we can see that an economic choice is going to be the case of soil
with %20 water which provides output of 4 volts. This optimal signal output is going to be used as the
feedback control signal to run the pump. Above 820 units (4 volts), the pump is going to be called to
run. It has been stated in TMP36-datasheet that the calibration factor is10 mV/°C, and the accuracy is
±2°C. The operating range is from −40°C until +125°C [7]. When you calibrate a TMP36 sensor, you
will notice that 3.3v reference has precise results among the 5v and less noise. To convert the
number from 0 until 1023 from Analog Digital Converter to 5v, we use the following formula: Vout
(mV) = (reading from ADC) *(1000mV/V) * (from 0 until 5 V) / (1024). If the used voltage reference
was 3.3v: Vout (mV) = (reading from ADC) * (1000 mV/V)* (from 0 until 3.3 V) / (1024). The
temperature output value can be obtained as: T (Co) = [Vout (mV) – 500] / 10.
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
124
Figure 3 Calibration a soil moisture transducer
3.2. MODELING THE AUTOMATED SMART HOUSE
Figure 4 illustrates components which were used to build the simulated automated smart
house. The system consists of an I2C serial LCD 1602 module, one HC-SR04 Ultrasonic
transducers, one Parallax servo, one photo-resistor, one electronic thermometer TMP36 and
two Arduino boards (Uno and Mega). Figures 5 & 6 illustrate the final sitting of the control
system drawing with Fritzing-software. The number of sensors was used here, are only for
simulation proposes, that means for using this system in controlling real house scale, the
number will be proportional to the house’s size.
I2C Serial LCD 1602
Module
HC-SR04 Ultrasonic transducer
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
125
Parallax Servo
Arduino Uno
Soil Moisture Sensor
Figure 4 system components
Figure 5 design of the simulated parking gate
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
126
Figure 6 design of the simulated parking gate
4. SYSTEM CONTROL USING ARDUINO A close control system was built as illustrated in figure 7 & 8. The HC-SR04 Ultrasonic, photo-
resistor, TMP36 and SEN13322 transducers provide necessarily feedback signals to adjust entry/exit
gates depending on our design control parameters, which are the availability of water in the soil,
appearance of a person in front door, lightness or darkness of outdoor, etc. As an example of these
control processes, is that the door will not open if the available space was less than {Measured
Distance >= 10 cm}. A resident must stand in a distance less than or equal to 10 cm from the door, in
order to send feedback signal to the servo-motor to open the door. Figure 8 illustrates one of usage
of Serial Plotter, which describes simulation of opening/closing a door. The gates rotate 90 degree to
allow a resident to enter to, or exit from, the door. The unit-pulse signal is illustrated in figure 8
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
127
describes the feedback at which the door’s servo starts to rotate from zero-degree to 90 degree
(opening position), in order to allow a resident to enter the house.
Figure 7 Close loop control system
Figure 8 Arduino Serial Plotter Simulation of a door control system using feedback from HC-
SR04 transducers (Blue-curve represents entering while red is for closing the door)
5. RESULTS The house automation using Arduino, appear clearly to have precise and accurate functionality,
where series of accurate transducers were used. The arrangement was designed and positioned
carefully to avoid any disturbance from another objects during each control process. The accuracy of
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
128
HC-SR04 transducers in detecting obstacles (residents) was tested during experimental characteristic,
where the transducer was calibrated to test the measurement range. The measurement range was
from 3 cm until 5 m. The effect of changing environmental condition (Ambient temperature) was
carefully tested, and confirmed that the optimal environmental temperature was 20 Co and also
there will be some error corresponding to the change of the ambient temperatures, since speed of
sound varies when ambient temperature was changed. Moreover, a carefully calibration of the SEN-
13322 sensors are carried out and the results show good repeatability and perfect accuracy.
6. CONCLUSIONS In this paper we presented detailed design process of the simulated automated smart home
using Arduino. The sensors which were used to provide the necessary feedback signals are SEN-
13322 (Soil moisture sensor), Photo resistors (Light sensor), TMP36 (Temperature sensor), and HC-
SR04 (Distance sensor). Detailed investigation of the static characteristic of the HC-SR04 and SEN-
13322 sensors were performed to estimate sensitivity, and minimum/maximum detecting range. This
work provides validation of repeatability, stability and accuracy of the automated smart home
system. The process of opening/closing doors, turning the watering-pump on/off, controlling air-
condition, and lighting the garden’s lamps were tested. The reliability, accuracy, precision and
reproducibility of all used sensors were tested using wide range of known measurement inputs
(known distances, temperatures, and soil moisture conditions) at ambient temperature of 20 Co.
we’ve documented maximum/minimum measurement range for the HC-SR04 sensor(from 3cm until
5m) as in figure 1, and for the SEN-13322 sensor as indicated in figure 3. Then we have investigated
the effect of changing the environmental condition (ambient temperatures) in the instrument
outputs. The results of ambient temperature affect were documented in figure 2, where distance
measurements were made at different ambient temperatures. The effect of changing the
environmental condition on the efficiency of the SEN-13322 sensor is negligible. The only
environmental condition could affect the HC-SR04-transducer measurements was ambient
temperatures but for usual temperature range there will be no effect during the system operational
time. This research is in the first stage, and is designed to catch attention of new undergraduate
researchers to participate in the mechanical Engineering Department research group in the area of
dynamic systems and control.
مجلة الجامعة األسمرية للعلوم األساسية والتطبيقية
2112 ، ديسمبر(2، العدد )( 1) السنة
129
REFERENCES
[1]. Abdusalam Alkhwaji, Design of an Automated Parking Lot Management System and
Effect of Ambient Temperature Changes, International Science & Technology
Journal, Vol.9, January 2017, pp. 1-13.
[2]. T.K. Sethuramalingam, M. Karthighairasan, Automatic gas valve control system,
Bonfring International Journal of Power Systems and Integrated Circuits, Vol. 2, No.
3, September 2012
[3]. Design and Implementation of Pulse Signal Detection System Based on Bluetooth
Transmission, International Journal of Control and Automation, Vol. 8, No. 7 (2015),
pp. 141-148
[4]. Bandana Mallick, Ajit Kumar Patro, Heart Rate Monitoring System Using Fingertip
Through Arduino and Processing Software, International Journal of Science,
Engineering and Technology Research (IJSETR), Volume 5, Issue 1, January 2016.
[5]. Alex Cao, Johann Borenstein, Experimental Characterization of Polaroid Ultrasonic
Sensors in Single and Phased Array Configuration, Presented at the UGV Technology
Conference at the 2002 SPIE AeroSense Symposium, Orlando, FL, April , 1-5, 2002
[6]. Alan S. Morris, measurement & instrumentation principles, 3rd
edition, Elsevier Ltd,
2001.
[7]. http://cdn.sparkfun.com/datasheets/Sensors/Temp/TMP35_36_37.pdf
[8]. http://www.mouser.com/ds/2/744/Seeed_101020008-838655.pdf
[9]. [https://en.wikipedia.org/wiki/Arduino]
[10]. [https://www.arduino.cc/en/Reference/HomePage]
[11]. [https://www.arduino.cc/en/Main/ArduinoBoardUno]
[12]. [http://fritzing.org/learning/full_reference]
[13]. [http://www.micropik.com/PDF/HCSR04.pdf ]
[14]. James R. Carstens, Electrical Sensors and Transducers, third edition, Prentice Hall,
1993.