Вы находитесь на странице: 1из 59

Android Switchboard- Mini Project Report

Introduction

Ever since we invented electricity, we have been using switch


boards. Except certain changes in form factor, switches used for domestic
applications have stayed pretty much the same for the last century. Their
inherent disadvantage is that the operator has to manually turn the switch
on and off. But with the advent of new technology like Bluetooth
communication and Smart Phones, we can now tackle this disadvantage
and we can make Smart Switch Boards.
Through our Project, we intent to tackle this problem by
making a switch board that can be controlled using an Android mobile
phone. For this, we intent to use the Bluetooth connectivity present in
almost all of the commercially available android phones. We will be
using a Bluetooth to Serial module (HC 05) to interface the phone and the
switch board. We designed this system in such a way that it can be
integrated into existing switch boards as an add-on and do not require
major overhauls of the wiring in the house.
The system has two parts one is the switchboard part and the other
is an android application. The switchboard part goes inside the
Switchboard. The android application is used to control the system using
an android phone.
Department of Instrumentation, CUSATPage 1

Android Switchboard- Mini Project Report

Motivation and Product Design

While we were hunting ideas for the mini project, the most
important thing we had in mind was that whatever we build should have
immediate practical applications. We wanted our project to solve a
common problem faced by the society. Since switchboards were present
everywhere and since they needed to be operated manually, we decided to
automate the system. Doing so would increase the convenience for people
and would be of immense importance to elderly people and people
suffering from disabilities.
The three elements of design are: Function
Aesthetics
Ergonomics
We have designed the product by keeping in mind all the above factors.
We believe that this system will make a huge difference in our current
and future lives. We are also excited about the future aspects and possible
expansions of our project.

2.Block Diagram
Department of Instrumentation, CUSATPage 2

Android Switchboard- Mini Project Report

The goal of this project is to control a switch board from an


android phone. For this we are using Bluetooth communication. The
system has two parts, a circuit that goes inside the switchboard and an
Android app.

Switchboard
Add-on

Bluetooth

Circuit

Communicat
ion

Android
Application

Figure 1:- Basic Block Diagram


Switchboard section
The switchboard section of the system contains a circuit board which has
Bluetooth communication capability.

Switches

Microcontro
ller

HC 05
Serial Comm.

Bluetooth
Module

Android Application

Relays

Department of Instrumentation, CUSATPage 3

Android Switchboard- Mini Project Report

The android application pushes data to the Bluetooth client to transmit it


to the switch board. The data is collected by means of software switches
on a Graphical user interface on the app.
GUI

ASCII

Bluetooth
Client

1 Byte Data

Bluetooth
Modem

Fig:- 3 Block Diagram of Android Application

Department of Instrumentation, CUSATPage 4

Android Switchboard- Mini Project Report

3.Block Diagram Description


Microcontroller
The microcontroller we choose for the system was the Atmel 89S52. The
AT89C2051is

low-power,

high-performance

CMOS8-bit

microcomputer with 8K bytes of Flash programmable and erasable read


only memory (PEROM). The device is manufactured using Atmels highdensity non volatile memory technology and is compatible with the
industry-standard 80C51 and 80C52 instruction set and pin-out. The onchip Flash allows the program memory to be reprogrammed in system or
by a conventional non volatile memory programmer. It is a stand alone
high performance single chip computer intended for use in sophisticated
real-time applications such as instrumentation, industrial control and
intelligent computer peripherals. It provides the hardware features,
architectural enhancements and new instructions that make it a powerful
and cost effective device.
Switches
The switches we use for the system are the standard household switches.
The switches must be Single pole Single Throw (SPST) Switches. It is a
basic on/off switch that turns a single circuit on or off. An SPST switch
has two terminals: one for the input and one for the output. SPDT (single
Department of Instrumentation, CUSATPage 5

Android Switchboard- Mini Project Report

pole, double throw): An SPDT switch routes one input circuit to one of
two output circuits.
Relays
A relay is an electrically operated switch. Many relays use an
electromagnet to mechanically operate a switch, but other operating
principles are also used, such as solid-state relays. 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. The first relays were
used in long distance telegraph circuits as amplifiers: they repeated the
signal coming in from one circuit and re-transmitted it on another circuit.
Relays were used extensively in telephone exchanges and early
computers to perform logical operations.
Bluetooth Module
The device that we use for communication with the android phone is a
Bluetooth to serial module called HC 05. The HC 05 receives and
transmits serial data as ASCII data i.e. 1 Byte data. The device uses TTL
logic levels and has a default baud rate of 9600bps.
The GUI

Department of Instrumentation, CUSATPage 6

Android Switchboard- Mini Project Report

The graphical user interface of the android application uses software


switches to interact with the user and then relay that data back to the
controller through the Bluetooth client.

Bluetooth Client and Bluetooth Modem


The Bluetooth client and Bluetooth modem present inside the android
phone can be used to sent the collected data to the controller by properly
configuring it. The use of high level languages to program the app makes
it easy to code the application.

