Pages

Saturday, September 21, 2013

OPTICAL FIBER COMMUNICATION

Fiber-optic communication is a method of transmitting information from one place to another by sending pulses of light through an optical fiber. The light forms an electromagnetic carrier wave that is modulated to carry information. First developed in the 1970s, fiber-optic communication systems have revolutionized the telecommunications industry and have played a major role in the advent of the Information Age. Because of its advantages over electrical transmission, optical fibers have largely replaced copper wire communications in core networks in the developed world.
The process of communicating using fiber-optics involves the following basic steps: Creating the optical signal involving the use of a transmitter, relaying the signal along the fiber, ensuring that the signal does not become too distorted or weak, receiving the optical signal, and converting it into an electrical signal.


Applications

Optical fiber is used by many telecommunications companies to transmit telephone signals, Internet communication, and cable television signals. Due to much lower attenuation and interference, optical fiber has large advantages over existing copper wire in long-distance and high-demand applications. However, infrastructure development within cities was relatively difficult and time-consuming, and fiber-optic systems were complex and expensive to install and operate. Due to these difficulties, fiber-optic communication systems have primarily been installed in long-distance applications, where they can be used to their full transmission capacity, offsetting the increased cost. Since 2000, the prices for fiber-optic communications have dropped considerably. The price for rolling out fiber to the home has currently become more cost-effective than that of rolling out a copper based network. Prices have dropped to $850 per subscriber[citation needed] in the US and lower in countries like The Netherlands, where digging costs are low.
Since 1990, when optical-amplification systems became commercially available, the telecommunications industry has laid a vast network of intercity and transoceanic fiber communication lines. By 2002, an intercontinental network of 250,000 km of submarine communications cable with a capacity of 2.56 Tb/s was completed, and although specific network capacities are privileged information, telecommunications investment reports indicate that network capacity has increased dramatically since 2004.

Tuesday, August 20, 2013

Program to interface LDR using ADC 0808. The output of LDR is displayed on LCD. Controller interrupt is used to generate the clock for driving ADC 0808.

                     // Program to interface LDR using ADC 0808. The output of LDR is displayed on LCD. Controller interrupt is used to generate the clock for driving ADC 0808.
#include<reg51.h>
sbit ale=P1^0;  //address latch enable
sbit oe=P1^3;  //output enable
sbit sc=P1^1;  //start conversion
sbit eoc=P1^2;  //end of conversion
sbit clk=P1^7;  // clock
sbit ADD_A=P1^4;  // Address pins for selecting input channels.
sbit ADD_B=P1^5;
sbit ADD_C=P1^6;
sfr lcd_data_pin=0xA0;  //P2 port
sbit rs=P3^0;
sbit rw=P3^1;
sbit en=P3^6;
sfr input_port=0x80;  //P0 port
unsigned int bitvalue,decimal_value,key,left_value,value,number,ascii1,ascii2,ascii3,flag,key1;

void timer0() interrupt 1  // Function to generate clock of frequency 500KHZ using Timer 0 interrupt.
{
clk=~clk;
}

void delay(unsigned int count)  // Function to provide time delay in msec.
{
int i,j;
for(i=0;i<count;i++)
for(j=0;j<1275;j++);
}

void lcd_command(unsigned char comm)  //Function to send command to LCD.
{
lcd_data_pin=comm;
en=1;
rs=0;
rw=0;
delay(10);
en=0;
}

void lcd_data(unsigned char disp)  //Function to send data to LCD.
{
lcd_data_pin=disp;
en=1;
rs=1;
rw=0;
delay(10);
en=0;
}

lcd_dataa(unsigned char *disp)  //Function to send string data to LCD.
{
int x;
for(x=0;disp[x]!=0;x++)
{
  lcd_data(disp[x]);
}
}

