EByte LoRa Communication encode/decode, crypt/decrypt

Home Forums esp32 EByte LoRa Communication encode/decode, crypt/decrypt

Viewing 9 reply threads
  • Author
    Posts
    • #25394
      sahar
      Participant

        I have two LoRa modules, the transmitter is E32-900T20D (with ESP32 DevKitC V4) and the receiver is LoRa32U4II. The problem is that the receiver is not receiving anything from the transmitter.
        Here is the code of configuration (E32-900T20D) :

        / * E32 —– esp32
        * M0 —– 3.3v
        * M1 —– 3.3v
        * RX —– TX2 (PullUP)
        * TX —– RX2 (PullUP)
        * AUX —– not connected
        * VCC —– 3.3v
        * GND —– GND
        *
        */

        #define FREQUENCY_868
        #include “Arduino.h”
        #include “LoRa_E32.h”

        LoRa_E32 e32ttl100(&Serial2,UART_BPS_RATE_9600 );
        void printParameters(struct Configuration configuration);
        void printModuleInformation(struct ModuleInformation moduleInformation);

        void setup() {
        Serial.begin(9600);
        delay(500);

        // Startup all pins and UART
        e32ttl100.begin();

        ResponseStructContainer c;
        c = e32ttl100.getConfiguration();
        // It’s important get configuration pointer before all other operation
        Configuration configuration = *(Configuration*) c.data;
        Serial.println(c.status.getResponseDescription());
        Serial.println(c.status.code);

        printParameters(configuration);
        configuration.ADDL = 0x0;
        configuration.ADDH = 0x1;
        configuration.CHAN = 0x6;

        configuration.OPTION.fec = FEC_0_OFF;
        configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
        configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
        configuration.OPTION.transmissionPower = POWER_20;
        configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250;

        configuration.SPED.airDataRate = AIR_DATA_RATE_000_03;
        configuration.SPED.uartBaudRate = UART_BPS_9600;
        configuration.SPED.uartParity = MODE_00_8N1;
        // Set configuration changed and set to not hold the configuration
        ResponseStatus rs = e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
        Serial.println(rs.getResponseDescription());
        Serial.println(rs.code);
        printParameters(configuration);
        c.close();
        }

        void loop() {

        }
        void printParameters(struct Configuration configuration) {
        Serial.println(“—————————————-“);

        Serial.print(F(“HEAD : “)); Serial.print(configuration.HEAD, BIN);Serial.print(” “);Serial.print(configuration.HEAD, DEC);Serial.print(” “);Serial.println(configuration.HEAD, HEX);
        Serial.println(F(” “));
        Serial.print(F(“AddH : “)); Serial.println(configuration.ADDH, BIN);
        Serial.print(F(“AddL : “)); Serial.println(configuration.ADDL, BIN);
        Serial.print(F(“Chan : “)); Serial.print(configuration.CHAN, DEC); Serial.print(” -> “); Serial.println(configuration.getChannelDescription());
        Serial.println(F(” “));
        Serial.print(F(“SpeedParityBit : “)); Serial.print(configuration.SPED.uartParity, BIN);Serial.print(” -> “); Serial.println(configuration.SPED.getUARTParityDescription());
        Serial.print(F(“SpeedUARTDatte : “)); Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(” -> “); Serial.println(configuration.SPED.getUARTBaudRate());
        Serial.print(F(“SpeedAirDataRate : “)); Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(” -> “); Serial.println(configuration.SPED.getAirDataRate());

        Serial.print(F(“OptionTrans : “)); Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(” -> “); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
        Serial.print(F(“OptionPullup : “)); Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(” -> “); Serial.println(configuration.OPTION.getIODroveModeDescription());
        Serial.print(F(“OptionWakeup : “)); Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(” -> “); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
        Serial.print(F(“OptionFEC : “)); Serial.print(configuration.OPTION.fec, BIN);Serial.print(” -> “); Serial.println(configuration.OPTION.getFECDescription());
        Serial.print(F(“OptionPower : “)); Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(” -> “); Serial.println(configuration.OPTION.getTransmissionPowerDescription());

        Serial.println(“—————————————-“);

        }

        `
        Here is the code of transmission (E32-900T20D) :

        / * E32 —– esp32
        * M0 —– GND
        * M1 —– GND
        * RX —– TX2 (PullUP)
        * TX —– RX2 (PullUP)
        * AUX —– not connected
        * VCC —– 3.3v
        * GND —– GND
        *
        */
        #include “LoRa_E32.h”

        LoRa_E32 e32ttl100(&Serial2,UART_BPS_RATE_9600 );

        void setup() {
        Serial.begin(9600);
        delay(500);

        // Startup all pins and UART
        e32ttl100.begin();

        Serial.println(“Hi, I’m going to send messages every second!”);

        // Send first message
        ResponseStatus rs = e32ttl100.sendMessage(“Hello, world?”);
        // Check if message was sent successfully
        if (rs.code == 1) {
        Serial.println(“Message sent successfully”);
        } else {
        Serial.println(“Failed to send message”);
        }
        }

        void loop() {
        delay(1000);

        // Send message
        ResponseStatus rs = e32ttl100.sendMessage(“Hello, world?”);
        // Check if message was sent successfully
        if (rs.code == 1) {
        Serial.println(“Message sent successfully”);
        } else {
        Serial.println(“Failed to send message”);
        }
        }

        here is the result of the transmitter (E32-900T20D):
        `
        Hi, I’m going to send messages every second!
        Message sent successfully
        Message sent successfully
        Message sent successfully
        `
        here is the code of the receiver (LoRa32U4):

        #include <LoRa.h>

        #define ss 8
        #define reset 4
        #define dio0 7

        void setup() {
        Serial.begin(9600);

        LoRa.setPins(ss, reset, dio0);
        if (!LoRa.begin(868E6)) {
        Serial.println(“Starting LoRa failed!”);
        while (1);
        }
        // Set signal bandwidth to 125kHz
        LoRa.setSignalBandwidth(125E3);

        // Set TX power to 20dBm
        LoRa.setTxPower(20);

        pinMode(LED_BUILTIN, OUTPUT);
        digitalWrite(LED_BUILTIN, HIGH);
        }

        void loop() {
        int packetSize = LoRa.parsePacket();
        if (packetSize) {
        // received a packet
        Serial.print(“Received packet with RSSI “);
        Serial.print(LoRa.packetRssi());
        Serial.print(“: “);

        while (LoRa.available()) {
        Serial.write(LoRa.read());
        }

        digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
        }
        }

      • #25397
        Renzo Mischianti
        Keymaster

          Hi Sahar,
          I think there are some problem.
          First three frequency is
          FREQUENCY_900
          then you must set the same frequency of the devices in configuration.

          But most important is that EByte LoRa use a cryptography system that do not allow the communication from different devices.
          But the algorithm was quite simple, so if you want I can search it and post here.
          Bye Renzo

          • #25398
            sahar
            Participant

              I really need help so if u can send me this algorithm.
              Is there a way to make it work , or should i just get new hardware ?
              Thank you for your help

          • #25400
            Renzo Mischianti
            Keymaster

              Hi Sahar,
              I’m out for 2 days when I return, I will try to find It.
              But surely It’s more simple to use the same kind of device to do a project, you can communicate with the transparent transmission, but a fixed one can be a problem.
              Bye Renzo

            • #25401
              sahar
              Participant

                I’ll be waiting for your response.
                Thank you

              • #25402
                sahar
                Participant

                  Hello ,
                  Please don’t forget to send me the cryptography system to communicate e32-900T20D with LoRa32U4 II.
                  If the communication between those two modules is impossible , can i replace e32-900T20D with another lora module(like LoRa1276) to communicate with lora32U4 II ?
                  Thanks.

                • #25407
                  Renzo Mischianti
                  Keymaster

                    Hi,
                    You can find an example communication here.
                    https://blog.zesanglier.fr/2023/02/11/communiquer-entre-un-module-ebyte-e32-et-un-module-ra01-02-sx1278/

                    The algorithm is quite simple.
                    Bye Renzo

                  • #25408
                    sahar
                    Participant

                      Thank you for your help

                    • #25409
                      sahar
                      Participant

                        Is there a way to disable the cryptography system of the Ebyte LoRa module ?

                      • #25426
                        Renzo Mischianti
                        Keymaster

                          I think It isn’t possible, but I can’t find anything about that.
                          Bye Renzo

                        • #25429
                          sahar
                          Participant

                            Thank you for your advices , i buy a new lora module (lora1276 V2.0) and the communication between this new module and lora32U4II is working

                        Viewing 9 reply threads
                        • You must be logged in to reply to this topic.
                        Exit mobile version