Share this

Research on Remote Control System Based on AVR Microcontroller

2026-04-06 03:40:04 · · #1
Currently, Ethernet and TCP/IP protocols have become among the most commonly used network standards. Their high speed, reliability, layering, and scalability make them increasingly flexible in various fields. In many cases, using Ethernet and TCP/IP can simplify the structure and reduce costs. Utilizing Ethernet to achieve remote control of industrial systems and sharing information from small embedded devices via the Internet is a developing trend in industrial control research. This system uses the high-speed single-chip microcomputer ATme... With the increasing popularity of the Internet, various household appliances, instruments, and data acquisition and control equipment in industrial production are gradually becoming networked to achieve distributed remote monitoring, information exchange, and sharing. Currently, most intelligent devices and instruments use RS232/485 or USB communication methods and lack remote control and data transmission capabilities. Utilizing Ethernet to achieve remote control of industrial systems and sharing information from small embedded devices via the Internet is a developing trend in industrial control research. This system uses the high-speed ATmega64 microcontroller and RTL8019AS Ethernet controller. It employs embedded TCP/IP protocols to implement network functions such as TCP and UDP, and further implements HTTP protocol services, enabling Web Server and Internet access. 1. System Hardware Design The system's block diagram is shown in Figure 1. The ATmega64 is a low-power 8-bit CMOS microcontroller based on an enhanced AVR RISC architecture. It has 64KB of Flash, 2KB of E2PROM, and 4KB of SRAM. Due to its advanced instruction set and single-clock-cycle instruction execution time, the ATmega64 achieves a data throughput of up to 1MIPS/MHz, thus meeting the system's requirements for power consumption and processing speed. The RTL8019AS is a highly integrated 10MB Ethernet controller, compatible with NE2000, supporting 8-bit and 16-bit data buses; it has a built-in 16KB SRAM cache; it can connect to coaxial cables and twisted-pair cables and can automatically detect the connected media. The Ethernet isolation filter is a 20F00IN. The RTL8019AS interfaces with the main processor in three ways: jumper mode, PNP (plug and play) mode, and jumperless mode. Pin 65 JP of the RTL8019AS determines the network card's operating mode. In this design, pin JP is connected to a high level (VCC), i.e., using jumper mode, which eliminates the need for an external E2PROM 93C46 chip. The microcontroller accesses the Ethernet controller via I/O mode. The RTL8019AS must operate in 8-bit mode, with its pin IOCS16B grounded via a resistor. The circuit block diagram is shown in Figure 2. The RTL8019AS itself has address decoding capabilities; all control functions or data transmissions are accomplished by accessing registers with address offsets of 00H to 1FH, thus requiring only 5 address lines (SA4 to SA0). In jumper mode, the I/O address of the RTL8019AS is determined by pins IOS3 to IOS0. When all pins corresponding to IOS3 to IOS0 are connected to a low level, the I/O base address of the RTL8019AS is 300H. Therefore, SA8 and SA9 can be used for chip selection connected to the microcontroller's PC7. When the PC7 pin is high, the RTL8019AS is selected; when the PC7 pin is low, the external RAM is selected. Grounding the chip select signal AEN saves the need for an inverter. AUI is used to detect the usage of the external MAU at the AUI interface. When this pin is not in use, it should be grounded. The media selection is determined by pins PL1 and PL0. The RTL8019AS also has an automatic function to test whether the media connection is successful. Unshielded twisted pair (UTP) cable is currently the most widely used type of telecommunications media. To facilitate the integration of the embedded Ethernet module into the local area network, this design uses an interface circuit that connects the RTL8019AS to a twisted-pair cable, grounding PL0 and PL1. 2. Ethernet Controller Operation The Ethernet controller's RAM is stored in pages of 256 bytes each, using a page-based storage structure. The high 8 bits of the 16-bit RAM address are called the page number. The 16KB RAM of the Ethernet controller has addresses from 0x4000 to 0x7FFF, i.e., from page 0x40 to page 0x7F, totaling 64 pages used for receiving and sending data packets. This 64-page RAM is a dual-port RAM. Dual-port means that two buses are connected to this RAM: bus A is used for the Ethernet controller to read/write to the on-chip RAM, and bus B is used for the microcontroller to read/write to the RAM on the Ethernet controller. Bus A is also called Local DMA, and bus B is also called Remote DMA. 2.1 Data packet sending process (1) Packet encapsulation: Before sending, the microcontroller encapsulates the data packet according to the Ethernet frame format shown in Figure 3 and stores it in the external SRAM. (2) The data packet is written to the data transmission buffer of the RLT8019AS through remote DMA. The starting address and number of bytes of the data destination buffer are set by the internal registers RSCR0 and 1. (3) The data is sent to the FIFO buffer for transmission through the local DMA of the RTL8019AS. 2.2 Data packet receiving process (1) The local DMA stores the data packet to be received into the receive buffer ring. (2) The remote DMA writes the data packet in the receive buffer ring into the external SRAM. If the Ethernet controller is running normally, the local DMA will be automatically started to store the data into the receive buffer ring when the data packet is received. That is to say, the first step is automatically completed by the RTL8019AS. However, the range of the receive buffer ring needs to be set. PSTART and PSTOP are used to set the start page and send page of the receive buffer ring, respectively. After the receive buffer ring is set, the position of the first received data packet is determined by the current page register CURR. 3. Server-Side Operation Process Figure 4 shows the TCP/IP protocols at each layer of this system. The link layer protocols are implemented by the RTL8019AS microcontroller, while other protocols are implemented by the microcontroller's internal program. When the server receives data, the Ethernet driver is responsible for receiving the data. The Ethernet controller interrupt handler wakes up the data receiving task, which then hands the received data frame to the network interface layer. The network interface layer extracts the frame header and determines the type of the received data. If it is an ARP packet, it is handed over to the ARP protocol module for processing; if it is an IP packet, it is handed over to the IP protocol module for processing. The IP protocol module extracts the IP header information and then, according to the packet type, hands the packet over to the corresponding protocol module (UDP module, TCP module, or ICMP module) for processing. After receiving the packet, the UDP or TCP module extracts the header, processes it, and then hands the user data over to the application program. When the server sends data, it hands the user data to the UDP or TCP protocol module for processing. The UDP or TCP module encapsulates the header and data into UDP or TCP packets, and then hands the encapsulated packets to the IP protocol module. The IP module adds an IP header to the packets from the upper layer, encapsulates them into IP packets, and then searches for a route for the IP packets. If no suitable route is found, an error message is sent to the ICMP protocol module for processing. Once a suitable route is found, if it's an Ethernet connection, the packet is sent to the network interface layer. The ARP protocol is used to find the physical address corresponding to the destination IP, and then it's encapsulated into an Ethernet frame. The network card driver then sends the Ethernet frame out. 4. Implementing Web Reception and Transmission Control Data Using the HTTP Protocol Implementing the HTTP protocol server function in a microcontroller system allows providing hypertext information to other clients. Clients only need to use a unified browser to exchange information with the server. Hypertext Transfer Protocol (HTTP) is currently the most common way to exchange information over the Internet. On the Internet, HTTP communication often occurs over TCP/IP connections. Its default port is TCP port 80, but other ports can also be used. The HTTP protocol is based on a request/response model. First, the client establishes a TCP connection with the server and sends a request containing the request method, URI, protocol version, and relevant MIME (Multipurpose Internet Mail Extensions) style messages. The server responds with a status line containing the protocol version, a success or failure code, and relevant MIME style messages (containing server information, resource entity information, and possible resource content). In addition to HTML files, the microcontroller server also includes an HTTP daemon to respond to control requests from the computer. A web interface written in HTML files can be accessed through a browser and uses corresponding buttons to send HTTP requests to the server, which are sent to the URL specified by the IP address. The daemon receives the request, performs the necessary operations, and then sends back the requested file. During this process, the data sent and received over the network is divided into one or more packets. Each packet includes: the data to be transmitted; and control information, which tells the network how to process the packet. TCP/IP determines the format of each data packet. Figure 5 shows the network control interface seen through a web browser. The IP addresses of the client computer and the server system must be set in the same segment. For example, the server IP address of this system is set to 192.168.0.10, the client IP address is set to 192.168.0.11, and the default gateway is 255.255.255.0. (1) Sending control data process: ① Send an HTTP request to the server system (microcontroller) through the browser; ② The server system uses the HTTP service program to view the changes of the input variables in the form of the web page program; ③ Take out the variable value and call the serial port program to send the data. (2) Receiving data acquisition process: ① The system HTTP protocol program calls the serial port program in http_serve to receive serial port data and uses this data to replace the "NO DATA" mark in the table of its internal web page; ② The server system sends the web page to the browser of the user interface. Using a low-cost AVR microcontroller and Ethernet controller, and with appropriate network protocols, data acquisition and system control of RS232 interface devices through the network are realized. With appropriate modifications and extensions, it can be used for instruments with other interfaces and applied to a wider range of fields. Since the controller of the system uses a microcontroller, the web page file cannot be too large due to its internal resources. References [1] He Suqin. TMS320C2000 series DSP principle and practical technology [M]. Beijing: Electronic Industry Press, 2003. [2] Jia Yunfei, Wang Jingqin. Research on data transmission using microcontroller to control Ethernet network card. Network and Bus, 2003, (6): 41. [3] Yan Baozhong, Yu Linghong, Wang Renlong. Research on Web server based on AVR high-speed microcontroller. Applied Technology, 2006, 33 (3): 25. [4] J. Magid. Web server technology guide. Translated by Li Qian. Beijing: Machinery Industry Press, 1996. [5] Network Working Group: RFC 2616 - Hypertext Transfer Protocol——HTTP/1.1.
Read next

CATDOLL Kelsie Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22