Data Communication using optical fibre

Synopsis

Wireless data Transmission with Encryption

Submitted by:

Submitted to:

Contents

Acknowlegement:-

Introduction

TEXT DATA TRANSMISSION THROUGH OPTICAL FIBRE USING CDMA TECHNLOGY

In this project we show that how we communicate between two microcontroller . In this project we transfer the data between two microcontroller using serial communication. We use LCD in both the transmitter and receiver circuit and display it on the lcd. In cdma transmission we always transmit a data with code. In this project we select a code with the DIP switches. After selecting a code we transfer the data using send switch. Data it converted into light with the help of the op-amp amplifier circuit. Output of the amplifier is connected to the light and this light is connected to the input of the optical fibre. Data through optical fibre is connected to the receiver end. In the receiver end we receive the data on the photodiode and then connected to the receiver microcontroller and then display it on the lcd receiver. In this project we use two receiver circuit . We use two receiver circuit because we want to show multiple Rx circuit. Receiver circuit receive the message when only code is match. Then buzzer is on and lcd display data received and then lcd display a same ASCII data of transmiiter end. .

HARDWARE DISCRIPTION.
TRANSMITTER CIRCUIT.
Pin no 40 of the ic is connected to the positive supply. In this project we use ic 7805 as regulator to stablize the voltage to 5 volt DC. In this project we use 9 volt DC as a main power source. With the help of the regulator we stablize the voltage to the 5 volt DC. Pin o 31 is also connected to the positive supply. Pin no 18 and 19 is connected to the crystal with two capacitor. In this project we use 12 Mhz crystal for outer frequency. All the input switches are connected to the port P1. All the switches are for alphanumeric data generation. We used mirco switches for keys purpose. One point of each key is connected with microcontroller and other point of each key is connected with ground .ie. each time when we press key then we provide ground that pin of microcontroller. To generate multifunction from each key i.e. a,b and c, we will give delay to keys. If switch will pressed for delay then mcu will change the ‘a’ to ‘b’ and then after more delay it will move ‘b’ to ‘c’. Similarly we can different characters from same key by adding delay. We will use 16*2 LCD ( universally called 44780 standard LCD) .
for amplification purpose we will use voltage and power amplifier. First of all we will use voltage amplifier. For that purpose we will use op amp 741 ic.first pin and 5pin of this ic will not be connected . we will give output from microcontrollers 11th pin to 2nd pin of iC741.3rd pin of mcu will be connected with null resistors. One 10k ohm resistance w.r.t ground and one 10k ohm resistance w,r,t vcc will be connected with 3rd pin IC741. IC 741 will connected with mcu at pin 2 of 741 using a coupling cap .1µf and resistance. Then 7 pin of 741 will be connected with vCC and 4 th pin will be grounded. Output of voltage amplifier will be rom 6th pin . Output of 741 will be connected with emitters of transistors 548 and 558. Tr 548 is npn transistors and tr558 is pnp transistors.we will connect AGC 10k pot from o’p of emitters of tr to 2pin of IC741. then we will convert the electric signal to ir will ir led. On rxer end we wil get the signalat pin no 10 of mcu after rxing from photo diode. We will use 4bit cod switches so that we can show that each time we will change code it will be transmitted only if code it mactches with the rxer code. If code matches only then it wil display “ data rxed” if not it will not play anything on LCD display. Then we will press enter switch . after preesing it will display “ eneter the password’ on rxer LCD display. Then we wil enter three no password from micro switches connected with rxer mcu. Then iif code matches it will display data on rxer side. In this way we are entering security for owner of rxer. So that only owner can read data rexed.
This project include
serial communication- sbuf
alphanumeric keyboard interfacing
infrared communicatin
sms technology
CDMA technology
Chip to chip data communication
LCD interfacing
In this connected to ground pin for providing a low voltage signal to microcontroller.
In this project we will generate multi character from same key using microcontroller assembly programming. We will give delay for that purpose. If key will be pressed for some time then mcu will move one character to other. If still key pressed for moiré delay then mcu will change the character to third option. In this way 1st key will change char from ‘a’ to ‘b’ to ‘c’. so its very important according to advanced keyboard interfacing point of view.
Our program sense this pins and then acknowledge this and call a lcd write function on every switch
CKNXT:
JNB TXDATA.0,CH0
JNB TXDATA.1,CH1
JNB TXDATA.2,CH2
JNB TXDATA.3,CH3
JNB TXDATA.4,CH4
JNB TXDATA.5,CH5
JNB TXDATA.6,CH6
JB ENTER,MAIN
ACALL TRANSMIT
JMP MAIN

