Wednesday, November 6, 2013

Home Automation using MATLAB on arduino

Hi to all. this is the post explains about the how to make the Home automation using MATLAB uisng arduino.
Abstract:The HomeAutomation is a wireless and wired home automation system that is supposed to be 
implemented in existing home environments, without any changes in the infrastructure. HomeAutomation let the user to control the home from his or her computer and assign actions that should happen depending on time or other sensor readings such as light, temperature or sound from any device in the 
HomeAutomation network.





























Home Automation is a way to have things around your home happen automatically. The first thing that comes to mind when folks think of home automation are robots, flashing lights, complicated electronics and a general feeling that their home is less of a warm home and more of a cold science experiment. However, in most homes today, you can easily find some simple forms of automation such as:Garage door openers ,Remote Controls ,Irrigation / sprinkler control systems ,Motion activated lights ,Security systems ,Programmable thermostats ,Programmable light timers If you want to keep going, you can throw in dishwasher, clothes washers and dryers, ovens, microwaves, cars, lights and switches…. The list goes on and on.
You may not think of a dishwasher or light switch as home automation, but compared to washing dishes by hand and striking a match to light a candle ever time you enter a room, it's defiantly automation.However, each of these things was designed to help us do some complicated, strenuous, unpleasant, or repetitious action automatically. The term 'Home Automation' today applies to the next level of automating home electronics.

Why automate your home?

The simple answer is just to make life easier. We invented TV remote controls so we didn't have to get out of the chair to change the channel. Some people now own complex media systems that require the owner to press 10 different buttons on 5 remotes just to watch Oprah.
What if you could:
Press one button on a remote control and have it dim the lights, set the volume level, and start playing a movie and music which you desire. Not have the sprinklers turn on if it just rained. Get emails sent to you at work or on your cell phone if a motion detector or security system is tripped while out of the house. Get emails sent to you with the caller ID information of a call received at your house when out. Automatically turn the lights on in the house when the garage door goes up and it's after sundown. Automatically turn the front porch lights on 1/2 hour before sundown every day (and automatically adjust for daylight savings). Automatically close the garage doors every night. Automatically turn on holiday lights at specific times (all at once). The full list is limited to imagination and a family's lifestyle.





The main principle of this project is to develop a module for Home Automation and Security system mainly in a Home and Industry using Industrial Sensors and transfer the related sensed data using the latest Global System for Mobile Technology (GSM), which intimates the unauthorized entry\Smoke, and Temperature to the Embedded -Controller. The Embedded -Controller maintains the security system, so its present information sends to the user for further investigation.
The Home Automation and security system, The Embedded-Controller module is to control the whole module for security purpose. The GSM TX- Modem, The GSM RX-Modem, The unauthorized entry, fire detected and variation in the temperature after being sensed will be fed to the Embedded- Controller which is responsible for processing the data and gives input to the GSM Modem at Disaster Base Station. The transmitted data will be received through the Short Messaging Service (SMS) at the GSM RX-Modem. The GSM-RX Modem decodes the data and transfers it to the user, which maintains the security for Home or industry. Relay is used to control the device.
In Home automation, the devices consist of GSM modem, microcontroller, sensors, relays, memory and displays. If the user want s to control some devices in his house he/she have to send the SMS indicating the operation of the device and then the system password, while the MODEM embedded with the system microcontroller receives SMS the microcontroller will read the SMS and check for the password the user had sent with the SMS, the passwords are stored in memory, so the microcontroller will read the password from the memory and compares with the message password. If the password is correct then it will check whether the message is for switch ON or OFF the devices. According to the received message the controller will switch on/off the relay.
In Security system, the device connected to the sensors. When somebody had entered home forcibly, the sensor connected to the door will detect the presence of person, and it will give an interrupt to the microcontroller. Then according to the program load in the flash, the controller will find out from which sensor the interrupt had came, then it will sent SMS to the owners mobile or police by retrieving the phone numbers from memory where numbers are stored in it. The system has been designed which is based on wireless communication embedded system. The design provides the necessary control for the working of home automation and security system. The control software program is written in ‘Embedded C’.The program has the capability of sending and receiving the SMS from and to the user mobile via GSM modem to tell that unauthorized entry/smoke has detected in case of security system and to control some devices in case of automation system respectively. The program also provides the display of current status of the system.
The fundamental requirements of the system
design are as follows:
GSM modem to send and receive the SMS
from and to the user mobile.
Sensors
to
detect
unauthorized entry/smoke.
ADC to convert sensed voltage to
correspond digital values.
LCD display to display the current status of
the system.
UART for the serial communication.
Microcontroller for the entire operation of
the system.
A range of voltage levels to compare with the sensed voltage






