Remote robot control based on Boa-web server (network version)

Publisher:太和清音Latest update time:2015-07-10 Source: 51heiKeywords:Boa-web Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
I took the course of intelligent robots last semester because of my passion for them, although I failed the course because I didn’t submit the assignments in time, o(︶︿︶)o (ps: teacher, if you see this article I wrote, please have mercy on me and change my grade),

I remember that the teacher of this course first talked about the basic application and programming of single-chip microcomputers, and then introduced us to the tiny6410 development board at the end of the course. Later, I went to check the relevant information and felt that it was feasible to use this board to make a remote-controlled robot, so I just bought the tiny6410 development board of Friendly Arm (ps: This cost me 600 yuan, teacher, you have to change my grade to a passing grade). For detailed information about this development board, please refer to the attachment or the relevant documents released by the official website of Friendly Arm.

Hardware Resources

First, let's take a look at the interfaces of tiny6410:


 

 From the layout of tiny6410, we can see that it provides quite a lot of hardware resources.

    Software Resources

    Next, let's take a look at the software resources of tiny6410.

Tiny6410 can be equipped with Linux, Android, and WinCE systems. The following is a brief introduction to the Linux system.


 

Development Road--Network

1. Development ideas

When it comes to Linux, many people will think of embedded development and network servers under Linux. However, embedded development is somewhat difficult for people who study electronics, so we can use network servers under Linux to do some development. [page]

The web servers for Linux include Hapd, Thttpd and Boa. Among them, the Boa server has open source code, excellent performance, and supports CGI common gateway interface technology, making it more suitable for web development. The Boa server can interact with external applications and scripts through CGI. According to the method used by the client browser when making a request, the server will collect the information provided by the client and send the information to the specified CGI extension program. The CGI extension program processes the information and returns the result to the server. The server then analyzes the information and sends the result back to the client to display on the browser. In fact, this is the B/S (browser/server) model, which can be represented by the following figure:


 

This mode will be the main mode for remote robot control development based on Boa-web server. The following is the description of this mode!!!

As shown in the figure:

1. The browser can be a browser under Windows or a browser on a mobile phone. The control end is just an HTML web page.

2. Web server is Boa server under Linux. Based on Boa server, a dynamic website can be established, through which information exchange between embedded devices and users can be carried out.

3. CGI part. CGI is a scripting language that can be used with Perl, PHP, and C language. In order to facilitate the construction of dynamic websites, this development is mainly based on PHP+CGI.

4. Application program. In fact, in this development, the application program is a CGI program. These CGI programs process the information transmitted by the user through the Boa server, and then call the hardware device of the development board through the hardware driver.

2. Construction of Boa and tftp server

   BOA server is to run on ARM embedded devices, so it is necessary to cross-compile BOA source files. The compilation tool uses the arm-linux-gcc-4.3.2 cross-compilation tool chain. Copy the file arm-lin-ux-gcc-4.3.2. tgz to the directory /tmp, and execute the command cd /tmp; tar zxvfarm-linux-gcc- 4.3.2. tgz-C /. In this way, the cross-compilation tool is installed in the directory /usr/local/arm/4.3.2. To ensure that the cross-compilation tool chain can be directly applied after opening the terminal, add the compiler path to the system environment variable in the /root/.bashrc file. Run the command gedit/root/.bashrc to edit the file /root/.bashrc. Add export PATH=$PATH:/usr/local/arm/4.3.2/bin at the end of the file. Save and exit. Then execute the source/root/.bashrc command to make the settings effective. Finally, check whether the cross-compilation tool is installed successfully. The command is to enter arm-linux-gcc-v in the terminal; if you can see the arm-linux-gcc version number 4.3.2 in the output information, it means that the installation is successful.

  Secondly, cross-compile BOA source code, copy BOA source code package boa-0.94.13.tar.gz to /tmp directory, decompress mask package tar zxvf boa-0.94.13.tar.gz; after decompression, enter the directory where BOA is located in the Linux terminal, first execute command ./con-figure to generate Makefile file, then open the folder, find Makefile file, open it with text editor, find CC=gcc, CPP=gcc-E two lines, set them to the cross-compilation tool path CC=/usr/local/arm/4.3.2/bin/arm-linux-gcc and CPP=/usr/local/arm/4.3.2/bin/arm-linux-gcc-E generated in the previous step, then save Makefile and exit, return to the terminal to execute make command, cross-compile to get executable program BOA, it is the executable file that can run on arm embedded device. You can view the file information through command fileboa. Copy this BOA file to the /bin directory of target board.

  Next, configure the boa server. The main purpose of configuring BOA is to enable it to support the execution of CGI programs. Create a BOA directory in the /etc directory of the file system with mkdir boa, copy the boa.conf file in the BOA source directory to the /etc/boa directory of the file system, and then modify it based on this configuration file according to the needs of the embedded BOA. When modifying this configuration file, you need to ensure that other files and settings must be consistent with the configuration file, otherwise the embedded Web server BOA cannot run normally.

After the Boa server is built, a www folder will appear in the root directory of the Linux file management. This folder is the storage directory of the dynamic website system mentioned above. If you want to read and write files of this website system, you need to use a tftp server. Through the tftp service, we can easily read and write files of the dynamic website system in the www folder. I will not introduce the construction of the tftp server here.

3. Boa server transplantation test

From the hardware resources of tiny6410, we can see that the development board provides four LEDs. Let's simply write a program to test remotely controlling the LEDs on the development board through the Boa server.

The procedure is as follows:

    <input type=“radio” name=“speed” value=“show” checked>Slow

  <input type=“radio” name=“speed” value=“normal”>Medium speed

  <input type=“radio” name=“speed” value=“rast”>High speed

  <input type="submit" value=confirm "name="submit>

  The leds.cgi program is as follows:

  #!/bin/sh

  Period=1+case$QUERY-STRING in

  *slow*)

  period=0.25

  ;;

  * normal *)

  period = 0.125

  ;;

  * fast *

  period=0.0625+;

  *fast * ) + period = 0.0626

  ;;

  esac

  /bin/echo $ period ? /tmp/led-control // passed to the application through the Query_String environment variable.

  echo “Content-type:texe/html;charset=gb2312”

  echo

  /bin/cat led =result.template

  exit 0

LED-control is a compiled executable application that controls the LED through the LED driver. These hardware data can be found in the PDF file provided by Friendly Arm. If other hardware devices on the development board are used, you can refer to the relevant data and call other hardware devices.

Next, assuming the IP of the development board is 192.198.1.230, you can directly visit http://192.198.1.230 to access the webpage of the Boa server, through which you can control the flashing speed of the LED on the development board. I won't post the pictures for this test for now, if you want to see them, you can come to my dormitory, hehe.

Conclusion

         The introduction of remote robot control based on Boa-web server (network version) is temporarily here. Next time, I will test calling other hardware. For example, I will make a development baseboard to control the rotation of the motor, and a remote-controlled robot can move. (*^__^*) Okay, I will stop here for now. Come on.......
Keywords:Boa-web Reference address:Remote robot control based on Boa-web server (network version)

Previous article:SST25VF driver program with stm32
Next article:NXP_LPC1114 delay function collection

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号