Arduino MKR 1010 with EByte E32 LoRa

Hi,

I have a weather station built that transmits using a EByte E32 LoRa's to communicate between Arduino's. The transmitter uses a Pro Mini and the receiver uses a Uno. I want to switch to a MKR 1010 so I can use the WiFi to connect to the internet.

My problem is that the Uno used Softwareserial to interface with the EByte. This does not work so I have tried the Serial1 Rx and Tx port. The port seems to connect to the E32 OK and send back the correct set up to match the transmitter but the data returned is incorrect.

Below is what is sent:
Wind direction=0

Average wind speed= 0
Pressure: 1011 hPa
Temp *C = 17
Hum. % = 63
Sending..
Size: 14 Bytes

Below is what is received:
Size: 28 Bytes
Max wind sp: 0 kts
Avg wind sp: 12897 kts
T:4128785C
H:1011%
P: 0 Battery Voltage: 0

Any idea's.

/*

  This example shows how to connect to an EBYTE transceiver
  using an Arduino MKR 1010

  This code for for the receiver.


  Connections
  Module      Arduino MKR
  M0          7
  M1          6
  Rx          13 (This is the MCU Tx lined)
  Tx          14 (This is the MCU Rx line)
  Aux         5 (not connected)
  Vcc         5v
  Gnd         Gnd

*/

#include "EBYTE.h"


#define PIN_M0 7
#define PIN_M1 6
#define PIN_AX 5

struct DATA {
  //unsigned long Count;
  int T;
  int h;
  int P;
  int wsa;
  int wgx;
  int wd;
  int vbatt;
};


int Chan;
DATA MyData;
unsigned long Last;

// create the transceiver object, passing in the serial and pins
EBYTE Transceiver(&Serial1, PIN_M0, PIN_M1, PIN_AX);

void setup() {

  pinMode(7, OUTPUT);
  digitalWrite(7, LOW); 
  pinMode(6, OUTPUT);
  digitalWrite(6, LOW); 
  pinMode(5, INPUT);
  Serial.begin(9600);

  Serial1.begin(9600);
  Serial.println("Starting Reader");

  // this init will set the pinModes for you
  Transceiver.init();
  Transceiver.SetAirDataRate(ADR_8K);   // change the air data rate
  Transceiver.SetAddressH(1);
  Transceiver.SetAddressL(0);
  Chan = 5;
  Transceiver.SetChannel(Chan);
  
  Serial.print(F("Air data rate:"));
  Serial.println(Transceiver.GetAirDataRate());
  Serial.print(F("Channel:"));
  Serial.println(Transceiver.GetChannel());

  // save the parameters to the unit,
  // Transceiver.SaveParameters(PERMANENT);

  Transceiver.PrintParameters();


}

void loop() {

  // if the transceiver serial is available, proces incoming data


  if (Transceiver.available()) {
  Transceiver.GetStruct(&MyData, sizeof(MyData));
  // You only really need this library to program these EBYTE units. 
  // For reading data structures, you can call readBytes directly on the EBYTE Serial object
  Serial1.readBytes((uint8_t*)& MyData, (uint8_t) sizeof(MyData));
  
    // dump out what was just received
  Serial.print(F("Size: ")); Serial.print(sizeof(MyData)); Serial.println(F(" Bytes"));
  Serial.print(F("Max wind sp: ")); Serial.print(MyData.wgx); Serial.println(F(" kts"));
  Serial.print(F("Avg wind sp: ")); Serial.print(MyData.wsa); Serial.println(F(" kts"));
  Serial.print(F("T:")); Serial.print(MyData.T); Serial.println(F("C")); Serial.print(F(" H:")); Serial.print(MyData.h); Serial.println(F("%"));
  Serial.print(F(" P: ")); Serial.print(MyData.P); 
  Serial.print(F(" Battery Voltage: ")); Serial.println(MyData.vbatt); 

    Last = millis();

  }
  else {
    // if the time checker is over some prescribed amount
    // let the user know there is no incoming data
    if ((millis() - Last) > 1000) {
      Serial.println("Searching: ");
      Last = millis();
    }

  }
}

you know that with the arduino mkr 1010 you can use dashboards to see everything from the pc and that you can make 2 mkr communicate directly with the variables ... I don't know, but in my opinion it was better for you to buy 2 mkr wifi 1010 and everything was easier ...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.