Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
1 | P a g e
Chapter 1
1 Introduction
1.1 Defining an Embedded System
An embedded system is a special-purpose computer syst...
2 | P a g e
Physically, embedded systems range from portable devices such as digital watches and MP3
players to large stat...
3 | P a g e
1.2 Goals
An embedded system is a special-purpose computer system designed to perform one or a few
dedicated f...
4 | P a g e
Chapter 2
2 Basic Electronics
Before getting into the world of embedded systems and its applications we need t...
5 | P a g e
2.2 Current
An electric current is a flow of electric charge. In electric circuits this charge is often carrie...
6 | P a g e
where I is the current through the conductor in units of amperes, V is the potential difference
measured acros...
7 | P a g e
Capacitors are often used in electric and electronic circuits as energy-storage devices. They
can also be used...
8 | P a g e
terminals. A vacuum tube diode has two electrodes, a plate (anode) and a heated cathode.
Semiconductor diodes ...
9 | P a g e
form of photons. This effect is called electroluminescence,[5] and the color of the light
(corresponding to th...
10 | P a g e
terminals changes the current through another pair of terminals. Because the controlled
(output) power can be...
11 | P a g e
It is often easier and cheaper to use a standard microcontroller and write a computer program
to carry out a ...
12 | P a g e
to jump into the conduction band. The resulting free electrons (and their hole partners) conduct
electricity,...
13 | P a g e
2.11 Relay
A relay is simply a switch that is activated by an electromagnet. You apply power to the coil
of t...
14 | P a g e
In a basic relay there are three contactors: normally open (NO), normally closed (NC) and
common (COM). At no...
15 | P a g e
2.13 Crystal Oscillator
A miniature 4 MHz quartz crystal enclosed in a hermetically sealed HC-49/US package, ...
16 | P a g e
generated, and the system may be damaged. If a DC supply of less than 5V is used, insufficient
voltage will b...
17 | P a g e
A Printed Circuit Board, or PCB, is used to mechanically support and electrically connect
electronic componen...
18 | P a g e
2.16.2 Microprocessor- A microprocessor is a computer processor that incorporates the
functions of a computer...
19 | P a g e
Chapter 3
3 Arduino
Arduino is an Open-Source computer hardware and software company, project and user
commun...
20 | P a g e
expensive for students. Massimo Banzi, one of the founders, taught at Ivrea.[13] The name
"Arduino" comes fro...
21 | P a g e
associated researchers, including David Cuartielles, promoted the idea. The Arduino's initial
core team consi...
22 | P a g e
3.2 Shields
Arduino and Arduino-compatible boards use printed circuit expansion boards called "shields",
whic...
23 | P a g e

HackARobot Fabric Shield – designed for Arduino Nano to hook up motors and
sensors such as gyroscope or GPS...
24 | P a g e
Some shields communicate with the Arduino board directly over various pins, but many shields
are individually...
25 | P a g e
Fig 3.5 Home screen for arduino
After compilation and linking with the GNU toolchain, also including with the...
26 | P a g e
1.) For starting with programming Arduino we have to first download the software from
Arduino website: http:/...
27 | P a g e
Fig 3.7 Selecting Arduino Board
4.) Select serial port
Fig 3.8 Selecting the serial port
Selection of serial ...
28 | P a g e
3.6 Programming an Arduino
Now let’s move on to the programming basics of Arduino.
Arduino programming starts...
29 | P a g e
Chapter 4
4 Arduino interfacing
4.1 LED
To build the circuit, connect one end of the resistor to Arduino pin ...
30 | P a g e
4.3 Seven Segment Display Interfacing
• A seven-segment display can be used to display the decimal numbers 0-...
31 | P a g e
Fig 4.4 LCD Pin Description Fig 4.5 LCD with Arduino.
 E: Enable (Latch data) - Used to latch the data.
 VE...
32 | P a g e
connect motor driver IC L293D in between the microcontroller and motor.
Fig 4.6 IC L293D and Its interfacing ...
33 | P a g e
Fig 4.7 IR sensor
4.7 LM35 Interfacing
• LM35 is a precision IC temperature sensor with its output proportion...
34 | P a g e
• Provide a sufficient amount of current to this relay, an extra circuit is also require
because microcontrol...
35 | P a g e
4.10 Accelerometer interfacing
 An accelerometer measures acceleration (change in speed) of anything that
it...
36 | P a g e
Chapter 5
5. Home Automation
The Home Automation is a wireless home automation system that is supposed to be
...
37 | P a g e
These both topics are later covered in this report in more detail as how to program for your
system and how t...
38 | P a g e
5.1 Software
In parallel with the Arduino code being programmed, the software for the computer was
created. T...
39 | P a g e
4.2.4 Other Functions
Apart from the two abovementioned core functions of the user interface, there are also ...
40 | P a g e
Now concerning Bluetooth Connectivity we need to connect the smartphone with the
Bluetooth module named like ...
41 | P a g e
5.2 Hardware
The heart and soul of this project is the Arduino. It is responsible for controlling as which
ap...
42 | P a g e
These two pins are responsible for serial communication in Arduino and also data through the
Bluetooth module...
43 | P a g e
Fig 5.4 Circuit Diagram of Home Automation
Also a diode is connected in between the supply mode of relay, to ...
44 | P a g e
5.3 PCB Design for Home Automation
PCB designing for Home Automation is done on any layout designer. Here we ...
45 | P a g e
5.4 Design Specification
The system is designed keeping in mind the following key requirements:
 Clients sho...
