Home > other >  Simple setup ESP8266 remote two-way communication via the Internet or LAN computer mobile phone and
Simple setup ESP8266 remote two-way communication via the Internet or LAN computer mobile phone and

Time:10-01



Settings ESP8266 for service and support computers, mobile phones, and other client remote connection via the Internet routing ESP8266 service stations under the WIFI, two-way communication,

Do the following steps down, can the two-way communication, with this routine with 51 single-chip microcomputer control 8266 is well understood,

I don't have a special USB adapter plate, so use the technology of single-chip microcomputer in the switch board's CH340, chips and cable connection as shown in figure, the online tutorials are many, also have ready-made adapter plate, I will not wordy,

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
The AT
Response to OK, said PC serial debugging software via USB serial port connected to the 8266 hardware communication has good

The AT + CWMODE here=1 mode option 1 or 3 you can

The AT + CWJAP="wifi name", "wifi password
"
Response to OK, said 8266 connected to the WIFI wireless communication has good

The above Settings set it only once and module ESP8266 power, set up also is not lost,

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
AT + CIFSR IP query command, record 8266 assigned IP network, the above three commands map is as follows:

In IP router setting with MAX address binding, make routing even restart, 8266 assigned to the network IP won't change,

Outside the firewall Settings in the router network to network IP port forwarding, port number 11853

View the communications company in the router to router distribution of external Internet IP, restart the router IP will change the network,

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
The AT + CIPMUX=1 must be set for multipath links

The AT + CIPSERVER=53 set the port number is 11853 8266 1118, 1 said remote connection

More than two sets, 8266 cannot save, when the power is back on the electricity needs to be set up after 8266, the client can be connected,

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ client through the network to connect to the ESP8266 service \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

Turn off the phone and WLAN open 4 g mobile data model into the external Internet,
Open the phone APP, I use the name of the APP a TCP connection, point connection, input the router outside the network IP and port number 11853, began to link




\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ client sends data through the network to the ESP8266 service \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

After the connection is successful, using a mobile phone APP to send data to the 8266,

After 8266 received, displayed:
+ IPD, 0 4: this is sent to the mobile phone through the network of 8266 data!!

Road is 0, 0, said data message from the client (phone)
36: said a total of 36 bytes of data
This is sent to the mobile phone through the network of 8266 data!! - is receiving data

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ESP8266 service station to send data to the external client (phone) \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
The AT + CIPSEND=0, 20 sent to the client (phone) 0, send the number of bytes in 20

A123456789B123456789 send 20 data


\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ network PC via LAN to send data to the ESP8266 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
Need to set into the client PC mode,
The IP address of the server address is 8266,
Service port number is: 11853

LAN PC sends data to the 8266.

\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ESP8266 through local area network to send data to the network PC \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
The AT + CIPSEND aiaa=1
1 on behalf of the client (PC)
32 data quantity of


\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
The AT + CIFSR IP query command

The AT + RST restart the module

The AT + RESTORE factory default

finally long-winded, every command to add carriage returns, send again, or sometimes command execution is not successful,

CodePudding user response:

Above is just what should understand the use of 51 single-chip microcomputer control ESP8266 two-way communication,
Specific application, I haven't thought of need this module communication scenarios, about remote control a few street lamps, isn't it a little too simple
I was hoping to take the demand of some data transfer scene,,,,
Going to do the PC with Labview software,
I don't know, cell phone APP introduction to write software with what is better? I made the android, teach,,,

CodePudding user response:

I don't have never failed to android, ask counsel,,,

CodePudding user response:

Initialization of the network reference a 51 esp program, after power on, can through WIFI connection esp,
Burning program on STC needs 5 V voltage, need to switch back to the 3.3 V at work, I forgot to switch back when the debugger, burn a piece of ESP8266, it's too bad.

#include

Unsigned char * STR.//send the char string


/* * anti-fuzzy serial initial function/
Void Serial_Inti ()//serial port initialization, must be careful not to start the T1 serial port interrupt
{
SCON=0 x50;//REN=1 allows serial accept state, serial working mode 1
TMOD |=0 x20;//TMOD=0 x20: use the timer 1, 8 bit automatic timer
PCON |=0 x80;
TH1=0 XFD;//baud * 2 * 19200 baud rate, data bits, stop bit 1, efficacy without (11.0592); Set up 8 automatic timer timing time,
//TH1=0 xf3;//baud * 2 * 4800 baud rate, data bits, stop bit 1, efficacy without (12 m)
TL1=0 xf3;//formula TL1=256 - fosc (SMOD + 1)/(32 * 12 * baud rate)
TR1=1;//TR1=1: to enable the timer 1
}

/* string sent a subroutine (used to configure) */
Void Uart_Sends (unsigned char * STR)
{
While (* STR!='\ 0')
{
SBUF=* STR;
while(! TI);//waiting to send complete signal appears (TI=1)
TI=0;//remove send interrupt flag bit to continue to send
Str++;
}
}

/* delay program */
Void Delay1ms (unsigned int j)
{
While (j> 1) {j -; }
}

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related