### Start Python SSL Server Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ssl/README.md Execute the Python script to start the SSL server. ```python cd python-tls-communication python3 server.py ``` -------------------------------- ### Project Installation and Key Generation Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/https/README.md Steps to clone the repository, set execute permissions for the key generation script, and run it to create server certificates. ```bash git clone https://github.com/nopnop2002/esp-idf-sx126x cd esp-idf-sx126x/https/ chmod 777 mkkey.sh ./mkkey.sh idf.py menuconfig idf.py flash ``` -------------------------------- ### Start C Language SSL Server Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ssl/README.md Compile and run the C-based SSL server application. ```bash cd clang-tls-communication make ./server ``` -------------------------------- ### Start HTTPS Server Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/https/README.md Launches the Python-based HTTPS server required for the ESP32 client to connect to. ```python python3 https-server.py ``` -------------------------------- ### Detailed Boot Log Example Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/README.md This log provides detailed information about the initialization process of the SX126x module, including GPIO configurations, SPI bus initialization, and register settings. Enable LoRaDebugPrint for this level of detail. ```text I (0) cpu_start: Starting scheduler on APP CPU. I (332) main: Frequency is 433MHz I (332) RA01S: CONFIG_MISO_GPIO=19 I (342) RA01S: CONFIG_MOSI_GPIO=23 I (342) RA01S: CONFIG_SCLK_GPIO=18 I (352) RA01S: CONFIG_NSS_GPIO=15 I (352) RA01S: CONFIG_RST_GPIO=16 I (352) RA01S: CONFIG_BUSY_GPIO=17 I (362) RA01S: CONFIG_TXEN_GPIO=-1 I (362) RA01S: CONFIG_RXEN_GPIO=-1 I (372) gpio: GPIO[15]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 I (382) gpio: GPIO[16]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 I (392) gpio: GPIO[17]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0 I (392) RA01S: spi_bus_initialize=0 I (402) RA01S: spi_bus_add_device=0 I (442) RA01S: Reset I (442) RA01S: ReadRegister: REG=0x740 I (442) RA01S: DataIn:14 I (442) RA01S: DataIn:24 I (452) RA01S: syncWord=0x1424 I (452) RA01S: SX126x installed I (452) RA01S: WriteCommand: CMD=0x80 I (462) RA01S: 00 --> a2 I (462) RA01S: WriteCommand: CMD=0x9d I (472) RA01S: 01 --> a2 I (472) RA01S: tcxoVoltage=0.000000 I (472) RA01S: WriteCommand: CMD=0x89 I (482) RA01S: 7f --> a2 I (482) RA01S: useRegulatorLDO=0 I (482) RA01S: WriteCommand: CMD=0x96 I (492) RA01S: 01 --> a2 I (492) RA01S: WriteCommand: CMD=0x8f I (502) RA01S: 00 --> a2 I (502) RA01S: 00 --> a2 I (502) RA01S: WriteCommand: CMD=0x95 I (512) RA01S: 04 --> a2 I (512) RA01S: 07 --> a2 I (512) RA01S: 00 --> a2 I (522) RA01S: 01 --> a2 I (522) RA01S: WriteRegister: REG=0x8e7 I (522) RA01S: 18 --> a2 I (532) RA01S: WriteCommand: CMD=0x8e I (532) RA01S: 16 --> a2 I (532) RA01S: 04 --> a2 I (542) RA01S: WriteCommand: CMD=0x98 I (542) RA01S: 6b --> a2 I (552) RA01S: 6f --> a2 I (552) RA01S: WriteCommand: CMD=0x86 I (552) RA01S: 1b --> a2 I (562) RA01S: 10 --> a2 I (562) RA01S: 00 --> a2 I (562) RA01S: 00 --> a2 I (572) MAIN: LoRaBegin=0 I (572) RA01S: WriteCommand: CMD=0x9f I (572) RA01S: 00 --> a2 I (582) RA01S: WriteCommand: CMD=0xa0 I (582) RA01S: 00 --> a2 I (582) RA01S: WriteCommand: CMD=0x8a I (592) RA01S: 01 --> a2 I (592) RA01S: WriteCommand: CMD=0x8b I (602) RA01S: 07 --> a2 I (602) RA01S: 04 --> a2 I (602) RA01S: 01 --> a2 I (612) RA01S: 00 --> a2 I (612) RA01S: ReadRegister: REG=0x736 I (612) RA01S: DataIn:0d I (622) RA01S: WriteRegister: REG=0x736 I (622) RA01S: 09 --> a2 I (622) RA01S: WriteCommand: CMD=0x8c I (632) RA01S: 00 --> a2 I (632) RA01S: 08 --> a2 I (642) RA01S: 00 --> a2 I (642) RA01S: ff --> a2 I (642) RA01S: 01 --> a2 I (652) RA01S: 00 --> a2 I (652) RA01S: WriteCommand: CMD=0x08 I (652) RA01S: 03 --> a2 I (662) RA01S: ff --> a2 I (662) RA01S: 00 --> a2 I (662) RA01S: 00 --> a2 I (672) RA01S: 00 --> a2 I (672) RA01S: 00 --> a2 I (672) RA01S: 00 --> a2 I (682) RA01S: 00 --> a2 I (682) RA01S: ----- SetRx timeout=16777215 I (682) RA01S: WriteCommand: CMD=0x80 I (692) RA01S: 00 --> a2 I (692) RA01S: SetRxEnable:SX126x_TXEN=-1 SX126x_RXEN=-1 I (702) RA01S: WriteCommand: CMD=0x82 I (702) RA01S: ff --> a2 I (702) RA01S: ff --> a2 I (712) RA01S: ff --> a2 I (712) RA01S: ReadCommand: CMD=0xc0 I (712) RA01S: DataIn:52 I (722) RA01S: ReadCommand: CMD=0xc0 I (722) RA01S: DataIn:52 I (732) task_tx: Start ``` -------------------------------- ### Install and Build ESP-IDF SX126x Project Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ssl/README.md Clone the repository, navigate to the SSL directory, make the script executable, generate keys, and configure and flash the ESP32 device. ```bash git clone https://github.com/nopnop2002/esp-idf-sx126x cd esp-idf-sx126x/ssl/ chmod 777 mkkey.sh ./mkkey.sh idf.py menuconfig idf.py flash ``` -------------------------------- ### Clone and Build ESP-IDF SX126x Project Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/README.md Clone the repository and navigate to the basic example directory. Use idf.py to configure and flash the project to your ESP32 device. ```Shell git clone https://github.com/nopnop2002/esp-idf-sx126x cd esp-idf-sx126x/basic/ idf.py menuconfig idf.py flash ``` -------------------------------- ### HTTP Server IP Address Example Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/http/README.md Specifies the IP address of the HTTP server to which the ESP32 gateway will send data. ```text 192.168.10.20 ``` -------------------------------- ### HTTP Server Fully Qualified Domain Name Example Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/http/README.md Specifies the fully qualified domain name (FQDN) of the HTTP server for the ESP32 gateway. ```text http-server.public.io ``` -------------------------------- ### HTTP Server mDNS Host Name Example Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/http/README.md Specifies the mDNS host name of the HTTP server for the ESP32 gateway to connect to. ```text http-server.local ``` -------------------------------- ### Project Structure with idf_component.yml Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/README.md Illustrates the initial project structure required to include the SX126x component. ```text YourProject --+-- CMakeLists.txt +-- main --+-- main.c +-- CMakeLists.txt +-- idf_component.yml ``` -------------------------------- ### Execute getpem.sh Script Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/mqtt/README.md Run this script to download necessary SSL/TLS certificates. This is required when connecting to MQTT brokers using secure ports (MQTTS, WSS) if you are not using the default broker. ```bash ./getpem.sh ``` -------------------------------- ### Project Structure After Dependency Fetch Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/README.md Shows the project structure after ESP-IDF automatically fetches and links the SX126x component from the specified Git repository. ```text YourProject --+-- CMakeLists.txt +-- main --+-- main.c | +-- CMakeLists.txt | +-- idf_component.yml +-- managed_components ----- nopnop2002__sx126x ``` -------------------------------- ### Troubleshooting Boot Time Wiring Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/README.md Verify correct wiring by checking for specific log messages during boot. If these messages are absent, it indicates a wiring issue. ```text I (3425) RA01S: syncWord=0x1424 I (3425) RA01S: SX126x installed ``` -------------------------------- ### Configure Project Sources and Components Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ssl/main/CMakeLists.txt Defines source files and registers the component with ESP-IDF, including embedding text files and include directories. ```cmake set(srcs "main.c" "ssl_client.c") idf_component_register(SRCS "${srcs}" EMBED_TXTFILES server.crt INCLUDE_DIRS ".") ``` -------------------------------- ### Make getpem.sh Executable Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/mqtt/README.md This command grants execute permissions to the getpem.sh script, which is necessary for downloading SSL/TLS certificates when using secure MQTT ports. ```bash chmod 777 getpem.sh ``` -------------------------------- ### Run USB Serial Host for Reading (LoRa to USB) Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/tusb-serial/README.md Execute this Python script to act as a USB Serial Host for receiving data from the ESP32, which has received it via LoRa. This is used in the 'LoRa to USB' configuration. ```python python3 ./read.py ``` -------------------------------- ### Register Component Source Files and Include Directories Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/interrupt/main/CMakeLists.txt This snippet registers the main C source file for the component and sets the current directory as an include directory. Use this to define the buildable sources and header search paths for your ESP-IDF component. ```cmake set(component_srcs "main.c") idf_component_register(SRCS "${component_srcs}" INCLUDE_DIRS ".") ``` -------------------------------- ### Run USB Serial Host for Writing (USB to LoRa) Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/tusb-serial/README.md Execute this Python script to act as a USB Serial Host for sending data to the ESP32, which then transmits it via LoRa. This is used in the 'USB to LoRa' configuration. ```python python3 ./write.py ``` -------------------------------- ### Subscribe to MQTT for LoRa Reception Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/mqtt/README.md Use this command to subscribe to an MQTT topic. Messages received on this topic will be forwarded from a LoRa device. Ensure your MQTT broker and topic are correctly configured. ```bash mosquitto_sub -h broker.emqx.io -p 1883 -t "/topic/lora/test" ``` -------------------------------- ### Registering Source Files and Component Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/https/main/CMakeLists.txt Register source files and embed text files for an ESP-IDF component. Specifies include directories for the component. ```cmake set(srcs "main.c" "https_client.c") idf_component_register(SRCS "${srcs}" EMBED_TXTFILES server.crt INCLUDE_DIRS ".") ``` -------------------------------- ### UDP Server Script Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/udp-socket/README.md Use this Python script as a UDP server to communicate with the ESP32 acting as a UDP client for LoRa reception. ```python python3 ./udp-server.py ``` -------------------------------- ### Enable Specific Interrupts and Map to DIO1 Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/interrupt/README.md Enables TxDone, RxDone, and Timeout interrupts and directs all of them to trigger DIO1. DIO2 and DIO3 are configured to not trigger any interrupts. ```c uint16_t irqMask = SX126X_IRQ_TX_DONE | SX126X_IRQ_RX_DONE | SX126X_IRQ_TIMEOUT; uint16_t dio1Mask = SX126X_IRQ_TX_DONE | SX126X_IRQ_RX_DONE | SX126X_IRQ_TIMEOUT; uint16_t dio2Mask = SX126X_IRQ_NONE; uint16_t dio3Mask = SX126X_IRQ_NONE; SetDioIrqParams(irqMask, dio1Mask, dio2Mask, dio3Mask); ``` -------------------------------- ### LoRa to Web Form Data Flow Diagram Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/web-form/README.md Illustrates the data path from an SX126x LoRa module, through an ESP32 via SPI, to a web form using WebSockets. ```text +-----------+ +-----------+ +-----------+ | | | | | | ==(LoRa)==>| SX126x |----(SPI)---->| ESP32 |-(WebSocket)->| WebForm | | | | | | | +-----------+ +-----------+ +-----------+ ``` -------------------------------- ### Enable All Interrupts and Map to DIOs Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/interrupt/README.md Configures all available interrupts and maps TxDone, RxDone, and Timeout events to DIO1. Other DIO pins are set to trigger no interrupts. ```c uint16_t irqMask = SX126X_IRQ_ALL; uint16_t dio1Mask = SX126X_IRQ_TX_DONE; uint16_t dio2Mask = SX126X_IRQ_RX_DONE;; uint16_t dio3Mask = SX126X_IRQ_TIMEOUT; SetDioIrqParams(irqMask, dio1Mask, dio2Mask, dio3Mask); ``` -------------------------------- ### Web Form to LoRa Data Flow Diagram Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/web-form/README.md Illustrates the data path from a web form, through an ESP32 using WebSockets, to an SX126x module via SPI for LoRa transmission. ```text +-----------+ +-----------+ +-----------+ | | | | | | | WebForm |-(WebSocket)->| ESP32 |----(SPI)---->| SX126x |==(LoRa)==> | | | | | | +-----------+ +-----------+ +-----------+ ``` -------------------------------- ### ESP-IDF Project CMakeLists.txt Boilerplate Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/interrupt/CMakeLists.txt Essential CMake commands that must be included in your project's CMakeLists.txt for correct ESP-IDF build system operation. Ensure these lines appear in the specified order. ```cmake cmake_minimum_required(VERSION 3.5) set(EXTRA_COMPONENT_DIRS ../components/ra01s) include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(lora) ``` -------------------------------- ### Configure ESP-IDF Component Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/vcp/main/CMakeLists.txt Defines source files and registers the component with ESP-IDF, specifying required targets. ```cmake set(srcs "main.c" "cdc_acm_vcp.cpp") idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "." REQUIRED_IDF_TARGETS esp32s2 esp32s3) ``` -------------------------------- ### Component Source and Target Registration Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/tusb-serial/main/CMakeLists.txt Registers source files and required ESP-IDF targets for the component. Ensure this configuration matches your project's needs. ```cmake set(srcs "main.c") idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "." REQUIRED_IDF_TARGETS esp32s2 esp32s3 esp32p4) ``` -------------------------------- ### idf_component.yml for SX126x Dependency Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/README.md Specifies the SX126x component as a dependency, including its path and Git repository. ```yaml dependencies: nopnop2002/sx126x: path: components/ra01s/ git: https://github.com/nopnop2002/esp-idf-sx126x.git ``` -------------------------------- ### Registering ESP-IDF Component and Embedding Files Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/web-form/main/CMakeLists.txt This snippet registers the main component for the ESP-IDF project. It specifies source files, include directories, and embeds static web assets directly into the firmware. ```cmake idf_component_register( SRCS "main.c" "web_server.c" "web_client.c" INCLUDE_DIRS "." EMBED_FILES "../html/error.html" "../html/favicon.ico" "../html/main.js" "../html/root.html" ) ``` -------------------------------- ### UDP Client Script Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/udp-socket/README.md Use this Python script as a UDP client to communicate with the ESP32 acting as a UDP server for LoRa transmission. ```python python3 ./udp-client.py ``` -------------------------------- ### Conditional Source File Inclusion for MQTT Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/mqtt/main/CMakeLists.txt This snippet shows how to conditionally append source files to the 'srcs' list based on build configurations. It's used to include MQTT-specific files like 'mqtt_sub.c' or 'mqtt_pub.c' depending on whether the project is configured as a sender or receiver. ```cmake set(srcs "main.c") if(CONFIG_SENDER) list(APPEND srcs "mqtt_sub.c") elseif(CONFIG_RECEIVER) list(APPEND srcs "mqtt_pub.c") endif() idf_component_register(SRCS "${srcs}" INCLUDE_DIRS "." EMBED_TXTFILES root_cert.pem) ``` -------------------------------- ### Accessing the ESP32 Web Server Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/web-form/README.md Provides the URL format to access the ESP32's web server from a web browser. Use either the IP address or the local hostname. ```plaintext http:://{IP of ESP32}/ or http://esp32-server.local/ ``` -------------------------------- ### Publish to MQTT for LoRa Transmission Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/mqtt/README.md Use this command to publish a message to an MQTT topic, which will then be forwarded to a LoRa device. Ensure your MQTT broker and topic are correctly configured. ```bash mosquitto_pub -h broker.emqx.io -p 1883 -t "/topic/lora/test" -m "test" ``` -------------------------------- ### Arduino Uno Sketch for LoRa Communication Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/vcp/README.md This sketch runs on an Arduino Uno and blinks the onboard LED when serial data is received. It also sends 'Hello World' messages periodically. ```arduino const int LED_PIN = 13; unsigned long lastMillis = 0; void setup() { Serial.begin(115200); pinMode( LED_PIN, OUTPUT ); } void loop() { while (Serial.available()) { String command = Serial.readStringUntil('\n'); digitalWrite( LED_PIN, !digitalRead(LED_PIN) ); } if(lastMillis + 1000 <= millis()){ Serial.print("Hello World "); Serial.println(millis()); lastMillis += 1000; } delay(1); } ``` -------------------------------- ### HTTPS Gateway Architecture Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/https/README.md Illustrates the data flow from LoRa reception on SX126x to an ESP32, which then transmits data via HTTPS to a server. ```text +-----------+ +-----------+ +------------+ | | | | | | ==(LoRa)==>| SX126x |--(SPI)--->| ESP32 |--(HTTPS)-->|HTTPS Server| | | | | | | +-----------+ +-----------+ +------------+ ``` -------------------------------- ### HTTP Server Script Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/http/README.md This script is used as an HTTP server (e.g., netcat) to receive data from the ESP32 gateway when receiving data from LoRa. It listens for incoming HTTP requests. ```shell ./http-server.sh ``` -------------------------------- ### Manual HTTPS Server IP Configuration Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/https/README.md Manually set the IP address of the HTTPS server within the key generation script if automatic detection is not desired. ```bash IP="192.168.0.123" openssl req -x509 -new -nodes -key server.key -subj "/CN=${IP}" -days 10000 -out server.crt ``` -------------------------------- ### TCP Server Script Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/tcp-socket/README.md Use this Python script as a TCP server to communicate with the ESP32 acting as a TCP client for the LoRa-to-TCP configuration. ```python3 ./tcp-server.py ``` -------------------------------- ### Enable Specific Interrupts and Map to DIOs Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/interrupt/README.md Enables TxDone, RxDone, and Timeout interrupts and maps them to their respective DIO pins (DIO1, DIO2, DIO3). This configuration provides distinct interrupt signals for each event. ```c uint16_t irqMask = SX126X_IRQ_TX_DONE | SX126X_IRQ_RX_DONE | SX126X_IRQ_TIMEOUT; uint16_t dio1Mask = SX126X_IRQ_TX_DONE; uint16_t dio2Mask = SX126X_IRQ_RX_DONE; uint16_t dio3Mask = SX126X_IRQ_TIMEOUT; SetDioIrqParams(irqMask, dio1Mask, dio2Mask, dio3Mask); ``` -------------------------------- ### TCP Client Script Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/tcp-socket/README.md Use this Python script as a TCP client to communicate with the ESP32 acting as a TCP server for the TCP-to-LoRa configuration. ```python3 ./tcp-client.py ``` -------------------------------- ### Register RA01S Component with Dependencies Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/components/ra01s/CMakeLists.txt Registers the RA01S component, specifying its source files and required ESP-IDF drivers (SPI, GPIO). Ensure these drivers are available in your project's build environment. ```cmake set(component_srcs "ra01s.c") idf_component_register( SRCS "${component_srcs}" PRIV_REQUIRES driver esp_driver_spi esp_driver_gpio INCLUDE_DIRS "." ) ``` -------------------------------- ### HTTP Client Script Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/http/README.md This script is used as an HTTP client to interact with the ESP32 gateway when sending data to LoRa. It initiates HTTP requests to the ESP32. ```shell ./http-client.sh ``` -------------------------------- ### ESP Board to USB Connector to Arduino Uno Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/vcp/README.md Diagram illustrating the physical connection between the ESP board, USB connector, and Arduino Uno. ```text +---------+ +-------------+ +-----------+ |ESP BOARD|==|USB CONNECTOR|==|Arduino Uno| +---------+ +-------------+ +-----------+ ``` -------------------------------- ### LoRa to WebSocket Gateway Architecture Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ws/README.md Illustrates the data flow where an SX126x module receives LoRa data, sends it to an ESP32, which then acts as a Web Server to broadcast it via WebSocket. ```text +-----------+ +-----------+ +-----------+ | | | | | | ==(LoRa)==>| SX126x |----(SPI)---->| ESP32 |-(WebSocket)->| Web Server| | | | | | | +-----------+ +-----------+ +-----------+ ``` -------------------------------- ### Conditional Source File Inclusion in CMakeLists.txt Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/http/main/CMakeLists.txt This snippet shows how to conditionally add source files to the build based on predefined configuration options. It's useful for managing different functionalities (e.g., sender vs. receiver) within a single project. ```cmake set(srcs "main.c") if(CONFIG_SENDER) list(APPEND srcs "http_server.c") elseif(CONFIG_RECEIVER) list(APPEND srcs "http_client.c") endif() idf_component_register(SRCS "${srcs}" INCLUDE_DIRS ".") ``` -------------------------------- ### WebSocket to LoRa Gateway Architecture Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ws/README.md Illustrates the data flow where a Web Client sends data via WebSocket to an ESP32, which then transmits it over LoRa using an SX126x module. ```text +-----------+ +-----------+ +-----------+ | | | | | | | Web Client|-(WebSocket)->| ESP32 |----(SPI)---->| SX126x |==(LoRa)==> | | | | | | +-----------+ +-----------+ +-----------+ ``` -------------------------------- ### Configure Signal Bandwidth Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ArduinoCode/README.md Define the signal bandwidth for LoRa transmission. The value corresponds to specific bandwidth settings, with '4' typically representing 125 kHz. ```c++ #define LORA_BANDWIDTH 4 // bandwidth ``` -------------------------------- ### ESP Board to USB Connector Pinout Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/vcp/README.md Details the specific pin connections from the ESP board to a USB Type-A connector, including power, data, and ground. ```text ESP BOARD USB CONNECTOR (type A) +--+ 5V -------------> | || VCC [GPIO19] -------------> | || D- [GPIO20] -------------> | || D+ GND -------------> | || GND +--+ ``` -------------------------------- ### ESP32-P4 Board to USB Connector Wiring Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/tusb-serial/README.md Wiring diagram for connecting ESP32-P4 boards to a USB connector. Ensure correct GPIO pins are used for D- and D+ signals. ```text ESP32-P4 BOARD USB CONNECTOR +--+ | || VCC [GPIO 26] --------> | || D- [GPIO 27] --------> | || D+ [ GND ] --------> | || GND +--+ ``` -------------------------------- ### Configure Radio Frequency Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ArduinoCode/README.md Set the center frequency for LoRa communication in Hertz. This value is crucial for establishing a connection with other LoRa devices. ```c++ #define RF_FREQUENCY 915000000 // Hz center frequency ``` -------------------------------- ### ESP32-S2/S3/P4 Board to USB Connector Wiring Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/tusb-serial/README.md Wiring diagram for connecting ESP32-S2/S3 boards to a USB connector. Ensure correct GPIO pins are used for D- and D+ signals. ```text ESP32-S2/S3 BOARD USB CONNECTOR +--+ | || VCC [GPIO 19] --------> | || D- [GPIO 20] --------> | || D+ [ GND ] --------> | || GND +--+ ``` -------------------------------- ### Troubleshooting Antenna Connection Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/README.md An 'Illegal Status' error during transmission may indicate an issue with the antenna connection. Check the antenna to resolve this. ```text E (14993) RA01S: SetTx Illegal Status ``` -------------------------------- ### Configure Spreading Factor Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ArduinoCode/README.md Set the spreading factor, expressed as a base-2 logarithm, for LoRa communication. This parameter affects the range and data rate, with values typically ranging from SF5 to SF12. ```c++ #define LORA_SPREADING_FACTOR 7 // spreading factor [SF5..SF12] ``` -------------------------------- ### Custom LoRa Error Handler Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/README.md Implement a custom error handling function by overriding the weak LoRaError function. This allows for specific error logging or recovery actions. ```c void LoRaError(int error) { # Place your favorite code ESP_LOGE(TAG, "LoRaError=%d", error); while (true) { vTaskDelay(1); } } ``` -------------------------------- ### ESP32 Receiving Data from Arduino Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/vcp/README.md Logs data received from an Arduino via CDC/ACM, showing the hexadecimal representation and interpreted string. Note the CR/LF termination from Arduino. ```log I (6020) VCP: Receiving data through CdcAcmDevice I (6020) VCP: 0x3fca1c04 48 65 6c 6c 6f 20 57 6f 72 6c 64 20 31 35 30 30 |Hello World 1500| I (6020) VCP: 0x3fca1c14 30 0d 0a |0..| I (6030) TX: xMessageBufferReceive received=19 I (6040) TX: 0x3fc9e230 48 65 6c 6c 6f 20 57 6f 72 6c 64 20 31 35 30 30 |Hello World 1500| I (6040) TX: 0x3fc9e240 30 ``` -------------------------------- ### Configure Error Coding Rate Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/ArduinoCode/README.md Set the error coding rate for LoRa communication. The value '1' typically corresponds to a coding rate of 4/5, which balances data integrity and transmission speed. ```c++ #define LORA_CODINGRATE 1 // [1: 4/5, ``` -------------------------------- ### ESP32 Sending Data to Arduino Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/vcp/README.md Logs data sent from ESP32 to Arduino, including hexadecimal representation and interpreted string. A LF character is appended to ensure proper termination for the Arduino sketch. ```log I (3280) RX: 18 byte packet received:[Hello World 133865] I (3280) RX: 0x3fc9e120 48 65 6c 6c 6f 20 57 6f 72 6c 64 20 31 33 33 38 |Hello World 1338| I (3280) RX: 0x3fc9e130 36 35 |65| I (3290) VCP: Sending data through CdcAcmDevice I (3300) VCP: 0x3fc9f260 48 65 6c 6c 6f 20 57 6f 72 6c 64 20 31 33 33 38 |Hello World 1338| I (3300) VCP: 0x3fc9f270 36 35 0a ``` -------------------------------- ### TCP Server mDNS Host Name Source: https://github.com/nopnop2002/esp-idf-sx126x/blob/main/tcp-socket/README.md Specify the mDNS host name of your TCP server when configuring the ESP32. ```text tcp-server.local ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.