Espressif Esp32 Learning Journey Espressif ESP-S2/S3 module implements USB wireless network card to surf the Internet, and install wireless WiFI Internet access for your desktop. (with source code)


  • This series of blog learning is written by an unofficial staff with half a heart . It is only for personal technical exchange and sharing, not for any commercial use. If there is something wrong, please leave a message and I will change it in time.

Series 1: ESP32 Series Module Basic Learning Series Notes

1. Climbing the pit to learn a new journey, build an esp32 development environment on a virtual machine, and print "Hellow World". 2. Using the eclipes editor skillfully, the official tutorial builds an esp32 development environment under Windows and prints "Hellow World". 3. Know the GPIO interface of the basic esp32, start to light up your first LED and interrupt callback to realize the button function. 4. Experience the powerful timer function of esp32, realize timing 2s to flash an LED light. 5. Contact and practice the pwm width pulse function of esp32 to realize the breathing effect and flash an LED light. 6. The realization of smartConfig and WeChat airKiss in esp32, one-click network configuration and easy and quick connection to the router. 7. Use the GPIO interrupt to make a short press and long press callback event of a button, no longer need to worry about the trigger source. 8. Realize the role of local UDP client and server on esp32, and realize communication in LAN. 9. Realize the role of local TCP client and server on esp32, which can return data by disconnecting and reconnecting the original route. 10. Espressif esp32 SDK programming uses rmt to drive ws2812 colorful lights to achieve rainbow gradient effects. 11. Get started with the development of the Espressif esp-adf audio framework, build a Bluetooth headset with esp32, realize functions such as switching songs and obtaining song information. 12. Open source a WeChat public account airkiss distribution network esp32 and LAN discovery function project, and share an airkiss distribution network gadget. 13. esp32 has a built-in dns server, no need to access the domain name from the external network to return to the specified web page. 14. Esp32 sdk programming implements mandatory portal authentication. After connecting to esp32 hotspot, the specified login interface will pop up automatically.













15. Understand the local offline voice wake-up recognition framework esp-skainet to realize low-cost hardware voice local recognition control. 16. Learning the local voice wake-up offline recognition framework esp-skainet, how to modify the wake-up word? How to customize the command word? How to do intention action? 17. Launched on the whole network, Espressif esp32 sdk is directly connected to JD Weilian·Xiaojingyu·IoT open platform to realize intelligent voice control of Dingdong audio. 18. Get started with the H5 development of the control panel of Jingdong Weilian Xiaojingyu, understand the syntax of Vue, and make your own control page. 19. Heavy open source, how to connect esp32 and blufi with ble on the WeChat applet! 20. A good article, the esp32 firmware compiled during the development process is too large to start normally? Teach you how to customize the partition table partitions.csv. 21. The esp32 bluetooth distribution network blufi is highly packaged, easy to integrate, easy to use, easy to use, and improves development efficiency! 22. Discuss the programmer's "youth rice" and share the realization of multiple encryption algorithms md5 | AES CBC-ECB | Sha1 | Sha256 and so on in esp32! 23. Anxinke esp32-a1s audio development board transplanted the latest esp-adf audio framework, a small test how to realize online text-to-speech playback. 25. Share the package that realizes the smooth adjustment of the color temperature of cold and warm light in the esp32 SDK, and easily integrate it into your project. 26. Share how to use CMake to compile under the window, the compilation speed is improved by a level compared with traditional make compilation, and ESP32 and ESP32-C3 are supported. 27. Install the ESP8266/ESP32 environment with the built-in Linux under the windows10 platform, and there is no need to install an additional virtual machine.










Series 2: ESP32-Camera camera development board series notes

1. Anxinke ESP32-Cam camera development board secondary development C SDK programming, realize MQTT remote photo transmission to the private server. 2. Anxinke ESP32-Cam camera development board secondary development C SDK programming to realize local video stream monitoring. 3. Anxinke ESP32-Cam camera development board secondary development C SDK programming, the pictures taken are transmitted to the host computer PC through the wired serial port.

Series 3: ESP32-C3 Module Series Notes

1. [Bluetooth Mesh notes ①] The ESP32-C3 module realizes Tmall Genie Bluetooth BLE Mesh AliGenie access, and Tmall Genie voice control can also be realized without WiFi connection.

Series 4: ESP32-S2 /S3 Module Series Notes

1. Espressif ESP-S2/S3 module implements USB wireless network card to access the Internet, and install wireless WiFI Internet access for your desktop.

1. Engineering description

    Recently, I saw that Espressif’s original factory is working on a USB-OTG solution for the ESP32S3 development board. I happened to play with it and share it with my friends. This open source sample program supports the following functions:

  • Support the Host host to access the Internet wirelessly through USB, that is, the wireless network card .
  • Support the Host host to communicate and control the Anxinke ESP-12K module through USB.
  • Support a variety of system and Wi-Fi control commands, using the FreeRTOS-Plus-CLI command line interface, it is easy to expand more commands.
  • Support hot swap.

2. Hardware preparation

Pinouts are only required for ESP chips with USB-OTG peripherals. If your board doesn't have a USB connector that connects to the USB-OTG dedicated GPIO, you may need to make a DIY cable and connect D+ and D- to the pins listed below.

insert image description here

ESP BOARD          USB CONNECTOR (type A)
                          --
                         | || VCC
[USBPHY_DM_NUM]  ------> | || D-
[USBPHY_DP_NUM]  ------> | || D+
                         | || GND
                          --
module USB_DP USB_DM
Anxinke ESP32-S2/S3 Series Modules GPIO20 GPIO19
  • Anxinke ESP-12K-KIT development board.

