LoRa E32 433T30D

Tagged: ,

Viewing 3 reply threads
  • Author
    Posts
    • #24051
      esadcal
      Participant

        Hi, i have LoRa E32 433T30D module and i want to transfer data which 128byte. But this module can receive 58byte max. I want to use buffer but i could not figure it out how to use. Do you know how can i do that. Do you have example codes.

      • #24057
        Renzo Mischianti
        Keymaster

          Hi esadcal,
          I don’t have a code ready for you.
          You need to create a structure with a progressive to recompose messages to the server.
          The code depends on the kind of data to transfer.

          If you post your possible solution, we will try to optimize it and help you.
          Bye Renzo

        • #24060
          esadcal
          Participant

            Here is my ender code that I have tried to send the struct in chunks of 58 bytes. But I could not. My main problem is I did not understand how to use buffer or an algorithm like that.

            #define E32_TTL_1W // E32 30d modülleri için bunu aktif et
            #include "LoRa_E32.h"
             
            #include <SoftwareSerial.h>
            #include "Wire.h";
            #include "Adafruit_BMP085.h"; //Basınç Sensörü Kütüphanesi
            Adafruit_BMP085 mySensor;
            
            #define BUFFER_SIZE 256
            char buffer[BUFFER_SIZE];
            int bufferIndex = 0;
            int chunkSize = 58;
            
             
            SoftwareSerial mySerial(10, 11);
            LoRa_E32 FixajSS(&mySerial);
             
            #define M0 7
            #define M1 6
             
            //PARAMETRE AYARLARI
            #define Adres 1   //0--65000 arası bir değer girebilirsiniz. Diğer Modüllerden FARKLI olmalı
            #define Kanal 20  //Frekans değeri Diğer Modüllerle AYNI olmalı.
            //E32 için 0--31 arasında bir sayı giriniz.
            //E32 433 için Frekans = 410 + kanal değeri
            int sayac=0; 
            #define GonderilecekAdres 2 //Mesajın gönderileceği LoRa nın adresi
             
            struct Signal {
              char zaman[15]="11.12,24.01.23";
              byte enlem[7];
              byte boylam[7];
              byte s[5];
              byte b[7];
              byte counter[4];
              byte y[6];
              byte b2[6];
              byte hata[5];
            
            } data;
             
             
            void setup() {
              pinMode(M0, OUTPUT);
              pinMode(M1, OUTPUT);
             
              Serial.begin(9600);
              FixajSS.begin();
              mySensor.begin();
             
              digitalWrite(M0, LOW);
              digitalWrite(M1, LOW);
             
              delay(500);
              Serial.println("başlıyoruz..");
            }
             
            void loop() {
             
              *(float*)(data.enlem) = 37.1993;
              *(float*)(data.boylam)= 45.4242;
              *(float*)(data.s)=25.32;//mySensor.readTemperature();
              *(float*)(data.b)=1023.45; //mySensor.readPressure();
              *(float*)(data.b2)=101.42;
              *(int*)(data.counter)=sayac;
              *(float*)(data.y)=450.12;
              //*(int*)(data.hata)=10100;
              
              int dataSize = sizeof(Signal);
              int offset = 0;
              while (offset < dataSize)
              {
                int bytesToSend = min(chunkSize, dataSize - offset);
                ResponseStatus rs = FixajSS.sendFixedMessage(highByte(GonderilecekAdres), lowByte(GonderilecekAdres), Kanal, (byte*)(&data) + offset, bytesToSend);
                offset += bytesToSend;
                delay(1000);
              }
            
              sayac++;
              delay(500);
            }
            
          • #24067
            Renzo Mischianti
            Keymaster

              Hi esadcal,
              I think that in your case the simplest solution is to split your structure and send 2 separate message.

              To the head of the message add a descriptor and use the read of partial structure like the examples in the tutorial.

              Ebyte LoRa E32 device for Arduino, esp32 or esp8266: power saving and sending structured data – Part 5

              Bye Renzo

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