46 | P a g e
5.4.1 Data Flow Diagram
Fig 5.8 Data Flow Diagram
Server
Wi-Fi / Bluetooth
Mobile Device
USB-to-Serial
Bridge...
47 | P a g e
The mobile device connects to the Microcontroller through Bluetooth or Wi-Fi. The user sends
commands to the ...
48 | P a g e
5.5 Programming code for microcontroller.
int rel1=12; // relay 1
int rel2=11; // relay 2
int mtr=10; // moto...
49 | P a g e
if(val=='1') // if val is equal to 1, checking the condition
{
digitalWrite(rel1,HIGH); // then turn the bulb...
50 | P a g e
}
else if(val == '6') // if val is equal to 6
{
digitalWrite(mtr,LOW); // motor moving in anti-clockwise dire...
51 | P a g e
References
1. Allan R. Hambley “Electrical Engineering”, pp. 3, 441, Prentice Hall, 2004
2. “Principles of El...
Upcoming SlideShare
Loading in …5
×

Home automation System

1,134 views

Published on

A full project report on Home Automation System using Android Application Via Bluetooth.

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Home automation System

  1. 1. 1 | P a g e Chapter 1 1 Introduction 1.1 Defining an Embedded System An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints. In contrast, a general-purpose computer, such as a personal computer, can do many different tasks depending on programming. Since the embedded system is dedicated to specific tasks, design engineers can optimize it, reducing the size and cost of the product, or increasing the reliability and performance. According to the definition from IEEE: "an embedded computer system is a computer system that is part of a larger system and performs some of the requirements of that system; for example, a computer system used in an aircraft or rapid transit system". EMBEDDED SYSTEM IN DAILY LIFE Digital Clock Traffic Light DVD Player Smart Phones Fig 1.1 Examples of using Embedded Systems
  2. 2. 2 | P a g e Physically, embedded systems range from portable devices such as digital watches and MP3 players to large stationary installations like traffic lights, factory controllers, or the systems which control nuclear power plants. Complexity varies from low, with a single microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a large chassis or enclosure. In general, "embedded system" is not an exactly defined term, as many systems have some element of programmability. For example, Handheld computers share some elements with embedded systems — such as the operating systems and microprocessors which power them — but are not truly embedded systems, because they allow different applications to be loaded and peripherals to be connected. Since the embedded system is dedicated to specific tasks, design engineers can optimize it to reduce the size and cost of the product and increase the reliability and performance. Some embedded systems are mass-produced, benefiting from economies of scale. 1.1.1 Characteristics-  Embedded systems are designed to do some specific task, rather than be a general- purpose computer for multiple tasks. Some also have real time performance constraints that must be met, for reasons such as safety and usability; others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs.  Embedded systems are not always standalone devices. Many embedded systems consist of small, computerized parts within a larger device that serves a more general purpose. For example, the Gibson Robot Guitar features an embedded system for tuning the strings, but the overall purpose of the Robot Guitar is, of course, to play music. Similarly, an embedded system in an automobile provides a specific function as a subsystem of the car itself.
  3. 3. 3 | P a g e 1.2 Goals An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints. It is usually embedded as part of a complete device including hardware and mechanical parts. In contrast, a general-purpose computer, such as a personal computer, can do many different tasks depending on programming. Embedded systems control many of the common devices in use today. With the platform provided by the semiconductor world in terms of Application processors and by the software industry in terms of OS, Embedded Systems are becoming more and more powerful and cost effective. As explained the domain of Embedded System is wide and thousands of embedded applications do exist. But here we intend to focus on Embedded Systems which in near time evolved more than forever and changed the way we see the world around us. The aim of the report is to explore the field of Embedded Technology and develop systems which fulfills three basic criteria: portability, scalability and performance. 1.3 Phases Initially we will understand the basic electronics in Embedded Systems which is very important. Basic components like resistor, capacitor, inductors, diode etc. will be described here. Then we move through the controller part, i.e., Arduino. Arduino which is a type of an embedded system runs on an 8-bit microcontroller. We understand the basic concept behind developing the Arduino and will illustrate its features in more detail. Its various boards and shields which are used by techies and hobbyist. We will also see the interfacing of various electronics components and modules used with Arduino. Later we will came to Raspberry Pi board solely called credit card size computer which runs ARM based 32 bit processor.
  4. 4. 4 | P a g e Chapter 2 2 Basic Electronics Before getting into the world of embedded systems and its applications we need to go through the basics of electronics which are responsible for the driving all these things. We will also see the different components related to the embedded systems and which are mostly used in it. 2.1 Voltage Voltage, electric potential difference, electric pressure or electric tension (denoted ∆V or ∆U) is the difference in electric potential energy between two points per unit electric charge. The voltage between two points is equal to the work done per unit of charge against a static electric field to move the charge between two points, described in volts.[1] Voltage can be caused by static electric fields, by electric current through a magnetic field, by time-varying magnetic fields, Voltage is electric potential energy per unit charge, measured in joules per coulomb (volts). In general terms, we can also say that voltage is the force applied on the electrons which is responsible for their movement inside a conducting material. 2.1 Batteries are sources of voltage in many electric circuits
  5. 5. 5 | P a g e 2.2 Current An electric current is a flow of electric charge. In electric circuits this charge is often carried by moving electrons in a wire. It can also be carried by ions in an electrolyte, or by both ions and electrons such as in a plasma. The SI unit for measuring an electric current is the ampere, which is the flow of electric charge across a surface at the rate of one coulomb per second. The particles that carry the charge in an electric current are called charge carriers. In metals, one or more electrons from each atom are loosely bound to the atom, and can move freely about within the metal. These conduction electrons are the charge carriers in metal conductors. Fig 2.2 Flow of Electrons in a wire. current in a wire or component can flow in either direction, when a variable I is defined to represent that current, usually by an arrow on the circuit schematic diagram. This is called the reference direction of current I. If the current flows in the opposite direction, the variable I has a negative value. 2.3 Ohm’s law Ohm's law states that the current through a conductor between two points is directly proportional to the potential difference across the two points. Introducing the constant of proportionality, the resistance, one arrives at the usual mathematical equation that describes this relationship:
  6. 6. 6 | P a g e where I is the current through the conductor in units of amperes, V is the potential difference measured across the conductor in units of volts, and R is the resistance of the conductor in units of ohms. More specifically, Ohm's law states that the R in this relation is constant, independent of the current. 2.4 Resistor A resistor is a two-terminal electrical or electronic component that opposes an electric current by producing a voltage drop between its terminals in accordance with Ohm's law: “The electrical resistance is equal to the voltage drop across the resistor divided by the current through the resistor while the temperature remains the same. Resistors are used as part of electrical networks and electronic circuits.” Fig 2.3 Carbon Composition Resistors 2.5 Capacitor A capacitor is an electrical/electronic device that can store energy in the electric field between a pair of conductors (called "plates"). The process of storing energy in the capacitor is known as "charging", and involves electric charges of equal magnitude, but opposite polarity, building up on each plate.[2]
  7. 7. 7 | P a g e Capacitors are often used in electric and electronic circuits as energy-storage devices. They can also be used to differentiate between high-frequency and low-frequency signals. This property makes them useful in electronic filters. 2.5.1 Capacitor types Fig 2.4 Capacitors: SMD ceramic, SMD tantalum, and electrolytic at bottom right. Fig 2.5 Various types of capacitors. From left: multilayer ceramic, ceramic disc, multilayer polyester film, tubular ceramic, polystyrene, metallized polyester film, aluminum electrolytic. Major scale divisions are cm. 2.6 Diode In electronics, a diode is a two-terminal electronic component that conducts primarily in one direction it has low (ideally zero) resistance to the flow of current in one direction, and high (ideally infinite) resistance in the other. A semiconductor diode, the most common type today, is a crystalline piece of semiconductor material with a p–n junction connected to two electrical
  8. 8. 8 | P a g e terminals. A vacuum tube diode has two electrodes, a plate (anode) and a heated cathode. Semiconductor diodes were the first semiconductor electronic devices.[4] The most common function of a diode is to allow an electric current to pass in one direction (called the diode's forward direction), while blocking current in the opposite direction (the reverse direction). This unidirectional behavior is called rectification, and is used to convert alternating current to direct current, including extraction of modulation from radio signals in radio receivers—these diodes are forms of rectifiers. Fig 2.6 Electronic symbol for Diode 2.7 Crystalline diode Fig 2.8 Diodes with different sizes and shapes 2.7 LED A light-emitting diode (LED) is a two-lead semiconductor light source. It is a p–n junction diode, which emits light when activated. When a suitable voltage is applied to the leads, electrons are able to recombine with electron holes within the device, releasing energy in the
  9. 9. 9 | P a g e form of photons. This effect is called electroluminescence,[5] and the color of the light (corresponding to the energy of the photon) is determined by the energy band gap of the semiconductor. Fig 2.9 Electronic symbol of LED Fig 2.10 Internal parts of an LED Appearing as practical electronic components in 1962, the earliest LEDs emitted low-intensity infrared light. Infrared LEDs are still frequently used as transmitting elements in remote- control circuits, such as those in remote controls for a wide variety of consumer electronics. LEDs have allowed new text, video displays, and sensors to be developed, while their high switching rates are also used in advanced communications technology. 2.8 Transistor A transistor is a semiconductor device used to amplify or switch electronic signals and electrical power. It is composed of semiconductor material with at least three terminals for connection to an external circuit. A voltage or current applied to one pair of the transistor's
  10. 10. 10 | P a g e terminals changes the current through another pair of terminals. Because the controlled (output) power can be higher than the controlling (input) power, a transistor can amplify a signal. Today, some transistors are packaged individually, but many more are found embedded in integrated circuits. Fig 2.11 Transistors in different sizing. The transistor is the fundamental building block of modern electronic devices. It was founded in 1947 by American physicists John Bardeen, Walter Brattain, and William Shockley, the transistor revolutionized the field of electronics, and paved the way for smaller and cheaper radios, calculators, and computers, among other things. The transistor is on the list of IEEE milestones in electronics. The transistor's low cost, flexibility, and reliability have made it a ubiquitous device. Transistorized mechatronic circuits have replaced electromechanical devices in controlling appliances and machinery. Fig 2.12 Transistor terminals(C,B,E)
  11. 11. 11 | P a g e It is often easier and cheaper to use a standard microcontroller and write a computer program to carry out a control function than to design an equivalent mechanical control function. 2.9 LDR A Photoresistor or light-dependent resistor (LDR) or photocell is a light-controlled variable resistor. The resistance of a Photoresistor decreases with increasing incident light intensity; in other words, it exhibits photoconductivity. A Photoresistor can be applied in light-sensitive detector circuits, and light- and dark-activated switching circuits. Fig 2.13 LDR Fig 2.14 Electronic symbol for LDR A Photoresistor is made of a high resistance semiconductor. In the dark, a Photoresistor can have a resistance as high as several megohms (MΩ), while in the light, a Photoresistor can have a resistance as low as a few hundred ohms. If incident light on a Photoresistor exceeds a certain frequency, photons absorbed by the semiconductor give bound electrons enough energy
  12. 12. 12 | P a g e to jump into the conduction band. The resulting free electrons (and their hole partners) conduct electricity, thereby lowering resistance. 2.10 Switch A switch is an electrical component that can break an electrical circuit, interrupting the current or diverting it from one conductor to another. The mechanism of a switch may be operated directly by a human operator to control a circuit (for example, a light switch or a keyboard button), may be operated by a moving object such as a door-operated switch, or may be operated by some sensing element for pressure, temperature or flow. Switches are made to handle a wide range of voltages and currents; very large switches may be used to isolate high- voltage circuits in electrical substations. An electrical switch is any device used to interrupt the flow of electrons in a circuit. Switches are essentially binary devices: they are either completely ON or completely OFF. Fig 2.15 Switch Symbol Fig 2.16 Electrical and Push Button Switches
  13. 13. 13 | P a g e 2.11 Relay A relay is simply a switch that is activated by an electromagnet. You apply power to the coil of the electromagnet and the movement of a part called the armature is made to close or open one or more sets of contacts. They are often used to isolate two circuits electrically in a circuit. Relay is an electromagnetic device which is used to isolate two circuits electrically and connect them magnetically. They are very useful devices and allow one circuit to switch another one while they are completely separate. They are often used to interface an electronic circuit (working at a low voltage) to an electrical circuit which works at very high voltage. For example, a relay can make a 5V DC battery circuit to switch a 230V AC mains circuit. Fig 2.17 A 5-Pin Relay and its Internal structure. Fig 2.18 Relay with its contacts
  14. 14. 14 | P a g e In a basic relay there are three contactors: normally open (NO), normally closed (NC) and common (COM). At no input state, the COM is connected to NC. When the operating voltage is applied the relay coil gets energized and the COM changes contact to NO. The Relay we are using here is called 5-pin Relay. This can also be seen from the images uploaded, as when no voltage is applied COM is connected to NC. But when supply is applied then due to magnetic field produced by the coil COM gets connected to NO. 2.12 Breadboard A breadboard is a construction base for prototyping of electronics. Originally it was literally a bread board, a polished piece of wood used for slicing bread. In the 1970s the solderless breadboard (AKA plugboard, a terminal array board) became available and nowadays the term "breadboard" is commonly used to refer to these. "Breadboard" is also a synonym for "prototype". A breadboard is a solderless device for temporary prototype with electronics and test circuit designs. Most electronic components in electronic circuits can be interconnected by inserting their leads or terminals into the holes and then making connections through wires. Fig 2.19 Solderless breadboard with 400 connection points and its hole pattern. The breadboard most commonly used today is usually made of white plastic and is a pluggable (solderless) breadboard. It was designed by Ronald J. Portugal of EI Instruments Inc. in 1971
  15. 15. 15 | P a g e 2.13 Crystal Oscillator A miniature 4 MHz quartz crystal enclosed in a hermetically sealed HC-49/US package, used as the resonator in a crystal oscillator. A crystal oscillator is an electronic circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency. This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies Fig 2.20 C-49 package quartz crystal 2.14 Voltage Regulator A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. It may use an electromechanical mechanism, or passive or active electronic components. Depending on the design, it may be used to regulate one or more AC or DC voltages. A 5V voltage regulator (7805) is used to ensure that no more than 5V is delivered in the output load regardless of the voltage present at the input terminal (provided that voltage is less than 12VDC). The regulator functions by using a diode to clamp the output voltage at 5VDC regardless of the input voltage - excess voltage is converted to heat and dissipated through the body of the regulator. If a DC supply of greater than 12V is used, excessive heat will be
  16. 16. 16 | P a g e generated, and the system may be damaged. If a DC supply of less than 5V is used, insufficient voltage will be present at the regulators output. Fig 2.21 7805 IC If a power supply provides a voltage higher than 7 or 8 volts, the regulator must dissipate significant heat. The "fin" on the regulator body (the side that protrudes upward beyond the main body of the part) helps to dissipate excess heat more efficiently. If the board requires higher currents, then the regulator may need to dissipate more heat. In this case, the regulator can be secured to the circuit board by fastening it with a screw and nut (see below). By securing the regulator tightly to the circuit board, excess heat can be passed to the board and then radiated away. Fig 2.22 Heat Sink 2.15 Printed circuit board
  17. 17. 17 | P a g e A Printed Circuit Board, or PCB, is used to mechanically support and electrically connect electronic components using conductive pathways, or traces, etched from copper sheets laminated onto a non-conductive substrate. Alternative names are printed wiring board (PWB), and etched wiring board. Fig 2.23 A populated PCB, showing the conductive trace and mounted electrical components. A PCB populated with electronic components is a printed circuit assembly (PCA), also known as a printed circuit board assembly (PCBA). PCBs are rugged, inexpensive, and can be highly reliable. They require much more layout effort and higher initial cost than either wire-wrapped or point-to-point constructed circuits, but are much cheaper and faster for high-volume production. 2.16 Microcontrollers & Microprocessors 2.16.1 Microcontroller- A microcontroller is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of Ferroelectric RAM, NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications. Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems.
  18. 18. 18 | P a g e 2.16.2 Microprocessor- A microprocessor is a computer processor that incorporates the functions of a computer central processing unit (CPU) on a single integrated circuit (IC), or at most a few integrated circuits. The microprocessor is a multipurpose, programmable device that accepts digital data as input, processes it according to instructions stored in its memory, and provides results as output. It is an example of sequential digital logic, as it has internal memory. Microprocessors operate on numbers and symbols represented in the binary numeral system. 2.16.3 Microcontroller VS Microprocessor A microcontroller differs from a microprocessor in many ways. The first and most important difference is its functionality. In order the microprocessor may be used, other components such as memory or components for data transfer must be added to it. Even though the microprocessor is considered to be a powerful computer machine, the weak point is that it is not adjusted to communication to peripheral environment. Fig 2.24 Microcontroller VS Microprocessor
  19. 19. 19 | P a g e Chapter 3 3 Arduino Arduino is an Open-Source computer hardware and software company, project and user community that designs and manufactures microcontroller-based kits for building digital devices and interactive objects that can sense and control objects in the physical world.[10] The project is based on microcontroller board designs, manufactured by several vendors, using various microcontrollers. These systems provide sets of digital and analog I/O pins that can be interfaced to various expansion boards ("shields") and other circuits. The boards feature serial communications interfaces, including USB on some models, for loading programs from personal computers. For programming the microcontrollers, the Arduino project provides an integrated development environment (IDE) based on the Processing project, which includes support for the C and C++ programming languages. The first Arduino was introduced in 2005, aiming to provide an inexpensive and easy way for novices and professionals to create devices that interact with their environment using sensors and actuators. Common examples of such devices intended for beginner hobbyists include simple robots, thermostats, and motion detectors. Arduino boards are available commercially in preassembled form, or as do-it-yourself kits. The hardware design specifications are openly available, allowing the Arduino boards to be manufactured by anyone. Adafruit Industries estimated in mid-2011 that over 300,000 official Arduinos had been commercially produced,[11] and in 2013 that 700,000 official boards were in users' hands.[12] Arduino started in 2005 as a project for students at the Interaction Design Institute Ivrea in Ivrea, Italy. At that time program students used a "BASIC Stamp" at a cost of $100, considered
  20. 20. 20 | P a g e expensive for students. Massimo Banzi, one of the founders, taught at Ivrea.[13] The name "Arduino" comes from a bar in Ivrea, where some of the founders of the project used to meet. The bar, in turn, has been named after Arduin of Ivrea, who was the margrave of Ivrea and King of Italy from 1002 to 1014.[14] Fig 3.1 Single board microcontroller ARDUINO-UNO FIG 3.2 an formerly produced Arduino board Colombian student Hernando Barragan created the Wiring development platform which served as the basis for Arduino. Following the completion of the Wiring platform, its lighter, less expensive versions[15] were created and made available to the open-source community;
  21. 21. 21 | P a g e associated researchers, including David Cuartielles, promoted the idea. The Arduino's initial core team consisted of Massimo Banzi, David Cuartielles, Tom Igoe, Gianluca Martino, and David Mellis. 3.1 Official boards from Arduino The original Arduino hardware was manufactured by the Italian company Smart Projects.[16] Some Arduino-branded boards have been designed by the American companies SparkFun Electronics and Adafruit Industries.[17] Sixteen versions of the Arduino hardware have been commercially produced to date. Among them ten boards are being described below:  Arduino Uno  Arduino Leonardo  Arduino LilyPad  Arduino Mega  Arduino Nano  Arduino Mini  Arduino Mini Pro  Cortino (ARM)  Xduino (ARM)  Arduino due Fig 3.3 Some Popular Arduino boards
  22. 22. 22 | P a g e 3.2 Shields Arduino and Arduino-compatible boards use printed circuit expansion boards called "shields", which plug into the normally supplied Arduino pin headers. Shields can provide motor controls, GPS, Ethernet, LCD, or breadboarding (prototyping). A number of shields can also be made DIY.  Example Arduino shields  Multiple shields can be stacked. In this example the top shield contains a solderless breadboard.  Screw-terminal breakout shield in a wing-type format  Adafruit Motor Shield with screw terminals for connection to motors  Adafruit Datalogging Shield with a Secure Digital (SD) card slot and real-time clock (RTC) chip
  23. 23. 23 | P a g e  HackARobot Fabric Shield – designed for Arduino Nano to hook up motors and sensors such as gyroscope or GPS, and other breakout boards such as WiFi, Bluetooth, RF, etc. 3.3 HARDWARE An Arduino board historically consists of an Atmel 8-,16- or 32-bit AVR microcontroller with complementary components that facilitate programming and incorporation into other circuits. An important aspect of the Arduino is its standard connectors, which lets users connect the CPU board to a variety of interchangeable add-on modules known as shields. [18] Fig 3.4 Hardware connections for Arduino UNO
  24. 24. 24 | P a g e Some shields communicate with the Arduino board directly over various pins, but many shields are individually addressable via an I²C serial bus—so many shields can be stacked and used in parallel. Prior to 2015 Official Arduinos had used the Atmel megaAVR series of chips, specifically the ATmega8, ATmega168, ATmega328, ATmega1280, and ATmega2560 and in 2015 units by other manufacturers were added. An Arduino's microcontroller is also pre-programmed with a boot loader that simplifies uploading of programs to the on-chip flash memory, compared with other devices that typically need an external programmer. Current Arduino boards are programmed via Universal Serial Bus (USB), implemented using USB-to-serial adapter chips such as the FTDI FT232.[19] The Arduino board exposes most of the microcontroller's I/O pins for use by other circuits. The Current Uno provide 14 digital I/O pins, six of which can produce pulse-width modulated signals, and six analog inputs, which can also be used as six digital I/O pins. 3.3 SOFTWARE Arduino programs may be written in any programming language with a compiler that produces binary machine code. The Arduino project provides the Arduino integrated development environment (IDE), which is a cross-platform application written in Java. It originated from the IDE for the Processing programming language project and the Wiring project. It includes a code editor and provides simple one-click mechanism for compiling and loading programs to an Arduino board. A program written with the IDE for Arduino is called a "sketch". [20] A typical Arduino C/C++ sketch consist of two functions that are compiled and linked with a program stub main() into an executable cyclic executive program: setup(): a function that runs once at the start of a program and that can initialize settings. loop(): a function called repeatedly until the board powers off.
  25. 25. 25 | P a g e Fig 3.5 Home screen for arduino After compilation and linking with the GNU toolchain, also including with the IDE distribution, the Arduino IDE employs the program avrdude to convert the executable code into a text file in hexadecimal coding that is loaded into the Arduino board by a loader program in the board's firmware. 3.4 Development Arduino is an open-source hardware: the Arduino hardware reference designs are distributed under a Creative Commons Attribution Share-Alike 2.5 license and are available on the Arduino Web site. Layout and production files for some versions of the Arduino hardware are also available. The source code for the IDE is available and released under the GNU General Public License, version 2. 3.5 Setting up the Arduino Environment In this section we have some steps to follow such that we can configure the IDE environment and load the program into the board.
  26. 26. 26 | P a g e 1.) For starting with programming Arduino we have to first download the software from Arduino website: http://arduino.cc/en/Main/Software Now according to the operating system you have there is a software available to you, look up for your OS and download the respective software. Now you can either download the installer file or the zip file as per your requirement. Now after downloading the software now you need to run the Arduino software. Before running Arduino, plug in your board using USB cable. If USB device is not recognized, select the appopriate driver from the installation directory. After driver installation we can finally run our program and set up the environment for Arduino board. 2.) Next, Start the Arduino software from the installed setup and run the application file. Fig 3.6 Arduino IDE 3.) Select the type of hardware or board you have from tools.
  27. 27. 27 | P a g e Fig 3.7 Selecting Arduino Board 4.) Select serial port Fig 3.8 Selecting the serial port Selection of serial port is very important as without this port selection Arduino hardware would not going to be detected by software.
  28. 28. 28 | P a g e 3.6 Programming an Arduino Now let’s move on to the programming basics of Arduino. Arduino programming starts with defining two blocks where we define and manipulate the data or use them accordingly as per the need. These are described below. void setup() –Will be executed only when the program begins (or reset button is pressed) void loop() –Will be executed repeatedly So it is clear from above that our program will revolve around these two code blocks. In the first block, i.e. , void setup() we define our input and output ports. Formally it includes all the parameters for the program. It is similar to the initialization. Next we have void loop(). This includes the body of the program, it is similar to an infinite loop, which unconditionally move through the body of the program. void setup() { // put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: } Text that follows// is a comment (ignored by compiler) Useful IDE Shortcut: PressCtrl‐/ to comment (or uncomment) a selected portion of your program.
  29. 29. 29 | P a g e Chapter 4 4 Arduino interfacing 4.1 LED To build the circuit, connect one end of the resistor to Arduino pin 13. Connect the long leg of the LED to the other end of the resistor. Connect the short leg of the LED to the Arduino GND. Most Arduino boards already have an LED attached to pin 13 on the board itself. The value of the resistor should be 220 ohm; the LED will lit up also with values up to 1K ohm. Fig 4.1 Led with Arduino 4.2 Switch Switch as described used to provide a break between a circuit. Here it is connected in pull down mode with a 10k ohm resistor. One part of switch is connected to the controller while the other is connected to GND through the resistor. Fig 4.2 Switch connected to Arduino
  30. 30. 30 | P a g e 4.3 Seven Segment Display Interfacing • A seven-segment display can be used to display the decimal numbers 0-9 and some alpha characters. • Each Segment is labeled (a) to (g). • Common Cathode (all LED cathodes are connected) • Common Anode (all LED anodes are connected) Fig 4.3 Seven segment display and it interfacing with Arduino 4.4 LCD interfacing • LCD’s are all around us so liquid crystal displays are very useful in these days. • It is a kind of display that is made up of a special matter state formed using liquid and crystal both , it’s a forth state of matter • The most popular one is 16x2 LCD module. It has 2 rows & 16 columns. The intelligent displays are two types:  Text Display  Graphics Display  8 data pins D7:D0 - Bi-directional data/command pins.  RS: Register Select RS = 0 -> Command Register is selected RS = 1 -> Data Register is selected  R/W: Read or Write - 0 -> Write, 1 -> Read
  31. 31. 31 | P a g e Fig 4.4 LCD Pin Description Fig 4.5 LCD with Arduino.  E: Enable (Latch data) - Used to latch the data.  VEE: contrast control.  VDD & VSS: Power supply VDD= +5V VSS=GND 4.5 DC Motor Interfacing • The simplest DC rotating machine consists of a single loop of wire rotating about a fixed axis. The magnetic field is supplied by the North and South poles of the magnet. • Rotor is the rotating part.Stator is the stationary part. • We can reverse the motor direction the simply by reversing the power supply connection of motor. It means motor is bipolar device. Necessary Medium to Operate • We are working on microcontroller and the maximum output current that it can provide is 20mA. • But our motor works on 1Amp current so to remove this problem we will have to
  32. 32. 32 | P a g e connect motor driver IC L293D in between the microcontroller and motor. Fig 4.6 IC L293D and Its interfacing with motor 4.6 IR Sensor interfacing  There are two part of the sensors: 1. Emitter 2. Receiver  Emitter converts the electrical current in the Infra-Red Radiation.  Receiver receive the IR radiation when the radiation reflect back after the collision from the obstacle. Operating Modes: Our IR sensor can work in two modes:  Analog Mode and Digital Mode How to use? • Digital Mode:-In this mode you can directly connect the sensor to any pin of the controller. • Analog Mode:-In this mode sensor will give analog value so you have to use ADC
  33. 33. 33 | P a g e Fig 4.7 IR sensor 4.7 LM35 Interfacing • LM35 is a precision IC temperature sensor with its output proportional to the temperature (in o C). The sensor circuitry is sealed and therefore it is not subjected to oxidation and other processes. • The operating temperature range is from -55°C to 150°C. The output voltage varies by 10mV in response to every o C rise/fall in ambient temperature, i.e., its scale factor is 0.01V/ o C. Pin Diagram Fig 4.8 LM35 and its Interfacing 4.8 Relay Interfacing • Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal
  34. 34. 34 | P a g e • Provide a sufficient amount of current to this relay, an extra circuit is also require because microcontroller is not capable of providing such current, that’s why ULN2803 IC is used for this purpose. Fig 4.9 Relay with Arduino 4.9 LDR LDR is connected to Arduino in pull down manner. One terminal of LDR is connected to GND and other terminal is connected the analog input A0. Also 10K ohm resistor is to LDR terminal which is going into the GNd. Fig 4.10 LDR with Arduino
  35. 35. 35 | P a g e 4.10 Accelerometer interfacing  An accelerometer measures acceleration (change in speed) of anything that it's mounted on.  Inside an accelerator MEMS device are tiny micro-structures that bend due to momentum and gravity. When it experiences any form of acceleration, these tiny structures bend by an equivalent amount which can be electrically detected  It detects the motion in X, Y and Z directions. Accelerometer can be interfaced with the controller with ADC PORT because it will also give analog output. These analog form values can be obtained by connecting X, Y and Z pins of the sensor to the controller’s ADC pins.  Similar to the analog sensors it will also give the different values whenever any motion will be there in X, Y, Z direction. Fig 4.11 Accelerometer with Arduino
  36. 36. 36 | P a g e Chapter 5 5. Home Automation The Home Automation is a wireless home automation system that is supposed to be implemented in existing home environments, without any changes in the existing infrastructure. Home Automation lets the user to control his home from his or her computer. In the computer program the user can create actions what should happen with electrical devices in the network depending on the sensors sensing surrounding environment. The concept here is that there will be a box connected to the mains and controls the power outlet of the electrical device that is plugged into it. Each box contains a circuitry to control the appliances connected to the box. This circuit is controlled by the signal sent by the user which further checked upon by the controller to take corresponding action. People can control power supply of electrical devices in order to create an interactive home environment to facilitate the control without changing any home appliance. People can enjoy the high technology and simplicity modern life style. Each device will be with standard setup and while adding it into network; it can be given an address and tasks to do. All the setting will be easily resettable to default value, so people can move the devices between different electrical devices and networks.Home Automation boxes will be put into different rooms at home, depending on the needed functionality. Various different sensors could be attached to the boxes. The sensors are used as triggers for actions, that user can set up in the User Interface of application. In the development of this project there are two important part, they are: 1.) ANDROID 2.) ARDUINO
  37. 37. 37 | P a g e These both topics are later covered in this report in more detail as how to program for your system and how to configure them. The project started off with a brainstorming session. All ideas about how the Home Automation should work and what functions it should have were written on a whiteboard. We discussed all possible solutions and ideas that we had come up with and removed things that were not possible to implement within this project scope. All that was left on the whiteboard in the end was divided up into following task areas: • Network Create a wireless connection between embedded Arduino boards and the Android application. • Software Computer software has to be able to control the communication, send tasks for Home Automation embedded devices and be provided with the GUI where end users can set up actions. • Electronics This area covers in detail the hardware solutions chosen and how that affected the final prototype. The hardware could be described as three different work areas: arduino, dimmer/switching circuit and wireless modules. • Prototyping and construction The last focusing area is prototyping the final product. We need to build the product and put it into aesthetic form. The presentation of the project should be done so the visitors understand how the final product is supposed to be used. Therefore we have to come up the suitable scenarios to present. Some furniture is needed to get a home environment feeling for the presentation.
  38. 38. 38 | P a g e 5.1 Software In parallel with the Arduino code being programmed, the software for the computer was created. The software is to be installed on the end user's computer in order to set up and run the Home Automation network at home. The program is written in Java, a language chosen because of the existing knowledge about the language in the group and the in-built cross- platform support. 4.2.1 User Interface The main user interface is divided in two parts, the main panel with all connected devices and their status and a table of all currently configured actions and their priority. 4.2.2 Device Panel The device panel is a horizontally scrollable list of all connected devices, which can be described by a custom name. For each device you can see all connected sensors and their status. You can also in real time control each device, for example set a lamps intensity to medium intensity or slowly fade another from off to fully lit and query the current status of the device’s controllable outlet. 4.2.3 Actions One of the main features of the program is the ability for the user to configure actions. An action is a kind of “if-then” clause. For example: “If the night lamp lights up at night then set all hallway lamps to half lit”. The user can also assign a custom name to each action to make it easy to associate the action with what is performed. Below the list of devices there is a list of all currently configured actions and their priority. The action’s priority can be changed and the actions themselves can be edited and deleted. If the “Edit” button or then “Add new action” is clicked, a new dialog is opened where the user can create or edit new actions to produce the kind of if-then clauses described above. Actions can have an arbitrary number of input triggers and output actions.
  39. 39. 39 | P a g e 4.2.4 Other Functions Apart from the two abovementioned core functions of the user interface, there are also a few assorted functions to be able to setup the network properties and to monitor the network activity and the messages getting transferred. In Figure below, there is a description of how data is being sent out to from a smart phone to the Bluetooth Module connected to the Arduino. Commands are being send in form of ASCII value and compare with instructions written in the program. Here we can see the five relays connected with Arduino. These relays are operated as per the commands send by the user. Fig 5.1 A shorthand view of Home Automation system The Android application we are using here is being developed in Eclipse using Android SDK tools. These applications are also downloaded from Google Play store. There are also some Open-Source projects we can use provided on GITHUB. So we have a lot of options in developing these Android Apps and we can use any one of them.
  40. 40. 40 | P a g e Now concerning Bluetooth Connectivity we need to connect the smartphone with the Bluetooth module named like HC-05 and HC-06. A connection authentication is necessary here since without this we cannot connect out sytem to outer modules. ` Fig 5.2 Connecting to Bluetooth Module HC-06 Moreover there are two basic softwares which we are going to use in this project, they are described below: 1. Arduino IDE: Arduino. 2. Eclipse for android programming (optional, not required). These both software can easily be downloaded from their respective websites. For Operating these Bluetooth devices we are using the Bluetooth terminal called Blue Term version 1.1 stable release.
  41. 41. 41 | P a g e 5.2 Hardware The heart and soul of this project is the Arduino. It is responsible for controlling as which appliance should operate at any particular time. Here we are using Arduino UNO as controller. Its IC Atmega328PU, which is also called the Arduino IC, is going to be use in this project and will be referred to as Arduino controller. In this text we will be using ATmega328PU as Arduino controller. ATmega328 is a microcontroller from Atmel. All the components required for the development of Home Automation are stated below: 1. Arduino / Arduino Clone or make your own custom Arduino board with this tutorial. 2. A 5v TTL -UART Bluetooth module 3. Four 5V SPDT Relays 4. Prototype board or breadboard. 5. Connecting wires. 6. PCB 7. Motor driver IC L23D Further with Arduino is the Bluetooth Module HC-05. This will be used to communicate with the Bluetooth module of Android phone. Next is a schematic for Arduino connected with relays. Relay provide the isolation between high signal AC to low signal DC. Now for connecting a controller with relays we need one more thing i.e. transistor. It is used to turn on the relay and also helpful in providing safety to the controller IC. Bluetooth module is connected at the Rx-Tx pin. Rx of Bluetooth is connected to Tx of microcontroller, and similarly Tx pin of Bluetooth is connected to Rx of microcontroller.
  42. 42. 42 | P a g e These two pins are responsible for serial communication in Arduino and also data through the Bluetooth module is also go serially to the IC. Data is interpreted here in ASCII value for comparison as what is being sent by the user. Fig 5.3 Home Automation Schematic There is a motor driver IC L293D which is used to drive DC motors. Since motors drive high current, they could damage the controller IC for that purpose this IC is used. A detailed schematic of home automation is provided below where the hard connections to microcontroller is shown. Here relay connection through a transistor is shown.
  43. 43. 43 | P a g e Fig 5.4 Circuit Diagram of Home Automation Also a diode is connected in between the supply mode of relay, to eliminate the chances of reverse current to relay since diode allows current in only one direction and there will be no current flowing from ground to supply. Further this diagram demonstrate a development circuit not only for Home Automation but also for Arduino board not as efficient as the actual board but it can quiet nicely.
  44. 44. 44 | P a g e 5.3 PCB Design for Home Automation PCB designing for Home Automation is done on any layout designer. Here we use Dip Trace for designing the component and layout design. They both are shown below. Fig 5.5 Component Design Fig 5.6 Layout Design
  45. 45. 45 | P a g e 5.4 Design Specification The system is designed keeping in mind the following key requirements:  Clients should be able to quickly and seamlessly connect to and disconnect from the system.  Connections from all kinds of clients must be handled simultaneously; i.e. Bluetooth.  Change in the status of an appliance should be propagated to all clients in real- time.  Customizable time-based profiles to automatically activate and deactivate appliances based on the time of day.  Hardware should be widely compatible with different smart phone configurations.  Provide a simple and user-friendly interface on the client side. Fig 5.7 A screenshot of BT terminal
  46. 46. 46 | P a g e 5.4.1 Data Flow Diagram Fig 5.8 Data Flow Diagram Server Wi-Fi / Bluetooth Mobile Device USB-to-Serial Bridge Microcontroller Relay System
  47. 47. 47 | P a g e The mobile device connects to the Microcontroller through Bluetooth or Wi-Fi. The user sends commands to the server from the mobile device. The microcontroller is connected to the server via USB. On receiving commands from the mobile device, the server sends commands to the microcontroller over the USB connection, also this data is send serially via Rx-Tx pin. The microcontroller is directly connected to the relays and it can enable or disable them. The relays are connected to the electrical system of the building so that they can control the plug points. Fig 5.7 Bluetooth module HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup. Serial port Bluetooth module is fully qualified Bluetooth V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio transceiver and baseband. It uses CSR Bluecore 04-External single chip Bluetooth system with CMOS technology and with AFH(Adaptive Frequency Hopping Feature). It has the footprint as small as 12.7mmx27mm. Hope it will simplify your overall design/development cycle.
  48. 48. 48 | P a g e 5.5 Programming code for microcontroller. int rel1=12; // relay 1 int rel2=11; // relay 2 int mtr=10; // motor 1 int mtr1=9; // motor 2 int val; // taking a variable void setup() { pinMode(rel1,OUTPUT); // set relay 1 as ouput for bub 1 pinMode(rel2,OUTPUT); // set relay 2 as ouput for bub 2 pinMode(mtr,OUTPUT); // set motor pin 1 as ouput pinMode(mtr1,OUTPUT); // set motor pin 2 as ouput Serial.begin(9600); // setting the baud rate for serial communication } void loop() { while(Serial.available()==0); // setting default value of “val” equal to Zero ( 0 ) val = Serial.read(); // saving the input value coming from the BT terminal
  49. 49. 49 | P a g e if(val=='1') // if val is equal to 1, checking the condition { digitalWrite(rel1,HIGH); // then turn the bulb 1 or relay 1 ON. } else if(val=='2') // if val is equal to 2 { digitalWrite(rel1,HIGH); // turn ON the relay no 2 or bulb no 2 } else if(val=='3') // if val is equal to 2 { digitalWrite(rel,LOW); // setting the relay 1 or bulb 1 OFF digitalWrite(rel1,LOW); // setting the relay 2 or bulb 2 OFF } else if(val== '4') // if val is equal to 4 { digitalWrite(mtr,HIGH); // motor moving in clockwise direction using both statement digitalWrite(mtr1,LOW); delay(5000); } else if(val == '5') // if val is equal to 5 { digitalWrite(mtr,LOW); // motor moving in anti-clockwise direction using both statement digitalWrite(mtr1,HIGH); delay(5000);
  50. 50. 50 | P a g e } else if(val == '6') // if val is equal to 6 { digitalWrite(mtr,LOW); // motor moving in anti-clockwise direction using both statement digitalWrite(mtr1,LOW); delay(5000); } } // end of the prigram Fig 5.8 Garage Operating Up nad Down Fig 5.9 Bulb 1 and bulb 2 Glowing Alternately
  51. 51. 51 | P a g e References 1. Allan R. Hambley “Electrical Engineering”, pp. 3, 441, Prentice Hall, 2004 2. “Principles of Electrical Engineering.” Books.google.com. Retrieved 2012-10-29. 3. Anthony J. Pansini “Electrical Distribution Engineering”, The Fairmont Press Inc., 2006 4. Erik Barnouw “A Tower in Babel”, p. 28, Oxford University Press US, 1966 5. “Radio Engineering Principles”. Books.google.com. Retrieved 2012-10-29. 6. Charles A. Harper “High Performance Printed Circuit Boards”, McGraw-Hill, 2000 7. Rakesh K. Garg/Ashish Dixit/Pavan Yadav “Basic Electronics”, p. 1, Firewall Media, 2008 8. Sachin S. Sharma “Power Electronics”, Firewall Media, 2008 9. Edward J. Rothwell/Michael J. “Cloud Electromagnetics”, CRC Press, 2001 10."Arduino - Introduction". arduino.cc. 11. "How many Arduinos are in the wild?" About 300,000". Adafruit Industries. May 15, 2011. Retrieved 2013-05-26. 12. "Arduino FAQ – With David Cuartielles". Malmö University. April 5, 2013. Retrieved 2014-03-24. 13. David Kushner (26 Oct 2011). "The Making of Arduino". IEEE Spectrum. 14. Justin Lahart (27 November 2009). "Taking an Open-Source Approach to Hardware". 15. "Rhizome - Interview with Casey Reas and Ben Fry". 2009-09-23. 16. "Hardware Index". Arduino Project. Retrieved 2013-12-10. 17. "Optiboot Bootloader for Arduino and Atmel AVR". Retrieved 2015-10-01. 18. Schmidt, M. ["Arduino: A Quick Start Guide"], Pragmatic Bookshelf, January 22, 2011 19. "Arduino - ArduinoBoardMega2560". arduino.cc. 20. "Arduino breadboard shield: $10 & 10 mins". todbot blog.

×