Department of Instrumentation, CUSATPage 7

Android Switchboard- Mini Project Report

4. Circuit Diagram
The circuit diagram for the Switch board side circuit is as shown below:-

Fig 4:- Circuit Diagram


Department of Instrumentation, CUSATPage 8

Android Switchboard- Mini Project Report

5. Dc Power Supply

Fig 5:- DC Power Supply


These form an important equipment of any Electronics laboratory. Power
supplies are essential for the testing and implementation of any useful
electronic circuit. If power supplies are not available then the only way to
provide power to a circuit is the battery. For long-term use and frequent
manipulation these are not feasible. More over these are not as flexible as
modern day power supplies. They do not provide for overload protection
and thermal protection.

Department of Instrumentation, CUSATPage 9

Android Switchboard- Mini Project Report

The following units form the backbone of any modern day power supply
Full wave bridge rectifier
Filter circuit
Voltage regulator
In the case if modern power supplies, the required power is derived from
the AC mains. For this at first the 230V/50 Hz is step down using a step
down transformer. Then The AC voltage is converted to DC using a
rectifier circuit. The bridge rectifier is considered the apt choice since it
avoids the center-tapped transformer. The ripples from the rectifiers
output are removed by filtering. The filter can be any of the following:
1. L filter
2. C filter
3. LC filter
4. CRC filter
And we use capacitive filtering.
The function of the voltage regulator is to provide a stable DC voltage for
powering other electronic circuits. The voltage regulator must be capable
of providing substantial output current. They must provide a constant
voltage regardless of changes in load current, temperature, and AC line
voltage. Although voltage regulators can be designed using opamps, it is
quicker and easier to use IC Voltage regulators. Furthermore, IC voltage
Department of Instrumentation, CUSATPage 10

Android Switchboard- Mini Project Report

regulators are versatile and relatively inexpensive and are available with
features such as programmable output, current / voltage boosting, internal
short circuit current limiting, thermal shut down, and floating operation
for high voltage applications. Voltage regulator may be classified as:
Series Regulator
Switching Regulator
Series regulators use a power transistor connected in series between the
unregulated DC input and the load. The output voltage is controlled by
the continuous voltage drop-taking place across the series pass transistor.
Since the transistor conducts in the active or the linear region, these
regulators are also called linear regulators. Linear regulators may have
fixed or variable output voltages and could be positive or negative.
Voltage regulators such as the 78XX series and the IC 723 are commonly
used. Switching regulators operate the power transistor as a HF on/off
switch, so that the power transistor does not conduct current continuously.
This gives an improve efficiency over the series regulator. The IC 723 can
be used as a switching regulator too.
With the advent of microelectronics, it is now possible to
incorporate the complete circuit of a voltage regulator on a single
monolithic silicon chip. These provide for high reliability, low cost,

Department of Instrumentation, CUSATPage 11

Android Switchboard- Mini Project Report

reduced size and excellent performance. The 78XX, 79XX families and
IC723 are good examples of monolithic general-purpose regulators. Here
we use the positive voltage regulators 78XX series.
78xx Series
The 78XX series of regulators are 3 terminal, positive fixed voltage
regulators. There are 7 voltage options available like: 5V, 6V, 8V, 12V,
15V, 18V and 24V. The 79XX series are negative fixed voltage
regulators. These regulators are available in two types of packages:
1. Metal Package (TO-3)
2. Plastic Package (TO-220)

6. Microcontroller
The microcontroller is programmed to read the serial data coming out of
the HC 05 and turn the relays on or off according to the received data.
The AT89S52 is a typical 8051 microcontroller manufactured by
Atmel.89S52 has 4 different ports, each one having 8 Input/output lines
providing a total of 32 I/O lines. Those ports can be used to output DATA
and orders do other devices, or to read the state of a sensor, or a switch.
Most of the ports of the 89S52 have 'dual function' meaning that they can
be used for two different functions: the fist one is to perform input/output

Department of Instrumentation, CUSATPage 12

Android Switchboard- Mini Project Report

operations and the second one is used to implement special features of the
microcontroller like counting external pulses, interrupting the execution
of the program according to external events, performing serial data
transfer or connecting the chip to a computer to update the software.

Fig 6:- Block diagram of microcontroller

Department of Instrumentation, CUSATPage 13

Android Switchboard- Mini Project Report

The main features include: 8kb of in-system programmable flash memory


4.0v to 5.5v operating range
Fully static operation: 0 Hz to 33 MHz
Three-level program memory lock
256 x 8 bit internal RAM
32 Programmable I/O lines
Three 16 bit timer/counters
8 interrupt sources
Full duplex UART serial channel
Low power Idle and power down Modes
Interrupt Recovery from Power down Mode
Watchdog Timer
Dual Data pointer
Power off flag

Department of Instrumentation, CUSATPage 14

Android Switchboard- Mini Project Report

Fig 7:- Pin out of 89S52


