Template:EMW3162 Uart-Wifi App Guide

From Waveshare Wiki
Jump to: navigation, search

EMW3162 Uart-Wifi App Guide

Preparations

  1. Properly connect the EMW3162 module to the WIFI Shield.
  2. Connect the USB TO UART port to a PC, of which Wi-Fi function is needed.

Test the default configuration

  1. Open the Wi-Fi connection, and choose the connection of which prefix is MXCHIP.
    EWM3162 UARTWIFI02.jpg
  2. Run the software File:TCP232.7z
    • Set the COMSettings area as: PortNum: Choose the COM Port listed in the Device Manager; BaudR: 115200; DPaity: NONE; DataB: 8 bit; StopB: 1 bit. Then click Open.
    • Set the NetSettings area as: Protocol: TCP Client; Server IP: 192.168.1.1; Server Port: 8080. Then click Connect.
    Now it implements the Transparent transmission between the UART and the Wi-Fi:
    EWM3162 UARTWIFI04.jpg

Set to AP mode

Note: when the module is tested using the PC software, the USB to UART module should feature FT232 or FT230XS!
  1. The EMW3162 module is configured by UART commands. Please first connect the pin 30 to Low for entering command mode. When using the module with the WIFI Shield, you can switch BOOT to H and switch STATUS to L, instead of connecting the pin 30 to Low.
    EWM3162 UARTWIFI14.jpg
  2. Run the software EMW ToolBox(PC).
  3. Click the Refresh button to refresh the present COM port, and then choose the corresponding COM port, of which properties are set by default as:
    Default -> Baud Rate: 115200; Data Bits: 8; Parity: None; Stop bits: 1. Click Start button to use the COM port.
    EWM3162 UARTWIFI06.jpg
  4. Click "Load Paras from module".
    EWM3162 UARTWIFI07.jpg
  5. Set the Wi-Fi mode to Soft AP Mode, set the SSID, i.e. the name of the Wi-Fi connection (for example, here the SSID is Waveshare).
    Choose the Wireless Encryption and set the Wi-Fi KEY (for example, here the key is 123456789).
    EWM3162 UARTWIFI08.jpg
  6. Click the Local IP tab and set the IP address of the module (for example, here is 192.168.1.100)
    EWM3162 UARTWIFI09.jpg
  7. Click the TCP/UDP Connection tab and set the Protocol as TCP Server; Port, e.g. 8899.
    EWM3162 UARTWIFI10.jpg
  8. When setup complete, click "Save Paras To Module" to save the parameters.
    EWM3162 UARTWIFI11.jpg
  9. Connect the pin 30 to High to reboot the module which will run with the configured parameters. When using the module with the WIFI Shield, you can switch STATUS to H, instead of connecting the pin 30 to High. Now you can connect the PC to the corresponding Wi-Fi connection:
    EWM3162 UARTWIFI12.jpg
  10. Run the software File:TCP232.7z.
    • Set the COMSettings area as: PortNum: Choose the COM Port listed in the Device Manager; BaudR: 115200; DPaity: NONE; DataB: 8 bit; StopB: 1 bit. Then click Open.
    • Set the NetSettings area as: Protocol: TCP Client; Server IP: 192.168.1.100; Server Port: 8899. Then click Connect.
    Now it implements the Transparent transmission between the UART and the Wi-Fi:
    EWM3162 UARTWIFI13.jpg

Set to STA mode

Note: when the module is tested using the PC software, the USB to UART module should feature FT232 or FT230XS!
  1. The EMW3162 module is configured by UART commands. Please first connect the pin 30 to Low for entering command mode. When using the module with the WIFI Shield, you can switch BOOT to H and switch STATUS to L, instead of connecting the pin 30 to Low.
    EWM3162 UARTWIFI14.jpg
  2. Run the software EMW ToolBox(PC).
  3. Click the Refresh button to refresh the present COM port, and then choose the corresponding COM port, of which properties are set by default as:
    Default -> Baud Rate: 115200; Data Bits: 8; Parity: None; Stop bits: 1. Click Start button to use the COM port.
    EWM3162 UARTWIFI06.jpg
  4. Click "Load Paras from module".
    EWM3162 UARTWIFI07.jpg
  5. Set the Wi-Fi mode to Station Mode, and then input the SSID of a router to be connected.
  6. Choose the Wireless Encryption of the router and input the KEY.
    EWM3162 UARTWIFI15.jpg
  7. Click the Local IP tab and set the IP address of the module. Here we choose "Get IP address automatically". However, if you choose "Use the following IP address", make sure the IP address is not conflict with another system on the network.
    EWM3162 UARTWIFI16.jpg
  8. The expected result is that, the module can access server through router, here the server is emulated by the software File:TCP232.7z.
    • Set the NetSettings area as: Protocol: TCP Server; Local host IP: 192.168.1.121; Local host Port: 8899. Then click Listening.
    EWM3162 UARTWIFI21.jpg
  9. For emulating the communication between the module and the server, set the module for connecting the server.
    Click the TCP/UDP Connection tab and set the Protocol as TCP Client; Port: 8899; Server IP mode: IP address; IP Address:192.168.1.121 (according to the server).
    EWM3162 UARTWIFI19.jpg
  10. When setup complete, click "Save Paras To Module" to save the parameters.
    EWM3162 UARTWIFI11.jpg
  11. Connect the pin 30 to High to reboot the module which will communicate with the router and server automatically. When using the module with the WIFI Shield, you can switch STATUS to H, instead of connecting the pin 30 to High.
    • Set the COMSettings area as: PortNum: Choose the COM Port listed in the Device Manager; BaudR: 115200; DPaity: NONE; DataB: 8 bit; StopB: 1 bit. Then click Open.
    Now it implements the Transparent transmission between the UART and the Wi-Fi:
    EWM3162 UARTWIFI20.jpg

STA Mode with Dual Sockets

  1. Set another socket on the basis of the configuration of STA mode before. Set the Protocol of Connection 2 as TCP Server; Port: 8080.
    EWM3162 UARTWIFI23.jpg
  2. Run the software File:TCP232.7z
    • Set the COMSettings area as: PortNum: Choose the COM Port listed in the Device Manager; BaudR: 115200; DPaity: NONE; DataB: 8 bit; StopB: 1 bit. Then click Open.
    • Set the NetSettings area as: Protocol: TCP Server; Local host IP: 192.168.1.121; Local host Port: 8899. Then click Listening.
  3. Reboot the module and it will connect to the corresponding router and server.
  4. Open another window of TCP232 and set as:
    • Set the NetSettings area as: Protocol: TCP Client; Server IP: 192.168.1.169 (this IP is assigned from the module automatically); Server Port: 8080. Then click Connect.
  5. Now both of the Socket can receive the messages from the UART, while the module can receive the messages from both of the Socket individually:
    EWM3162 UARTWIFI24.jpg