You are on page 1of 4

International Journal of Computer Networking,

Wireless and Mobile Communications (IJCNWMC)


ISSN 2250-1568
Vol. 3, Issue 2, Jun 2013, 43-46
TJPRC Pvt. Ltd.

AVR EMBEDDED BASED WEB SERVER

MAHESHCHANDRA JADHAV1 & M. S. BIRADAR2


1
ME Student of Siddhant College of Engineering, Pune, Maharashtra, India
2
Professor in Siddhant College of Engineering, Pune, Maharashtra, India
ABSTRACT
Computer communication systems and especially the Internet are playing an important role in the daily life. Using
this knowledge many applications are imaginable. The web server will host a small web page which will be stored in the
Microcontrollers Flash memory. Through the interface of the webpage, a user can control the devices attached to the
Microcontroller. Additionally an LCD is also interfaced with the Microcontroller to provide user interface through the use
of four keys. Currently device with microcontroller has been widely used in industrial field. However, a large number of
devices dont have the network interface and the data from them cannot be transmitted in network. A design of AVR
processor-based embedded Ethernet interface is presented. In the design, an existing SPI serial device can be converted
into a network interface peripheral to obtain compatibility with the network. By typing the IP-address of LAN on the web
browser, the user gets a web page on screen; this page contains all the information about the status of the devices. The user
can also control the devices interfaced to the web server by pressing a button provided in the web page.
KEYWORDS: SPI (Serial Peripheral Interface), SPCR (SPI control register), AVR
INTRODUCTION
Computer communication systems and especially the Internet are playing an important role in the daily life.
Using this knowledge many applications are imaginable. Home automation, utility meters, appliances, security systems,
card readers, and building controls, which can be easily, controlled using either special front-end software or a standard
internet browser client from anywhere around the world. Small systems to large systems may provide an interface and
control via the onboard switches or via IR or RF based remote control. But what if the User who wants to control a device,
is out of reach of the device or is at another part of world. There are other methods developed to control the devices
remotely, but each technique requires some new implementations to be done. Here we use the existing technique of
Internet Web based HTTP protocol with TCP/IP protocol suite to control the devices. Embedding a web application in a
system is termed as embedded web server. Suppose an Embedded Web Server is embedded in several units in a house as
shown in figure 1. Every server is connected to the network. A computer located at home as on figure controls all devices
and can receive requests from other computers on the Internet. The web server is identified by its unique IP address and
can be controlled remotely from anywhere in the world. 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.

Figure 1: Monitoring Home Equipment from the Office


44 Maheshchandra Jadhav & M. S. Biradar

SYSTEM DESIGN
To implement a web server on an 8 bit Microcontroller we will use AVR microcontroller because of its high
throughput. Also ENC28J60 Ethernet controller is used instead of Realtek family of Ethernet controller because of low
number of pins which provides an easy interfacing with 8 bit Microcontroller. The following important components in
brief (For further study their datasheet can be referred): The block diagram of System is as shown in figure 2.
Atmel ATmega32 Microcontroller
ENC28J60 Ethernet Controller.
Integrated Magnetics RJ -45 Jack.
Along with these the miscellaneous components used and about the SPI (Serial Peripheral Interfacing) used to
interface ATmega32 with ENC28J60. [1]
Atmel ATmega32 Microcontroller
A Microcontroller is a highly integrated chip that contains all the components comprising a controller. Typically
this includes a CPU, RAM, some form of ROM, 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. In
order to maximize performance and parallelism, the AVR uses Harvard architecture with separate memories and buses
for program and data. Instructions in the program memory are executed with a single level pipelining. While one
instruction is being executed, the next instruction is pre-fetched from the program memory. This concept enables
instructions to be executed in every clock cycle. The program memory is In-System Reprogrammable Flash memory. The
fast-access Register File contains 32 x 8-bit general purpose working registers with a single clock cycle access time. Six of
the 32 registers can be used as three 16-bit indirect address register pointers for Data Space addressing enabling efficient
address calculations. The ALU supports arithmetic and logic operations between registers or between a constant and a
register. Single register operations can also be executed in the ALU. After an arithmetic operation, the Status Register is
updated to reflect information about the result of the operation.
ENC28J60 Ethernet Controller
An Ethernet Controller is a device used to implement Ethernet Protocol. The reason for using ENC28J60 as an
Ethernet Controller in our application is because its supports SPI(Serial Peripheral Interface) interfacing. The SPI
interfacing provides serial interface with the device and hence lowers the number of address and data lines used. The
ENC28J60 is a stand-alone Ethernet controller with an industry standard Serial Peripheral Interface (SPI). It is designed to
serve as an Ethernet network interface for any controller equipped with SPI. The ENC28J60 meets all of the IEEE 802.3
specifications. It incorporates a number of packet filtering schemes to limit incoming packets. It also provides an internal
DMA module for fast data throughput and hardware assisted checksum calculation, which is used in various network
protocols. Communication with the host controller is implemented via an interrupt pin and the SPI, with clock rates of up
to 20 MHz. Two dedicated pins are used for LED link and network activity indication. [4]
SPI (Serial Peripheral Interface)
An ATmega32 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 interconnection between two SPI devices always happens between a master device and a
slave device. Compared to some peripheral devices like sensors which can only run in slave mode, the SPI of the AVR can
AVR Embedded Based Web Server 45