PIN DESCRIPTION
Vss :Circuit ground potential
Vcc :+5V power supply during operation, programming and verification.
Port O :Port O is an 8-bit open drain bi-directional I/O port. It is also
the multiplexed low order address and data bus when using external
memory. It is used for data output and output during programming and
verification. Port O can sink/source two TTL loads.

Department of Instrumentation, CUSATPage 15

Android Switchboard- Mini Project Report

Port 1 :Port 1 is an 8-bit quasi-traditional I/O port. It also emits the loworder address byte during programming and verification. Port 1 can
sink/source one TTL Load.
Port 2 :Port 2 is an 8-bit quasi-bi-directional I/O port. It also emits the
high order address byte when accessing external memory. It is used for
the high-order address and the control signals during programming and
verification. Port 2 can sink/source one TTL load.
Port 3 :Port 3 is an 8-bit quasi bi-directional I/O port. It also contains the
interrupt, timer, serial port and RD and WR pins that are used by various
options. The output batch corresponding to a secondary function must be
programmed to a one (1) for that function to operate. Port 3 can
sink/source one TTL load. The secondary functions are assigned to the
pins of port 3, as follows.
RXD/data (P3.0):Serial Ports receiver data input (asynchronous) or data
input/output (synchronous).
TXD/Clock (P3.1) - Serial ports transmitts data output (asynchronous) or
clock output (synchronous).
INTO (P3.2):Interrupt O input or gate control input for counter 0.
INTI (P3.3) :Interrupt 1 input or gate control input for counter 1.
T0 (P3.4):Input to counter 0.
Department of Instrumentation, CUSATPage 16

Android Switchboard- Mini Project Report

T1 (P3.5):Input to counter 1.
WR (P3.6):The write control signal batches the data byte from port 0 into
the External Data Memory to port 0.
RST/VPD :A low to high transition on this pin (at approximately 3V)
resets the 8051. If VPD is held within its space (approximately +5V),
while Vcc drops below spec, VPD will provide stand by power to the
RAM. When VPD is low, the RAMs current is drawn from Vcc. A small
internal resistor permits power on reset using only a capacitor connected
to Vcc.
ALE/PROG:Provides Address Latch Enable output used for latching the
address into external memory during normal operation. Receives the
program pulse input during EPROM programming.
PSEN: The program store enable output is a control signal that enables
the external program memory to the bus during normal fetch operations.
EA/VDD: When held at a TTL high level, the 8051 executes instructions
from the internal ROM/EPROM when the PC is less than 4096. When
held at a TTL low level, the 8051 fetches all instructions from external
program memory. The pin also receives the 21V EPROM programming
supply voltage.

Department of Instrumentation, CUSATPage 17

Android Switchboard- Mini Project Report

XTAL1:Input to the oscillators high gain amplifier. A crystal or external


source can be used.

APPLICATIONS OF MICROCONTROLLER
1) Hand-held instruments
a) Pagers
b) Electronic plan meter
c) Level meter
d) IC Tester
2) Peripheral Devices

a) Keyboard controller
b) Modem
c) Printer buffer
3) Stand-Alone devices
a) Color copier
b) Electronic typewriter
c) Cable TV terminal
4) Instrumental Sub-Functions
a) Digital oscilloscope
b) Dedicated front panel
c) Microwave computer
5)Automotive application

Department of Instrumentation, CUSATPage 18

Android Switchboard- Mini Project Report

7. ULN2003A
The microcontroller cannot directly drive a relay. A relay need high
current to turn on/off. To provide that high current we use a Darlington
pair array.
The ULx200xA devices are high-voltage, high-current . Darlington
transistor arrays. Each consists of seven NPN Darlington pairs that
feature high-voltage outputs with common-cathode clamp diodes for
switching inductive loads.

Fig 8:-Simplified Block Diagram


The collector-current rating of a single Darlington pair is 500 mA. The
Darlington pairs can be paralleled for higher current capability.
Applications include relay drivers, hammer drivers, lamp drivers, display
Department of Instrumentation, CUSATPage 19

Android Switchboard- Mini Project Report

drivers (LED and gas discharge), line drivers, and logic buffers. For 100V (otherwise interchangeable) versions of the ULx2003A devices, see the
SLRS023 data sheet for the SN75468 and SN75469 devices. The
ULN2002A device is designed specifically for use with 14-V to 25-V
PMOS devices. Each input of this device has a Zener diode and resistor in
series to control the input current to a safe limit. The ULx2003A devices
have a 2.7-k series base resistor for each Darlington pair for operation
directly with TTL or 5-V CMOS devices.

8. HC 05 Bluetooth Module
It is a Bluetooth module that is widely used with Microcontroller to
enable Bluetooth communication. This module cam be interfaced using
the UART in 8051 microcontroller where the data are transmitted in the
form of packets. The pins TX and RX pin of the HC 05 form the path for
data transmission and reception. These TX pin of HC05 must be
connected to the RX pin of 8051 and vice versa.

Department of Instrumentation, CUSATPage 20

Android Switchboard- Mini Project Report

Fig 9:- HC 05 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)
Hardware Features