void lcd_ini()  //Function to inisialize the LCD
{
lcd_command(0x38);
delay(5);
lcd_command(0x0F);
delay(5);
lcd_command(0x80);  //Force cursor to blink at line 1 positon 0
delay(5);
}

  void BCD()  // Binary to decimal conversion to send the data to LCD
{
  key1++;
  key=0;
  flag=0;
    number=input_port;
    value=number%10;
number=number/10;
ascii1=value+48;
if(number!=0)
{
  value=number%10;
  number=number/10;
  ascii2=value+48;
    flag=1;
}
else
{
   ascii2=48;
   flag=1;
}
if(number!=0)
{
  value=number%10;
    number=number/10;
    ascii3=value+48;
    key=2;
}
else
{
  ascii3=48;
  key=2;
}
if(key==2)
lcd_data(ascii3);
if(flag==1)
lcd_data(ascii2);
lcd_data(ascii1);
if(key1==3)
{
key1=0;
ascii3=0;
ascii2=0;
ascii1=0;
delay(10);
}
}

void adc()  //Function to drive ADC
{
while(1)
{
  ADD_C=0;  // Selecting input channel 2 using address lines
  ADD_B=0;
  ADD_A=1;
  delay(2);
  ale=1;
  delay(2);
  sc=1;
  delay(1);
  ale=0;
  delay(1);
  sc=0;
  while(eoc==1);
  while(eoc==0);
  oe=1;
  BCD();
  lcd_command(0x88);
  delay(2);
  oe=0;
}
}

void main()
{
eoc=1;
ale=0;
oe=0;
sc=0;
key1=0;
TMOD=0x02;  //timer0 setting for generating clock of 500KHz using interrupt enable mode.
TH0=0xFD;
IE=0x82;
TR0=1;
lcd_ini();
lcd_dataa("Value : ");
lcd_command(0x88);
adc();
}

Doubleblink

#include<at89x51.h>
void main()
{
int disp1[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
int disp2[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
float j;
int k=0;
int l=0;
P1=0x00;
P2=0x00;
while(1)
{
P1=disp1[k];
P2=disp2[l];
for(j=0;j<1000;j++);
k++;
if(k==10)
{
k=0;
l++;
if(l==10)
l=0;
}
}
}

Lidblink

#include<at89x51.h>
void main()
{
   float i;
   while(1)
   {
   P1_0=!P1_0;
   P1_1=!P1_1;
   P1_2=!P1_2;
   P1_3=!P1_3;
   P1_4=!P1_4;
   P1_5=!P1_5;
   P1_6=!P1_6;
   P1_7=!P1_7;
   for(i=0;i<1000;i++);
   }
}
 

Scaling

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

void main()
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int maxx, maxy;

   /* our polygon array */
   int poly[10];

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "C:\\TC\\BGI");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)
   /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
   /* terminate with an error code */
      exit(1);
   }
  // printf("Enter the ")
   int a[8]={25,25,32,20,30,40,25,25}, b[8], c[8],i;
   drawpoly(4,a);
   for( i=0;i<=8;i++)
   b[i]=(a[i]*2)+100;
   drawpoly(4,b);
   for(i=0;i<=8;i++)
   c[i]=(b[i]*2)+100;
   drawpoly(4,c);
   getch();
}

Ellipse

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   float x,y,rx,ry,xc,yc,p;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "C:\\TC\\BGI");

   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */
   }

   printf("enter the radius of ellipse");
   scanf("%f %f",&rx,&ry);
   printf("cnter the centre of ellipse");
   scanf("%f %f",&xc,&yc);
   x=0;
   y=ry;

   p=ry*ry-rx*rx*ry+1.0/4.0*rx*rx;
   do
   {
   if(p<0)
   {
   x=x+1;
   y=y;
   p=p+2*ry*ry*x+3*ry*ry;
   }
   else
   {
   x=x+1;
   y=y-1;
   p=p+2*ry*ry*x+3*ry*ry-2*rx*rx*y+2*rx*rx;
   }
   putpixel(x+xc,y+yc,100);
   putpixel(xc-x,yc+y,100);
   putpixel(xc-x,yc-y,100);
   putpixel(xc+x,yc-y,100);
   }
   while(2*x*ry*ry<=2*y*rx*rx);



   p=ry*ry*(x+0.5)*(x+0.5)+rx*rx*(y-1)*(y-1)-rx*rx*ry*ry;
   do
   {
   if(p>0)
   {
   x=x;
   y=y-1;
   p=p-2*rx*rx*y+3*rx*rx;
   }
   else
   {
   x=x+1;
   y=y-1;
   p=p-2*rx*rx*y+3*rx*rx+2*ry*ry*x+2*ry*ry;
   }
   putpixel(x+xc,y+yc,100);
   putpixel(xc-x,yc+y,100);
   putpixel(xc-x,yc-y,100);
   putpixel(xc+x,yc-y,100);
   }
   while(y>0);


   getch();
  }