Home automation and security system without software is of little use and hardware with poor software can be worse. The software developed for this project is user friendly. The code is written in ‘EMBEDDED C (KEIL SOFTWORE).
Software requirements:
Keil ┬ÁVision2 IDE:
Keil ┬ÁVision2 IDE (Integrated Development Environment) is a Windows based front end for the C Compiler and assembler. Keil ┬ÁVision2 is used for writing embedded C programswhich is explained later.. Embedded C is a high level language, which includes many aspects of the ANSI (American National Standard Institute) C programming language. Standard libraries are altered or enhanced to address the peculiarities of an embedded target processor.
Cx51 cross compiler:
Cx51 is a cross compiler to compile C programs for your target 8051 environment and provides several extensions to ANSI Standard C to support
the elements of the 8051 architecture. These C
programs are referred as Embedded C programs.
UP loader 4.0:
This Up-loader is used to flash some of the
Micro-Controllers. It Supports only 8051, Atmel
89c51, 89c52 & 89c55wd. This Up-Loader is used
to flash the Microcontroller via Hex file and then it
verify the written Hex code to the flash memory.
The flashing time is faster when we use the up-
loader. This up-loader is very much compact.





Embedded C:
The C programming language is a general- purpose programming language that provides code efficiency, elements of structured programming, and a rich set of operators. Its generality combined with its absence of restrictions, makes C a convenient and effective programming solution for a wide variety of software tasks. Many applications can be solved more easily and efficiently with C than with other more specialized languages. Cx51 is not a universal C compiler adapted for the 8951 target.

The Global System for Mobile communications (GSM: originally from Group Special Mobile) is the most popular standard for mobile phones in the world. Over 2 billion people use GSM service across more than 212 countries and territories. Its ubiquity makes international roaming very common between mobile phone operators, enabling subscribers to use their phones in many parts of the world. GSM differs significantly from its predecessors in that both signaling and speech channels are digital call quality, and so is considered a second generation (2G) mobile phone system. This has also meant that data communication was built into the system from the 3rd Generation Partnership Project (3GPP).
The key advantage of GSM systems to consumers has been higher digital voice quality and low cost alternatives to making calls, such as the Short message service (SMS, also called "text messaging"). The advantage for network operators has been the ease of deploying equipment from any vendors that implements the standard. [3] Like other cellular standards, GSM allows network operators to offer roaming services so that subscribers can use their phones on GSM networks all over the world.
Newer versions of the standard were backward compatible with the original GSM phones. For example, Release '97 of the standard added packet data capabilities, by means of General Packet Radio Service (GPRS). Release '99 introduced higher speed data transmission using Enhanced Data Rates for GSM Evolution (EDGE).


General Behaviors
SIM Insertion, SIM Removal
SIM card Insertion and Removal procedures are supported. There are software functions relying on positive reading of the hardware SIM detect pin. This pin state (open/closed) is permanently monitored. When the SIM detect pin indicates that a card is present in the SIM connector, the product tries to set up a logical SIM session. The logical SIM session will be set up or not depending on whether the detected card is a SIM Card or not. The AT+CPIN? command delivers the following responses:
If the SIM detect pin indicates “absent”, the response to AT+CPIN? Is “+CME ERROR 10” (SIM not inserted).
If the SIM detect pin indicates “present”, and the inserted Card is a SIM Card, the response to AT+CPIN? is “+CPIN: xxx” depending on SIM PIN state.
If the SIM detect pin indicates “present”, and the inserted Card is not a SIM Card, the response to AT+CPIN? is CME ERROR 10.
These last two states are not given
immediately
due
to
background initialization. Between the hardware SIM detect pin indicating “present” and the previous results the AT+CPIN? sends “+CME ERROR: 515” (Please wait, init in progress).
When the SIM detect pin indicates card absence, and if a SIM Card was previously inserted, an IMSI detach procedure is performed, all user data is removed from the product (Phonebooks, SMS etc.). The product then switches to emergency mode.
Attention (AT) Commands
GSM modem can be controlled by standard set of AT (Attention) commands. These commands can be used to control majority of the functions of GSM modem. Few commands used in this project are described in the chapter APPENDIX.
.5. ADVANTAGES AND APPLICATIONS
ADVANTAGES:
 We can access the devices such as home
appliances remotely.
We can detect the unauthorized
smoke/entry even if we are not present in
home.
Easy to implement








APPLICATIONS:
Automation and security system is required at:
Home
Office
Industry
Power plants
Other valuable areas

Automation and security system is required at:
Home
Office
Industry
Power plants
Other valuable areas
6. CONCLUSION
The designed home automation and security system has been successfully demonstrated by connecting GSM modem and sending/receiving the SMS by using GSM mobile from/to the system via GSM modem. The LCD display will display the correct current status of the system. This project is easy to implement and it has become one of the modern wireless privacy system.
7. SCOPE FOR FURTHER
IMPLEMENTATIONS
In future we can add a multimedia camera
to see what is going inside the home by
sitting in office or some where.
We can voice recorder for IR Sensor’s detection


MM32f103 led blink program

To work on mind motion MM32 microcontroller we need to install the keil uvision 5 version then install the mm32-link programmer go to li...