IN this program we monitor the switch with the help of the JNB command and then jump to the switch location of JNB command offer

JNB TXDATA.0,CH0

Here Txdata is Port P1 , we monitor this pin by JNB command if the pin is low, when we press a switch then pin gets low then our program jump to the cho function. So by this way we monitor the different switches one by one
In this project we assigne each switch for different letter. Like switch p1.0 is for a A character. So we move the ASCII code of A into a Accumulator and then call a write_m function.

Each switch is for the different letter. In this project we use total 6 switches from A, b,c,d,f,g.

In this project we use only 6 switches, but in future it is possible to use 26 switches for keyboard . then we use multipal switches with the help of row and matrix logic.

‘a’ with semicolon is ASCII code data assembler automatic comvert it in to a hex code automatically. Whenever we want to write something in the lcd then we use Accumulator to receive a data.

CH0:
MOV A,#’A’
ACALL WRITE_M
JMP MAIN
CH1:
MOV A,#’B’
ACALL WRITE_M
JMP MAIN
CH2:
MOV A,#’C’
ACALL WRITE_M
JMP MAIN
CH3:
MOV A,#’D’
ACALL WRITE_M
JMP MAIN
CH4:
MOV A,#’E’
ACALL WRITE_M
JMP MAIN
CH5:
MOV A,#’F’
ACALL WRITE_M
JMP MAIN
CH6:
MOV A,#’G’
ACALL WRITE_M
JMP MAIN

After sensing all the switches for different codes we jump to MAIN program for further procedding. Whenever we press a switch then after putting a value in the A then we call a LCD write message.

WRITE_M:
MOV R1,A
ACALL WRITE
ACALL DELAY
RET

WRITE:
MOV LCD,A
SETB RS
CLR RW
SETB E
CLR E
RET

Whenever we want to write a message in the in the LCD then set the RS bit of LCD by set b command and clr the R/W pin. Enable pin is also very important for the enable firstly we clr the E and then Set the e pin

After write in the lcd then we monitor the send switch when send switch is pressed then we call a transmit switch

    JB ENTER,MAIN
    ACALL TRANSMIT       
    JMP MAIN

TRANSMIT:
MOV A,CODE ;SEND ADDRESS
ACALL TRANS
RET

;TRANSMIT DATA SERIALLY
TRANS:
MOV SBUF,A
JNB TI,TRANS
ACALL DELAY
RET

. LCD is connected to the port p0 of the microcontroller. Port p0 is open collector mode port so to get a data from this pin we connect a pull resistor on each pin. So we connect a 10 k ohm resistor to all the eight pins of port p0. Control pins of the lcd is connected to the p2.5,p2.6, p2.7 . Output is available from the pin p3.1. which is transmit pin of the microcontroller. Output from the microcontroller is connected to the op-amp amplifier circuit, Here in this project we use ic 741 as a amplifier. Pin no 7 is connected to the positive line and pin no 4 is connected to the negative pin. Pin no 2 is input pin data from the microcontroller is connected to the pin no 2of the ic 741. Pin no 3 is act as a reference pin, so we connect a two 10 k ohm resisitor to this pin. With the help of these two resistor we provide a zero voltage to this pin.

P2.0, P2.1,p2.2,p2.3 is connected to the four bit code.

