ethernet card_project report
TRANSCRIPT
ETHERNET CARD
1
CHAPTER 1
INTRODUCTION
ETHERNET CARD
2
INTRODUCTION
1.1 Overview
Data transferring is the key part of any data acquisition or data collection system.
How to found a useful, extensively, agility, high efficiency data collection system is a
important and difficult problem. Traditional data collection systems use the single-chip as
the kernel of the system. The precision and the operation ability of the system is finite,
the interface is not easy. Again, the distance of data transferring, capability of the data storage is also finite. With the embedded new technology development, data collection
system import multitask operation system. This have many characteristics, such as rapidness of the collection velocity, easy interface etc. The technology will bring into
play important effect on industry development. LAN supplies networking capability to group of computers in close proximity to each other such as in an office, school or a
home. Most LANs are built with relatively inexpensive hardware. Ethernet is a physical and data link layer technology for LANs. Ethernet means
network of everywhere. No computer should be island. With Ethernet, file sharing and printer sharing among machines become possible. Again, installation of Ethernet is easier
and less expensive than other network protocol. It offers efficient ways to connect across MAC.PC, Linux, UNIX workstations. Thus suggests LAN to SPI communication using
Ethernet. To monitor industrial parameters like temperature, speed etc numbers of monitoring equipments are used. Here we proposed LAN to SPI interface to monitor
these industrial parameters with the help of different sensors. The other target application
can be industrial automation, building automation, home control etc.
1.2 Theory
The Ethernet protocol is made up of a number of components, such as the
structure of Ethernet frames, the Physical Layer and its MAC operation. Ethernet is defined as IEEE802.2 standard. It is having Media Access Control (MAC) address of 48
bits. Ethernet is a LAN topology based on carrier sense multiple access/collision detection (CSMA/CD).Ethernet/IP is used with personal computers, mainframes, robots,
input/output (I/O) devices and adapters, programmable logic controllers (PLCs) and many other devices.
Ethernet was invented by engineer Robert Metcalfe. When first widely deployed
in the 1980s, Ethernet supported a maximum theoretical data rate of 10 megabits per
second (Mbps). Later, so-called "Fast Ethernet" standards increased this maximum data
rate to 100 Mbps. Gigabit Ethernet technology further extends peak performance up to
1000 Mbps, and 10 Gigabit Ethernet technologies also exists. An Ethernet card is one
kind of network adapter. These adapters support the Ethernet standard for high-speed
network connections via cables. Ethernet cards are sometimes known as network
interface cards (NICs).
Setting up a network for your small business can be tricky work -- there are a lot
of parts involved, and every computer on the network has to have the correct equipment
ETHERNET CARD
3
in order to transfer files and access the server. Ethernet cards are essential parts of a network. They connect a computer to another computer or to a server by using a cable, an
alternative to a wireless network
An Ethernet card in your computer serves one basic function is to transmit data
from the network to your computer. An Ethernet card is the communications hub for your computer; it connects to a network using a network cable. Ethernet cards can also
communicate one-on-one with another Ethernet card, allowing for peer-to-peer network connections -- these are useful for direct file sharing. The cable connection on the
Ethernet card is called an RJ-45 connection, which connects to a variety of cable types, all capable of different transmission speeds.
For any computer, Ethernet card performs two crucial tasks
– Establishes and manages the computer’s network connection.
– Translates digital computer data into signals (appropriate for the networking
medium) for outgoing messages, and translates signals into digital computer data
for incoming messages.
1.3 Problem Statements
Main task is to establish the connectivity between PC and server to ensure the connectivity we will send the data from the sensor to server via Ethernet card. Now this
process will send some message to another process, which will contain the destination and source address and some data.
This sending will represent Ethernet communication. Collision on the Ethernet
cable will be detected by CSMA/CD (carrier Sense Multiple Access Collision Detection)
method where the process reads the bus to see if some other process is transiting or not
and accordingly either transmits or waits for a random amount of time. This is how it as
to be simulated.
By using this device SPI serial devices can be converted into a network interface
peripheral to obtain compatibility with the network. This module can be used to monitor
industrial parameters like temperature, speed, humidity etc
1.4 Projects Objectives
Study of Ethernet protocol.
Study of MAC and PHYSICAL layer.
Study of SPI protocol.
Study of MSSP module of PIC16f877A.
Study of ENC28J60 external Ethernet controller chip.
Study of RJ45 cable and signals.
Study of Ethernet transformer.
Study of ferrite bead.
Study of power supply 5v 1A.
Study of Ethernet to serial conversion.
ETHERNET CARD
4
1.5 Importance of Project
Speed
An Ethernet card provides a fast connection for data transmission. Tasks such as video conferencing, streaming high-definition movies and some computer gaming are
often more practical using an Ethernet card.
Reliability and Security Ethernet card provide a reliable connection to the data transmission that should
not vary in performance or availability if the network if functioning properly. Ethernet card provide more secure connections. Ethernet is comparatively easy to use
than that of other wireless protocols.
Bandwidth
Main advantage is Bandwidth offered by Ethernet; very large data can be transferred between two or more PC’s which are locally connected to Ethernet.
ETHERNET CARD
5
CHAPTER 2
LITERATURE REVIEW
ETHERNET CARD
6
LITERATURE REVIEW
Communication protocol or data transfer mechanism is a key part in designing a
data acquisition system. There are many protocols which can do same job with different
mechanisms and speed. Each system is having its own advantages and drawbacks. For
example consider RS232 protocol which is commonly used for point-to-point wiring.
More to the point, each transmitter connected to the receiver on the other node hence only
one device can be connected to other. But it is suitable for small distance as it has less
noise immunity. The data transmission speed provided by RS232 is comparatively less as considering small distance.
Ethernet is really a standard for computer network technologies that describes both hardware and communication protocols.
Ethernet handles both the physical media control and the software encoding for
data going onto a network. Since Ethernet is a broadcast topology, where every computer
can potentially "talk" at once, it has a mechanism to handle collisions—when data
packets from two computers are transmitted at the same time. If a collision is detected,
both sides retransmit the data after a random delay. This works pretty well most of the
time. However, this is also a downside to the Ethernet architecture. All computers
attached to an Ethernet network are broadcasting on the same physical wire, and an
Ethernet card on the network sees all the traffic passing it. The Ethernet card is designed
to process only packets addressed to it, but you can clearly see the security implication
here.
ETHERNET CARD
7
CHAPTER 3
PROCESS FLOW
ETHERNET CARD
8
PROCESS FLOW DIAGRAM
POWER ON
Input
SPI
Initialization
LCD Initialization
Port Initialization
Output
ADC
Initialization
Display
SPI Tx.
Process Data
Ethernet
LCD LCD Display
PHY init
MAC init
ETHERNET CARD
9
MAIN PROGRAM
START
INIT_LCD ( )
ADC_INIT ( )
SPI_INIT ( )
PHY_INIT ( )
MAC_INIT ( )
ETHERNET CARD
10
ADC
1. Function name - adc_init();
Function arguments - NULL
Functions return type – NULL
Function operation - To initialize ADC procedure of the controller
2. Function name - adc_process(unsigned int);
Function arguments - unsigned char
Functions return type - NULL
Function operation - To convert data in proper format.
ETHERNET CARD
11
LCD
1. Function name – init_lcd(); Function arguments - NULL
Functions return type - NULL Function operation - To initialize LCD.
2. Function name – lcd_cmd(unsigned char);
Function arguments - unsigned char Functions return type - NULL
Function operation - To send command to LCD.
3. Function name – lcd_write(unsigned char);
Function arguments - unsigned char
Functions return type - NULL
Function operation - To send data to be displayed on LCD.
4. Function name – write_string (unsigned char,unsigned char);
Function arguments - unsigned char,unsigned char
Functions return type - NULL
Function operation - To write string on LCD.
ETHERNET CARD
12
SPI
1. Function name - SPI_init();
Function arguments - NULL Functions return type - NULL
Function operation - To initialize MSSP module for SPI communication
2. Function name - SPI_Tx(unsigned char);
Function arguments – unsigned char
Functions return type - NULL
Function operation - To initialize SPI to transmit the data.
3. Function name - MAC_init(); Function arguments - NULL
Functions return type - NULL Function operation - To initialize MAC procedure of the controller.
4. Function name - PHY_init();
Function arguments - NULL
Functions return type - NULL
Function operation - To initialize PHY procedure of the controller
ETHERNET CARD
13
CHAPTER 4
HARDWARE DEVELOPMENT
ETHERNET CARD
14
HARDWARE DEVELOPMENT
4.1 Hardware Overview:
PIC16F877A
High-Performance RISC CPU:
• Only 35 single-word instructions to learn • All single-cycle instructions except for program branches, which are
two-cycle • Operating speed: DC – 20 MHz clock input DC – 200 ns instruction
cycle • Up to 8K x 14 words of Flash Program Memory, Up to 368 x 8 bytes of
Data Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory
Peripheral Features:
• Timer0: 8-bit timer/counter with 8-bit prescaler
• Timer1: 16-bit timer/counter with prescaler, can be incremented during
Sleep via external crystal/clock
• Timer2: 8-bit timer/counter with 8-bit period register, prescaler and
postscaler
• Two Capture, Compare, PWM modules
- Capture is 16-bit, max. resolution is 12.5 ns
- Compare is 16-bit, max. resolution is 200 ns
- PWM max. resolution is 10-bit
• Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™
(Master/Slave)
• Universal Synchronous Asynchronous Receiver Transmitter
(USART/SCI) with 9-bit address detection
• Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls (40/44-pin only)
• Brown-out detection circuitry for Brown-out Reset (BOR)
Analog Features:
• 10-bit, up to 8-channel Analog-to-Digital Converter (A/D) • Brown-out Reset (BOR)
• Analog Comparator module with: - Two analog comparators
- Programmable on-chip voltage reference (VREF) module - Programmable input multiplexing from device inputs and
internal voltage reference - Comparator outputs are externally accessible
ETHERNET CARD
15
Special Microcontroller Features:
• 100,000 erase/write cycle Enhanced Flash program memory typical • 1,000,000 erase/write cycle Data EEPROM memory typical
• Data EEPROM Retention > 40 years • Self-reprogrammable under software control
• In-Circuit Serial Programming™ (ICSP™) via two pins • Single-supply 5V In-Circuit Serial Programming
• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
• Programmable code protection • Power saving Sleep mode
• Selectable oscillator options
• In-Circuit Debug (ICD) via two pins
Ethernet Controller (ENC28J60) • IEEE 802.3 compatible Ethernet controller • Integrated MAC and 10BASE-T PHY
• Receiver and collision squelch circuit • Supports one 10BASE-T port with automatic polarity detection and
correction • Supports Full and Half-Duplex modes
• Programmable automatic retransmit on collision • Programmable padding and CRC generation
• Programmable automatic rejection of erroneous packets • SPI™ Interface with speeds up to 10 Mb/s
Buffer
• 8-Kbyte transmit/receive packet dual port SRAM • Configurable transmit/receive buffer size
• Hardware-managed circular receive FIFO
• Byte-wide random and sequential access with auto-increment
• Internal DMA for fast data movement
• Hardware assisted IP checksum calculation
Medium Access Controller (MAC) Features
• Supports Unicast, Multicast and Broadcast packets
• Programmable receive packet filtering and wake-up host on logical AND
or OR of the following:
- Unicast destination address, Multicast address
- Broadcast address Magic Packet™
- Group destination addresses as defined by 64-bit hash table
- Programmable pattern matching of up to 64B at user defined
offset
• Loopback mode
ETHERNET CARD
16
Physical Layer (PHY) Features • Wave shaping output filter
• Loopback mode
Operational • Two programmable LED outputs for LINK, TX, RX, collision
and full/half-duplex status • Seven interrupt sources with two interrupt pins
• 25MHz clock • Clock out pin with programmable prescaler
• Operating voltage range of 3.14V to 3.45V • TTL level inputs
• 28-pin SPDIP, SSOP, SOIC, QFN packages
Temperature Sensor LM35
• Calibrated Directly in Celsius (Centigrade)
• Linear + 10-mV/°C Scale Factor • 0.5°C Ensured Accuracy (at 25°C)
• Rated for Full −55°C to 150°C Range • Suitable for Remote Applications
• Operates from 4 V to 30 V • Less than 60-μA Current Drain
• Low Self-Heating, 0.08°C in Still Air • Non-Linearity Only ±¼°C Typical
• Low-Impedance Output, 0.1 Ω for 1-mA Load
LCD
• Type: Character • Format 16x2 Characters
• Duty cycle: 1/16 • 5 x 8 dots includes cursor
• + 5 V power supply • LED can be driven by pin 1, pin 2, or A and K
• Optional: Smaller character size (2.95 mm x 4.35 mm) • Compliant to RoHS directive 2002/95/EC
ETHERNET CARD
17
4.2 Hardware Parts
ETHERNET CARD
18
4.3 Data Transmission and Reception
SPI- Serial Peripheral Interface
Hardware Handshaking Signals
Software Handshaking Signals
ETHERNET CARD
19
4.4 Circuit Operation
Block diagram Ethernet Card
BLOCK DIAGRAM DESCRIPTION:
As our project main aim is to established the connectivity between
sensor and PC via Ethernet card ,so to ensure connectivity we have to send
some data ,for that we use LM 35 temperature sensor. LM 35 then measure
the temperature of surrounding and give temperature in analog form. But
other components need the data in digital form .So, conversion of analog to
digital is carried out in microcontroller PIC 16F877A.When we give the 5V
power supply to pic it gets initialized and starts functioning. At same time,
MASTER SYNCHRONOUS SERIAL PORT (MSSP) MODULE also get
initialized. The Master Synchronous Serial Port (MSSP) module is a serial
interface, useful for communicating with other peripheral or microcontroller
devices. The MSSP module can operate in one of two modes: Serial
Peripheral Interface (SPI) and Inter-Integrated Circuit (I2C). But to send
data serially we use MSSP module in SPI mode. So to ensure that LM 35
give the correct output or not we check output of sensor on LCD display. We
uses 4 bit LCD display. TO get reliable data at output ,the averaging of the
bits of digital data is done in PIC itself. THEN averaged data is converted to
decimal form and send to LCD . Also the averaged data is send to Ethernet
controller ENC28J60.
ETHERNET CARD
20
Ethernet controller ENC28J60 is basically consist of three stages Tx
/Rx buffer, MAC(Media Access Control) and PHY(Physical Layer). The
main function of this is to arrange the data in form of frame format of
Ethernet protocol. Also data encapsulation- decapsulation, frame coding and
error detection these are the main functions of MAC and this is carried out at
MAC layer. Also, the speed of data transmission, mode of transmission
these all are carried out at PHY chip of controller. Then Ethernet frame
formed by Ethernet controller is send to PC via RJ 45 (Resistor Jack) data
transmission cable. To send data it first sense the channel is free or not and
then sends. The data is transmitted to PC in form of packets. So, in this way
after the successful transmission of data from sensor to PC via Ethernet
controller we can say that the connectivity between sensor and PC is
achieved successfully.
ETHERNET CARD
21
Schematic Description:
LCD Interface:
LCD PIN PIC16F877a PIN PIC16F877a PIN NO.
D4 RD4 27
D5 RD5 28
D6 RD6 29
D7 RD7 30
R/W RE1 9
EN RE2 10
RS RE0 8
LM35 Sensor Interface:
LM35 PIN PIC16F877a PIN PIC16F877a PIN NO
VCC VCC 11
OUT AN1 3
ENC28j60 SPI Interface:
ENC28j60 Pin PIC16F877a PIN PIC16F877a PIN NO
VCC VCC 11
GND GND 12
SCK SCK/RC3 18
SDI SDI/RC4 23
SDO SDO/RC5 24
CS SS/RA5 7
Other Connections:
PIC16F877a PIN PIC16F877a PIN NO
VCC 11,32
GND 12,31
OSC1,OSC2 13,14
MCLR 1
ETHERNET CARD
22
4.5 Hardware Assembling:
INPUT SECTION:
Input section consists of temperature sensor LM35 which is having temperature range from -55 to 150°C. Output of sensor is connected to
channel 1 of ADC from PIC16f877a.
MICROCONTROLLER SECTION: PIC16F877A microcontroller is used. We are using inbuilt ADC of PIC to
convert analog output of sensor into digital. For communication we are
using SPI protocol from MSSP module of PIC.
OUTPUT SECTION: 16x2 LCD is interfaced with PIC in 4bit mode. ENC28j60 which is an
external Ethernet controller is interfaced with SPI protocol.
4.6 Hardware Testing:
Test point
Hardware
1.Test point 1 (tp1)
Voltage across secondary voltage of transformer
2.Test point 2 (tp2)
Output voltage of Bridge Rectifier IC
3.Test point 3 (tp3)
Output voltage of Power Supply
4.Test point 4 (tp4)
Voltage at MCLR pin
5.Test point 5 (tp5)
Output of LM35
6.Test point 6 (tp6) VCC at PIC (Pin 11 and 32)
7. Test point 7 LCD CONTROL and DATA signals
ETHERNET CARD
23
CHAPTER 5
RESULT AND DISCUSSION
ETHERNET CARD
24
5.1 Hardware Experiments
Test point
Hardware Testing
1.Test point 1 (tp1)
Voltage across secondary
voltage of transformer Tested Ok
2.Test point 2
(tp2)
Output voltage of Bridge
Rectifier IC Tested Ok
3.Test point 3 (tp3)
Output voltage of Power Supply
Tested Ok
4.Test point 4
(tp4)
Voltage at MCLR pin Tested Ok
5.Test point 5
(tp5)
Output of LM35 Tested Ok
6.Test point 6
(tp6)
VCC at PIC (Pin 11 and
32)
Tested Ok
7. Test point 7
LCD CONTROL and
DATA signals
Tested Ok
5.2 Comparison of Result -
ETHERNET CARD
25
CHAPTER 6
CONCLUSION AND
RECOMMENDATION
ETHERNET CARD
26
6.1 CONCLUSION:
Any microcontroller based system can be connected with the Ethernet interface
card and the whole system can be connected to the internet by which we can communicate with the system. The heart of the entire system is the Ethernet controller
ENC28J60 which communicates with MCU through its SPI interface. So, MCU only need to have the SPI .This Ethernet interface can be used to develop different
applications like embedded web server, Ethernet based Data acquisition system, internet controlled robot etc.
Documentation part and version completed and Ethernet communication part is in
Progress.
VERSION 1: The code of LCD has successfully completed.
VERSION 2: The code of SPI has successfully completed.
VERSION 3: The code of ADC+LCD has successfully completed.
Project is partially completed till data/
6.2 PROJECT LIMITATION:
At a time only one device communication takes place.
The card operates on speed up to 10 Mbps. The Ethernet card can be used for controlling as well as monitoring the devices
we have developed the application only for monitoring device parameter.
6.3 FUTURE RECOMMENDATION:
The Ethernet card that we have developed is external device to the system. But in future this can be embedded within the system as internal device with high speed.
ETHERNET CARD
27
REFERENCES
1. RESEARCH PAPERS:
Sr.
No
Author name Title of book Publisher Year of
publication
1 Zobair Ullah
Use of Ethernet
Technology in
Computer Network
Global
Journals
Inc.(USA)
2012
2 Bheema Rao
Introduction to
Ethernet
Technology
Global
Technology
Centre
2011
2. PDF:
PIC 16F877A datasheet
ENC28J60 datasheet
LM 35 datasheet
Interfacing PIC microcontroller
Ethernet Basics
Practical Networking with Ethernet.
3. BIBLIOGRAPHY:
www.microchip.com
www.wikipedia.org
www.alldatasheet.com
http://en.wikipedia.org/wiki/SPI
ETHERNET CARD
28
4. BOOKS:
Sr.
No
Author
name Title of book Publisher
Year of
publication
1 NXP PIC 16F877Adatasheet MICROCHIP 2003
2 Martin Bates
Interfacing of PIC
Microcontroller Elsevier 2006
3 Milan Verle PIC Microcontrollers
Programming in C mikroElektronika 2009
ETHERNET CARD
29
Individual contribution :
In case of a group project - What is individual’s role in project (in brief).
1.Tanmay Chauk
- Power Supply Design
- Power Supply Testing with load
- Continuity testing
- Mother Board, Soldering and hardware testing
- Chapter 4:Hardware Development
- Coding: SPI
2.Priyanka Chaudhary
- Power Supply Design
- Power Supply Testing with load
- Mother Board Testing and Hardware testing
- Chapter 2:Literature review, Result and Conclusion
- Chapter 3:Software Development
- Coding: SPI and LCD
3.Chanchal Rani
- Power Supply Design
- Power Supply Testing with load
- Continuity testing
- Chapter 1:Introduction, Literature review
- Chapter 4:Hardware Development
- Coding: LCD, ADC.