KrisKasprzak / EBYTE

Libraries to program and use UART-based EBYTE wireless data transceivers
233 stars 75 forks source link

3 transmissions instead of 1 #51

Closed Yousefff1 closed 1 year ago

Yousefff1 commented 2 years ago

Hi,

I have two E220's connected to two Atmega328Ps, they were working just fine, but just recently, instead of sending one transmission every 10 minutes, it sends three at the same time, I've verified this is from the sender, because I have another receiver that also received three transmissions, this only happened overnight for some reason, I've reuploaded the code, but still, it sometimes randomly sends three transmissions for some reason.

Any ideas?

KrisKasprzak commented 2 years ago

without any code or wiring, I have no idea. On 5v0 units (like those arduinos), a pullup between the modules on aux and tx may be help.

Thanks, Kris @.***

On Tuesday, March 29, 2022, 02:01:31 PM CDT, Yousefff1 ***@***.***> wrote:  

Hi,

I have two E220's connected to two Atmega328Ps, they were working just fine, but just recently, instead of sending one transmission every 10 minutes, it sends three at the same time, I've verified this is from the sender, because I have another receiver that also received three transmissions, this only happened overnight for some reason, I've reuploaded the code, but still, it sometimes randomly sends three transmissions for some reason.

Any ideas?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Yousefff1 commented 2 years ago

For the wiring I followed the default wiring from the example sketch notes, it works just fine.

What I remember changing (maybe) is playing with how the receiver wakes up, here is the sender sketch:

` int serial_number = 100;

/--- Lora --------------- /

include

include "EBYTE.h"

define PIN_RX 2

define PIN_TX 3

define PIN_M0 4

define PIN_M1 5

define PIN_AX 6

struct DATA { float Volts; float Temp; uint16_t Distance; uint16_t serial_number; }; int Chan; DATA MyData;

SoftwareSerial ESerial(PIN_RX, PIN_TX); EBYTE Transceiver(&ESerial, PIN_M0, PIN_M1, PIN_AX); /------------------------ /

/--- Other --------------- /

include "LowPower.h"

/--------------------------- /

/--- Distance --------------- /

include

include

VL53L1X sensor;

/--------------------------- / void(* resetFunc) (void) = 0;

void setup() {

Serial.begin(9600);

/--- Distance --------------- / Wire.begin(); Wire.setClock(400000); // use 400 kHz I2C sensor.setTimeout(500); if (!sensor.init()) { Serial.println("Failed to detect and initialize sensor!"); delay(4000); // while (1); resetFunc(); } sensor.setDistanceMode(VL53L1X::Long); sensor.setMeasurementTimingBudget(50000);

/--- Lora --------------- / ESerial.begin(9600); // Serial.println("Starting Sender"); Transceiver.init();

}

void loop() { digitalWrite(PIN_M0, LOW); // Normal operation digitalWrite(PIN_M1, LOW); // Normal operation

/ Distance ------------------------ / delay(1000);

int16_t distance;

distance = sensor.readSingle(); MyData.Distance = distance; / ------------------------------ /

MyData.serial_number = serial_number; / ---- Temperatur------------------ / MyData.Temp = 13.3; / ------------------------------ /

/ ---- Voltage ------------------ / MyData.Volts = 3.7; / ------------------------------ /

Transceiver.SendStruct(&MyData, sizeof(MyData));

Serial.println("Data sent"); delay(1000);

ESerial.flush();

delay(1000); / ------------------------------ /

digitalWrite(PIN_M0, LOW); //put the transmitter to sleep digitalWrite(PIN_M1, HIGH); // put the transmitter to sleep

delay(1000);

for(int i=0; i <= 5; i++){ // sleep for 5*8 seconds LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF); //Turn the arduino to low power mode }

}`

Yousefff1 commented 2 years ago

@KrisKasprzak it's also interesting that sometimes the serial number is received as 256000 not 100, this seems like a norm.

KrisKasprzak commented 2 years ago

Try sending and receiving the data directly with serial commands

for the receiver: ESerial.readBytes((uint8_t*)& MyData, (uint8_t) sizeof(MyData));

for the transmitter ESerial.write((uint8_t*) &MyData, (uint8_t) sizeof(MyData));

Yousefff1 commented 2 years ago

Thank you! I'll try it out. I'll also change the serial_number from int to uint16_t in the first lines of the sketch.

Yousefff1 commented 1 year ago

Hi Kris,

Do you have the default configuration values for the E220 433mhz module?

I've been playing around with the configuration sittings, and my E220 modules are no longer receiving or transmitting anything.

It seems the modules stopped transmitting anything after uncommenting Transceiver.SetPullupMode(1);

KrisKasprzak commented 1 year ago

The default settings can be found on the data sheet.

Thanks. Kris Kasprzak

On Nov 4, 2022, at 6:42 PM, Yousefff1 @.***> wrote:

 Hi Kris,

Do you have the default configuration values for the E220 433mhz module?

I've been playing around with the configuration sittings, and my E220 modules are no longer receiving or transmitting anything.

It seems the modules stopped transmitting anything after uncommenting Transceiver.SetPullupMode(1);

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.