wireless Datalogger Configuration Principle
The core of Wifi is actually to use various methods to send the SSID and password of the AP ( Router ) to be connected to the WIFI device( Datalogger ) that requires networking equipment, and then the WIFI device connects to the designated WIFI network to achieve the purpose of accessing the LAN or the Internet.
Inside Shinewifi-F, Shinewiif-S or Shinewhifi-X series, ESP chip has been used, ESP chip is manufactured by great Chip Company called Lexin in China. When we configure datalogger via Shinephone or AP mode, they have used SmartConfig technology etc.
Here attached 2 configuration principle
When we use Shinephone to configure wireless datalogger, actually we are using SmartConfig technology. The technical essence of smartconfig is UDP broadcast .Smart config refers to sending multicast or broadcast from a device (usually a mobile phone) connected to the router. Wi-Fi devices that are not connected to the router can receive this information and connect to the router to achieve one-click network configuration of the device.
ESP8266 and ESP32 use the ESP-Touch protocol, which is suitable for SmartConfig technology developed by TI. SmartConfig, also known as Quick Connection, is used to connect new Wi-Fi-based IoT devices to Wi-Fi networks. When the current device has not established any actual communication links with other devices, configure the device to access WIFI with one click.
The basic principle of smartconfig network distribution is to send messages directly to the network equipment to be distributed through the mobile phone. The mobile phone sends a UDP broadcast message, and the network device to be configured scans all available wireless channels, finds the message sending smartConfig, and locks on this channel to start receiving data.
Smartconfig completes the network configuration in the following three steps:
1.The datalogger like Shinewifi-F, Shinewifi-S, Shinewifi-X etc. enters the initialization state and starts monitoring nearby WiFi data packets. 2. After setting the WiFi name and password on your phone, send a UDP broadcast packet via Router 3. The datalogger like Shinewifi-F, Shinewifi-S, Shinewifi-X etc. obtains the configuration information through the UDP packet (length), switches the network mode, connects to the home WiFi, and the configuration is completed.
The following is the encapsulation format of 802.2.
DA: Destination MAC address SA: source MAC address LENGTH: Indicates the length of the following data LLC: indicates LLC header SNAP: represents 3byte manufacturer code and 2byte protocol type representation DATA: payload data FCS: frame check sequence
Sender: You can use 2 different encoding sending methods, UDP broadcast and multicast;
1. UDP Broadcast
From the 802.11 frame format analysis, we know that from the perspective of the wireless signal monitor, regardless of whether the wireless channel is encrypted or not, the DA, SA, LENGTH, LLC, SNAP, and FCS fields are always exposed. Therefore, the signal monitor can learn from these 6 fields. field to obtain valid information. From the sender’s point of view, due to the limitations of the operating system, if broadcast is used, only LENGTH can be controlled by the sender by changing the length of the data packets it needs to send. Therefore, as long as a set of communication using length encoding is specified protocol, you can use the Length field of the data packet for data transmission;
DATA is not good. So plan to start with other fields. Most of the fields cannot be obtained by mobile phones. The most suitable ones are only the length field.
2: UDP multicast
Multicast addresses are reserved Class D addresses from 126.96.36.199-188.8.131.52
The mapping relationship between IP address and MAC address is: set the first 25 bits of the MAC address to 01.00.5e, and the last 23 bits of the MAC address correspond to the bits of the IP address;
Therefore, the sending end can encode the data in the last 23 bits of the multicast IP, send it through the multicast packet, and the receiving end can decode it;
The current mainstream IOT wifi solutions
|Manufacturer||Chip Solution||Technology Name||Packet Type|
|1||TI||CC3200||SmartConfig||Send udp packet to a fixed IP|
|3||联发科 MTK||MTK7681||SmartConnection||Multicast address encoding|
|4||MARVELL||MC200+8801/MW300||EasyConnect||Multicast address encoding|
|5||Reltek||AMEBA||SimpleConfig||Multicast address encoding|
|6||乐鑫 ESPRESSIF||Esp8266||SmartConfig||Multicast, via length encoding|
|7||新案线||NL6621||SmartConfig||Multicast address encoding|
|8||微信 Wechat||AirKiss||Broadcast across the entire network, via length encoding|
Simple and easy to use, you only need to enter ssid and password on the mobile phone via relevent APP
1. The transmission speed is slow, limited by the principle of smartConfig. The fastest one packet can transmit 23-bit data. If you want to make a product, you must also consider issues such as security, leader packets, data verification, and packet loss, resulting in a limited success rate. 2. Router compatibility is a big problem. Due to the rapid development of routers, the internal logic of the models is also diverse, such as: 2.1 Some routers do not forward multicast broadcast packets, which will also reduce the success rate of the device receiving data. 2.2 Router frequency band problem. Nowadays, common Wi-Fi modules usually only have the 2.4GHz frequency band, so they can only communicate with routers in the 2.4GHz frequency band. Today's routers generally have two frequency bands: 2.4GHz and 5GHz. During actual operation, users may misuse the router in the 5GHz band, causing the Wi-Fi device to be unable to receive data. 2.3 Some routers now also have mimo and mumimo functions, and the Wi-Fi module may have a single antenna, resulting in incomplete reception of data sent and received, eventually leading to failure.
2. SoftAP Configuration
SoftAP network configuration, first, the WIFI device to be configured will establish an AP. The user will connect a smartphone or other device with human-computer interaction function to this AP, and then send the device information to be connected to the WIFI device to be configured. After receiving the information, the WIFI device to be configured will find the corresponding AP and actively connect to it to complete the network configuration.