Typical -80dBm sensitivity

Up to +4dBm RF transmit power

Low Power 1.8V Operation ,1.8 to 3.6V I/O

PIO control

UART interface with programmable baud rate

Department of Instrumentation, CUSATPage 21

Android Switchboard- Mini Project Report

With integrated antenna

With edge connector

Software Features

Default Baud rate: 38400, Data bits:8, Stop bit:1,Parity:No parity, Data control: has.
Supported baud rate: 9600,19200,38400,57600,115200,230400,460800.

Given a rising pulse in PIO0, device will be disconnected.

Status instruction port PIO1: low-disconnected, high-connected;

PIO10 and PIO11 can be connected to red and blue led separately. When master and slave
are paired, red and blue led blinks 1time/2s in interval, while disconnected only blue led blinks 2times/s.

Auto-connect to the last device on power as default.

Permit pairing device to connect as default.

Auto-pairing PINCODE:0000 as default

Auto-reconnect in 30 min when disconnected as a result of beyond the range of connection.

Department of Instrumentation, CUSATPage 22

Android Switchboard- Mini Project Report

Fig 10:- Interfacing with the 89S52


The Interfacing of the Device is as Shown in the Circuit diagram above.
For additional protection, the voltage of the Tx line of the Microcontroller
may be reduced by the use of a resistor network.

9 Software and Programming Tools


DESIGN TOOLS

Department of Instrumentation, CUSATPage 23

Android Switchboard- Mini Project Report

Electronic Design Automation (EDA) Tools:- With the advent of


powerful computing system and interactive software stages in the design
and development of an electronic circuit has undergone automation is
called EDA tools. This tool helps us in such a way that we can draw the
circuit, list the functioning of the circuit in response to the best input in
assimilation software after successfully simulating the circuit. The
placing and routing software does the PCB artwork in the project. The
design automation tool used is EXPRESS PCB, which includes
EXPRESS SCH For circuiting the diagram, create schematic and net
list.
EXPRESS PCB For creating the PCB artwork .

Programming Tools
The program was written and simulated using MikroC,
which is a complete IDE. It consists of a text editor, C
compiler and a simulator to simulate our code. The MikroC
PRO for PIC is a powerful, feature- rich development tool
for PIC microcontrollers. It is designed to provide the
programmer with the easiest possible solution to develop

Department of Instrumentation, CUSATPage 24

Android Switchboard- Mini Project Report

applications

for

embedded

systems,

without

compromising performance or control.


Features: MickroC PRO for PIC allows you to quickly develop
and deploy complex applications
Write your C source code using the built in code editor (Code and
Parameter Assistance, Code Folding, Syntax Highlighting, Auto
Correct Code Templates, and more.)
Use included MikroC PRO for AT89c2051 and AT89s52
microcontroller libraries to dramatically speed up the development:
data acquisition, memory, displays, conversations, communications
etc.
Monitor your program structure, variables and functions in the
Code Explorer.
Generate commented, human readable assembly, and standard
HEX compatible with all programmers.
Features: MickroC PRO for PIC allows you to quickly develop
and deploy complex applications
Write your C source code using the built in code editor (Code and
Parameter Assistance, Code Folding, Syntax Highlighting, Auto
Correct Code Templates, and more.)
Use included MikroC PRO for AT89c2051 and AT89s52
microcontroller libraries to dramatically speed up the development:
data acquisition, memory, displays, conversations, communications
etc.
Monitor your program structure, variables and functions in the
Code Explorer.
Generate commented, human readable assembly, and standard
HEX compatible with all programmers.

Department of Instrumentation, CUSATPage 25

Android Switchboard- Mini Project Report

10 PCB Design
The PCB design starts right from the selection of the laminates .The two
main types of base laminate are epoxy glass and phenolic paper laminates
are generally used for simple circuits. Though it is very cheap and can
easily be drilled, phenolic paper has poor electrical characteristics and it
absorbs more moisture than epoxy glass. Epoxy glass has higher
mechanical strength.
The important properties that have to be considered for selecting the PCB
substrate are the dielectric strength, insulation resistance, water
absorption property, coefficient of thermal expansion, shear strength,
hardness, dimensional stability etc.
Manufacturing Process
The steps involved in manufacture are
Department of Instrumentation, CUSATPage 26

Android Switchboard- Mini Project Report

a)
b)
c)
d)
e)
f)

Artwork preparation.
Resist preparation.
Resist application an fixing.
Acid etches.
Cleaning and inspection.
Resist removal.

PCB Fabrication

a)
b)
c)
d)

The fabrication of PCB has basically of four steps.


Preparing the PCB pattern.
Transferring the pattern onto the PCB.
Developing the PCB.
Finishing ie) drilling, cutting, smoothing, turning etc.

Preparing the PCB pattern


Pattern designing is the primary step in fabricating a PCB in this step, all
interconnection between the components in the given circuit are
converted into PCB tracks several factors such as positioning, the
diameter of holes, the area that each component would occupy, and the
type of end terminal should be considered.

