Professional Documents
Culture Documents
Avr Microcontroller Based Web Server: Vishram Mishra
Avr Microcontroller Based Web Server: Vishram Mishra
Submitted by
Vishram Mishra
in
SCHOOL OF ENGINEERING
KOCHI- 682022
March 2009
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
COCHIN UNIVERSTY OF SCIENCE AND TECHNOLOGY
DIVISION OF COMPUTER ENGINEERING
CENTRE FOR ENGINEERING STUDIES
COCHIN-682022
Certficate
VISHRAM MISHRA
Of the VIthsemester ,Computer Science and Engineering in the year 2009 in partial
fulfilment of the requirements to the award of Degree Bachelor of Technology in
Computer Science and Engineering of Cochin Universty of Science and Technology.
Place:Kochi
Date:30.03.2009
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ACKNOWLEDGEMENT
Vishram Mishra
Abstract
Microcontroller. The web server will host a small web page which will be
the web page, a user can control the devices attached to the
I am sure that this project will be helpful to control the devices remotely
ii
LIST OF TABLES
iii
LIST OF FIGURES
iv
2.22 Ethernet Encapsulation.......................................................................32
2.15 Example POST request.......................................................................34
2.15 HTTP response message.....................................................................34
v
TABLE OF CONTENTS
ACKNOWLEDGEMENT....................................................................i
ABSTRACT.........................................................................................ii
LIST OF TABLES...............................................................................iii
LIST OF FIGURES..............................................................................iv
TABLE OF CONTENTS.....................................................................vi
1. INTRODUCTION.....................................................................................1
1.1 Embedded Web Server.........................................................................1
1.2 8-bit Microcontroller Based Web Server.............................................1
2. SYSTEM STUDY.....................................................................................4
2.1 HARDWARE...........................................................................................4
2.1.1 Atmel ATmega32 Microcontroller.........................................................4
2.1.1.1 PIN Configuration.....................................................................5
2.1.1.2 Overview...................................................................................5
2.1.1.3 AVR CPU Core.........................................................................7
2.1.2 ENC28J60 Ethernet Controller...............................................................9
2.1.2.1 Pin Configuration......................................................................9
2.1.2.2 Overview...................................................................................9
2.1.3 Integrated Magnetics RJ-45 Jack ..........................................................12
2.1.3.1 Overview.................................................................................12
2.1.3.2 AutoMDIX ..............................................................................12
2.1.3.3 Cabling....................................................................................13
vi
2.1.4.2 Data transmission between Master and Slave................................15
2.1.4.3 Pins of the SPI.........................................................................16
2.1.5 Miscellaneous Components..................................................................17
2.1.5.1 LM 7805 IC.............................................................................17
2.1.5.2 LM 317 IC ..............................................................................17
2.1.5.3 JHD-162A LCD Display.........................................................18
2.1.6 Interfacing of Different Components....................................................19
2.2 NETWORKING....................................................................................20
2.2.1 TCP/IP Protocol Suite................................................................20
2.2.1.1 Application Layer..........................................................20
2.2.1.2 Transport Layer.............................................................21
2.2.1.3 Network Layer..............................................................21
2.2.1.4 Link Layer.....................................................................21
2.2.2 Combining all.............................................................................22
2.2.3 Port Numbers..............................................................................23
2.2.4 Encapsulation........................................................................................23
2.2.5 Internet Addresses......................................................................25
2.2.6 IP (Internet Protocol) .................................................................26
2.2.6.1 IP Header.......................................................................26
2.2.7 TCP (Transmission Control Protocol) .......................................28
2.2.7.1 TCP Header...................................................................29
2.2.8 Ethernet Encapsulation...............................................................32
2.2.9 HTTP (Hyper Text Transfer Protocol) ......................................33
2.2.9.1 HTTP Message .............................................................33
2.2.9.2 HTTP Methods..............................................................34
2.2.9.3 Status Codes..................................................................34
vii
2.2 Software Package..................................................................................36
2.3.1 WinAVR....................................................................................36
2.3.2 AVR Studio version 4................................................................36
2.3.3 PonyProg....................................................................................36
3. Software Code...................................................................................38
3.1 Header Files..................................................................................38
3.1.1 enc28j60.h........................................................................38
3.1.2 arp.h..................................................................................38
3.1.3 ip.h....................................................................................39
3.1.4 tcp.h..................................................................................39
3.1.5 http.h ................................................................................40
3.1.6 menu.h..............................................................................41
3.1.7 main.h...............................................................................42
4. EXECUTION.....................................................................................43
4.1 Testing and Debugging.......................................................43
4.2 Procedure for Execution......................................................43
5. CONCLUSION..................................................................................45
REFERENCES..................................................................................46
APPENDICES...................................................................................47
viii
AVR Web Server
CHAPTER 1
INTRODUCTION
This chapter provides an introduction to the embedded web server and their
implementation. Their typical application is explained with the help of examples.
Section 1.2 gives a brief explanation of implementation of embedded web server
based on Atmel AVR microcontroller.
A computer located in an office may send a request to turn off the Refrigerator
located at home via Internet. The web server will be running an HTTP application
through the interface of which the user can control and monitor the devices.
The following high level diagram explains how we can implement a web server on an
8-bit Microcontroller.
Fig 1.2 shows how an 8-bit microcontroller is interfaced with an Ethernet controller
which controls the physical layer of TCP/IP stack model. The standard RJ-45
connector is used for interfacing the Ethernet controller with a PC. When a request is
made from the web browser it is transferred as raw bits through the Ethernet lines and
is then fetched by the Ethernet Controller. The Ethernet Controller then passes this
information above to it that is to the Microcontroller. The program running on the
microcontroller then decodes the request and performs the required operation.
Usage of 8-bit AVR Microcontroller simplifies the design step. One of the most
popular 8-bit AVR Microcontroller is ATmega32 which has 32 Kb of Flash memory,
large enough for storing a small web page.
In the next coming sections we will perform system study and deals with various
hardware and software requirements of the project.
CHAPTER 2
SYSTEM STUDY
In this section we perform the system study by studying and analyzing various
hardware, software requirement and constraints. Section 2.1 deals with the hardware
requirements and explains the constraints associated with some of the hardware. The
constraints are removed by selecting different hardware. Section 2.2 deals with the
study of networking which is required for writing the various protocols. These
protocols include TCP, IP, HTTP, ICMP etc. In section 2.3 we give a brief
introduction to the software packages used.
We will discuss some of the following important components in brief (For further
study their datasheet can be referred):
Along with these we will also discuss some of the miscellaneous components used
and about the SPI (Serial Peripheral Interfacing) used to interface ATmega32 with
ENC28J60.
I/O ports, and timers. The reason for using ATmega32 as an 8-bit Microcontroller in
our application is because of its high throughput and SPI(Serial Peripheral Interface)
interfacing. The SPI interfacing provides serial interface with the device and hence
lowering the number of address and data lines used.
2.1.1.2 Overview
The AVR core combines a rich instruction set with 32 general purpose
working registers. All the 32 registers are directly connected to the Arithmetic Logic
Unit (ALU), allowing two independent registers to be accessed in one single
instruction executed in one clock cycle. The resulting architecture is more code
efficient while achieving throughputs up to ten times faster than conventional CISC
microcontrollers.
The main function of the CPU core is to ensure correct program execution.
The CPU must therefore be able to access memories, perform calculations, control
peripherals, and handle interrupts. Figure 2.3 represents a typical AVR CPU core.
2.1.2.2 Overview
link and network activity indication. A simple block diagram of the ENC28J60 is
shown in figure 2.5. With the ENC28J60, two pulse transformers and a few passive
components are all that is required to connect a microcontroller to an Ethernet
network.
A typical application circuit using the device is shown in the following figure 2.6
Here only five lines are required to interface the Microcontroller with the
ENC28J60. Whenever a data packet is received by ENC28J60 it sends an interrupt to
the Microcontroller. Based upon the timing of the interrupt the main program checks
the packet received and check to which protocol it belong. Based on that, appropriate
handling is done.
2.1.3.1 Overview
2.1.3.2 AutoMDIX
An Ethernet has one wire pair for transmit (Tx) and one for receive (Rx). A
Hub/Switch will amplify the signal and cross connect Tx of one network element with
Rx of the other. If we want to connect the AVR web server directly to our computer
without a Hub/Switch in-between then we will normally need a cross connect
Ethernet cable. A cross connect cable is a cable where Tx and Rx are swapped on one
side. The AutoMDIX magjack has some additional logic inside which will
automatically swap the cable for us if needed. In other words we can always use a
straight cable no matter if weconnect to a Hub/Switch or directly to a computer.
2.3.3 Cabling
2.1.4.1 Overview
An ATmega 32 Microcontroller uses SPI (Serial Peripheral Interface) to
effectively communicate with the Ethernet controller ENC28J60. The usage of SPI
provides serial communication thus eliminating large number of lines used for data
and addressing purpose. The SPI allows high-speed synchronous data transfer
between the AVR and peripheral devices or between several AVR devices. On most
parts the SPI has a second purpose where it is used for In System Programming (ISP).
The master is the active part in this system and has to provide the clock signal a serial
data transmission is based on. The slave is not capable of generating the clock signal
and thus can not get active on its own. The slave just sends and receives data if the
master generates the necessary clock signal. The master however generates the clock
signal only while sending data. That means that the master has to send data to the
slave to read data from the slave.
The interaction between a master and a slave AVR is shown in the figure 2.10
Two identical SPI units are displayed. The left unit is configured as master
while the right unit is configured as slave. The MISO, MOSI and SCK lines are
connected with the corresponding lines of the other part. The mode in which a part is
running determines if they are input or output signal lines. Because a bit is shifted
from the master to the slave and from the slave to the master simultaneously in one
clock cycle both 8-bit shift registers can be considered as one 16-bit circular shift
register. This means that after eight SCK clock pulses the data between master and
slave will be exchanged. The system is single buffered in the transmit direction and
double buffered in the receive direction.
After a transfer is completed the SPI Interrupt Flag (SPIF) will be set in the SPI Status
Register (SPSR). This will cause the corresponding interrupt to be executed if this
interrupt and the global interrupts are enabled. Setting the SPI Interrupt Enable (SPIE)
bit in the SPCR enables the interrupt of the SPI while setting the I bit in the SREG
enables the global interrupts.
The SPI consists of four different signal lines. These lines are the shift clock
(SCK), the Master Out Slave In line (MOSI), the Master In Slave Out line (MISO)
and the active low Slave Selectline (SS). When the SPI is enabled, the data direction
of the MOSI, MISO, SCK and SS pins are overridden according to the following table
2.
2.1.5.1 LM 7805 IC
LM7805 is a three-terminal positive voltage regulator employ built-in current
limiting, thermal shutdown, and safe-operating area protection which makes them
virtually immune to damage from output overloads. Here we use LM 7805 for getting
an output of 5V required by ATmega32 Microcontroller. Figure 2.11 shows the pin
layout of LM7805 IC.
2.1.5.2 LM 317 IC
LM317 is an adjustable 3-terminal positive voltage regulator capable of
supplying in excess of 1.5A over a 1.2V to 37V output range. They are exceptionally
easy to use and require only two external resistors to set the output voltage. Further,
both line and load regulation is better than standard fixed regulators. Here we use LM
317 voltage regulator for getting an output of 3.3 V required by ENC28J60 IC. .
Figure 2.12 shows the pin layout of LM317 IC.
An LCD display offers high flexibility to user to display the required data on
it. It may be also used for debugging purpose of the program i.e. by checking which
all subroutines are executed by displaying the value on LCD display. In our case a
16x2 alphanumeric LCD display is used to display the current AVR IP, the ADC
value (if connected) and temperature. An LCD driver is a link between the
microcontroller and LCD. The JHD 162A LCD display uses driver HD44780U. The
header file included in the program depends upon the LCD display driver used.
Figure 2.13 shows a JHD 162A LCD display
The following figure shows the main interfacing of AVR web server:
2.2 Networking
The TCP/IP protocol suite allows computers of all sizes, running different
operating systems, to communicate with each other. It forms the basis for what is
called the worldwide Internet, a Wide Area Network (WAN) of several million
computers.
.
Fig 2.15: TCP/IP protocol stack
The three lower layers do not know anything about the specific application and only
take care of communications details.
TCP is responsible for a reliable flow of data between two hosts. Typically,
TCP divides data passed to it from the application into appropriately sized chunks for
the network layer below, acknowledging received packets that are sent and
retransmits lost packets. Since this reliable, flow of data is provided by the Transport
Layer, the Application Layer above can ignore these details.
This layer is sometimes called the Internet Layer. It handles the movements of
packets around the network. Routing of packets, for example, takes place here. IP
(Internet Protocol) and ICMP (Internet Control Message Protocol) provides the
Network Layer in the TCP/IP Protocol Suite.
Figure 2.16 shows an example that includes two hosts on a Local Area Network
(LAN) such as Ethernet, using HTTP.
One side represents the client, and the other the server. The server provides
some type of service to clients, in this case, access to web pages on the server host.
Each layer has one or more protocols for communicating with its peer at the same
layer. One protocol, for example, allows the two TCP layers to communicate, and
another protocol lets the two IP layers communicate.
The Application Layer is normally a user-process while the lower three layers
are usually implemented in the kernel (the operating system).
Different applications can use TCP or UDP at any time. The Transport layer
protocols store an identifier in the headers they generate to identify the application.
Both TCP and UDP use 16-bit port numbers to identify applications. TCP and UDP
store the source port number and the destination port number in those respective
headers. Servers are normally known by their well-known port number. Every TCP/IP
implementation with a FTP server provides that service on TCP port 21. Every Telnet
server is on TCP port 23. Services provided by any implementation of TCP/IP have
well-known port numbers between 1 and 1023. The well-known ports are managed by
the Internet Assigned Numbers Authority (IANA).
2.2.4 Encapsulation
When an application sends data using TCP, the data is sent down the protocol
stack, through each layer, until it is sent as a stream of bits across the network. Each
layer adds information to the data by prepending headers and adding trailers to the
data it receives. Figure 2.17 shows this process.
Some abbreviations:
• TCP segment: The unit of data that TCP sends to IP.
• IP datagram: The unit of data that IP sends to the network interface.
• Frame: The stream of bits that flows across the Ethernet.
The TCP and UDP store the source port number and the destination port
number in their respective headers. The network interface sends and receives frames
on behalf of IP, ARP, RARP. There must be some form of identification in the
Ethernet header indicating which network layer protocol generates the data. To handle
this, there is a 16- bit frame type field in the Ethernet header.
Every interface on the internet has a unique Internet Address (IP Address).
The addresses are 32-bit numbers. Following figure 2.18 shows the structure and the
five different classes of Internet addresses:
The 32-bit addresses are normally written as four decimal numbers, one for
each byte of the address. This notation is called dotted-decimal. Since every interface
on internet must have a unique IP address, there must be one central authority for
allocating these addresses for networks connected to the worldwide Internet. Internet
Network Information Center (NIC) is the responsible authority. Table 3 gives the
dotted decimal notation of classes of IP.
Table 3: Classes of IP
All TCP, UDP and ICMP data get transmitted as IP datagrams. IP provides an
unreliable, connectionless datagram delivery service. There is no guarantee that an IP
datagram successfully gets to its destination. When something goes wrong, IP has a
simple error handling algorithm: Throw away datagram and try to send an ICMP
message back to the source. Any required reliability must be provided by the upper
layers.
2.2.6.1 IP Header
Figure 2.19 shows the format of an IP datagram. The normal size of the IP
header is 20 bytes, unless options are present. The most significant bit is numbered 0
at the left, and the least significant bit of a 32-bit value is numbered 31 on the right.
The 4 bytes in the 32-bit value are transmitted in the order: bits 0 - 7, then bits 8 - 15
and so on. This is called Big-Endian byte ordering, which is the byte ordering
required for all binary integers in the TCP/IP headers as they traverse a network. This
is called the network byte order.
Header length:
The header length is the number of 32-bit words (4 bytes per word) in the header,
including any options. This limits the header length to 60 bytes.
Total Length:
This is the total length of the IP datagram in bytes. Using this field and the header
length field, we know where the data portion of the IP datagram starts and its length.
Since this is a 16-bit field, the maximum size of an IP datagram is 65535 bytes.
Identification:
This field uniquely identifies each datagram sent by a host. It normally increments by
One each time a datagram is sent.
Time To Live:
Time-to-live sets an upper limit on the number of routers through which datagram can
pass. It limits the lifetime of the datagram. It is initialized by the sender to some value
(often 32 or 64) and decrements by one in every router that handles the datagram.
Then this field reaches 0, the datagram is discarded, and the sender is notified with an
ICMP message. This prevents the packet from getting caught in eternal routing loops.
Protocol:
Protocol is used by IP to demultiplex incoming datagrams. It identifies which protocol
gave the data for IP to send.
Header Checksum :
The Header checksum is calculated over the IP header only. It does not cover any data
that follows the header. ICMP, UDP and TCP all have a checksum in their own
headers to cover their own header and data. Every IP datagram contains the source IP
address and the destination IP address. These are 32-bit values.
TCP and UDP use the same network layer (IP), but TCP provides a totally
different service to the Application Layer. TCP provides a connection-oriented,
reliable, byte stream service. The term connection-oriented means the two
applications using TCP must establish a TCP connection with each other before they
can exchange data.
• The application data is broken into what TCP considers the best sized chunks to
send. This is totally different from UDP, where each write by the application generate
a UDP datagram of that size. The unit of information passed by TCP to IP is called a
segment.
• When TCP sends a segment it maintains a timer, waiting for the other end to
acknowledge reception of the segment. If an acknowledge is not received in time, the
segment is retransmitted.
• When TCP receives data from the other end of the connection, it sends an
acknowledgment. This acknowledgment is not sent immediately, but normally
delayed a fraction of a second.
• TCP maintains a checksum on its data header page. This is an end-to-end checksum
whose purpose is to detect any modifications of the data in transit. If a segment
arrives with an invalid checksum, TCP discards it and does not acknowledge
receiving it. This expects the sender to time out and retransmits.
• Since TCP segments are transmitted as IP datagrams, and since IP datagrams can
arrive out of order, TCP segments can also arrive out of order. A receiving TCP
resequences the data if necessary, passing the received data in the correct order to the
application.
• Since IP datagrams can get duplicated, a receiving TCP must discard duplicate data.
• TCP also provides flow control. Each end of a TCP connection has a finite amount
of buffer space. A receiving TCP only allows the other end to send as much data as
the receiver has buffer for. This prevents a fast host from taking the entire buffer on a
slower host.
Figure 2.21 shows the format of the TCP header. Its normal size is 20 bytes, unless
options are present.
Sequence Number:
This identifies the byte stream of data from the sending TCP to the receiving TCP that
the first byte of data in this segment represents. TCP numbers each byte with a
sequence number. The sequence number is a 32-bit unsigned number that wraps back
around to 0 after reaching 232-1.
Acknowledge Number:
This contains the next sequence number that the sender of the acknowledgment
expects to receive. This is therefore the sequence number plus 1 of the last
successfully received byte of data. This field is only valid if the ACK flag is set. The
32-bit acknowledgment number field is always part of the header, as is the ACK flag.
This field is always set and the ACK FLAG is on.
Header Length:
This gives the length of the header in 32-bit words. This is required because the length
of the options field is variable. With a 4-bit field, TCP is limited to a 60-byte header.
Without options, however, the normal size is 20 bytes.
Flag Bits:
There are six flag bits in the TCP header – one or more of them can be turned on at
the same time:
1. URG – The urgent pointer is valid.
2. ACK – The acknowledgment number is valid.
3. PSH – The receiver should pass data to the application as soon as possible.
4. RST – Reset the connection.
5. SYN – Synchronize sequence numbers to initiate a connection.
6. FIN – the sender is finished sending data.
Window Size:
TCP’s flow control is provided by each end advertising a window’s size. This is the
number of bytes, starting with the one specified by the acknowledgment number field,
that the receiver is willing to accept. This is a 16-bit field, limiting the window to
65535 bytes.
Checksum:
Checksum covers the TCP segment: the TCP header and the TCP data. This is a
mandatory field and must be calculated and stored by the sender and then verified by
the receiver.
Urgent Pointer:
The urgent pointer is valid only if the URG flag is set. This pointer is a positive offset
that must be added to the sequence number field of the segment to yield the segment
number of the last byte of urgent data. TCP’s urgent mode is a way for the sender to
transmit emergency data to the other end.
Checksum:
The most common option field is the MSS (maximum segment size). Each end of a
connection normally specifies this option on the first segment exchanged (the one sent
with the SYN flag set to establish the connection). It specifies the maximum size
segment that the sender wants to receive.
Data:
The data portion of the TCP header is optional. A header without data is used to
acknowledge received data if there is no data to be transmitted in that direction. There
are also some cases dealing with time-outs when a segment can be sent without any
data.
Destination Address:
This field contains the 48-bit destination MAC address.
Source Address:
This field contains the 48-bit source MAC address.
Ethernet Type:
Identifies the type of data that follows.
CRC:
Cyclic redundancy checksum used to detects errors in the rest of the frame.
Preamble:
The Ethernet frame begins with 8 byte preamble field to synchronize the sender’s
clock with the receiver clock.
Minimum Size:
For an Ethernet frame it is 46 bytes. To handle this, pad bytes are inserted to assure
that the frame is sufficiently large
The HTTP protocol is a protocol that allows a (web) client to request files or
other resources from a server. Various types of requests can be sent by the client. The
most basic are the “GET” request and the “POST” request which are used to fetch and
post data, respectively. The server processes the request, returns a header containing a
status code and either a file or an HTML document attached after the header. Finally,
the server closes the connection.
In this section we will discuss in brief about the software packages used in the
project. The software packages used in the project are:
WinAVR
AVR Studio
PonyProg
2.3.1 WinAVR
WinAVR contains all the tools for developing of an AVR application. This
includes Programmers Notepad (editor), avr-gcc (compiler), avrdude (programmer),
avr-gdb (debugger).
2.3.3 PonyProg
CHAPTER 3
SOFTWARE CODE
The header files are written by declaring the necessary Macros and Function
into a file ending with .h extension. The real definition of the function appears in the
C program with the same file name as header file but ending with .C extension.
Most of the header files are obtained under GNU general public license and are
rewritten for our convenience. Some of these headers files are discussed here:
3.1.1 enc28j60.h
It provides the driver for ENC28J60 IC. Some of the functions defined in this
header file are:
3.1.2 arp.h
arp_send_request (): Used for sending an arp request packet. It calls function
arp_generate_packet.
arp_packet_is_arp (): check received packet, that packet is match with arp and
avr ip or not?
arp_who_is(): send arp request to destination ip, and save destination MAC to
dest_mac.
3.1.3 ip.h
3.1.4 tcp.h
3.1.5 http.h
http_home (): It prepares the web page by writing the HTML data to the TCP
send buffer.
3.1.6 menu.h
This header file implements Menu structure used in 16x2 LCD display.
Functions defined in this header file are:
my_strcpy(): copy string (end '\0') from program memory to ram and return
pointer to end of string.
menu_process(): Used to process the menu using the up and down keys.
Following are the functions related to the two keys:
3.1.7 main.h
This is the main header file where the infinite loop is implemented. It also has
some function defined as Server Process which is called by main loop. The infinite
loop is implemented as:
for(;;)
{ // wait until timer1 overflow
while ( (TIFR & _BV ( TOV1 )) == 0 );
TIFR |= _BV(TOV1);
TCNT1 = 1536; // Timer1 overflow every 1/16MHz * ( 65536 -
1536 ) = 4ms, 250Hz
}
return 0;
}
Here since the AVR is clocked at 16 MHz and the counter is set to count downward
from 65536 to 1536, this loops runs at 250 Hz (or 4 ms).
CHAPTER 4
EXECUTION
This section deals with the testing, debugging and execution of the program.
The program is written based on the header files which we have discussed in the
previous section.
All the codes were written on AVR Studio (refer Appendix 1). Each of the
function was independently tested with the set of inputs and was simulated by inbuilt
Simulator of AVR Studio. After integration of all the functions a sample input was
provided to check the output. Also in between code LCD display messages were
provided so as to perform debugging through LDC display.
Now plug one of the RJ 45 connector of the cross over cable to the RJ 45 jack
of AVR web server and the other end connector to the RJ 45 Jack of CPU. Manually
configure the Internet Connection. If the AVR IP is set to 10.1.1.1, then type this
address in the address bar of the web browser and hit enter. After a short period of
time a web page will be displayed which shows the current status of the devices
attached to the microcontroller. Now through the interface of this web page devices
attached to the microcontroller can be controlled.
CHAPTER 5
CONCLUSION
The project on “AVR Microcontroller based Web Server” has been developed
which hosts a small web page. The web page is stored onto the ATmega32 Flash
memory.
Through the interface of the web page a user is able to control the devices
remotely. A user can also monitor the devices remotely by embedding each device to
be controlled or monitored with the AVR web server. Each device now has a separate
IP address assigned to it. When the IP address is type onto the address bar of the web
browser the web page associated with that device get opens.
REFERENCES
[8] Plummer, David C., Network Working Group. Request for Comment: 826,
November 1982.
http://www.faqs.org/rfcs/rfc826.html
Appendices
Appendix 1
Perform the installation of WinAVR before installing AVR Studio. It helps in locating
the libraries by AVR Studio.
Step 2: Select AVR GCC compiler and enter a name for the project
Appendix 2
Step2: Make the settings depending upon your hardware programmer type
Step 3: Click on “Setup” menu and click on “Calibration”, click Yes to Calibrate.
Step5: Click on “Security and Configuration Bits”. Click on read, make the
appropriate changes depending upon the Oscillator used. Here we are using external
16 MHz crystal. Click on write after the changes are done.
Step 6: Open the hex file generated by AVR studio and click on “Write All” under
“Command” tab, then click yes.
If a write successful message appears, then the Code was successfully written onto the
microcontroller.
Appendix 3
Programmer Hardware:
A simple hardware programmer for AVR microcontroller using parallel port is shown
here. There are several other programmer hardware circuit available using Serial and
USB port, but using Parallel Port is the easiest one.
The length of the wire to target should not exceed more than 20 cm, otherwise the
SCK line starts oscillating and there would be no synchronization between the
Microcontroller and the CPU