Send switch is connected to the p3.2

Data with code is transmit through a optical fibre and then connected to the photodiode fo the receiver circuit. Photodiode receive the signal on p3.0 and display on the lcd on the receiver end if the code is match. In the receiver circuit Pin no 40 and 31 is again connected to the positive pin. Pin no 20 is connected to the ground pin. Port 0 with 10k pull up resistor is connected to the data lines of the lcd. Three control pins are connected to the p2.5, p2.6, p2.7 of the microcontroller..

Receiving buzzer is connected to the p3.2 of the microcontroller
Whenever controller receive the message and code is match then circuit gives a buzzer sound . lcd display a message received.

Component List:-
Microcontroller 89C051
16*2 LCD Display-
Mic condensor
Speaker 8 ohm
Infrared transmitter
Crystal 3.58Mhz
Resistance 220 ohm
Capacitor 0.01 micro farad
Keyboard general or push to on Button
DIP switches
Connecting wires
Microcontroller programming kit
12v supply
copper clad board
Ferric chloride
Marker
Computer

Transmitter Block diagram

Receiver Block Diagram

Block Diagram
Contain and LCD

            Seraildata transmission




Contain  LCd 

Code selecting circuit:- In code selection circuit we will use one of the port of microcontroller for this purpose & dip switch used for this purpose.coding is already wiil be done in microcontroller.
In receiver with the help of switch we will select the channel & will try to match the coding of tx with rx signal. When code will match , then we will recive data at seven segmant display.
Display device- LCD interface
Microcontroller:-
Look around. Notice the smart “intelligent” systems? Be it the T.V, washing machines, video games, telephones, automobiles, aero planes, power systems, or any application having a LED or a LCD as a user interface, the control is likely to be in the hands of a micro controller!

Measure and control, that’s where the micro controller is at its best.

Micro controllers are here to stay. Going by the current trend, it is obvious that micro controllers will be playing bigger and bigger roles in the different activities of our lives.

So where does this scenario leave us? Think about it……

The world of Micro controllers

What is the primary difference between a microprocessor and a micro controller? Unlike the microprocessor, the micro controller can be considered to be a true “Computer on a chip”.

In addition to the various features like the ALU, PC, SP and registers found on a microprocessor, the micro controller also incorporates features like the ROM, RAM, Ports, timers, clock circuits, counters, reset functions etc.

While the microprocessor is more a general-purpose device, used for read, write and calculations on data, the micro controller, in addition to the above functions also controls the environment.

We have used a whole lot of technical terms already! Don’t get worried about the meanings at this point. We shall understand these terms as we proceed further
For now just be aware of the fact, that all these terms literally mean what they say.

Bits and Bytes

Before starting on the 8051, here is a quick run through on the bits and bytes. The basic unit of data for a computer is a bit. Four bits make a nibble. Eight bits or two nibbles make a byte. Sixteen bits or four nibbles or two bytes make a word.

1024 bytes make a kilobyte or 1KB, and 1024 KB make a Mega Byte or 1MB.

Thus when we talk of an 8-bit register, we mean the register is capable of holding data of 8 bits only.

The 8051