Transferring the PCB Pattern


The copper side of the PCB should be thoroughly cleaned with the help
of alcoholic spirit or petrol must be completely free from dust and other
contaminants. The mirror image of the pattern must be carbon copied and
to the laminate the complete pattern may now be made each resistant with
the screen printing technology.
Developing
In this developing all excessive copper is removed from the board
and only the printed pattern is left behind. About 100ml of tape water
should be heated to 75 C and 30.5 grams of FeCl3 added to it, the

Department of Instrumentation, CUSATPage 27

Android Switchboard- Mini Project Report

mixture should be thoroughly stirred and a few drops of HCl may be


added to speed up the process.
The board with its copper side facing upward, should be placed in a
flat bottomed plastic tray and the aqueous solution of FeCl 2 poured in
the etching process would take 40 to 60 min to complete.
After etching the board it should be washed under running water
and then held against light .the printed pattern should be cleanly visible.
The paint should be removed with the help of thinner.
Finishing Touches
After the etching is completed ,hole of suitable diameter should be
drilled, then the PCB may be tin plated using an ordinary 35 Watts
soldering rod along with the solder core ,the copper side may be given a
coat of varnish to prevent oxidation.

Drilling
Drills for PCB use usually come with either a set of collects of
various sizes or a 3-Jaw chuck. For accuracy however 3-jaw chunks
arent brilliant and small drill below 1 mm from grooves in the jaws
preventing good grips.

Soldering
Begin the construction by soldering the resistors followed by the
capacitors and the LEDs diodes and IC sockets. Dont try soldering an
IC directly unless you trust your skill in soldering. All components
should be soldered as shown in the figure. Now connect the switch and
then solder/screw if on the PCB using multiple washers or spaces.
Department of Instrumentation, CUSATPage 28

Android Switchboard- Mini Project Report

Soldering it directly will only reduce its height above other components
and hamper in its easy fixation in the cabinet. Now connect the battery
lead.
Assembling
The circuit can be enclosed in any kind of cabinet. Before fitting
the PCB suitable holes must be drilled in the cabinet for the switch,
LED and Switches. Note that a rotary switch can be used instead of a
slide type.

11 PCB Layout
The Different Pcb layouts are as shown below: Top copper layer:-

Department of Instrumentation, CUSATPage 29

Android Switchboard- Mini Project Report

Fig 11:- Top copper layer


Components Layout:-

Fig 12:- Components Layout

12 The Program
-----------------------------------------------------------------------------------------------Department of Instrumentation, CUSATPage 30

Android Switchboard- Mini Project Report

#include<regx51.h>
#define mode P1_7

