Web Server Implementation Using AVR Embedded Technology


Computer communication systems, particularly the Internet, hold significant sway in our daily lives, offering numerous conceivable applications. This web server project aims to store a small web page in the Microcontroller’s Flash memory, enabling users to control devices connected to the Microcontroller via the webpage interface. Furthermore, an LCD connected to the Microcontroller facilitates user interaction through four keys. While microcontroller-based devices are extensively used in industrial settings, many lack network interfaces, hindering data transmission across networks. This project introduces an embedded Ethernet interface design based on the AVR processor. This design converts an existing SPI serial device into a network interface peripheral, ensuring compatibility with networks. By entering the LAN’s IP address into a web browser, users access a web page displaying comprehensive information regarding device statuses. Users can manipulate the devices linked to the web server by using buttons available on the web page interface.


Computer communication systems, notably the Internet, play a pivotal role in everyday life, offering numerous possibilities for various applications. These applications span across realms such as home automation, utility metering, appliance management, security systems, card readers, and building controls. These systems can be conveniently managed either through specialized front-end software or a standard internet browser client from any global location. From small-scale setups to large-scale implementations, these systems can provide control interfaces accessible through onboard switches, IR, or RF-based remote control mechanisms. However, there’s a challenge when the user seeking device control is physically distant or located in another part of the world. While several methods have been developed to control devices remotely, each method necessitates specific new implementations.

In this context, we leverage the existing Internet Web-based HTTP protocol within the TCP/IP protocol suite to facilitate device control. The integration of a web application into a system is referred to as an embedded web server. For instance, in a residential setting (as depicted in Figure 1), multiple units are embedded with an Embedded Web Server, each connected to the network. A computer situated at home oversees all devices and can receive control requests from other computers across the Internet. Each web server possesses a unique IP address, enabling remote control from any global location. For instance, a computer located in an office can transmit a request to remotely turn off the refrigerator at home via the Internet.

The web server operates an HTTP application interface, empowering users to control and monitor devices efficiently through its interface.

Figure 1: Monitoring Home Equipment from the Office


To establish a web server on an 8-bit Microcontroller, we’ll employ the AVR microcontroller due to its superior throughput capabilities. Additionally, we’ll utilize the ENC28J60 Ethernet controller instead of the Realtek family of Ethernet controllers. This choice is driven by the ENC28J60’s lower pin count, enabling easier interfacing with the 8-bit Microcontroller. The key components involved are briefly outlined below (For further details, refer to their respective datasheets). The system’s block diagram is depicted in figure 2.

– Atmel ATmega32 Microcontroller
– ENC28J60 Ethernet Controller
– Integrated Magnetics RJ-45 Jack

These essential components, along with miscellaneous additional parts, are utilized along with the Serial Peripheral Interface (SPI) to facilitate the interfacing between the ATmega32 and ENC28J60. [1]

Atmel ATmega32 Microcontroller

A microcontroller serves as a highly integrated chip encompassing all essential components needed for control functions. Typically, this includes a CPU, RAM, various forms of ROM, I/O ports, and timers. The selection of the ATmega32 as an 8-bit microcontroller in our application is due to its notable throughput capacity and the provision of Serial Peripheral Interface (SPI) interfacing. The SPI interface streamlines the connection by enabling a serial interface with the device, thereby reducing the number of address and data lines required.

To optimize performance and facilitate parallelism, the AVR employs the Harvard architecture, employing separate buses and memories for program and data. Instructions stored in the program memory execute through a single-level pipelining system. While one instruction undergoes execution, the subsequent instruction is pre-fetched from the program memory. This methodology allows for instructions to execute in every clock cycle. The program memory, in this case, is a type of In-System Reprogrammable Flash memory.

The Register File, which provides swift access, contains 32 x 8-bit general-purpose working registers, accessible within a single clock cycle. Six of these registers can serve as three 16-bit indirect address register pointers for Data Space addressing, enhancing the efficiency of address calculations. The Arithmetic Logic Unit (ALU) supports arithmetic and logic operations either between registers or between a constant and a register. Additionally, the ALU can execute operations on a single register. Post an arithmetic operation, the Status Register gets updated, reflecting details about the operation’s result.

ENC28J60 Ethernet Controller

An Ethernet Controller is a fundamental component employed for executing the Ethernet Protocol. Our choice of utilizing ENC28J60 as the Ethernet Controller in this application is due to its support for SPI (Serial Peripheral Interface) interfacing. This SPI interfacing streamlines the serial connection with the device, thereby reducing the number of address and data lines required. The ENC28J60 functions as an independent Ethernet controller featuring the widely recognized Serial Peripheral Interface (SPI). Its design caters to serving as an Ethernet network interface for any controller equipped with SPI capabilities. Adhering to all IEEE 802.3 specifications, the ENC28J60 incorporates several packet filtering mechanisms to control incoming packet streams. Additionally, it integrates an internal DMA module to facilitate high-speed data throughput and hardware-supported checksum calculations, essential in numerous network protocols. Interaction with the host controller is established through an interrupt pin and SPI, capable of clock rates up to 20 MHz. Specifically dedicated pins are designated for LED indication, signaling link status, and network activity. [4]