The 8051 developed and launched in the early 80`s, is one of the most popular micro controller in use today. It has a reasonably large amount of built in ROM and RAM. In addition it has the ability to access external memory.

The generic term 8x51 is used to define the device. The value of x defining the kind of ROM, i.e. x=0, indicates none, x=3, indicates mask ROM, x=7, indicates EPROM and x=9 indicates EEPROM or Flash.

A note on ROM

The early 8051, namely the 8031 was designed without any ROM. This device could run only with external memory connected to it. Subsequent developments lead to the development of the PROM or the programmable ROM. This type had the disadvantage of being highly unreliable.

The next in line, was the EPROM or Erasable Programmable ROM. These devices used ultraviolet light erasable memory cells. Thus a program could be loaded, tested and erased using ultra violet rays. A new program could then be loaded again.

An improved EPROM was the EEPROM or the electrically erasable PROM. This does not require ultra violet rays, and memory can be cleared using circuits within the chip itself.

Finally there is the FLASH, which is an improvement over the EEPROM. While the terms EEPROM and flash are sometimes used interchangeably, the difference lies in the fact that flash erases the complete memory at one stroke, and not act on the individual cells. This results in reducing the time for erasure.

Understanding the basic features of the 8051 core

Let’s now move on to a practical example. We shall work on a simple practical application and using the example as a base, shall explore the various features of the 8051 microcontroller.

Consider an electric circuit as follows,

The positive side (+ve) of the battery is connected to one side of a switch. The other side of the switch is connected to a bulb or LED (Light Emitting Diode). The bulb is then connected to a resistor, and the other end of the resistor is connected to the negative (-ve) side of the battery.

When the switch is closed or ‘switched on’ the bulb glows. When the switch is open or ‘switched off’ the bulb goes off

If you are instructed to put the switch on and off every 30 seconds, how would you do it? Obviously you would keep looking at your watch and every time the second hand crosses 30 seconds you would keep turning the switch on and off.

Imagine if you had to do this action consistently for a full day. Do you think you would be able to do it? Now if you had to do this for a month, a year??

No way, you would say!

The next step would be, then to make it automatic. This is where we use the Microcontroller.

But if the action has to take place every 30 seconds, how will the microcontroller keep track of time?

Execution time

Look at the following instruction,
clr p1.0

This is an assembly language instruction. It means we are instructing the microcontroller to put a value of ‘zero’ in bit zero of port one. This instruction is equivalent to telling the microcontroller to switch on the bulb. The instruction then to instruct the microcontroller to switch off the bulb is,

Setb p1.0

This instructs the microcontroller to put a value of ‘one’ in bit zero of port one.

Don’t worry about what bit zero and port one means. We shall learn it in more detail as we proceed.

There are a set of well defined instructions, which are used while communicating with the microcontroller. Each of these instructions requires a standard number of cycles to execute. The cycle could be one or more in number.

How is this time then calculated?

The speed with which a microcontroller executes instructions is determined by what is known as the crystal speed. A crystal is a component connected externally to the microcontroller. The crystal has different values, and some of the used values are 6MHZ, 10MHZ, and 11.059 MHz etc.
Thus a 10MHZ crystal would pulse at the rate of 10,000,000 times per second.
The time is calculated using the formula

No of cycles per second = Crystal frequency in HZ / 12.

For a 10MHZ crystal the number of cycles would be,

10,000,000/12=833333.33333 cycles.

This means that in one second, the microcontroller would execute 833333.33333 cycles.

Therefore for one cycle, what would be the time? Try it out.

The instruction clr p1.0 would use one cycle to execute. Similarly, the instruction setb p1.0 also uses one cycle.

So go ahead and calculate what would be the number of cycles required to be executed to get a time of 30 seconds!

Getting back to our bulb example, all we would need to do is to instruct the microcontroller to carry out some instructions equivalent to a period of 30 seconds, like counting from zero upwards, then switch on the bulb, carry out instructions equivalent to 30 seconds and switch off the bulb.

Just put the whole thing in a loop, and you have a never ending on-off sequence.

Simple isn’t it?

Let us now have a look at the features of the 8051 core, keeping the above example as a reference,

  1. 8-bit CPU.( Consisting of the ‘A’ and ‘B’ registers)

Most of the transactions within the microcontroller are carried out through the ‘A’ register, also known as the Accumulator. In addition all arithmetic functions are carried out generally in the ‘A’ register. There is another register known as the ‘B’ register, which is used exclusively for multiplication and division.

Thus an 8-bit notation would indicate that the maximum value that can be input into these registers is ‘11111111’. Puzzled?

The value is not decimal 111, 11,111! It represents a binary number, having an equivalent value of ‘FF’ in Hexadecimal and a value of 255 in decimal.

We shall read in more detail on the different numbering systems namely the Binary and Hexadecimal system in our next module.

  1. 4K on-chip ROM

Once you have written out the instructions for the microcontroller, where do you put these instructions?

Obviously you would like these instructions to be safe, and not get deleted or changed during execution. Hence you would load it into the ‘ROM’

The size of the program you write is bound to vary depending on the application, and the number of lines. The 8051 microcontroller gives you space to load up to 4K of program size into the internal ROM.

4K, that’s all? Well just wait. You would be surprised at the amount of stuff you can load in this 4K of space.

Of course you could always extend the space by connecting to 64K of external ROM if required.

  1. 128 bytes on-chip RAM

This is the space provided for executing the program in terms of moving data, storing data etc.

  1. 32 I/O lines. (Four- 8 bit ports, labeled P0, P1, P2, P3)

In our bulb example, we used the notation p1.0. This means bit zero of port one. One bit controls one bulb.

Thus port one would have 8 bits. There are a total of four ports named p0, p1, p2, p3, giving a total of 32 lines. These lines can be used both as input or output.

  1. Two 16 bit timers / counters.

A microcontroller normally executes one instruction at a time. However certain applications would require that some event has to be tracked independent of the main program.

The manufacturers have provided a solution, by providing two timers. These timers execute in the background independent of the main program. Once the required time has been reached, (remember the time calculations described above?), they can trigger a branch in the main program.

These timers can also be used as counters, so that they can count the number of events, and on reaching the required count, can cause a branch in the main program.

  1. Full Duplex serial data receiver / transmitter.

The 8051 microcontroller is capable of communicating with external devices like the PC etc. Here data is sent in the form of bytes, at predefined speeds, also known as baud rates.

The transmission is serial, in the sense, one bit at a time

  1. 5- interrupt sources with two priority levels (Two external and three internal)

During the discussion on the timers, we had indicated that the timers can trigger a branch in the main program. However, what would we do in case we would like the microcontroller to take the branch, and then return back to the main program, without having to constantly check whether the required time / count has been reached?

This is where the interrupts come into play. These can be set to either the timers, or to some external events. Whenever the background program has reached the required criteria in terms of time or count or an external event, the branch is taken, and on completion of the branch, the control returns to the main program.

Priority levels indicate which interrupt is more important, and needs to be executed first in case two interrupts occur at the same time.

  1. On-chip clock oscillator.

This represents the oscillator circuits within the microcontroller. Thus the hardware is reduced to just simply connecting an external crystal, to achieve the required pulsing rate.

The Basic Registers of the 8051

For more details contact the course coordinator at contact@microtutorials.com
www.ludhianaprojects.com/sms.doc

PIN WISE DETAIL OF LCD

  1. Vss GROUND
  2. Vcc +5VOLT SUPPLY

3 Vee POWER SUPPLY TO CONTROL CONTRAST

  1. RS RS = 0 TO SELECT COMMAND REGISTER
    RS = 1 TO SELECT DATA REGISTER
  2. R/W R/W = 0 FOR WRITE
    R/W = 1 FOR READ

6 E ENABLE

7 DB0

8 DB1

  1. DB2
  2. DB3
  3. DB4
  4. DB5
  5. DB6
  6. DB7

15 ,16 FOR BACK LIGHT DISPLAY

Applications:

  1. Machine control and communication- it can be used for communication between two machines.
  2. it can be used for local wireless communication in office ,factory and defence
  3. secure data file transfer for offices

Advantage :

Low cost
Easy to fabricate
Portable
Components available in the market
Flexible

Disadvantages:
Any one who know sending address can break security.

Bibiliography:
www.toshankits.com
www.ludhianaprojects/sms.doc
ww.atmel.com- about 8051
www.8051project.net- project idea
other sites
www.8051projects.info
www.rickysworld.com
www.8052.com

Leave a Reply

Your email address will not be published. Required fields are marked *