Program to multiply the 2 matrices

//Program to multiply the 2 matrices
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

class matrix
{
   int a[4][4],b[4][4],c[4][4];
   int m,n,p,q;
   public:
   void getdata()
   {
    cout<<"Enter the size of matrix 1";
    cin>>m>>n;

    cout<<"Enter the size of matrix 2";
    cin>>p>>q;
   }
   void showdata();
};


void matrix::showadata()
{
int i,j,k;

 if (n==p)
     {

    cout<<"\nEnter matrix 1:\n";
    for(i=0;i<m;i++)
     {
       for(j=0;j<n;j++)
        cin>>a[i][j]);
     }

       cout<<"\nEnter matrix 2:\n";
       for(i=0;i<p;i++)
      {
        for(j=0;j<q;j++)
        cin>>b[i][j];
      }

       cout<<"The matrices were:\n";
       cin<<"Matrix 1=\n";
       for(i=0;i<m;i++)
     {
       for(j=0;j<n;j++)
       cout<<a[i][j]<<"\t";
       cout<<"\n";
      }

    cout<<"\nmatrix 2=\n";
    for(i=0;i<p;i++)
     {
       for(j=0;j<q;j++)
       cout<<b[i][j]<<"\t";;
       printf("\n");
     }

     cout<<"\nThe mulptiplication of matrices is :\n";
     for(i=0;i<m;i++)
     {
       for(j=0;j<p;j++)
    {
    c[i][j]=0;
      {
       for(k=0;k<p;k++)
          c[i][j]+=(a[i][k]*b[k][j]);
          cout<<c[i][j]<<"\t";
       }
    }
          cout<<"\n";
     }
}
else
cout<<"\aORDER MISMATCHED! Matrix cannot be multiplied";
}

int main()
{
matrix m;
//clrscr();
m.getdata();
m.showdata();
getch();
}

Complex and Imaginary

#include<iostream.h>
#include<conio.h>

class complex
{
 int real;
 int img;
 public:
  complex()
   {
     real=0; img=0;
   }
  complex(int r,int i)
   {
    real=r; img=i;
   }
  void getdata()
   {
     cout<<"Complex No"<<endl;
     cout<<"Real:";
     cin>>real;
     cout<<"Imaginary:";
     cin>>img; 
   }

   void showcomplex()
   {
     cout<<real<<"+i"<<img<<endl;
   }
 void add_complex(complex,complex);
};

void complex::add_complex(complex c1,complex c2)
{
  real=c1.real+c2.real;
  img=c1.img+c2.img;
}

/*main*/
 int main()
{
  complex c1,c2,c3;
 
  c1.getdata();
  c2.getdata(); 
  c3.add_complex(c1,c2);
  cout<<"c1:";
  c1.showcomplex();
 cout<<"c2:";
 c2.showcomplex();
 cout<<"c3:";
 c3.showcomplex();
getch();
}

use of copy constructors

//Demonstrate the use of copy constructors
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>

class A
{
       int p,q;
  public:
         A()                             //1st constructors
         {
               p=0; q=0;
         }
         A(int m,int n)    //2nd constructors
         {
               p=m; q=n;
         }
         A(A&b)          //copy constructors
         {
               p=b.p;
               q=b.q;
         }
         void showdata()
         {  cout<<p<<ends<<q<<endl;
         }
};

