In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
How to use Arduino UART-WiFi module to do web server, in view of this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
I. hardware preparation
1. There are two main types of hardware to choose:
One is the officially recommended Arduino WiFi Shield (more expensive, about 300,400 yuan on Taobao; but the information is complete)
One is the UART-WiFi module, which not only supports Arduino, but also supports all serial ports of the single-chip microcomputer can communicate with its module (about 100 yuan, Taobao, less information).
Finally chose the UART-WIFI module, but also took a bumpy road, perhaps to a lot of things.
2. Introduction of UART-WIFI module
Picture
Interface
Double row (2 x 4) pin interface
Support baud rate range: 1200~115200bps
Support hardware RTS/CTS flow control
Single 3.3V power supply, 300mA
Wireless
Support for IEEE802.11b/g wireless standard
Support frequency range: 2.412 to 2.484 GHz
Two types of wireless networks are supported:
Basic network (Infra) and ad hoc network (Adhoc)
Multiple security authentication mechanisms are supported:
WEP64/WEP128/ TKIP/CCMP (AES)
WEP/WPA-PSK/WPA2-PSK
Support for fast networking
Support for wireless roaming
Other
Supports a variety of network protocols:
TCP/UDP/ICMP/DHCP/DNS/HTTP
Both automatic and command modes are supported
Supports serial port transparent transmission mode
Support for AT+ control instruction set
Multiple parameter configuration methods are supported:
Serial port / WEB server / wireless connection
3. UART-WIFI module configuration
Because the UART-WIFI module needs 3.3V and 300mA input, while the Arduino can only provide 3.3V and 50 mA, directly connecting to the Arduino will lead to the 3.3v output of the arduino. The actual measurement is only about 2.3V, so the UART-WIFI module can not be used normally.
Three configurations
Configuration 1: external power supply
Configuration 2: an upgraded development board (Freaduino) compatible with official Arduino can be used. Freaduino uses 1117-3.3V output 3.3V power supply, maximum current 800mA. Arduino only provides 5V power of 500mA, while Freaduino changes the original LDO design to DCDC, which can provide up to 2A 5V power.
Configuration 3: adapter board (no suitable adapter board has been found, not verified, but the principle should be the same, increase current)
Second, test the UART-WiFi module
Method 1: use UART-WIFI configuration manager to manage
Connect the UART-WIFI module to the serial port connection board, and turn on the power after connecting the serial port cable.
Tips: 1. The reset and gnd of Arduino can be connected to use as a serial port adapter board; when 2.Arduino is used as a serial port adapter board, RX must be connected to UART-WIFI module RX;TX to UART-WIFI module TX.
Start the UART-WIFI configuration management program and select the connection port number of the module from the list of ports. If you are not sure, you can choose automatic (frequency set to 9600)
Click "exit transparent mode"
Click "search module". If the connection port is selected "automatic" and the computer has multiple serial ports, it may take a long time to search, as shown in the following figure:
Modify the corresponding configuration of the module
Method 2: through the built-in WEB server, using the IE browser to configure the parameters through the web page
Using pc, search for and connect to the ap of the module. Must ensure that the module is successfully connected to the network
The default port number of the WEB server is 80, so just enter the address in the browser's address bar. For example: 192.168.1.100
Enter the account password of the WEB server (default account: admin default password: 000000)
The configuration page of the web page is shown in the following figure. If you want to modify the configuration parameters of the wireless module, simply click the corresponding "save" button after the modification is completed and submit the modification.
Third, realize wifi webserver
Step 1: configure parameters (using both the hypervisor and web backend)
Protocol type: TCP
Cpact S mode: server
TCP expiration time: 2s
Port number: 8080
Sta mode
SSID name
Encryption mode
Wireless router password
Wireless parameters
Automatic working mode
Step 2: write arduino and upload the code to the board
Void setup ()
{
Serial.begin (9600)
}
Void loop ()
{
Boolean currentLineIsBlank = true
While (1) {
If (Serial.available ()) {
Char c = Serial.read ()
/ / if you've gotten to the end of the line (received a newline
/ / character) and the line is blank, the http request has ended
/ / so you can send a reply
If (c = ='\ n'& & currentLineIsBlank) {
/ / send the webpage
Serial.println ("HTTP/1.1 200OK\ r\ nContent-Type: text/html\ r\ n\ r\ nHello wordstones! I am WiFi WebServer")
Break
}
If (c = ='\ n') {
/ / you're starting a new line
CurrentLineIsBlank = true
}
Else if (c! ='\ r') {
/ / you've gotten a character on the current line
CurrentLineIsBlank = false
}
}
}
}
Note: do not enter three "!" in a row. Which will cause the upload to mega2560 to fail
Schematic diagram:
Step 3: open the browser, access the ip address of the board, and verify the results. Take 192.168.103purl 8080 as an example
The answer to the question about how to use the Arduino UART-WiFi module to do the web server is shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.