{"id":13673738,"url":"https://github.com/xreef/LoRa_E32_Series_Library","last_synced_at":"2025-04-28T11:30:40.718Z","repository":{"id":44383761,"uuid":"214284247","full_name":"xreef/LoRa_E32_Series_Library","owner":"xreef","description":"Arduino LoRa EBYTE E32 device library complete and tested with Arduino, esp8266, esp32, STM32 and Raspberry Pi Pico (rp2040 boards). sx1278/sx1276","archived":false,"fork":false,"pushed_at":"2023-08-10T21:23:27.000Z","size":2261,"stargazers_count":379,"open_issues_count":0,"forks_count":75,"subscribers_count":29,"default_branch":"master","last_synced_at":"2025-04-05T20:06:20.225Z","etag":null,"topics":["arduino","arduino-library","arduino-mkr","arduino-nano-33-iot","e32","ebyte","esp32","esp8266","library","lora","pico","raspberry-pi","rp2040","stm32","sx1276","sx1278"],"latest_commit_sha":null,"homepage":"https://www.mischianti.org","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xreef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-10-10T20:57:16.000Z","updated_at":"2025-03-16T12:13:58.000Z","dependencies_parsed_at":"2024-01-17T04:41:23.920Z","dependency_job_id":"8498cf47-4756-49ce-bd26-8ccad0b2ceae","html_url":"https://github.com/xreef/LoRa_E32_Series_Library","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FLoRa_E32_Series_Library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FLoRa_E32_Series_Library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FLoRa_E32_Series_Library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xreef%2FLoRa_E32_Series_Library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xreef","download_url":"https://codeload.github.com/xreef/LoRa_E32_Series_Library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251304665,"owners_count":21567918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-library","arduino-mkr","arduino-nano-33-iot","e32","ebyte","esp32","esp8266","library","lora","pico","raspberry-pi","rp2040","stm32","sx1276","sx1278"],"created_at":"2024-08-02T11:00:20.684Z","updated_at":"2025-04-28T11:30:39.459Z","avatar_url":"https://github.com/xreef.png","language":"C++","funding_links":[],"categories":["Libraries"],"sub_categories":[],"readme":"﻿\u003cdiv\u003e\n\u003ca href=\"https://www.mischianti.org/forums/forum/mischiantis-libraries/ebyte-lora-e32-uart-devices/\"\u003e\u003cimg\n  src=\"https://github.com/xreef/LoRa_E32_Series_Library/raw/master/resources/buttonSupportForumEnglish.png\" alt=\"Support forum EByte e32 English\"\n   align=\"right\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\u003cdiv\u003e\n\u003ca href=\"https://www.mischianti.org/it/forums/forum/le-librerie-di-mischianti/ebyte-e32-dispositivi-lora-uart/\"\u003e\u003cimg\n  src=\"https://github.com/xreef/LoRa_E32_Series_Library/raw/master/resources/buttonSupportForumItaliano.png\" alt=\"Forum supporto EByte e32 italiano\"\n  align=\"right\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n#\n#\n#\n\n# A complete tutorial on my site www.mischianti.org\n\n1.  [LoRa E32 device for Arduino, esp32 or esp8266: settings and basic usage](https://www.mischianti.org/2019/10/15/lora-e32-device-for-arduino-esp32-or-esp8266-specs-and-basic-usage-part-1/)\n2.  [LoRa E32 device for Arduino, esp32 or esp8266: library](https://www.mischianti.org/2019/10/21/lora-e32-device-for-arduino-esp32-or-esp8266-library-part-2/)\n3.  [LoRa E32 device for Arduino, esp32 or esp8266: configuration](https://www.mischianti.org/2019/10/29/lora-e32-device-for-arduino-esp32-or-esp8266-configuration-part-3/)\n4.  [LoRa E32 device for Arduino, esp32 or esp8266: fixed transmission](https://www.mischianti.org/2019/11/10/lora-e32-device-for-arduino-esp32-or-esp8266-fixed-transmission-part-4/)\n5.  [LoRa E32 device for Arduino, esp32 or esp8266: power saving and sending structured data](https://www.mischianti.org/2019/12/03/lora-e32-device-for-arduino-esp32-or-esp8266-power-saving-and-sending-structured-data-part-5/)\n6.  [LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) the microcontroller and Arduino shield](https://www.mischianti.org/2019/12/28/lora-e32-device-for-arduino-esp32-or-esp8266-wor-wake-on-radio-the-microcontroller-also-and-new-arduino-shield-part-6/)\n7.  [LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and new WeMos D1 mini shield](https://www.mischianti.org/2020/01/17/lora-e32-device-for-arduino-esp32-or-esp8266-wor-wake-on-radio-microcontroller-and-new-wemos-d1-mini-shield-part-7/)\n\n## Changelog\n - 2023-08-10 1.5.13 Add E32_TTL_2W for E32-433T33S [Comment](https://mischianti.org/2019/10/21/lora-e32-device-for-arduino-esp32-or-esp8266-library-part-2/#comment-15851)\n - 2023-05-02 1.5.12 Fix 900Mhz frequency for E32-900T20D and E32-900T30D [Forum](https://www.mischianti.org/forums/topic/e32-915t-and-e32-900t-modules/)\n - 2023-04-18 1.5.11 Distinct frequency from 900MHz and 915Mhz devices [Forum](https://www.mischianti.org/forums/topic/e32-915t-and-e32-900t-modules/)\n - 2022-12-14 1.5.10 Fix UART_PARITY for ESP32 C3 [Forum](https://www.mischianti.org/forums/topic/problems-including-library/) fix\n - 2022-12-14 1.5.9 Raspberry Pi Pico test and examples\n - 2022-09-19 1.5.8 Fix stm32 rogerclerk library #48\n - 2022-08-31 1.5.7 Minor Fix and examples update\n - 2022-04-07 1.5.6 Fix support for STM32\n - 2022-03-09 1.5.5 Fix UART baudrate variable and debug println\n - 2021-01-24 1.5.4 Add Arduino Nano BLE support and minor adjustment\n - 2021-12-31 1.5.3 Add support for Arduino SAMD boards\n\n# An Arduino UNO shield to simplify the use\nArduino UNO shield\n\n\u003cimg width=\"450px\" src=\"https://www.mischianti.org/wp-content/uploads/2019/12/ArduinoShieldMountedE32LoRa_min.jpg\" alt=\"\" class=\"wp-image-2155\"/\u003e\n\nYou can order the PCB  [here](https://www.pcbway.com/project/shareproject/LoRa_E32_Series_device_Arduino_shield.html?from=mischianti05) \n\nInstruction and assembly video on 6 part of the guide\n\n# An WeMos D1 shield to simplify the use\nWeMos D1 shield\n\u003cimg width=\"450px\" src=\"https://www.mischianti.org/wp-content/uploads/2020/01/WeMosD1ShieldMountedE32LoRa_min.jpg\" alt=\"\" class=\"wp-image-2155\"/\u003e\n\nYou can order the PCB  [here](https://www.pcbway.com/project/shareproject/LoRa_E32_Series_device_WeMos_D1_mini_shield_RF_8km_range.html?from=mischianti05) \n\n# An ESP32 shield to simplify the use\nESP32 shield\n\u003cimg width=\"450px\" src=\"https://www.mischianti.org/wp-content/uploads/2021/04/esp32-DOIT-DEV-KIT-v1-EByte-LoRa-E32-shield-main.jpg\" alt=\"\" class=\"wp-image-2155\"/\u003e\n\nYou can order the PCB  [here](https://www.pcbway.com/project/shareproject/LoRa_ESP32_DEV_KIT_v1_shield_for_EByte_E32_E22__RF_8km_12km_range.html?from=mischianti05) \n\n\n\nInstruction and assembly video on 6 part of the guide\n\n\n\n# LoRa E32 (EBYTE LoRa SX1278/SX1276) series Library for Arduino, esp8266 and esp32-\n\nI create a library to manage EBYTE E32 series of LoRa device, very powerfull, simple and cheap device.\n\n![](https://www.mischianti.org/wp-content/uploads/2019/09/LoRa_E32-TTL-100.jpg)\n\nLoRa E32-TTL-100\n\nYou can find here [AliExpress (3Km device)](http://s.click.aliexpress.com/e/eOHotRkU) [AliExpress (8Km device)](http://s.click.aliexpress.com/e/qRuqOQQM)\n\nThey can work over a distance of 3000m to 8000m, and they have a lot of features and parameter.\n\nSo i create this library to simplify the usage.\n\nPlease refer to my article to get updated Schema\n\n### Library\n\nYou can find my library here.\n\nTo download.\n\nClick the DOWNLOADS button in the top right corner, rename the uncompressed folder LoRa_E32.\n\nCheck that the LoRa_E32 folder contains LoRa_E32.cpp and LoRa_E32.h.\n\nPlace the LoRa_E32 library folder your /libraries/ folder.\n\nYou may need to create the libraries subfolder if its your first library.\n\nRestart the IDE.\n\n#### Pinout\n\n![](https://www.mischianti.org/wp-content/uploads/2019/09/sx1278-sx1276-wireless-lora-uart-module-serial-3000m-arduino-433-rf-robotedu-1705-13-robotedu@101.jpg)\n\nE32 TTL 100\n\nYou can buy here [AliExpress](http://s.click.aliexpress.com/e/eOHotRkU)\n\n|Pin No.|Pin item|Pin direction|Pin application|\n|---|---|---|---|\n|1|M0|Input（weak pull-up）|Work with M1 \u0026 decide the four operating modes.Floating is not allowed, can be ground.|\n|2|M1|Input（weak pull-up）|Work with M0 \u0026 decide the four operating modes.Floating is not allowed, can be ground.|\n|3|RXD|Input|TTL UART inputs, connects to external (MCU, PC) TXD outputpin. Can be configured as open-drain or pull-up input.|\n|4|TXD|Output|TTL UART outputs, connects to external RXD (MCU, PC) inputpin. Can be configured as open-drain or push-pull output|\n|5|AUX|Output|To indicate module’s working status \u0026 wakes up the external MCU. During the procedure of self-check initialization, the pin outputs low level. Can be configured as open-drain output orpush-pull output (floating is allowed).|\n|6|VCC|Power supply 2.3V~5.5V DC|\n|7|GND|Ground|As you can see you can set various modes via M0 and M1 pins.|\n\n|**Mode**|**M1**|**M0**|**Explanation**|\n|---|---|---|---|\n|Normal|0|0|UART and wireless channel is good to go|\n|Wke-Up|0|1|Same as normal but a preamble code is added to transmitted data for waking-up the receiver.|\n|Power-Saving|1|0|UART is disable and wireless is on WOR(wake on radio) mode which means the device will turn on when there is data to be received. Transmission is not allowed.|\n|Sleep|1|1|Used in setting parameters. Transmitting and receiving disabled.|\n\nAs you can see there are some pins that can be use in a static way, but If you connect It to the library you gain in performance and you can control all mode via software, but we are going to explain better next.\n\n### Fully connected schema\n\nAs I already say It’s not important to connect all pin to the output of microcontroller, you can put M0 and M1 pins to HIGH or LOW to get desidered configuration, and  **if you don’t connect AUX the library set a reasonable delay to be sure that the operation is complete**.\n\n#### AUX pin\n\nWhen transmitting data can be used to wake up external MCU and return HIGH on data transfer finish.\n\n![](https://www.mischianti.org/wp-content/uploads/2019/10/e32auxPinOnTransmission-1024x269.jpg)\n\nLoRa E32 AUX Pin on transmission\n\nWhen receiving AUX going LOW and return HIGH when buffer is empty.\n\n![](https://www.mischianti.org/wp-content/uploads/2019/10/e32auxPinOnReception-1024x342.jpg)\n\nLoRa e32 AUX pin on reception\n\nIt’s also used for self checking to restore normal operation (on power-on and sleep/program mode).\n\n![](https://www.mischianti.org/wp-content/uploads/2019/10/e32auxPinOnSelfCheck-1024x312.jpg)\n\nLoRa e32 AUX pin on self-check\n\nesp8266 connection schema is more simple because It work at the same voltage of logical communications (3.3v).\n\n![](https://www.mischianti.org/wp-content/uploads/2019/10/LoRa_E32-TTL-100_WemosD1_VD_PU_FullyConnected_bb-1024x746.jpg)\n\nLoRa E32 TTL 100 Wemos D1 fully connected\n\nIt’s important to add pull-up resistor (4,7Kohm) to get good stability.\n\n|M0|D7|\n|---|---|\n|M1|D6|\n|RX|PIN D2 (PullUP 4,7KΩ)|\n|TX|PIN D3 (PullUP 4,7KΩ)|\n|AUX|D5 (Input)|VCC|\n|3.3v|GND|GND|\n\nArduino working voltage is 5v, so we need to add a voltage divider on RX pin M0 and M1 of LoRa module to prevent damage, you can get more information here  [Voltage divider: calculator and application](https://www.mischianti.org/2019/06/15/voltage-divider-calculator-and-application/).\n\nYou can use a 2Kohm resistor to GND and 1Kohm from signal than put together on RX.\n\n![](https://www.mischianti.org/wp-content/uploads/2019/10/LoRa_E32-TTL-100_Arduino_VD_PU_FullyConnected_bb-1024x692.jpg)\n\nLoRa E32 TTL 100 Arduino fully connected\n\n|M0|7 (Voltage divider)|\n|---|---|\n|M1|6 (Voltage divider)|\n|RX|PIN D2 (PullUP 4,7KΩ \u0026 Voltage divider)|\n|TX|PIN D3 (PullUP 4,7KΩ)|\n|AUX|5 (Input)|\n|VCC|3.3v|\n|GND|GND|\n\n## Constructor\n\nI made a set of quite numerous constructors, because we can have more options and situations to manage.\n\n```cpp\nLoRa_E32(byte rxPin, byte txPin, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\n\nLoRa_E32(byte rxPin, byte txPin, byte auxPin, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\n\nLoRa_E32(byte rxPin, byte txPin, byte auxPin, byte m0Pin, byte m1Pin, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\n```\n\nFirst set of constructor are create to delegate the manage of Serial and other pins to the library.\n\n-   `rxPin` and  `txPin` is the pin to connect to UART and they are  **mandatory**.\n-   `auxPin` is a pin that check the operation, transmission and receiving status (we are going to explain better next), that pin  **It isn’t mandatory**, if you don’t set It I apply a delay to permit the operation to complete itself (with latency).\n\n-   `m0pin` and  `m1Pin` are the pins to change operation MODE (see the table upper), I think  **this pins in “production” are going to connect directly HIGH or LOW**, but for test they are usefully to be managed by the library.\n-   `bpsRate` is the boudrate of SoftwareSerial normally is 9600 (the only baud rate in programmin/sleep mode)\n\nA simple example is\n\n```cpp\n#include \"LoRa_E32.h\"\nLoRa_E32 e32ttl100(2, 3); // RX, TX\n// LoRa_E32 e32ttl100(2, 3, 5, 6, 7); // RX, TX\n```\n\nWe can use directly a SoftwareSerial with another constructor\n\n```cpp\nLoRa_E32(HardwareSerial* serial, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\nLoRa_E32(HardwareSerial* serial, byte auxPin, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\nLoRa_E32(HardwareSerial* serial, byte auxPin, byte m0Pin, byte m1Pin, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\n```\n\nThe example upper with this constructor can be do like so.\n\n```cpp\n#include \u003cSoftwareSerial.h\u003e\n#include \"LoRa_E32.h\"\nSoftwareSerial mySerial(2, 3); // RX, TX\nLoRa_E32 e32ttl100(mySerial);\n// LoRa_E32 e32ttl100(\u0026amp;mySerial, 5, 7, 6);\n```\n\nThe last set of constructor is to permit to use an HardwareSerial instead of SoftwareSerial.\n\n```cpp\nLoRa_E32(SoftwareSerial* serial, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\nLoRa_E32(SoftwareSerial* serial, byte auxPin, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\nLoRa_E32(SoftwareSerial* serial, byte auxPin, byte m0Pin, byte m1Pin, UART_BPS_RATE bpsRate = UART_BPS_RATE_9600);\n```\n\n## Begin\n\nThe begin command is used to startup Serial and pins in input and output mode.\n\n```cpp\nvoid begin();\n```\n\nin execution is\n\n```cpp\n// Startup all pins and UART\ne32ttl100.begin();\n```\n\n### Configuration and information method\n\nThere a set of methods for manage configuration and get information of the device.\n\n```cpp\nResponseStructContainer getConfiguration();\nResponseStatus setConfiguration(Configuration configuration, PROGRAM_COMMAND saveType = WRITE_CFG_PWR_DWN_LOSE);\nResponseStructContainer getModuleInformation();\nvoid printParameters(struct Configuration configuration);\nResponseStatus resetModule();\n```\n\n#### Response container\n\nTo simplify the manage of response I create a set of container, for me very usefully to manage errors and return generic data.\n\n##### ResponseStatus\n\nThis is a status container and have 2 simple entry point, with this you can get the status code and the description of status code\n\n```cpp\nSerial.println(c.getResponseDescription()); // Description of code\nSerial.println(c.code); // 1 if Success\n```\n\nThe code are\n\n```cpp\nE32_SUCCESS = 1,\nERR_E32_UNKNOWN,\nERR_E32_NOT_SUPPORT,\nERR_E32_NOT_IMPLEMENT,\nERR_E32_NOT_INITIAL,\nERR_E32_INVALID_PARAM,\nERR_E32_DATA_SIZE_NOT_MATCH,\nERR_E32_BUF_TOO_SMALL,\nERR_E32_TIMEOUT,\nERR_E32_HARDWARE,\nERR_E32_HEAD_NOT_RECOGNIZED\n```\n\n##### ResponseContainer\n\nThis container is created to manage String response and have 2 entry point.\n\n`data` with the string returned from message and  `status` an instance of  `RepsonseStatus`.\n\n```cpp\nResponseContainer rs = e32ttl.receiveMessage();\nString message = rs.data;\nSerial.println(rs.status.getResponseDescription());\nSerial.println(message);\n```\n\n##### ResponseStructContainer\n\nThis is the more “complex” container, I use this to manage structure, It has the same entry point of ResponseContainer but data is a void pointer to manage complex structure.\n\n```cpp\nResponseStructContainer c;\nc = e32ttl100.getConfiguration();\n// It's important get configuration pointer before all other operation\nConfiguration configuration = *(Configuration*) c.data;\nSerial.println(c.status.getResponseDescription());\nSerial.println(c.status.code);\n```\n\n#### getConfiguration and setConfiguration\n\nThe first method is getConfiguration, you can use It to retrive all data stored on device.\n\n```cpp\nResponseStructContainer getConfiguration();\n```\n\nHere an usage example.\n\n```cpp\nResponseStructContainer c;\nc = e32ttl100.getConfiguration();\n// It's important get configuration pointer before all other operation\nConfiguration configuration = *(Configuration*) c.data;\nSerial.println(c.status.getResponseDescription());\nSerial.println(c.status.code);\nSerial.println(configuration.SPED.getUARTBaudRate());\n```\n\n![Get configuration](https://www.mischianti.org/wp-content/uploads/2019/12/E32_request_configuration_logic_analyzer-1024x319.jpg)\n\nStructure of configuration have all data of settings, and I add a series of function to get all description of single data.\n\n```cpp\nconfiguration.ADDL = 0x0; // First part of address\nconfiguration.ADDH = 0x1; // Second part of address\nconfiguration.CHAN = 0x19; // Channel\nconfiguration.OPTION.fec = FEC_0_OFF; // Forward error correction switch\nconfiguration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION; // Transmission mode\nconfiguration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS; // Pull-up management\nconfiguration.OPTION.transmissionPower = POWER_17; // dBm transmission power\nconfiguration.OPTION.wirelessWakeupTime = WAKE_UP_1250; // Wait time for wake up\nconfiguration.SPED.airDataRate = AIR_DATA_RATE_011_48; // Air data rate\nconfiguration.SPED.uartBaudRate = UART_BPS_115200; // Communication baud rate\nconfiguration.SPED.uartParity = MODE_00_8N1; // Parity bit\n```\n\nYou have the equivalent function to get all description:\n\n```cpp\nSerial.print(F(\"Chan : \")); Serial.print(configuration.CHAN, DEC); Serial.print(\" -\u003e \"); Serial.println(configuration.getChannelDescription());\nSerial.println(F(\" \"));\nSerial.print(F(\"SpeedParityBit : \")); Serial.print(configuration.SPED.uartParity, BIN);Serial.print(\" -\u003e \"); Serial.println(configuration.SPED.getUARTParityDescription());\nSerial.print(F(\"SpeedUARTDatte : \")); Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(\" -\u003e \"); Serial.println(configuration.SPED.getUARTBaudRate());\nSerial.print(F(\"SpeedAirDataRate : \")); Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(\" -\u003e \"); Serial.println(configuration.SPED.getAirDataRate());\nSerial.print(F(\"OptionTrans : \")); Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(\" -\u003e \"); Serial.println(configuration.OPTION.getFixedTransmissionDescription());\nSerial.print(F(\"OptionPullup : \")); Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(\" -\u003e \"); Serial.println(configuration.OPTION.getIODroveModeDescription());\nSerial.print(F(\"OptionWakeup : \")); Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(\" -\u003e \"); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());\nSerial.print(F(\"OptionFEC : \")); Serial.print(configuration.OPTION.fec, BIN);Serial.print(\" -\u003e \"); Serial.println(configuration.OPTION.getFECDescription());\nSerial.print(F(\"OptionPower : \")); Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(\" -\u003e \"); Serial.println(configuration.OPTION.getTransmissionPowerDescription());\n```\n\nAt same way setConfiguration want a configuration strucutre, so I think the better way to manage configuration is to retrieve the current one, apply the only change you need and set It again.\n\n```cpp\nResponseStatus setConfiguration(Configuration configuration, PROGRAM_COMMAND saveType = WRITE_CFG_PWR_DWN_LOSE);\n```\n\n`configuration` is the strucutre previsiouly show,  `saveType` permit to you to choiche if the change become permanently of only for the current session.\n\n```cpp\nResponseStructContainer c;\nc = e32ttl100.getConfiguration();\n// It's important get configuration pointer before all other operation\nConfiguration configuration = *(Configuration*) c.data;\nSerial.println(c.status.getResponseDescription());\nSerial.println(c.status.code);\nprintParameters(configuration);\nconfiguration.ADDL = 0x0;\nconfiguration.ADDH = 0x1;\nconfiguration.CHAN = 0x19;\nconfiguration.OPTION.fec = FEC_0_OFF;\nconfiguration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;\nconfiguration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;\nconfiguration.OPTION.transmissionPower = POWER_17;\nconfiguration.OPTION.wirelessWakeupTime = WAKE_UP_1250;\nconfiguration.SPED.airDataRate = AIR_DATA_RATE_011_48;\nconfiguration.SPED.uartBaudRate = UART_BPS_115200;\nconfiguration.SPED.uartParity = MODE_00_8N1;\n// Set configuration changed and set to not hold the configuration\nResponseStatus rs = e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_LOSE);\nSerial.println(rs.getResponseDescription());\nSerial.println(rs.code);\nprintParameters(configuration);\n```\n\nThe parameter all all managed as constant:\n\n#### Basic configuration option\n\n|ADDH|High address byte of module (the default 00H)|00H-FFH|\n|---|---|---|\n|ADDL|Low address byte of module (the default 00H)|00H-FFH|\n|SPED|Information about data rate parity bit and Air data rate|CHAN|\n\n|Communication channel（410M + CHAN*1M）, default 17H (433MHz),  **valid only for 433MHz device**|00H-1FH|\n|---|---|\n\nOPTION\n\nType of transmission, pull-up settings, wake-up time, FEC, Transmission power\n\n#### SPED detail\n\nUART Parity bit:  _UART mode can be different between communication parties\n\n|7|6|UART parity bit|Const value|\n|---|---|---|---|---|\n|0|0|8N1 (default)|MODE_00_8N1|\n|0|1|8O1|MODE_01_8O1|\n|1|0|8 E1|MODE_10_8E1|\n|1|1|8N1 (equal to 00)|MODE_11_8N1|\n\nUART baud rate: UART baud rate can be different between communication parties, The UART baud rate has nothing to do with wireless transmission parameters \u0026 won’t affect the wireless transmit / receive features.\n\n|5|43|TTL UART baud rate（bps）|Constant value|\n|---|---|---|---|\n|0|0|0|1200|UART_BPS_1200|\n|0|0|1|2400|UART_BPS_2400|\n|0|1|0|4800|UART_BPS_4800|\n|0|1|1|9600 (default)|UART_BPS_9600|\n|1|0|0|19200|UART_BPS_19200|\n|1|0|1|38400|UART_BPS_38400|\n|1|1|0|57600|UART_BPS_57600|\n|1|1|1|115200|UART_BPS_115200|\n\nAir data rate: The lower the air data rate, the longer the transmitting distance, better anti- interference performance and longer transmitting time, The air data rate must keep the same for both communication parties.\n\n|2|1|0|Air data rate（bps）|Constant value|\n|---|---|---|---|---|\n|0|0|0|0.3k|AIR_DATA_RATE_000_03|\n|0|0|1|1.2k|AIR_DATA_RATE_001_12|\n|0|1|0|2.4k (default)|AIR_DATA_RATE_010_24|\n|0|1|1|4.8k|AIR_DATA_RATE_011_48|\n|1|0|0|9.6k|AIR_DATA_RATE_100_96|\n|1|0|1|19.2k|AIR_DATA_RATE_101_192|\n|1|1|0|19.2k (same to 101)|AIR_DATA_RATE_110_192|\n|1|1|1|19.2k (same to 101)|AIR_DATA_RATE_111_192|\n\n#### OPTION detail\n\nTransmission mode: in fixed transmission mode, the first three bytes of each user’s data frame can be used as high/low address and channel. The module changes its address and channel when transmit. And it will revert to original setting after complete the process.\n\n|7|Fixed transmission enabling bit（similar to MODBUS）|Constant value|\n|---|---|---|\n|0|Transparent transmission mode|FT_TRANSPARENT_TRANSMISSION|\n|1|Fixed transmission mode|FT_FIXED_TRANSMISSION|\n\nIO drive mode: this bit is used to the module internal pull- up resistor. It also increases the level’s adaptability in case of open drain. But in some cases, it may need external pull-up  \nresistor.\n\n|6|IO drive mode ( default 1)|Constant value|\n|---|---|---|\n|1|TXD and AUX push-pull outputs, RXD pull-up inputs|IO_D_MODE_PUSH_PULLS_PULL_UPS|\n|0|TXD、AUX open-collector outputs, RXD open-collector inputs|IO_D_MODE_OPEN_COLLECTOR|\n\nWireless wake-up time: the transmit \u0026 receive module work in mode 0, whose delay time is invalid \u0026 can be arbitrary value, The transmitter works in mode 1 can transmit the preamble code of the corresponding time continuously, when the receiver works in mode 2, the time means the monitor interval time (wireless wake-up). Only the data from transmitter that works in mode 1 can be  \nreceived.\n\n|5|4|3|wireless wake-up time|Constant value|\n|---|---|---|---|---|\n|0|0|0|250ms (default)|WAKE_UP_250|\n|0|0|1|500ms|WAKE_UP_500|\n|0|1|0|750ms|WAKE_UP_750|\n|0|1|1|1000ms|WAKE_UP_1000|\n|1|0|0|1250ms|WAKE_UP_1250|\n|1|0|1|1500ms|WAKE_UP_1500|\n|1|1|0|1750ms|WAKE_UP_1750|\n|1|1|1|2000ms|WAKE_UP_2000|\n\nFEC: after turn off FEC, the actual data transmission rate increases while anti- interference ability decreases. Also the transmission distance is relatively short, both communication parties must keep on the same pages about turn-on or turn-off FEC.\n\n|2|FEC switch|Constant value|\n|---|---|---|\n|0|Turn off FEC|FEC_0_OFF|\n|1|Turn on FEC (default)|FEC_1_ON|\n\nTransmission power\n\nYou can change this set of constant by apply a define like so:\n\n```cpp\n#define E32_TTL_100 // default value without set\n```\n\nApplicable for  **E32-TTL-100, E32-TTL-100S1, E32-T100S2.**  \nThe external power must make sure the ability of current output more than 250mA and ensure the power supply ripple within 100mV.  \nLow power transmission is not recommended due to its low power supply  \nefficiency.\n\n```cpp\n#define E32_TTL_100 // default value without set\n```\n\n|1|0|Transmission power (approximation)|Constant value|\n|---|---|---|---|\n|0|0|20dBm (default)|POWER_20|\n|0|1|17dBm|POWER_17|\n|1|0|14dBm|POWER_14|\n|1|1|10dBm|POWER_10|\n\nApplicable for E32-TTL-500。  \nThe external power must make sure the ability of current output more than 700mA and ensure the power supply ripple within 100mV.  \nLow power transmission is not recommended due to its low power supply efficiency.\n\n```cpp\n#define E32_TTL_500\n```\n\n|1|0|Transmission power (approximation)|Constant value|\n|---|---|---|---|\n|0|0|27dBm (default)|POWER_27|\n|0|1|24dBm|POWER_24|\n|1|0|21dBm|POWER_21|\n|1|1|18dBm|POWER_18|\n\nApplicable for E32-TTL-1W, E32 (433T30S), E32 (868T30S), E32 (915T30S)  \nThe external power must make sure the ability of current output more than 1A and ensure the power supply ripple within 100mV.  \nLow power transmission is not recommended due to its low power supply  \nefficiency.\n\n```cpp\n#define E32_TTL_1W\n```\n\n|1|0|Transmission power (approximation)|Constant value|\n|---|---|---|---|\n|0|0|30dBm (default)|POWER_30|\n|0|1|27dBm|POWER_27|\n|1|0|24dBm|POWER_24|\n|1|1|21dBm|POWER_21|\n\nYou can configure Channel frequency olso with this define:\n\n\n```cpp\n// One of\n\n#define FREQUENCY_433\n#define FREQUENCY_170\n#define FREQUENCY_470\n#define FREQUENCY_868\n#define FREQUENCY_915\n```\n\n### Send receive message\n\nFirst we must introduce a simple but usefully method to check if something is in the receiving buffer\n\n```cpp\nint available();\n```\n\nIt’s simply return how many bytes you have in the current stream.\n\n#### Normal transmission mode\n\nNormal/Transparent transmission mode is used to send messages to all device with same address and channel.\n\n![](https://www.mischianti.org/wp-content/uploads/2019/10/LoRa_E32_transmittingScenarios.jpg)\n\nLoRa E32 transmitting scenarios, lines are channels\n\nThere are a lot of method to send/receive message, we are going to explain in detail:\n\n```cpp\nResponseStatus sendMessage(const String message);\n```\n\n```cpp\nResponseContainer receiveMessage();\n```\n\nFirst method is sendMessage and is used to send a String to a device in  **Normal mode**.\n\n```cpp\nResponseStatus rs = e32ttl.sendMessage(\"Prova\");\nSerial.println(rs.getResponseDescription());\n```\n\nThe other device simply do on the loop\n\n\n```cpp\nif (e32ttl.available() \u003e 1){\nResponseContainer rs = e32ttl.receiveMessage();\nString message = rs.data;` `// First ever get the data\nSerial.println(rs.status.getResponseDescription());\nSerial.println(message);\n}\n```\n\n#### Manage structure\n\nIf you want send a complex strucuture you can use this method\n\n\n```cpp\nResponseStatus sendMessage(const void *message, const uint8_t size);\n\nResponseStructContainer receiveMessage(const uint8_t size);\n```\n\nIt’s used to send strucutre, for example:\n\n```cpp\nstruct Messaggione {\n\nchar type[5];\n\nchar message[8];\n\nbool mitico;\n\n};\n\nstruct Messaggione messaggione = {\"TEMP\", \"Peple\", true};\n\nResponseStatus rs = e32ttl.sendMessage(\u0026amp;messaggione, sizeof(Messaggione));\n\nSerial.println(rs.getResponseDescription());\n```\n\nand the other side you can receive the message so\n\n```cpp\nResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Messaggione));\n\nstruct Messaggione messaggione = *(Messaggione*) rsc.data;\n\nSerial.println(messaggione.message);\n\nSerial.println(messaggione.mitico);\n```\n\n##### Read partial strucure\n\nIf you want read first part of the message to manage more type of strucutre you can use this method.\n\n\n```cpp\nResponseContainer receiveInitialMessage(const uint8_t size);\n```\n\nI create It to receive a string with type or other to identify the strucuture to load.\n\n```cpp\nstruct Messaggione { // Partial strucutre without type\n\nchar message[8];\n\nbool mitico;\n\n};\n\nchar type[5]; // first part of structure\n\nResponseContainer rs = e32ttl.receiveInitialMessage(sizeof(type));\n\n// Put string in a char array (not needed)\n\nmemcpy ( type, rs.data.c_str(), sizeof(type) );\n\nSerial.println(\"READ TYPE: \");\n\nSerial.println(rs.status.getResponseDescription());\n\nSerial.println(type);\n\n// Read the rest of structure\n\nResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Messaggione));\n\nstruct Messaggione messaggione = *(Messaggione*) rsc.data;\n```\n\n#### Fixed mode instead of normal mode\n\nAt same manner I create a set of method to use with fixed transmission\n\n#### Fixed transmission\n\n**You need to change only the sending method, because the destination device don’t receive the preamble with Address and Channel.**\n\nSo for String message you have\n\n```cpp\nResponseStatus sendFixedMessage(byte ADDL, byte ADDH, byte CHAN, const String message);\n\nResponseStatus sendBroadcastFixedMessage(byte CHAN, const String message);\n```\n\nand for structure you have\n\n```cpp\nResponseStatus sendFixedMessage(byte ADDL, byte ADDH, byte CHAN, const void *message, const uint8_t size);\n\nResponseStatus sendBroadcastFixedMessage(byte CHAN, const void *message, const uint8_t size );\n```\n\nHere a simple example\n\n```cpp\nResponseStatus rs = e32ttl.sendFixedMessage(0, 0, 0x17, \u0026amp;messaggione, sizeof(Messaggione));\n\n// ResponseStatus rs = e32ttl.sendFixedMessage(0, 0, 0x17, \"Ciao\");\n```\n\nFixed transmission have more scenarios\n\n![](https://www.mischianti.org/wp-content/uploads/2019/10/LoRa_E32_transmittingScenarios.jpg)\n\nLoRa E32 transmitting scenarios, lines are channels\n\nIf you send to a specific device (second scenarios Fixed transmission) you must add ADDL, ADDH and CHAN to identify It directly.\n\n```cpp\nResponseStatus rs = e32ttl.sendFixedMessage(2, 2, 0x17, \"Message to a device\");\n```\n\nIf you want send a message to all device in a specified Channel you can use this method.\n\n```cpp\nResponseStatus rs = e32ttl.sendBroadcastFixedMessage(0x17, \"Message to a devices of a channel\");\n```\n\nIf you want receive all broadcast message in the network you must set your  `ADDH` and  `ADDL` with  `BROADCAST_ADDRESS`.\n\n```cpp\nResponseStructContainer c;\n\nc = e32ttl100.getConfiguration();\n\n// It's important get configuration pointer before all other operation\n\nConfiguration configuration = *(Configuration*) c.data;\n\nSerial.println(c.status.getResponseDescription());\n\nSerial.println(c.status.code);\n\nprintParameters(configuration);\n\nconfiguration.ADDL = BROADCAST_ADDRESS;\n\nconfiguration.ADDH = BROADCAST_ADDRESS;\n\n// Set configuration changed and set to not hold the configuration\n\nResponseStatus rs = e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_LOSE);\n\nSerial.println(rs.getResponseDescription());\n\nSerial.println(rs.code);\n\nprintParameters(configuration);\n```\n\n## Thanks\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxreef%2FLoRa_E32_Series_Library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxreef%2FLoRa_E32_Series_Library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxreef%2FLoRa_E32_Series_Library/lists"}