int main()
{
     A f1;
     A f2(1,2);
     A f3(f2);
     f1.showdata();
     f2.showdata();
     f3.showdata();
 getch();
}      

Thursday, August 1, 2013

Fire alarm system

1. INTRODUCTION

An automatic fire alarm system is designed to detect the unwanted presence of fire by monitoring environmental changes associated with combustion. In general, a fire alarm system is classified as either automatically actuated, manually actuated, or both. Automatic fire alarm systems are intended to notify the building occupants to evacuate in the event of a fire or other emergency, report the event to an off-premises location in order to summon emergency services, and to prepare the structure and associated systems to control the spread of fire and smoke.

Fundamental configuration

  • Fire alarm control panel: This component, the hub of the system, monitors inputs and system integrity, controls outputs and relays information.
  • Primary Power supply: Commonly the non-switched 120 or 240 Volt Alternating Current source supplied from a commercial power utility. In non-residential applications, a branch circuit is dedicated to the fire alarm system and its constituents. "Dedicated branch circuits" should not be confused with "Individual branch circuits" which supply energy to a single appliance.
  • Secondary (backup) Power supplies: This component, commonly consisting of sealed lead-acid storage batteries or other emergency sources including generators, is used to supply energy in the event of a primary power failure.
  • Initiating Devices: This component acts as an input to the fire alarm control unit and are either manually or automatically actuated. Examples would be devices like pull stations or smoke detectors.
  • Notification appliances: This component uses energy supplied from the fire alarm system or other stored energy source, to inform the proximate persons of the need to take action, usually to evacuate. This is done by means of a flashing light, strobe light, electromechanical horn, speaker, or a combination of these devices.
  • Building Safety Interfaces: This interface allows the fire alarm system to control aspects of the built environment and to prepare the building for fire and to control the spread of smoke fumes and fire by influencing air movement, lighting, process control, human transport and exit.

 

Initiating devices

  • Manually actuated devices; Break glass stations, Buttons and manual fire alarm activation are constructed to be readily located (near the exits), identified, and operated.
  • Automatically actuated devices can take many forms intended to respond to any number of detectable physical changes associated with fire: convected thermal energy; heat detector, products of combustion; smoke detector, radiant energy; flame detector, combustion gasses; carbon monoxide detector and release of extinguishing agents; water-flow detector. The newest innovations can use cameras and computer algorithms to analyze the visible effects of fire and movement in applications inappropriate for or hostile to other detection methods.

2. TECHNICAL DETAIL
2.1 BUILDING THE ALARM PCB

COMPONENTS NEEDED

R1 and R2 10k resistor (brown black orange gold)
R3 22k resistor (red red orange gold)
R4 330R resistor (orange orange brown gold)
R5 1k resistor (brown black red gold)
R6 1k/10k resistor (brown black red/orange gold)
(the value of R6 depends on the type of LDR used)
LED1 5mm red LED
PZ piezo sounder
TR1 BC548B Transistor
D1 1N4001 diode
C1 100uF electrolytic capacitor
IC1 8 pin IC socket
IC1 PICAXE-08 microcontroller
CT1 PICAXE download 3.5mm socket
BT1 battery clip
BT1 4.5V (3xAA) battery box
BLOCK DIAGRAM











CIRCUIT DIAGRAM
















3.BLOCK DIAGRAM DISCRIPTION

The main electronic components you may need for your alarm are shown here. The next few pages describe each of these components in more detail, and also provide some programming ideas that may be us
PICAXE-08 microcontroller
light emitting diode (LED)
piezo sounder
light dependent resistor (LDR)
transistor and diode
batteries
And you will also need pixel download socket resistors useful when you are later programming your alarm.


3.1 MICROCONTROLLER

A microcontroller is often described as a ‘computer-on-a-chip’. It is an integrated circuit that contains memory, processing units, and input/output circuitry in a single unit. Microcontrollers are purchased ‘blank’ and then programmed with a specific control program. Once programmed the microcontroller is built into a product to make the product more intelligent and easier to use.

