Serial Communication SMS GPRS

Source: Internet
Author: User
Tags domain name server
Serial Communication Using C # And Whidbey
Implementing SMS quiz server using GSM Modem enabled mobile phone

Research on New Methods for GPRS data transmission
Research of data terminal based on GPRS Remote Monitoring System

Design and Implementation of GPRS transmission Static Image System (details)

GPS graphics navigator Based on GPRS network
Implementation of Wireless Monitor System Based on GPRS street lamp

Research on the Application of GPRS-based socket communication (details)

Key to GPRS data terminal design PDF
GPRS/CDMA Data Collection System Problems

GPRS data transmission application
PPP scenario: At + cipcsmp = 1, "cmnet"
connection server: At + cipstart = "TCP", 218.246.31.188, 2020
OK
connect OK
query PPP status: At + cipstatus
8
OK
send information to the network server: at + cipsend
Hello (^ Z)
send OK
receive data from the network server: Hello
disable the TCP connection: at + close
OK
close PPP connection: At + cipshut
OK

4. Computers access the Internet through built-in modem
M55 supports connection to the Internet using the built-in modem of the mobile phone on the computer or laptop. Because there is no infrared ray, the connection between the computer and the mobile phone is only through the data cable, which can be a comport or USB port.
1. Use the Siemens GPRS assistant in SDS to access the Internet. The installation is simple. Follow the prompts to proceed step by step.
2. Another simple general method
Take Windows 98 as an example. The 2000 and XP operations are similar.
1) first install the modem in the control panel, select "do not detect the modem, directly select from the list", and then select the standard modem on the left of the window, select the standard 19200 modem on the right side, next, select the COM port, and click Next.
2) Add a dial-up connection. Go to the dial-up network on my computer (if no dial-up network is installed, go to control panel-add and deleteProgram-Install the dial-up network in the Windows component), then select Add new connection, select the new standard 19200 modem, and click set to set the fastest speed to 57600. Next, enter ** 99 *** 1 # In the phone number to complete the next step.
3) set the APN, select Advanced attributes from the modem, and fill in at + cgdcont = 1, "ip", "cmnet" in the additional settings "; ^ sgauth = 1 and click OK.
4) double-click the connection you just created to access the Internet through your mobile phone.
PS: how to configure MMS and email in the next articleArticleDetailed description.

What are the IP addresses of data centers?

A:
1. fixed IP Address
From the perspective of reliability of system operation, it is best to have a fixed IP address in the data center. In addition, this will add new and more powerful functions (such as wireless video monitoring) to the system in the future) it is also very convenient, but you need to pay a large monthly rental fee to apply for a fixed IP address, and if the data collection system itself is not large, it will be even more economical.
2. Dynamic domain name resolution
You can also resolve the IP address of the data center through domain name resolution.
When you apply for a Domain Name Service from your ISP (Internet Service Provider) and configure the domain name to the GPRS/cdma dtu, DTU can connect to the server through domain name resolution each time you dial, the server does not need a fixed IP address. The user needs to pay the domain name service fee to the ISP, which is usually much lower than the request for a fixed IP address. However, when domain name resolution is adopted, the stability of the system depends largely on the working status of the domain name resolution server, which is generally provided by the ISP.
3. ADSL dialing, Short Message notification IP Address
The customer can connect to the Internet through low-cost ADSL dial-up. The IP address obtained by each dial-up connection is dynamic. This IP address notifies every DTU in the GPRS/CDMA Data Collection System by short message, after receiving the short message, DTU connects to the client using this IP address.
In this way, no monthly rental fee is required. The disadvantage is that after each ADSL dial-up, if you want to transmit data, you must use a short message to notify the IP address of each DTU data center. This method is especially suitable for situations where data transmission is not frequent and DTU is not always online.
Our GPRS/cdma dtu supports all of the above methods. Customers can choose flexibly based on their actual networking needs. In particular, in the third way, our company has thoroughly analyzed the customer's needs and provided flexible and powerful work methods for Short Message control connections. For example, short messages start TCP connections, Short Messages disconnect TCP connections, Short Messages modify passwords, Short Messages modify DTU IDs, and so on.

