Home › Forums › The libraries hosted on the site › EByte LoRa e32 UART devices sx1262/sx1268 › ESP32 – Ebyte LORA E32 433T30D V8
Tagged: ESP32 - LORA E32 433T30D V8
- This topic has 3 replies, 2 voices, and was last updated 4 months, 1 week ago by
petoga.
-
AuthorPosts
-
-
30 December 2024 at 15:00 #32011
Hi Renzo,
I have trouble with config Lora E32 433T30D, I see it can sendmessage with code 1: success, but they can not receive. I dont know why and how to solve, I use ESP32 doit devkit V1, it do not support softwareSerial so I use hardwareSerial (Serial2) for connect Lora module.
I have info after config as below for 1st module:
HEAD : 10010001 145 91AddH : 0
AddL : 2
Chan : 17 -> 433MHzSpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDatte : 11 -> 9600bps (default)
SpeedAirDataRate : 10 -> 2.4kbps (default)
OptionTrans : 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)
OptionPullup : 1 -> TXD, RXD, AUX are push-pulls/pull-ups
OptionWakeup : 0 -> 250ms (default)
OptionFEC : 1 -> Turn on Forward Error Correction Switch (Default)
OptionPower : 0 -> 20dBm (Default)
—————————————-
Success
Waiting for incoming data…
Data available: 0
CHECK: No_dataAnd 2nd Module as below:
HEAD : 11000011 195 C3AddH : 0
AddL : 3
Chan : 17 -> 433MHzSpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDatte : 11 -> 9600bps (default)
SpeedAirDataRate : 10 -> 2.4kbps (default)
OptionTrans : 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)
OptionPullup : 1 -> TXD, RXD, AUX are push-pulls/pull-ups
OptionWakeup : 0 -> 250ms (default)
OptionFEC : 1 -> Turn on Forward Error Correction Switch (Default)
OptionPower : 0 -> 20dBm (Default)
—————————————-
Success
Waiting for incoming data…
Data available: 0
CHECK: No_dataI do not if I miss something, so pl help!
Attachments:
You must be logged in to view attached files. -
10 January 2025 at 09:21 #32036
Hi Petoga,
to use different HardwareSerial pins, you must use the correct constructorLoRa_E32(byte txE32pin, byte rxE32pin, HardwareSerial* serial, byte auxPin, byte m0Pin, byte m1Pin, UART_BPS_RATE bpsRate, uint32_t serialConfig = SERIAL_8N1); // -------------------------------------
so the first example constructor become
LoRa_E32 e32ttl100(RX_PIN, TX_PIN, &Serial2, 35, M0, M1, UART_BPS_RATE_9600); // RX AUX M0 M1
Bye Renzo
-
11 January 2025 at 13:31 #32044
Hi Renzo,
Thanks for your support, I have update my code with your comment, I also check voltage of all lora pin, I get M0 = M1 = 0v, AUX = 3.3v, Tx = 3.3v, Rx = 3.3v, for both module. But can not get receive data from both.
AUX, RX, TX I use resistor 4.7k to 3.3v and M1, M0 use 1k ohm to GND (cause if dont use resistor it always 3.3v even though I set it LOW . Serial output as below:
CHECK: No_data
No_data
Pin GPIO27: 0.00 V
Pin GPIO33: 0.00 V
Message sent successfully!
Module acknowledged with response:
Waiting for incoming data…
Data available: 0
CHECK: No_dataBelow is update code:
`#include <Wire.h>
#include <HardwareSerial.h>
#include “LoRa_E32.h”
//#define LED 14
#define BUTT 12
#define M1 33
#define M0 27
int counting = 0;
#define RX_ESP 16 // RXD2 16
#define TX_ESP 17 // TXD2 17
#define AUX 5
HardwareSerial mySerial(2);
//LoRa_E32(byte txE32pin, byte rxE32pin, HardwareSerial* serial, byte auxPin, byte m0Pin, byte m1Pin, UART_BPS_RATE bpsRate, uint32_t serialConfig = SERIAL_8N1);
LoRa_E32 e32ttl( RX_ESP ,TX_ESP, &mySerial, AUX, M0, M1,UART_BPS_RATE_9600,SERIAL_8N1);
// ————————————-
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
void SendData(String str);
void SendData(String str);
void setMode(int m0, int m1);
void waitForAux();
String revData();
void voltage();
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch
//
const int adcPins[] = {27, 33 }; //32, 33, 34, 35, 36, 39, 25, 26, 0, 2, 4, 12, 13, 14, 15, 27};
//const int adcPins[] = { 16, 17, 5, 27, 33 };
const int numPins = sizeof(adcPins) / sizeof(adcPins[0]);
void setup()
{
Serial.begin(115200);
//pinMode(LED, OUTPUT);
pinMode(BUTT, INPUT);
pinMode(M0, OUTPUT);
pinMode(M1, OUTPUT);
pinMode(AUX, INPUT);
//digitalWrite(LED, LOW);
setMode(LOW, LOW);
digitalWrite(M0, LOW);
digitalWrite(M1, LOW);
//Serial1.begin(9600, SERIAL_8N1, RX_PIN, TX_PIN);
mySerial.begin(9600, SERIAL_8N1, RX_ESP, TX_ESP);
e32ttl.begin();
waitForAux();
delay(100);
//
ResponseStructContainer info = e32ttl.getModuleInformation();
//
delay(100);
ResponseStructContainer c;
c = e32ttl.getConfiguration();
Configuration configuration = *(Configuration*) c.data;
configuration.ADDL = 0x02;
configuration.ADDH = 0x00;
configuration.CHAN = 0x17;
configuration.SPED.uartBaudRate = 0x04 ;//19200;
configuration.SPED.airDataRate = 0x03; //2.4k
configuration.OPTION.fec = 1;
configuration.OPTION.transmissionPower = 0;
configuration.OPTION.wirelessWakeupTime = 0;
configuration.SPED.uartParity = 0;
configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS; // Pull-up management
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());
configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
Serial.println(“LoRa Sender Initialized”);
c.close();
printParameters(configuration);
// —————————
//digitalWrite(M0, LOW);
digitalWrite(M1, LOW);
}// The loop function is called in an endless loop
void loop()
{
voltage();
// ResponseStatus rs = e32ttl.sendFixedMessage(0,3,17, “HELLO LORA_3”);
ResponseStatus rs = e32ttl.sendBroadcastFixedMessage(0x17, “HELLO LORA_3”);
if (rs.code == 1) {
Serial.println(“Message sent successfully!”);
ResponseContainer response = e32ttl.receiveMessage();
if (response.status.code == 1) {
Serial.print(“Module acknowledged with response: “);
Serial.println(response.data);
} else {
Serial.println(“No acknowledgment received.”);
}
} else {
Serial.println(“Failed to send message.”);
}
//
String res2 = revData();
delay(100);
Serial.println(“CHECK: ” + res2);
if (res2.substring(0,12) == “HELLO LORA_2”) {
Serial.println(“NHAN: ” + res2);
delay(50);
}
else {
Serial.println(res2);
}
delay(1000);
//}
//
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, HEX);
Serial.print(F(“AddL : “)); Serial.println(configuration.ADDL, HEX);
Serial.print(F(“Chan : “)); Serial.print(configuration.CHAN, HEX); 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(“—————————————-“);
}void SendData(String str) {
String s = str + “: ” + String(counting);
counting++;
ResponseStatus rs = e32ttl.sendBroadcastFixedMessage(0x17, s);
//ResponseStatus rs = e32ttl.sendFixedMessage(0x00, 0x03, 0x17, s);
Serial.println(“Code: ” + String(rs.code));
if (rs.code != 1) {
Serial.println(“Error Ping: ” + rs.getResponseDescription());
}
else {
Serial.println(“Message have been send: ” + s + ” ” + rs.getResponseDescription());
}
// Serial.println(String(rs.code) + “:” + rs.getResponseDescription());
delay(200);
}String revData() {
String res =””;
Serial.println(“Waiting for incoming data…”);
Serial.println(“Data available: ” + String(e32ttl.available()));
if (e32ttl.available() > 0){
ResponseContainer rs = e32ttl.receiveMessage();
if (rs.status.code == 1) {
String data = rs.data;
Serial.println(“Received: ” + data);
return data;
}
}
return “No_data”;
}void setMode(int m0, int m1) {
digitalWrite(M0, m0);
digitalWrite(M1, m1);
delay(10);
}void waitForAux() {
while (digitalRead(AUX) == LOW) {
delay(1);
}
}void voltage() {
for (int i = 0; i < numPins; i++) {
int pin = adcPins[i];
int adcValue = analogRead(pin); // Đọc giá trị ADC
float voltage = adcValue * 3.3 / 4095.0; // Chuyển đổi giá trị ADC sang điện áp
Serial.print(“Pin GPIO”);
Serial.print(pin);
Serial.print(“: “);
Serial.print(voltage);
Serial.println(” V”);
}
}
Please help! Thank Renzo!Attachments:
You must be logged in to view attached files. -
12 January 2025 at 08:02 #32047
Hi Renzo,
They have been communicated each other, I change UART_BPS_RATE_9600 for serial speed and configuration.SPED.uartBaudRate = 0x03 and it works.
I try to set higher like 19200 for all but after upload it in restart loop. Just 9600 is suitable, I dont know why.
Thank Renzo!
-
-
AuthorPosts
- You must be logged in to reply to this topic.