be configured for both master and slave mode. The mode the AVR is running in is specified by the settings of the master
bit (MSTR) in the SPI control register (SPCR). Special considerations about the SS pin have to be taken into account. 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 cannot 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.

Figure 2: Block Diagram of System


MISCELLANEOUS COMPONENTS
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 shows the pin layout of LM7805 IC.
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 shows the pin layout of LM317 IC.
SYSTEM SOFTWARE DESIGN
In order to transmit the data from SPI serial to Ethernet, two system tasks are established in OS C / OS-. One is
to receive front-end data through SPI interface and the other is to transmit data to Ethernet.

SPI Receiving Task


For the case that the data are transmit to Ethernet, the data which have been arrived at SPI port are stored into SPI
sending buffer and packaged according to TCP/IP protocol and then are added IP and UDP message head on the condition
that the PC with SPI interface is set to SPI slave mode and the SPI interface is enabled. At last, the converted data are sent
to the host through the corresponding UDP port.
Ethernet Receiving Task
In the Ethernet task, in order to receive the data from Ethernet in the system, the local IP address and subnet mask
must be set firstly, and the appropriate UDP port is opened to monitor whether there are data in UDP port. As UDP packet,
the data which have been reached the UDP port, are analysed according to TCP/IP protocol and then stored into SPI
receiving buffer. At last, the analysed data are sent to the SPI serial device through SPI interface driver.

SYSTEM TESING
Figure 3 shows the simple web page designed using HTML language. It is requested by the client to server.
Then the internet processes these request and server response for client request with web page. Now the Client can know
46 Maheshchandra Jadhav & M. S. Biradar

the status of industry machineries and can control the machines via its own browser from remote location. The status
of the stepper motor is shown on the web page by typing the IP address of the server board. We can view the status of
stepper motor as shown and change the status by clicking on it and update the system. The status of the stepper motor is
changed similarly the temperature of the room will be observed for every hour by refreshing the results. Hence, results
show that the client can access the whole industry from any remote place via its own local browser. In industry the single
AVR board acts as data acquisition and control system and as web server, so the system is compact with less complexity.

Figure 3: Web Page Shows Status of Temperature Sensor


CONCLUSIONS
In order to transmit the data from an existing device with SPI interface to network, an AVR Embedded based Web
Server is designed. This design can be used widely in remote data acquisition and control system in industry. These
Embedded Ethernet modules are having the capacity to perform as a true Ethernet device. It is possible to interface
different kind of sensors with these modules and make various applications. So it can monitor embedded system operation
state through Internet, achieving network monitoring purposes. The AVR system adopts the high performance Ethernet
controller the system communication and debugging are fast, reliable and real-time; In addition, it can be also applied in
on-line monitoring, remote fault diagnosis system.
ACKNOWLEDGEMENTS
Perseverance, Inspiration & Motivation have always played a key role in the success of any venture. Our sincere
gratitude to our respected Project Guide Prof. Mrs. M. S. Biradar Who as a guide evolved an interest in our Project work
and select an entirely new idea for Project. He has been keenly co-operative and helpful to us in sorting out all the
difficulties.Our sincere thanks to HOD Prof. Mr. B.R. Jadhavar for his kind co-operation and guidance in proper direction
for the completion of project work
REFERENCES
1. Atmel ATmega32 Datasheet, Atmel Corporation. www.atmel.com/dyn/resources/prod_documents/doc2503.pdf
2. AVR 460 Application Note, Atmel Corporation. www.atmel.com/atmel/acrobat/doc2396.pdf
3. Berners-Lee, Fielding, T.R. Irvine, H. UC, Frystyk. Request for Comment:1945, May 1996.
http://www.faqs.org/rfcs/rfc1945.html
4. ENC28J60 Datasheet, Microchip Technology Inc.
http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en022889
5. Gary Desrosiers, 99. Embedded Ethernet. http://www.embeddedethernet.com/
6. Postel, Jon, Information Science Institute. University of Southern California., Network Working Group, Request
for Comment:791, September1981. http://www.faqs.org/rfcs/rfc791.html
7. Postel, Jon, Information Science Institute. University of Southern California., Network Working Group, Request
for Comment:792, April1984 http://www.faqs.org/rfcs/rfc792.html

You might also like