3 Software Design of Image Transmission System
3.1 design purpose
Software design objective: to control the communication process of mobile terminals by sending AT commands to the GPRS module, so that the mobile station can access Intemet through gateways and routes provided by GPRS, the TCP/IP network protocol is used to transmit image data between the monitoring center and the Internet.

Based on the above requirements, the communication software is designed, that is, the GPRS client software and the server software.

3.2 GPRS wireless module communication instructions

The software part of the wismo 2D module provides an AT Instruction Set for controlling system operations. By receiving at commands from UART, interpreting and performing corresponding operations, the software part of wismo 2D module implements the corresponding function of wireless modem.

Because the program is too long, only the main AT commands used for TCP transmission are listed:
At + cgreg = 1; // set the GPRS registration status
At + cgatt = L; // GPRS network attachment
At # apnserv = "cmnet"; // sets the GPRS Access Point
At # apnun = ""; // The authentication username is blank.
At # apnpw = ""; // The authentication password is blank.
At # connectionstart; // connect to the CPRs network to log on to the Internet and return the dynamically assigned IP address.
At # tcpserv = "202.112.135.203": // sets the Server IP address, that is, the IP address of the monitoring center.
At # tcpport = "6000": // set the socket port for communication between the server and the client:
At # otcp; // open the TCP connection to the remote server

After the TCP connection is successful, the GPRS module enters the data transmission status, and then the image data can be sent to the GPRS module through the serial port. The module sends the image data to the monitoring center through socket, and the monitoring center can also send response data to the module. After the data is transmitted, the control machine sends the ending character <etx> to the GPRS module, and the mobile terminal returns to the AT command receiving status.

3.3 GPRS client software

The client software running on the control machine has the following features:
(1) serial communication, including at command communication and data file communication.
(2) display the transmission time, used to test the transmission rate of the system.
(3) Stop the TCP protocol stack communication of the GPRS module. Stop the protocol stack when an error occurs during system transmission.

The buffer area of the TCP protocol stack embedded in q2406b is limited. If the serial port write rate is much higher than the GPRS transmission rate, the protocol stack will lose data. To ensure the reliability of data transmission, flow control is required. Two traffic control methods are used in the design: Data subcontracting method and hardware handshake method.

Figure 4 shows the flowchart of image file transmission on the GPRS client using the data subcontracting method. In this method, the image file is first packaged into several small data packets and written to the serial port one by one, which is sent by the GPRS module. The monitoring center server receives a packet and then returns the response frame. The GPRS module then sends the next packet. If the response frame is not returned after the timeout, resend the previous packet. This method sacrifices a certain amount of time, but ensures the reliability of image transmission.

The hardware handshaking method uses the hardware handshaking signal in the 9-wire serial port: RTS/CTS for stream control. When the system is working. The control machine starts the data stream of the GPRS module by using RTS, And the GPRS module starts and stops the data stream from the control machine by using CTS. When the data volume in the cache reaches a high level, the module sets the CTS line to a low level. After the control machine detects that the CTS is low, it stops sending data, until the data volume in the protocol stack cache is lower than the low level, the CTS is set to a high level.

This method also ensures that the written data is not lost, and the time consumed for transmitting image files is lower than the previous method. However, it cannot be used for simplified three-line serial port Protocol, nor can it detect packet loss during GPRS data transmission as in the previous method, and ensure the reliability of the transmission process through resending.

3.4 GPRS server software

The GPRS image transmission system connects multiple mobile terminals to the monitoring center server. The server adopts the Common Internet host mode. As a TCP server, the server has a static public network IP address. The Listener port is opened and can be accessed from outside. The server runs the TCP port listener, receives TCP data packets from the Mobile Station and sends response data to the mobile station. The process of receiving image files on the GPRS server using the data subcontracting method is shown in step 5. The software on the server has the following functions: (1) Listening to the TCP port; (2) receiving data packets, sending and receiving response frames; (3) displaying the received data and size, saving image files.