SPI (Serial Peripheral Interface)

An ATmega32 Microcontroller utilizes the Serial Peripheral Interface (SPI) to establish efficient communication with the Ethernet controller ENC28J60. The utilization of SPI streamlines communication by employing serial data transfer, reducing the number of lines required for data transmission and addressing. This protocol facilitates high-speed synchronous data exchange between the AVR and peripheral devices, or among multiple AVR devices. In many instances, SPI serves a secondary function as In-System Programming (ISP). Interconnection between SPI devices occurs between a master and a slave device. While certain peripheral devices, such as sensors, operate solely in slave mode, the AVR’s SPI can be configured to operate in both master and slave modes. The operational mode of the AVR is determined by the configuration of the master bit (MSTR) in the SPI control register (SPCR). Special attention must be given to the SS pin. In this setup, the master device plays an active role by providing the necessary clock signal for serial data transmission. Conversely, the slave device lacks the capability to generate a clock signal and remains inactive until prompted by the master. The slave device sends and receives data only when the master initiates the required clock signal. The master generates the clock signal exclusively during data transmission, necessitating data transmission from the master to enable data reception by the slave.

Figure 2: Block Diagram of System


LM 7805 IC

The LM7805 is a three-terminal positive voltage regulator that integrates built-in features such as current limiting, thermal shutdown, and safe-operating area protection. These attributes provide robust protection against output overloads, virtually preventing damage. In our setup, we utilize the LM7805 to obtain the 5V output necessary for powering the ATmega32 Microcontroller. Figure 2 illustrates the pin configuration of the LM7805 IC.

LM 317 IC

The LM317, an adaptable 3-terminal positive voltage regulator, has the capacity to provide over 1.5A across a range of 1.2V to 37V as an output. Its simplicity is remarkable, necessitating solely two external resistors to establish the output voltage. Moreover, its performance in terms of both line and load regulation surpasses that of typical fixed regulators. In this setup, the LM317 voltage regulator is employed to obtain the 3.3V output required for the ENC28J60 IC. Figure 2 illustrates the pin configuration of the LM317 IC.


To facilitate the transmission of data from the SPI serial interface to Ethernet, two distinct system tasks are initialized within the OS μC/OS-П. The first task involves acquiring front-end data via the SPI interface, while the second task manages the transmission of data to the Ethernet.

SPI Receiving Task

If the data is being transmitted via Ethernet, the information received at the SPI port is stored in the SPI sending buffer. This data is then organized based on the TCP/IP protocol, incorporating IP and UDP message headers, given that the PC configured with the SPI interface operates in SPI slave mode and the SPI interface is activated. Finally, the processed data is dispatched to the host through the designated UDP port.

Ethernet Receiving Task

Within the Ethernet task, configuring the system to receive data entails initial setup steps. This involves setting the local IP address and subnet mask, followed by the opening of the appropriate UDP port to monitor incoming data. As UDP packets arrive at the designated UDP port, they undergo analysis in accordance with the TCP/IP protocol and are subsequently stored in the SPI receiving buffer. Finally, the processed data is transmitted to the SPI serial device utilizing the SPI interface driver.


Figure 3 depicts a basic web page created using HTML language, which the client requests from the server. Subsequently, the internet processes this request, and the server responds by providing the web page to the client. This setup enables the client to access information regarding the status of industrial machinery and exercise control over these machines through their browser from a remote location. The web page displays the current status of the stepper motor upon entering the server board’s IP address. Users can view the stepper motor’s status and modify it by clicking on it, subsequently updating the system. Additionally, the temperature of the room is regularly monitored and displayed, refreshing the results every hour. This functionality enables remote access to the entire industry through the client’s local browser. In this industrial setting, a single AVR board serves as both a data acquisition/control system and a web server, resulting in a compact system with reduced complexity.

Figure 3: Web Page Shows Status of Temperature Sensor


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.


Persistence, inspiration, and motivation stand as pivotal factors contributing to the success of every endeavor. We extend our heartfelt appreciation to our esteemed Project Guide, Prof. Mrs. M. S. Biradar, whose guidance sparked our interest in the project and led us to explore an entirely new idea. Their keen cooperation and assistance were invaluable in overcoming various challenges. We also express our sincere gratitude to HOD Prof. Mr. B.R. Jadhavar for his kind cooperation and guidance, steering our project towards successful completion.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

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

Scroll to Top