// global variables
unsigned char con,ipt,as;
unsigned int nb;
void modify();
void toggles(unsigned char d);
void serialcomm();
void toggle(unsigned char s);
// main
void main(){
unsigned char a,b;
nb=0;
P1=0xff;
P0=0xff;
TH1=0xfd;
TMOD=0x20;
TI=0;
TR1=1;
SM0=0;
SM1=1;
EA=1;
ES=1;
REN=1;
P0_7=0;
a=P1&0x1f;
Department of Instrumentation, CUSATPage 31

Android Switchboard- Mini Project Report

b=P0&0xe0;
P0=a|b;
as=P1;
ipt=P1&0x1f;
while(1){
if(mode==0){

a=P1&0x1f;
b=P0&0xe0;
P0=a|b;
}else{
modify();

void serialcomm() interrupt 4{


con=SBUF;
nb=1;
RI=0;
return;
}
void modify(){
if(nb==1){
Department of Instrumentation, CUSATPage 32

Android Switchboard- Mini Project Report

nb=0;
toggle(con);
}else{
if(ipt!=(P1&0x1f)){
as=P1;
toggles(P1);
}

ipt=as&0x1f;
return;
}
void toggle(unsigned char s){
switch(s){
case '0': P0_0=~P0_0;
break;
case '1': P0_1=~P0_1;
break;
case '2': P0_2=~P0_2;
break;
case '3': P0_3=~P0_3;
break;
case '4': P0_4=~P0_4;
break;
default : P0_7=~P0_7;
}
Department of Instrumentation, CUSATPage 33

Android Switchboard- Mini Project Report

return;
}
void toggles(unsigned char d){
unsigned char a,b,c;
a=d^ipt;
b=P1&0xe0;
c=~a;
c=c&P1;
a=a&P1;
a=a|c;
a=0x1f&a;
P0=a|b;
return;
}
// End of Program
---------------------------------------------------------------------------------------------------------------

13 Android Application Development


The second part of the system is the Android application. In order to
develop the app, we used a development environment called MIT App
Department of Instrumentation, CUSATPage 34

Android Switchboard- Mini Project Report

Inventor. It is a joint venture by Google and Massachusetts Institute of


Technology, USA.
Our devices such as mobile and PCs need special applications known as
Bluetooth Terminal to communicate with our microcontrollers via
Bluetooth.
These applications are developed in such a way to send characters
through your device BT which was received by the BT module connected
with our controller. Even some apps offers some interactive GUI buttons
which transmits specific characters with the press of each buttons. Later
the received character can be processed in our code and force the
controller to perform tasks based on the received character. We can use
the Bluetooth communication in two ways, either we can use it to receive
data from the Controller or control the system using our device
Bluetooth.
The App Inventor
App Inventor for Android is an open-source web application originally
provided by Google, and now maintained by the Massachusetts Institute
of Technology (MIT).
It allows newcomers to computer programming to create software
applications for the Android operating system (OS). It uses a graphical
interface, very similar to Scratch and the StarLogo TNG user interface,
which allows users to drag-and-drop visual objects to create an
application that can run on Android devices. In creating App Inventor,
Google drew upon significant prior research in educational computing, as
well as work done within Google on online development environments.
[1]

App Inventor and the projects on which it is based are informed by


constructionist learning theories, which emphasizes that programming
can be a vehicle for engaging powerful ideas through active learning. As
such, it is part of an ongoing movement in computers and education that
began with the work of Seymour Papert and the MIT Logo Group in the
1960s and has also manifested itself with Mitchel Resnick's work on
Lego Mindstorms and StarLogo.
Department of Instrumentation, CUSATPage 35

Android Switchboard- Mini Project Report

Fig 13:- Blocks Editor In App Inventor


These Components of App Inventor are uses by our Program: Accelerometer
Bluetooth Client
Notifier
The accelerometer is used to sense Gestures enable controlling of the
switch board with the help of Gestures like Flicking the phone etc. The
Bluetooth client sents info to the Controller. The notifier is used to
display error messages on screen.

Fig 14:- Screenshots of the Application

Department of Instrumentation, CUSATPage 36

Android Switchboard- Mini Project Report

Fig 15:- Screenshots of the App Inventor Blocks editor

The application is named Bluelink and can be packaged as an .apk file


and can be run on most android devices with inbuilt Bluetooth
connectivity.

The app allows us to do the following: Connect the android device to the switchboard
Control the switches using the on Screen Buttons
Control the switches using Gestures.

Department of Instrumentation, CUSATPage 37

Android Switchboard- Mini Project Report

14 Applications
The system designed as part of this Mini Project can be used for the
following applications:1.
2.
3.
4.

Home Automation Systems


Wireless Operation of Switchboards using a android phone.
Using Android phone to control Home Appliances
The system can help old and disabled people control their
home appliances with an android phone.

Department of Instrumentation, CUSATPage 38

Android Switchboard- Mini Project Report

15 Merits and Demerits


Merits:1. Easy to setup
2. Since android phones have become ubiquitous, no separate
remote control is needed for different home appliances. They
can all be controlled using an android phone.
3. Use of gesture recognition technology allows the system to
be controlled even by blind people.

Demerits:1. Can be use to control only one switchboard.


2. Bluetooth technology has a range of only 10 meters.
3. Cannot yet control regulators of fans etc.

Department of Instrumentation, CUSATPage 39

Android Switchboard- Mini Project Report

16 Future Scope
The future scope of a system like this is a thousand times more exciting
than the current design. With the inevitable advent of the Internet of
Things (IoT), a connected switchboard could be controlled from
anywhere in the world. The complete control of the devices at our homes
can be done from an internet enabled device, placed anywhere in the
world.

The further developments that can be done are:1. Replace Bluetooth with Wi-Fi to get better range and
functionality.
2. Connect to the internet to enable IoT.
3. Network a number of switchboards to make a complete
home automation system.
4. Improve the functionality of the android app to turn devices
on/off at specific times of the day with no user input etc..

Department of Instrumentation, CUSATPage 40

Android Switchboard- Mini Project Report

17 Conclusion

The project was designed and implemented successfully and has proved
to be of immense practical applications. The system enables a person to
control the appliances connected to a switchboard using an Android
Phone. The system can be very useful to old and physically challenged
people. The future scope of the system is awe-inspiring and can be the
subject of a larger project.

Department of Instrumentation, CUSATPage 41

Android Switchboard- Mini Project Report

18 References

Journal / Conference Papers


[1] RishabhGulati, Modern electrical control system,International Journal of Scientific &
Engineering Research, Volume 2, Issue 1, January-2011.
[2] Pan Thu Tun, Development and Implementation of Microcontroller-based sensors, World
Academy of Science, Engineering and Technology, Volume 4, February 2008, Page number
362-365.

Reference / Hand Books / Text Books


[1] Tim Wilmshurst, Designing Embedded Systems with 8051 Microcontrollers,
Published by Elsevier Ltd, First Edition, ISBN: 978-0-7506-6755-5

[2] Kirk Zurell, C programming for embedded systems , R and D Books, First Edition,
ISBN 1-929629-04-4

[3] Martin Bates, ATMEL microcontrollers, An introduction to Microelectronics ,


Published by Elsevier Ltd, Second Edition, ISBN: 0 7506 6267 0

Web
[1] 16F877A,http://ww1.microchip.com/downloads/en/devicedoc/39582b.pdf
[2] PIC Mid Range Reference Manual,
ww1.microchip.com/downloads/en/devicedoc/33023a.pdf
[3] Express tutorial,http://referencedesigner.com/tutorials/express/express_01.php
[4] Datasheets, http://www.datasheetsarchive.com
[5] http://ai2.appinventor.mit.edu/
[6] http://wiki.iteadstudio.com/Serial_Port_Bluetooth_Module_(Master/Slave)_:_
HC-05

Department of Instrumentation, CUSATPage 42

Android Switchboard- Mini Project Report

Department of Instrumentation, CUSATPage 43

Android Switchboard- Mini Project Report

Department of Instrumentation, CUSATPage 44

Android Switchboard- Mini Project Report

Department of Instrumentation, CUSATPage 45

Android Switchboard- Mini Project Report

A.1
AT89S52

Department of Instrumentation, CUSATPage 46

Android Switchboard- Mini Project Report

Features

Compatible with MCS-51 Products

8K Bytes of In-System Programmable (ISP) Flash Memory


Endurance: 1000 Write/Erase Cycles

4.0V to 5.5V Operating Range

Fully Static Operation: 0 Hz to 33 MHz

Three-level Program Memory Lock

8-bit Internal RAM

32 Programmable I/O Lines

Three 16-bit Timer/Counters

Eight Interrupt Sources

Full Duplex UART Serial Channel

Low-power Idle and Power-down Modes

Interrupt Recovery from Power-down Mode

Watchdog Timer

Dual Data Pointer

Power-off Flag

Fast Programming Time

Flexible ISP Programming (Byte and Page Mode)

Green (Pb/Halide-free) Packaging Option

DoE, CE Cherthala

Page 47

Android Switchboard- Mini Project Report

Pin Diagram of AT89S52

Fig.A.1.1 AT89S52 Pin diagram

DoE, CE Cherthala

Page 48

Android Switchboard- Mini Project Report

Pin Description

Port 0
Port 0 is an 8-bit open drain bidirectional I/O port. As an output port,
each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the
pins can be used as high-impedance inputs. Port 0 can also be configured
to be the multiplexed low-order address/data bus during accesses to
external program and data memory. In this mode, P0 has internal pull-ups.
Port 0 also receives the code bytes during Flash programming and outputs
the code bytes during program verification. External pull-ups are required
during program verification.

Port 1
Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1
output buffers can sink/source four TTL inputs. When 1s are written to Port
1 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 1 pins that are externally being pulled low will
source current (IIL) because of the internal pull- ups. In addition, P1.0 and
P1.1 can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively,
as shown in the following table.Port 1 also receives the low-order address
bytes during Flash programming and verification.
Port Pin
P1.0
P1.1
P1.5
P1.6
P1.7

Alternate Functions
T2(external count input to Timer/Counter2), clock-out
T2EX(Timer/Counter 2 capture/reload trigger and direction
control)
MOSI(used for In-System Programming)
MISO(used for In-System Programming)
SCK(used for In-System Programming)

Table A.1.1 Pin description- Port 1


Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port
2 output buffers can sink/source four TTL inputs. When 1s are written to
Port 2 pins, they are pulled high by the internal pull-ups and can be used
as inputs. As inputs, Port 2 pins that are externally being pulled low will
DoE, CE Cherthala

Page 49

Android Switchboard- Mini Project Report

source current (IIL) because of the internal pull-ups. Port 2 emits the highorder address byte during fetches from external program memory and
during accesses to external data memory that uses 16-bit addresses
(MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups
when emitting 1s. During accesses to external data memory that uses 8bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special
Function Register. Port 2 also receives the high-order address bits and
some control signals during Flash programming and verification.

Port 3
Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3
output buffers can sink/source four TTL inputs. When 1s are written to Port
3 pins, they are pulled high by the internal pull-ups and can be used as
inputs. As inputs, Port 3 pins that are externally being pulled low will
source current (IIL) because of the pull-ups. Port 3 receives some control
signals for Flash programming and verification. Port 3 also serves the
functions of various special features of the AT89S52, as shown in the
following table.
Port Pin

Alternate Functions

P3.0

RXD (Serial Input Port)

P3.1

TXD (Serial Output Port)

P3.2

INT0 (External Interrupt 0)

P3.3

INT1 (External Interrupt 1)

P3.4

T0 (Timer 0 External Input)

P3.5

T1 (Timer 1 External Input)

P3.6

WR (External Data Memory Write Strobe)

P3.7

RD (External Data Memory Read Strobe)

Table A.1.2 Pin description- Port 3


RST
Reset input. A high on this pin for two machine cycles while the oscillator
is running resets the device. This pin drives high for 98 oscillator periods
after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH)

DoE, CE Cherthala

Page 50

Android Switchboard- Mini Project Report

can be used to disable this feature. In the default state of bit DISRTO, the
RESET HIGH out feature is enabled.

ALE/PROG
Address Latch Enable (ALE) is an output pulse for latching the low byte of
the address during accesses to external memory. This pin is also the
program pulse input (PROG) during Flash programming. In normal
operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency
and may be used for external timing or clocking purposes.
Note, however, that one ALE pulse is skipped during each access to
external data memory. If desired, ALE operation can be disabled by setting
bit 0 of SFR location 8EH. With the bit set, ALE is active only during a
MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high.
Setting the ALE-disable bit has no effect if the microcontroller is in external
execution mode.

PSEN
Program Store Enable (PSEN) is the read strobe to external program
memory. When the AT89S52 is executing code from external program
memory, PSEN is activated twice each machine cycle, except that two
PSEN activations are skipped during each access to external data memory.
EA/VPP
External Access Enable (EA) must be strapped to GND in order to enable
the device to fetch code from external program memory locations starting
at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA
will be internally latched on reset. EA should be strapped to VCC for
internal

program

executions.

This

pin

also

receives

the

12-volt

Input to the inverting oscillator amplifier and input to the internal

clock

programming enable voltage (VPP) during Flash programming.


XTAL1

operating circuit.

DoE, CE Cherthala

Page 51

Android Switchboard- Mini Project Report

XTAL2
XTAL2 is the output from the inverting oscillator amplifier.

DoE, CE Cherthala

Page 52

Android Switchboard- Mini Project Report

Architecture of AT89S52

Fig.A.1.2 AT89S52 Architecture

DoE, CE Cherthala

Page 53

Android Switchboard- Mini Project Report

Different Modes

Idle Mode
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals
remain active. The mode is invoked by software. The content of the onchip RAM and all the special functions registers remain unchanged during
this mode. The idle mode can be terminated by any enabled interrupt or
by a hardware reset. Note that when idle mode is terminated by a
hardware reset, the device normally resumes program execution from
where it left off, up to two machine cycles before the internal reset
algorithm takes control. On-chip hardware inhibits access to internal RAM
in this event, but access to the port pins is not inhibited. To eliminate the
possibility of an unexpected write to a port pin when idle mode is
terminated by a reset, the instruction following the one that invokes idle
mode should not write to a port pin or to external memory.

Power-down Mode
In the Power-down mode, the oscillator is stopped, and the instruction that
invokes Power-down is the last instruction executed. The on-chip RAM and
Special Function Registers retain their values until the Power-down mode is
terminated. Exit from Power-down mode can be initiated either by a
hardware reset or by an enabled external interrupt. Reset redefines the
SFRs but does not change the on-chip RAM. The reset should not be
activated before VCC is restored to its normal operating level and must be
held active long enough to allow the oscillator to restart and stabilize.

Serial Port Demonstration


This demonstrates the working of the microcontrollers serial port. Now
you can send any data byte as it is coming from the host microcontroller.
The controller receives this data and then complements the data and
sends it back to the host. Again you can see the data coming into the host
port receive buffer. The program waits for the data byte at the RXD line of
the controller. Then the controller complements the input data and sends
out the same at TXD line.

DoE, CE Cherthala

Page 54

Android Switchboard- Mini Project Report

A.2
AT89c2051
Features
Compatible with MCS-51Products
2K Bytes of Reprogrammable Flash
Memory
Endurance: 10,000 Write/Erase Cycles
2.7V to 6V Operating Range
Fully Static Operation: 0 Hz to 24 MHz
Two-level Program Memory Lock
128 x 8-bit Internal RAM

DoE, CE Cherthala

15 Programmable I/O Lines


Two 16-bit Timer/Counters
Six Interrupt Sources
Programmable Serial UART Channel
Direct LED Drive Outputs
On-chip Analog Comparator
Low-power Idle and Power-down Modes
Green (Pb/Halide-free) Packaging
Option

Page 55

Android Switchboard- Mini Project Report

2015

Description
The AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcomputer with
2K bytes of Flash programmable and erasable read-only memory (PEROM). The device is
manufactured using Atmels high-density nonvolatile memory technology and is compatible
with the industry-standard MCS-51 instruction set. By combining a versatile 8-bit CPU with
Flash on a monolithic chip, the Atmel AT89C2051 is a powerful microcomputer which
provides a highly-flexible and cost-effective solution to many embedded control applications.
The AT89C2051 provides the following standard features: 2K bytes of Flash, 128 bytes of
RAM, 15 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a
full duplex serial port, a precision analog comparator, on-chip oscillator and clock circuitry.
In addition, the AT89C2051 is designed with static logic for operation down to zero
frequency and supports two software selectable power saving modes. The Idle Mode stops
the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue
functioning. The power-down mode saves the RAM contents but freezes the oscillator
disabling all other chip functions until the next hardware reset.

Department of Instrumentation, CUSATPage 56

Android Switchboard- Mini Project Report

Department of Instrumentation, CUSATPage 57

2015

Android Switchboard- Mini Project Report

Department of Instrumentation, CUSATPage 58

2015

Android Switchboard- Mini Project Report

Department of Instrumentation, CUSATPage 59

2015

Вам также может понравиться