insert image description here

3. Compile the code

  1. Confirm that the ESP-IDF environment is successfully built, use the masterbranch
  2. Add ESP-IDF environment variables, the Linux method is as follows, for other platforms, please refer to Set up the environment variables
    . $HOME/esp/esp-idf/export.sh
    
  3. Download the source code: https://github.com/xuhongv/StudyInEsp32/tree/master/23_usb_dongle_wifii
  4. Set the compile target to esp32s2oresp32s3
    idf.py set-target esp32s2
    
  5. Compile, download, view output
    idf.py build flash monitor
    

4. Instructions for use

  1. After completing the above hardware preparations and successfully burning the firmware, connect the USB to the PC

  2. A USB network card and a USB serial port will be added on the PC side

  3. On the Linux side, you can use the following command to check the newly added USB device, and on the Windows side, you can check the USB device through the device manager

     ls /dev/ttyACM*
    

    insert image description here

    ifconfig -a 
    

    insert image description here

  4. Communicate with the ESP device through the USB serial port, the baud rate is 115200, use the help command to view all the currently supported commands

  5. Control the ESP device for network distribution operation through instructions

Notice!

When the device has been connected to a router, but you need to switch the router again, you need to perform the following operations after executing the sta or smartconfig network configuration command

View the name of the USB network card

ifconfig

Uninstall the USB NIC

ifconfig <name> down 

Mount the USB NIC

ifconfig <name> up

command description

1. help

Function:

List all registered commands

Command:

help

Response:

help:
 Lists all the registered commands

ap <ssid> [<password>]: configure ssid and password
sta -s <ssid> [-p <password>]: join specified soft-AP
sta -d: disconnect specified soft-AP
mode <mode>: <sta> station mode; <ap> ap mode
smartconfig [op]: op:1, start smartconfig; op:0, stop smartconfig
scan [<ssid>]: <ssid>  SSID of AP want to be scanned
ram: Get the current size of free heap memory and minimum size of free heap memory
restart: Software reset of the chip
version: Get version of chip and SDK
>

2.ap

Function:

Set AP mode, query AP settings

Set Command:

ap Soft_AP espressif

Query Command:

ap

Response:

AP mode:Soft_AP,espressif
>

Note:

password is optional, if not configured, it will not be encrypted by default

3.sta

Function:

Start the Station mode and query the connected AP information

Set Command:

sta -s AP_Test -p espressif

Query Command:

sta

Response:

<ssid>,<channel>,<listen_interval>,<authmode>
>
authmode_value mode
0 WIFI_AUTH_OPEN
1 WIFI_AUTH_WEP
2 WIFI_AUTH_WPA_PSK
3 WIFI_AUTH_WPA2_PSK
4 WIFI_AUTH_WPA_WPA2_PSK
5 WIFI_AUTH_WPA2_ENTERPRISE
6 WIFI_AUTH_WPA3_PSK
7 WIFI_AUTH_WPA2_WPA3_PSK
8 WIFI_AUTH_WAPI_PSK

Note:

password is optional

Function:

Disconnect from AP

Set Command:

sta -d

Response:

OK
>

4.mode

Function:

Set WiFi mode

Command:

  • Set Station mode

    mode sta
    
  • Set AP mode

    mode ap
    

5.smartconfig

Function:

  • Open SmartConfig network configuration

    Command:

    smartconfig 1
    

    Response:

    >SSID:FAST_XLZ,PASSWORD:12345678
    OK
    >
    
  • Close SmartConfig distribution network

    Command:

    smartconfig 0
    

    Response:

    OK
    >
    

    Note:

    After using the smartconfig 1command to open the SmartConfig distribution network and successfully connect, there is no need to use the smartconfig 0command to close the SmartConfig distribution network

    smartconfig 0The command only needs to be called when SmartConfig fails to configure the network

Network distribution steps:

  • Download ESPTOUCH APP: Android source code iOS source code
  • Make sure your phone is connected to the target AP (2.4GHz)
  • Open ESPTOUCH APP, enter password and confirm
  • PC side sends smartconfig 1command

6.scan

Function:

Scan AP and list corresponding SSID and RSSI

Command:

  • Scan specific AP

    scan <SSID>
    
  • Scan all APs

    scan
    

Response:

>
[ssid][rssi=-22]

7.ram

Function:

Get the current remaining memory size and the minimum hourly memory size during system operation

Command:

ram

Response:

free heap size: 132612, min heap size: 116788
>

8.restart

Function:

restart the system

Command:

restart

9.version

Function:

Get the current IDF version and chip information

Command:

version

Response:

IDF Version:v4.4-dev-2571-gb1c3ee71c5
Chip info:
	cores:1
	feature:/802.11bgn/External-Flash:2 MB
	revision number:0
>

In addition, don't take my blog as a learning standard, mine are just notes, and it's hard to be negligent. If there are any, please point them out, and welcome to leave a message!

  • Play esp8266with you, QQjoin the group, friends who don’t like it, don’t spray or add: 434878850
  • Personal E-mail: [email protected] 24 hours online, all emails will be replied!
  • esp8266 source code learning summary (continuously updated, welcome to star): https://github.com/xuhongv/StudyInEsp8266
  • esp32 source code learning summary (continuously updated, welcome to star): https://github.com/xuhongv/StudyInEsp32
  • Pay attention to the QR code of the WeChat public account below, there are a lot of dry goods, and we will push them as soon as possible!

insert image description here

Guess you like

Origin blog.csdn.net/xh870189248/article/details/119928180