USE
Microcontrollers are used as the ‘brain’ in electronic circuits. These electronic circuits are often drawn visually as a ‘block diagram’.  The program for the microcontroller is developed (and tested) on the computer and then downloaded into the microcontroller. Once the program is in the microcontroller it starts to ‘run’ and carries out the instructions. The PICAXE microcontroller system is a low cost, flash memory based microcontroller. The simplest PICAXE microcontroller IC the PICAXE-08. This is programmed using BASIC programming language. Once the programme has been written it is downloaded via a serial port on the PC direct to the picaxe circuit.

The PICAXE-08 has 8 legs, similar to many integrated circuits (ICs). However, the numbers of the output/input pins are not the same as the leg numbers. The table above shows the leg numbers and pin numbers and their functions. Great care must be taken when using the PICAXE-08 in a circuit as the leg numbers and pin numbers can be confused. The PICAXE-08 project board shown below has the PINS clearly labeled. 

   








3.2 POWER SUPPLY

Batteries come in all sorts of types and sizes. Most battery packs are made up of a number of 'cells', and each cell provides about 1.5V. Therefore 4 cells will generate a 6V battery and 3 cells a 4.5V battery. As a general rule, the larger the battery the longer it will last (as it contains more chemicals and so will be able to convert more energy). A higher voltage battery does not last longer than a lower voltage battery. Therefore a 6V battery pack made up of 4A A cells will last much longer than a 9V PP3 battery, as it contains a larger total amount of chemical energy as it is physically larger. Therefore items that require more power to work (e.g. a CD walkman which contains a motor and laser to read the CD's) will always use AA cells rather than PP3 batteries. Microcontrollers generally require 3 to 6V to work, and so it is better to use a battery pack made up of three or four AA size cells. Never use a 9V PP3 battery as the 9V supply will damage the microcontroller.


3.3 LIGHT EMITTING DIODE (LED)

A Light Emitting Diode (LED) is an electronic component that gives out light when current passes through it. An LED is a special type of diode. A diode is a component that only allows current to flow in one direction. Therefore when using a diode, it must always be connected the correct way around. The positive (anode) leg of an LED is longer than the negative (cathode) leg (shown by the bar on the symbol). The negative leg also has a flat edge on the plastic casing of the LED.

What are LEDs used for?

LEDs are mainly used as indicator lights. Red and green LEDs are commonly used on electronic appliances like televisions to show if they are switched on or in 'standby' mode. LEDs are available in many different colours, including red, yellow, green and blue. Special 'ultrabright' LEDs are used in safety warning devices such as the 'flashing lights' used on bicycles. Infra-red LEDs produce infra-red light that cannot be seen by the human eye but can be used in devices such as video remote-controls
3.4 PIEZO-TRANSDUCERS
                         
A piezo transducer is a low-cost 'mini-speaker' that can used to make sounds. The sound that the piezo makes can be changed by altering the electronic signals provided by the microcontroller.

Use

Piezos are used in many different consumer goods to provide 'feedback' to the user. A good example is a vending machine which will 'beep' whenever a keypad switch is pressed to select a drink or snack. The 'beep' provides the user with feedback to tell them their switch push has been successful. Uncased piezos are also often used in musical birthday cards to play a tune when the card is opened.

Using piezos.

A piezo is very simple to connect. Simply connect the red wire to the microcontroller output pin and the black wire to 0V (ground). Note that the cheapest piezos do not have a plastic casing to them. In this case it is necessary to mount the piezo on a piece of board (with a sticky pad) to create a noise that can be heard. The board acts as a 'sound-box' to amplify the sound made by the piezo. Make sure the sticky pad is stuck on the correct side of the piezo (the brass side

3.5 TRANSISTOR

A transistor is a component that controls current flow in a circuit. A transistor acts as an ‘electronic switch’ so that a small current can control a large current. This allows low-current devices, like a microcontroller, to control large current devices (like motors.

Using Transistors.

A transistor has three legs. These are labeled base, collector and emitter. The base connection is the leg that is used to activate the ‘electronic switch’. When a small current is passed through the base connection, it allows a much larger current to flow down between the collector and emitter. This larger current can be used to switch on devices such as motors, lamps and buzzers. A common transistor is the BC548B type. This has a plastic can with a flat edge. The flat edge enables the base

3.6 DIGITAL SENSORS (SWITCHES)
What are switches?
A digital sensor is a simple ‘switch’ type sensor that can only be ‘on’ or ‘off’. Switches are electronic components that detect movement. There are a large number of different types of switches e.g: push switches that detect momentary ‘push’ micro-switches with long levers that detect small movement’s tilt-switches that detect jolting reed-switches that detect a magnet being moved
.
Using switches     

The value of the resistor is not that important, but a 10k resistor is often used. When the switch is 'open' the 10k resistor connects the microcontroller input pin down to 0V, which gives an off (logic level 0) 0V signal to the microcontroller input pin. When the switch is activated, the input pin is connected to the positive battery supply (V+). This provides an on (logic level 1) signal to the microcontroller.


3.7 LIGHT DEPENDENT RESISTOR (LDR)

A Light Dependent Resistor (LDR) is special type of resistor that reacts to changes in light level. The resistances of the LDR changes as different amounts of light fall on the top 'window' of the device. This allows electronic circuits to measure changes in light level.

Using  LDRs.

A LDR can be used in two ways. The simplest way to use an LDR is as a simple on-off ("digital") switch - when the light level is above a certain value (called the 'threshold value') the LDR will provide an on signal, when the light level is below a certain value the LDR will provide an off signal. In this case the LDR is used in a potential divider with a standard resistor. The value of the standard resistor sets the 'threshold value'. For miniature LDRs a suitable value is 10k or 1k, for larger ORP12 type LDRs 10k is more appropriate. If desired the fixed resistor can be replaced by a variable resistor so that the threshold value can be 'tuned' to different light values. A more versatile way of using the LDR is to measure a number of different light values, so that decisions can be made at varying light levels rather than just one fixed threshold value. A varying value is known as an 'analogue' value, rather than a digital 'on-off' value. To measure analogue values the microcontroller must contain an 'analogue to digital converter (ADC)' and the programming software must support use of this ADC. Most microcontrollers only contain ADC on certain input pins, and so the input pin connection must be carefully selected. With the 8 pin microcontroller only pin1 can be used. The electronic circuit for using the ADC is a potential divider identical to the circuit above. The analogue 'measurement' is carried out within the microcontroller itself.






















Cost Estimation

S.N
Components
Qty.
Rate
Total
1
Resistor Box
Few
-
100
2
LED
Few
-
50
3
PZ piezo sounder
3
-
150
4
TR1 BC548B Transistor
5
20
100
5
D1 1N4001 diode
Few
-
50
6
C1 100uF electrolytic capacitor
Few
-
250
7
IC1 8 pin IC socket
2
200
400
8
IC1 PICAXE-08 microcontroller
2
200
400
9
CT1 PICAXE download 3.5mm socket
2
50
100
10
BT1 battery clip
2 set
15
30
11
BT1 4.5V (3xAA) battery box
1
100
100
12
Bread Board
2
25
50
13
PCB
1
200
200
14
Miscellaneous
-
-
500

Total


2480

















TIME ESTIMATION
The overall time duration of the project is estimated to be about 3 months. Different tasks will be performed during that period of time.
23/1/2069                       13/2/2069                     03/03/2069                  23/03/2069             13/04/2069   






















































Figure: Chart showing time Estimation
 

 












Horizontal Bars represent time duration.

Task 1 :  Primary Research and study
Task 2 :  Collection of materials
Task 3 :  System Design
Task 4 :  Programming
Task 5 :  System testing
Task 6 :  Implementation
Task 7 :  Final System Review






 
 









Conclusion

The main objective of minor project can be obtained by conducting “Fire alarm system”. This project of  Bachelor of electronics engineering can be successfully completed with gaining basic skill of project management and ability of team working can be enhanced.