Two stream control methods are designed for the sending end of the system, one for hardware implementation and the other for software implementation. When the network is stable, the transmission speed is faster. The latter can effectively ensure the stability and reliability of the entire GPRS transmission process and can be directly used for the simplified three-line serial port protocol. When the control machine uses an embedded microprocessor, it can be easily connected to the microprocessor serial port, no need for serial conversion chips.

Using the General GPRS Service provided by China Mobile for testing, the transmission rate of the system can reach 10 Kbps. In the case of a large number of tests, no data loss occurs, and the entire system is stable and reliable. At the same time, it can be used to transmit any form of file data and apply it to systems that require remote data transmission.

3. Create a socket connection command

The following describes some AT commands used in socket communication [2.

3.1 Basic settings

① Gprs isp code.
At + iisp1 = * 99 *** 1 # // universal nationwide

② Login username.
At + iusrn = WAP // GPRS network login name

③ Logon password.
At + ipwd = WAP // GPRS network logon Password

④ Modem type.
At + imtyp = 2 // define the GPRS Modem

⑤ Initialization command.
At + IMIS = "at + cgdcont = 1, ip, cmnet"

⑥ Domain Name Server.
At + idns1 = 211.136.18.171
// DNS server address, universal nationwide

7. Expansion code (XRC ).
At + ixrc = 0

3.2 socket settings

① Establish a TCP communication.
At + istcp: 218.66.16.173, 1024 <CR>
Establish a socket connection. 218.66.16.173 is the IP address of the computer in the Application Service Center (the actual address is determined by the actual situation), and 1024 is the port number (the port number is determined by the socket port listening program setting in the center ). If the connection is successful, lt8030 returns I/xxx. XXX is the handle number of this socket connection in lt8030. The central listener displays the IP address of the connected terminal. If the connection fails, lt8030 returns I/error (XXX ). XXX is incorrectCode.

② Send data.
At + mongod %: XXX, <String Length >:< string>
Send data. XXX is the handle, <string length> is the length of the character to be sent, and <string> is the data to be sent. After the message is sent successfully, you can view the data sent by the terminal in the center. You can send up to 5 kb of data at a time.

③ Query the socket status.
At + ISST: XXX <CR>
Query the socket status. XXX is the handle. Lt8030 returns I/<socketstat>. If <socketstat> = 000, the connection to the port is normal. If <socketstat> is ≥1, lt8030 receives the number of bytes in the buffer from the center through this port; if <socketstat> <0, the socket is incorrect.

④ Receive data.
At + isrcv: XXX <CR>
XXX is the handle. This command reads the data received by the lt8030 from the center through the handle, and the data in the buffer exists. The buffer can store up to 30 kb of data.

⑤ Disable the socket channel.
At + iscls: XXX
Close the socket channel. XXX is the handle.

4 Program Design

According to the communication protocol between the microcontroller and the GPRS module, the serial port of the microcontroller is set to method 1, the baud rate is 9 600 bps, 8-bit UART, 1-bit start bit, 1-bit stop bit, no parity check. After power-on, send the basic setup command to the GPRS module, that is, the ISP code, user name, and user password frame. The ISP code must be "* 99 *** 1 #", the user name and password can be set at will, but cannot be blank. You must set these parameters correctly before using the lt8030 GPRS function. Once the parameter is set, it is permanently saved and does not need to be reset later (the above is the default parameter when lt8030c is released ). Then, send the socket setting frame to the GPRS module. If the frame is set up successfully, the point-to-point communication environment is established, and then the data frame is called.

After power-on, the program runs in the main function and the microcontroller initializes the program. Initialization includes setting the serial port working mode and baud rate, and initializing variable parameters and flags.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.