kriskasprzak / ebyte Goto Github PK
View Code? Open in Web Editor NEWLibraries to program and use UART-based EBYTE wireless data transceivers
Libraries to program and use UART-based EBYTE wireless data transceivers
Hi guys, am I incorrect with my discovery that my E23-TTL-100 433MHz lora Uart radio only does 1MHz channels?!
So ISM band is 433.050 to 434.790 MHz where I am,
The Bandwidth for Lora Phy at 0.3Kb on-air is 125KHz.
That would allow for:
433.000 Channel 1
433.125 Channel 2 - not available on this device.
433.250 Channel 3 - not available on this device.
433.375 Channel 4 - not available on this device.
433.500 Channel 5 -not available on this device.
.....
Really? only 2 ISM 433 MHz usable frequencies?
Please tell me that these is better firmware for operating a finer frequency selection.
Please! Please!
P
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?
Hi,
I have an ebyte e22-400t30d module. This module is based on sx1268 chip and has uart interface. It's easy to program, but there is no access to the sx1268 chip settings. I want to establish communication between this module and another one based on the sx1278 chip and having a spi interface. Does anyone know what parameters the ebyte e22-400t30d uses? I need to know Modulation BandWidth, Spreading Factor, Coding Rate and others.
Hi Kris,
Many thank for a simple and powerful library.
As I was code reviewing your work, i came across this line of code in method bool EBYTE::ReadModelData()
__s->readBytes((uint8_t*)& _Params, (uint8_t) sizeof(Params));
I suspect this is wrong since it passes the address of the buffer pointer. Ichanged it to
_bool EBYTE::ReadModelData()_s->readBytes((uint8_t*) _Params, (uint8_t) sizeof(Params));
For some reason; it gave me the same data back. May be the compiler did some optimization.
peace
Good Morning,
I'm doing a project for university, and I'm using 2 Transceivers Ebyte E32-868T30D.
I can communicate up to a distance of 10/15 meters but more than that.
Can you give me some help in configuring them !?
Hi,
Sorry if this is the wrong place to post this. I'm struggling to find a good place to ask my question.
Your library has been great while trying to set up a laser gate timing system. I have 2 Arduino Nanos sending and an Uno receiving. I am now onto adding a screen to my setup and have switched to an Adafruit Metro M0 rather than the Uno. The M0 does not allow a software serial.
You mention in your description "Some MCU such as the Teensy, and ESP32 do NOT allow the use of SoftwareSerial to create a communications port. No worries, just hard wire the EBTYE to a dedicated UART port (pin 0 and pin 1 on a teensy 3.2 for Serial1." however, I am very new to programming and can't figure out how to set this up. What do I replace SoftwareSerial loraSerial (2,3); //TX, RX
with? I have tried replacing SoftwareSerial with Serial1 but it says "Serial1 does not name a type".
I have my basic code below which works as a receiver on the uno
Thanks in advance,
Ben
#include <SoftwareSerial.h>
#include "EBYTE.h"
//If using direct wiring, use these pin definitions
//#define PIN_M0 4
//#define PIN_M1 5
//#define PIN_AX 6
SoftwareSerial loraSerial (2,3); //TX, RX
EBYTE Transceiver(&loraSerial); //PIN_M0, PIN_M1, PIN_AX);
void setup() {
Serial.begin(9600);
loraSerial.begin(9600);
Transceiver.init();
Transceiver.SetMode(MODE_NORMAL);
Transceiver.SetAirDataRate(ADR_9600);
Transceiver.SetTransmitPower(OPT_TP17);
}
void loop() {
if (loraSerial.available()>0){
String input = loraSerial.readString();
Serial.print("I received: "); Serial.println(input);
}
}
Hi,
I have two NodeMCU V2 and a pair of E32868TD.
Using this library I can't connect correctly the E32 with MCU.
I have tried much many options, first using assigning -1 to M0, M1, and AUX.
Result : continuous reboot of MCU. It seems the -1 don't work.
The last I used complete GPIO assigning, and also no working.
#define PIN_RX 10
#define PIN_TX 9
#define PIN_M0 4
#define PIN_M1 5
#define PIN_AUX 14
This is my entire receiver code, it is the same as is your sample, plus led :
void setup()
{
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH }
ESerial.begin(9600);
Serial.println("Starting Receiver");
// this init will set the pinModes for you
Transceiver.init();
// all these calls are optional but shown to give examples of what you can do
// Serial.println(Transceiver.GetAirDataRate());
// Serial.println(Transceiver.GetChannel());
// Transceiver.SetAddressH(1);
// Transceiver.SetAddressL(0);
// Chan = 5;
// Transceiver.SetChannel(Chan);
// save the parameters to the unit,
// Transceiver.SaveParameters(PERMANENT);
// you can print all parameters and is good for debugging
// if your units will not communicate, print the parameters
// for both sender and receiver and make sure air rates, channel
// and address is the same
Transceiver.PrintParameters();
}
void loop()
{
// if the transceiver serial is available, proces incoming data
// you can also use Transceiver.available()
if (ESerial.available())
{
digitalWrite(LED_BUILTIN, LOW); // Turn the LED on by making the voltage LOW
delay(50);
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH }
delay(50);
// i highly suggest you send data using structures and not
// a parsed data--i've always had a hard time getting reliable data using
// a parsing method
Transceiver.GetStruct(&MyData, sizeof(MyData));
// dump out what was just received
Serial.print("Count: ");
Serial.println(MyData.Count);
Serial.print("Bits: ");
Serial.println(MyData.Bits);
Serial.print("Volts: ");
Serial.println(MyData.Volts);
// if you got data, update the checker
Last = millis();
}
else
{
delay(50);
}
}
The result is always
Starting Receiver
trying: 0
trying: 1
trying: 2
trying: 3
trying: 4
----------------------------------------
Model no.: 0
Version : 0
Features : 0
Mode (HEX/DEC/BIN): 0/0/0
AddH (HEX/DEC/BIN): 0/0/0
AddL (HEX/DEC/BIN): 0/0/0
Sped (HEX/DEC/BIN): 0/0/0
Chan (HEX/DEC/BIN): 0/0/0
Optn (HEX/DEC/BIN): 0/0/0
Addr (HEX/DEC/BIN): 0/0/0
SpeedParityBit (HEX/DEC/BIN) : 0/0/0
SpeedUARTDataRate (HEX/DEC/BIN) : 0/0/0
SpeedAirDataRate (HEX/DEC/BIN) : 0/0/0
OptionTrans (HEX/DEC/BIN) : 0/0/0
OptionPullup (HEX/DEC/BIN) : 0/0/0
OptionWakeup (HEX/DEC/BIN) : 0/0/0
OptionFEC (HEX/DEC/BIN) : 0/0/0
OptionPower (HEX/DEC/BIN) : 0/0/0
----------------------------------------
It seems doesn't have the connection between NODEMCU and E32.
The RX is powered by 3.3 V, the common as the same as ground of MCU.
I have tested the two NodeMCU and two E32, same issue.
I have changed a lot of wires and I have tested all what I could.
Any chance to run ?
Thanks, regards
Claudio
I'm using an E32-TTL-100 wired exactly as described in the example and didn't modify a single line of code except by commenting the loop content. Meaning it should just print the current parameters of the module.
But somehow, every value I'm getting printed on screen is 0.
I've tested this on two modules and they both are able to send data to each other, but unable to shown and/or set any configuration through this code.
I 've added the library #include "EBYTE.H" and i wrote SendStruct(&name, sizeof(Name)) ; but it says SendStruct() was not declared in this scope, here is the full code:
`#include <EBYTE.h>
struct Name{
int name = 40 ;
int identity = 41 ;
};
Name name;
EBYTE Transceiver(&Serial, 4, 5, 6);
void setup() {
Serial.begin(9600);
}
void loop() {
SendStruct(&name, sizeof(Name)) ;
delay(1000);
}`
What am i doing wrong, can you help me please
Hello,
I don't know much about low-level programming language :/ it's all new to me.
Is it possible to specify the destination address or the channel only for sending a message ?
Of style:
EBYTE::SendFixedMessage(2, 2, 0x17, "Message to a device");
It appears that the changes for M0 & M1 also assume that Aux is also not used as you never set pinmode for Aux if M0 & M1 are set to -1. That should not be the case as Aux is still very valid.
Also, at line 61 "if ((_M0 == -1) & (_M1 == -1)){" did you mean '&&' as I believe a logical AND is required here and not a bit-wise AND?
Not trying to be picky, just trying to understand.
Originally posted by @tqueale in #11 (comment)
hi, Is EBYTE Lora module compatible with others, for example Hoperf, TTGO or AI Thinker?
I tested TTGO and Heltec, they can work with each other. I want to use EBYTEs module as the Gateway and Heltec ASR6502 as the relay controller
@KrisKasprzak Thank you for the inspiration,
After finishing an ESP32 LoRa to MQTT gateway with your library, I started working on a similar library for Python on a RaspberryPi (GPIO header).
https://github.com/vindolin/python_ebyte_lora
When reading the Ebyte datasheet for the E32-868T20D module, I noticed that it reads:
Do the older modules allow programming in different baud rates?
Cheers
Thomas
I really appreciate your work, It helped me a lot in my project. I wanted to check if my data has been received or not by the receiver. How can do this using your library or is there any other way to implement this?
Hi! I wrote here in past about issues on parallel use of a E32900t20d and a SHT30 (they use I2C), I solved using I2C on others declared PINs.
My issue now is about the packet transmission structure.
I modified it into:
struct DATA {
unsigned long Count;
float Temperatura;
float Umidita;
String Uuid;
};
It is composed by 2 floats and a string.
The floats are ok, they are received with no problem but the string is sended for example with this value
9C9C1FE20168
and it is received with strange characters.
What could be the problem?
The structure is the same in the sending sketch and in the receiving sketch.
Thank you for your great job and your support!
Bye
Luca Menghini
Hi,
Thank you for this excellent library.
I do not know how I did it, but I have an E32-868T20D module where Sped = 2 and Optn = 0.
I would like to change these settings (mostly because FEC = 0), but I did not find the method. Can you help me ? Thank you in advance.
Philippe
Hi,
I need some help I can get the code running.
I want to program and address with 1 coordinator 5 slave.
desired address in the communication with the lora on the arduino on led i want to burn. or I want to extinguish.
How can I do it.Thank you.
===Coordinator===
Transceiver.init();
Transceiver.SetMode(MODE_NORMAL);
Transceiver.Reset();
Transceiver.SetTransmitPower(OPT_TP20);
Transceiver.SetAirDataRate(ADR_8K);
Transceiver.SetAddressH(0);
Transceiver.SetAddressL(0);
Transceiver.SetChannel(11);
Transceiver.SaveParameters(PERMANENT);
Transceiver.PrintParameters();
====Slave=== 1
Transceiver.init();
Transceiver.SetMode(MODE_NORMAL);
Transceiver.Reset();
Transceiver.SetTransmitPower(OPT_TP20);
Transceiver.SetAirDataRate(ADR_8K);
Transceiver.SetAddressH(0);
Transceiver.SetAddressL(0);
Transceiver.SetChannel(1);
Transceiver.SaveParameters(PERMANENT);
Transceiver.PrintParameters();
====Slave=== 2
Transceiver.init();
Transceiver.SetMode(MODE_NORMAL);
Transceiver.Reset();
Transceiver.SetTransmitPower(OPT_TP20);
Transceiver.SetAirDataRate(ADR_8K);
Transceiver.SetAddressH(0);
Transceiver.SetAddressL(0);
Transceiver.SetChannel(2);
Transceiver.SaveParameters(PERMANENT);
Transceiver.PrintParameters();
====Slave=== 3
Transceiver.init();
Transceiver.SetMode(MODE_NORMAL);
Transceiver.Reset();
Transceiver.SetTransmitPower(OPT_TP20);
Transceiver.SetAirDataRate(ADR_8K);
Transceiver.SetAddressH(0);
Transceiver.SetAddressL(0);
Transceiver.SetChannel(3);
Transceiver.SaveParameters(PERMANENT);
Transceiver.PrintParameters();
====Slave=== 4
Transceiver.init();
Transceiver.SetMode(MODE_NORMAL);
Transceiver.Reset();
Transceiver.SetTransmitPower(OPT_TP20);
Transceiver.SetAirDataRate(ADR_8K);
Transceiver.SetAddressH(0);
Transceiver.SetAddressL(0);
Transceiver.SetChannel(4);
Transceiver.SaveParameters(PERMANENT);
Transceiver.PrintParameters();
====Slave=== 5
Transceiver.init();
Transceiver.SetMode(MODE_NORMAL);
Transceiver.Reset();
Transceiver.SetTransmitPower(OPT_TP20);
Transceiver.SetAirDataRate(ADR_8K);
Transceiver.SetAddressH(0);
Transceiver.SetAddressL(0);
Transceiver.SetChannel(5);
Transceiver.SaveParameters(PERMANENT);
Transceiver.PrintParameters();
Are there any possibility to get RSSI value, something compareable or any means to monitor signal/communication quality/strength for the E32868T30D?
I guess the module itself does not provide that? Does it make sense to contact EBYTE to enhace their firmware for tge module to implement that?
I have found statements and code that indicates, that Semtech SX1276/78 supports RSSI (which is most likely used by the E32 modules)
When doing tests with the Arduino NANO Every card I have a constant error with the EBYTE library, I tried the Arduino and Teensy examples, since the latter has more than one serial port like the card with which I am testing, but not I have gotten it to work.
Reading about the Arduino NANO Every, the SoftwareSerial library does not work nor has it been ported since the serial port available to work is Serial1 and it is separate from the one used for USB communication.
The error is the following, when I try the send sketch:
Arduino:1.8.13 (Windows Store 1.8.42.0) (Windows 10), Tarjeta:"Arduino Nano Every, None (ATMEGA4809)"
In file included from C:\xXx\AppData\Local\Temp\arduino_modified_sketch_750088\Send.ino:21:0:
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:175:15: error: expected ')' before '*' token
EBYTE(Stream *s, uint8_t PIN_M0 = 4, uint8_t PIN_M1 = 5, uint8_t PIN_AUX = 6, unsigned long ReadTimeout = 1000);
^
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:270:2: error: reference to 'Stream' is ambiguous
Stream* _s;
^~~~~~
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:169:7: note: candidates are: class Stream
class Stream;
^~~~~~
In file included from D:\XxX\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/Client.h:22:0,
from D:\XxX\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/ArduinoAPI.h:29,
from D:\XxX\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/Arduino.h:23,
from sketch\Send.ino.cpp:1:
D:\XxX\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/Stream.h:50:7: note: class arduino::Stream
class Stream : public Print
^~~~~~
In file included from C:\Users\Francis\AppData\Local\Temp\arduino_modified_sketch_750088\Send.ino:21:0:
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:271:2: error: reference to 'Stream' is ambiguous
Stream* _TD;
^~~~~~
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:169:7: note: candidates are: class Stream
class Stream;
^~~~~~
In file included from D:\XxX\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/Client.h:22:0,
from D:\XxX\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/ArduinoAPI.h:29,
from D:\XxX\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/Arduino.h:23,
from sketch\Send.ino.cpp:1:
D:\XxX\ArduinoData\packages\arduino\hardware\megaavr\1.8.6\cores\arduino/api/Stream.h:50:7: note: class arduino::Stream
class Stream : public Print
^~~~~~
Send:46:51: error: no matching function for call to 'EBYTE::EBYTE(UartClass*, int, int, int)'
EBYTE Transceiver(&ESerial, PIN_M0, PIN_M1, PIN_AX);
^
In file included from C:\Users\Francis\AppData\Local\Temp\arduino_modified_sketch_750088\Send.ino:21:0:
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:171:7: note: candidate: EBYTE::EBYTE()
class EBYTE {
^~~~~
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:171:7: note: candidate expects 0 arguments, 4 provided
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:171:7: note: candidate: constexpr EBYTE::EBYTE(const EBYTE&)
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:171:7: note: candidate expects 1 argument, 4 provided
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:171:7: note: candidate: constexpr EBYTE::EBYTE(EBYTE&&)
D:\XxX\Arduino\libraries\EBYTE-master/EBYTE.h:171:7: note: candidate expects 1 argument, 4 provided
exit status 1
no matching function for call to 'EBYTE::EBYTE(UartClass*, int, int, int)'
Hi!
I'm having issues transmitting data using two E220 modules but with different MCUs, in this case ESP8266 (receiver) and Atmega328P-AU (Transmitter). It seems floats transmit just fine, but Integers show up either as random (large) numbers or zero.
I'm using the barebone receive and transmit sketches examples from the library.
Any ideas?
Hi Kris,
First of all, I greatly appreciate your work here! I love it.
First maybe some background on my project. I'd like to set up a simple sender-receiver communication using two Ebyte E32-915T30D modules. The sender is connected to an Arduino and the receiver to a Raspberry Pi 2B.
I have been able to get a communication established in the past (read: last week), but the data transfer rate was too slow. So I ended up finding your library with the goal to configure the modules for a higher data transfer rate.
With another Arduino and some basic coding using your library, I made a little "programmer" and I was able to reconfigure the modules to baud rate 115200 bps and 19.2bps. The rest I kept the same.
In my sender code, I have inserted the following lines to check the sender module parameters:
`EBYTE Transceiver(&Serial); // Create the transceiver object, passing in the serial and pins
void setup()
{
Serial.begin(9600); // Connect terminal serial (shared for LORA serial on Arduino Nano)
Transceiver.init(); // This init will set the pinModes for you
Transceiver.PrintParameters();`
The serial output I get is as follows:
`⸮⸮⸮⸮⸮⸮----------------------------------------
Model no.: 44
Version : C
Features : 1E
Mode (HEX/DEC/BIN): C0/192/11000000
AddH (HEX/DEC/BIN): 0/0/0
AddL (HEX/DEC/BIN): 0/0/0
Sped (HEX/DEC/BIN): 3D/61/111101
Chan (HEX/DEC/BIN): F/15/1111
Optn (HEX/DEC/BIN): 44/68/1000100
Addr (HEX/DEC/BIN): 0/0/0
`
This output data looks fine I believe.
Now, what I do not understand:
Thanks in advance for any help,
Kevin
I wish to always use my unit in 'normal' mode (M1 & M0 both LOW). Is there an option to assign -1 to these pins during creation of the EBYTE object, similar to that provided for the Aux pin? Both M0 & M1 would be hard wired to Gnd. Saves 2 I/O lines as well.
I'll start with, it used to work and the channel would change properly, but as I've been fiddling with things for reasons I can't understand I've now got stuck on Channel 0 (862Mhz) where I want to use channel 41 (903MHz).
ESP32 all wiring is correct, module responds, other parameters are sent and I have equipment that can measure output so I know I've been able to change the output power from 21dbm to 30dbm, so I know there is communication with the module. Code on the PrintParameters shows the settings I have set. I have tried adjusting PIN_RECOVER to 250mS with no effect. I also note my modules return 0 for model but valid data for the other pieces.
Message is being sent, using sdr module I can see the transmission on 862 MHz (looked at first on 903MHz not found).
Lastly, I have 3 of these modules, they are all currently behaving identically when I swap them out on the perfboard.
Any pointers very welcome, thank you.
Current send code:
'''
#ifndef LED_BUILTIN
#define LED_BUILTIN 13
#endif
#include "EBYTE.h"
#define PIN_RX 16
#define PIN_TX 17
#define PIN_M0 4
#define PIN_M1 21
#define PIN_AX 23
struct DATA {
unsigned long Count;
int Bits;
float Volts;
float Amps;
};
DATA MyData;
EBYTE Transceiver(&Serial2, PIN_M0, PIN_M1, PIN_AX);
void setup() {
Serial.begin(9600);
Serial2.begin(9600);
Serial.println("Starting Reader");
Transceiver.init();
Transceiver.SetAddressH(1);
Transceiver.SetAddressL(1);
Transceiver.SetOptions(0b11000100);
Transceiver.SetSpeed(0b00011010);
Transceiver.SetChannel(41);
Transceiver.SaveParameters(TEMPORARY);
Transceiver.PrintParameters();
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
MyData.Count++;
MyData.Bits = analogRead(A0);
MyData.Volts = MyData.Bits * ( 5.0 / 1024.0 );
Transceiver.SendStruct(&MyData, sizeof(MyData));
Serial.print("Sending: "); Serial.println(MyData.Count);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
'''
I want to use the LoRaWAN module 868LN22S. Would it be supported? I am not perfectly clear if this module supports UART or SPI, web sources are not clear about it. Thank you!
In EBYTE.cpp at line 263 in Reset() comments you have "Per the data sheet just send 3x 0x4C to the unit" - this should be '0xC4' in place of the '0x4C'. The code is correct.
Does this Reset() restore factory defaults (those specified as defaults in the data sheet) or does it restore what you have saved with SaveParameters(PERMANENT)? The data sheet does not make this clear.
Hi Kris another issue.
I defined:
#include "EBYTE.h"
#include "Wire.h"
#include "SHT31.h"
#define SHT31_ADDRESS 0x44
SHT31 sht;
and in the setup i setted:
Wire.begin();
sht.begin(SHT31_ADDRESS);
Wire.setClock(100000);
I've got to use EBYTE to transmit, Wire to set the clock and sht31.h to manage a umidity&temeprature sensor.
I debugged the sketch because the transmitting doesn't work and I found that the line "Wire.begin();" doesn't not permit the transceiver to work
How can I solve? please help me
thank you
bye
the complete sketch here:
#include "EBYTE.h"
#include "Wire.h"
#include "SHT31.h"
// definizioni per SHT30
#define SHT31_ADDRESS 0x44
uint32_t start;
uint32_t stop;
SHT31 sht;
uint32_t connectionFails = 0;
// altre definizioni
String strid = "";
/*
WARNING: IF USING AN ESP32
DO NOT USE THE PIN NUMBERS PRINTED ON THE BOARD
YOU MUST USE THE ACTUAL GPIO NUMBER
*/
#define PIN_RX 16 // Serial2 RX (connect this to the EBYTE Tx pin)
#define PIN_TX 17 // Serial2 TX pin (connect this to the EBYTE Rx pin)
#define PIN_M0 4 // D4 on the board (possibly pin 24)
#define PIN_M1 22 // D2 on the board (possibly called pin 22)
#define PIN_AX 21 // D15 on the board (possibly called pin 21)
// i recommend putting this code in a .h file and including it
// from both the receiver and sender modules
struct DATA {
unsigned long Count;
int Bits;
float Volts;
float Amps;
};
int Chan;
DATA MyData;
unsigned long Last;
EBYTE Transceiver(&Serial2, PIN_M0, PIN_M1, PIN_AX);
void setup() {
Serial.begin(9600);
Serial2.begin(9600);
Serial.println("Starting Reader");
Serial.println(Transceiver.init());
Transceiver.PrintParameters();
// GESTIONE SHT30
Serial.println("Inizializzazione SHT30");
Serial.println(FILE);
Serial.print("SHT31_LIB_VERSION: \t");
Serial.println(SHT31_LIB_VERSION);
Wire.begin();
sht.begin(SHT31_ADDRESS);
Wire.setClock(100000);
uint16_t stat = sht.readStatus();
Serial.print(stat, HEX);
Serial.println();
//inizializzo LORA
strid=getMacAddress();
Serial.println(strid);
}
void loop() {
// lettura dati SHT31
if ( sht.isConnected() )
{
start = micros();
sht.read(); // default = true/fast slow = false
stop = micros();
Serial.print("Temperatura : ");
Serial.print(sht.getTemperature(), 1);
Serial.println(" °C");
Serial.print("Umidità : ");
Serial.print(sht.getHumidity(), 1);
Serial.println(" %");
}
else
{
connectionFails++;
Serial.print(millis());
Serial.print("\tNot connected:\t");
Serial.print(connectionFails);
// sht.reset();
}
// delay di 2 secondi con a capo
Serial.println();
// measure some data and save to the structure
MyData.Count++;
MyData.Bits=(sht.getTemperature(), 1);
MyData.Volts=(sht.getHumidity(), 1);
// i highly suggest you send data using structures and not
// a parsed data--i've always had a hard time getting reliable data using
// a parsing method
Transceiver.SendStruct(&MyData, sizeof(MyData));
// note, you only really need this library to program these EBYTE units
// you can call write directly on the EBYTE Serial object
// Serial2.write((uint8_t*) &Data, PacketSize );
// let the use know something was sent
Serial.print("Sending: "); Serial.println(MyData.Count);
delay(100);
}
// FUNZIONE CHE RITORNA UN id UNIVOCO PER SCHEDA
String getMacAddress() {
uint8_t baseMac[6];
// Get MAC address for WiFi station
esp_read_mac(baseMac, ESP_MAC_WIFI_STA);
char baseMacChr[18] = {0};
sprintf(baseMacChr, "%02X:%02X:%02X:%02X:%02X:%02X", baseMac[0], baseMac[1], baseMac[2], baseMac[3], baseMac[4], baseMac[5]);
String ris=String(baseMacChr);
ris.replace(":","");
return String(ris);
}
Hi,
I used two E22-900T30S modules with two Arduino Uno. Modules send and receive data without any problem except setting and printing the parameters?
How to solve this?
Hello Kris
Whereas the library is working fine with E30 and E32 modules, as soon as the Adafruit_BME280_Library is used, multiple compile errors appear in relation to MODE_NORMAL
I found out that both libraries are using a parameter MODE_NORMAL.
I try to rename all MODE_NORMAL in your Ebyte library EBYTE.h and EBYTE.cpp to MODE_NORMAAL and now everything works neatly together with the Adafruit library.
Good luck and thanks for this nice piece of work!
Dear Kris,
My name is Kirill. Write to you from a Russian model rocket club “Borschevik”. We’re making an on-board computer for our rocket model. As part of this device we’re using radiomodule Ebyte E32-868T20D controlled by Arduino Pro Mini 3.3V.
There is one problem. We’re trying to use the example from your library “Ebyte” but something is going wrong: we can’t transmit or receive any data. Could you advise us the ways to solve it?
I attached to this message:
-our electrical scheme;
-two videos of voltage measurements on radiomodules’ pins during the work;
-a program code;
-screenshots of a program we’re using to set up module params.
Sincerely,
Kirill
Transmitter
#include <SoftwareSerial.h>
#include "EBYTE.h"
#define PIN_RX 10 //arduinoRX
#define PIN_TX 7 //arduinoTX
#define PIN_M0 9
#define PIN_M1 8
#define PIN_AX 11
struct DATA {
unsigned long Count;
int Bits;
float Volts; };
int Chan;
DATA MyData;
SoftwareSerial ESerial(PIN_RX, PIN_TX);
EBYTE Transceiver(&ESerial, PIN_M0, PIN_M1, PIN_AX);
void setup() {
Serial.begin(9600);
ESerial.begin(9600);
Serial.println("Starting Sender");
Transceiver.init(); }
void loop() {
MyData.Count++;
MyData.Bits = 10;
MyData.Volts = MyData.Bits * ( 5.0 / 1024.0 );
Transceiver.SendStruct(&MyData, sizeof(MyData));
Serial.print("Sending: "); Serial.println(Transceiver.available());
delay(1000);
}
Receiver
#include <SoftwareSerial.h>
#include "EBYTE.h"
#define PIN_RX 10 //arduinoRX
#define PIN_TX 7 //arduinoTX
#define PIN_M0 9
#define PIN_M1 8
#define PIN_AX 11
struct DATA {
unsigned long Count;
int Bits;
float Volts; };
int Chan;
DATA MyData;
SoftwareSerial ESerial(PIN_RX, PIN_TX);
EBYTE Transceiver(&ESerial, PIN_M0, PIN_M1, PIN_AX);
void setup() {
Serial.begin(9600);
ESerial.begin(9600);
Serial.println("Starting Reader");
Transceiver.init(); }
void loop() {
if (ESerial.available()) {
Transceiver.GetStruct(&MyData, sizeof(MyData));
Serial.print("Count: "); Serial.println(MyData.Count);
Serial.print("Bits: "); Serial.println(MyData.Bits);
Serial.print("Volts: "); Serial.println(MyData.Volts);
Last = millis();
}
else {
if ((millis() - Last) > 1000) {
Serial.println("Searching: ");
Last = millis();
}
}
Video Tx: https://drive.google.com/file/d/11_lKVOkfTr2ua-ZTcl26wmVUJlUjYeBs/view?usp=sharing
Video Rx: https://drive.google.com/file/d/1S2jI8LHeGZeUg3xzuOff7Qa88wt6Tpff/view?usp=sharing
I have a sender (Arduino Mega) and a Receiver (esp32, heltec v2).
These are the params:
MEGA
----------------------------------------
Model no.: 45
Version : D
Features : 14
Mode (HEX/DEC/BIN): 0/0/0
AddH (HEX/DEC/BIN): 0/0/0
AddL (HEX/DEC/BIN): 0/0/0
Sped (HEX/DEC/BIN): 1A/26/11010
Chan (HEX/DEC/BIN): 6/6/110
Optn (HEX/DEC/BIN): 47/71/1000111
Addr (HEX/DEC/BIN): 0/0/0
SpeedParityBit (HEX/DEC/BIN) : 0/0/0
SpeedUARTDataRate (HEX/DEC/BIN) : 3/3/11
SpeedAirDataRate (HEX/DEC/BIN) : 2/2/10
OptionTrans (HEX/DEC/BIN) : 0/0/0
OptionPullup (HEX/DEC/BIN) : 1/1/1
OptionWakeup (HEX/DEC/BIN) : 0/0/0
OptionFEC (HEX/DEC/BIN) : 1/1/1
OptionPower (HEX/DEC/BIN) : 3/3/11
----------------------------------------
ESP32
----------------------------------------
Model no.: 45
Version : D
Features : 14
Mode (HEX/DEC/BIN): 0/0/0
AddH (HEX/DEC/BIN): 0/0/0
AddL (HEX/DEC/BIN): 0/0/0
Sped (HEX/DEC/BIN): 1A/26/11010
Chan (HEX/DEC/BIN): 6/6/110
Optn (HEX/DEC/BIN): 47/71/1000111
Addr (HEX/DEC/BIN): 0/0/0
SpeedParityBit (HEX/DEC/BIN) : 0/0/0
SpeedUARTDataRate (HEX/DEC/BIN) : 3/3/11
SpeedAirDataRate (HEX/DEC/BIN) : 2/2/10
OptionTrans (HEX/DEC/BIN) : 0/0/0
OptionPullup (HEX/DEC/BIN) : 1/1/1
OptionWakeup (HEX/DEC/BIN) : 0/0/0
OptionFEC (HEX/DEC/BIN) : 1/1/1
OptionPower (HEX/DEC/BIN) : 3/3/11
----------------------------------------
Everything seems the same on both the modules, but the receiver doesn't receive anything at all.
Receiver loop code
if (ESerial.available()) {
Transceiver.GetStruct(&MyData, sizeof(MyData));
Serial.print("Count: "); Serial.println(MyData.c);
}
Sender loop code
strcpy(MyData.c , "test");
Transceiver.SendStruct(&MyData, sizeof(MyData));
Serial.print("Sending: "); Serial.println(MyData.c);
delay(500);
The structure sent:
struct DATA {
char c[10];
};
Parameters:
Transceiver.Reset();
Transceiver.SetMode(MODE_NORMAL);
Transceiver.SetChannel(6);
Transceiver.SetAirDataRate(ADR_2400);
Transceiver.SetTransmitPower(0b11);
Transceiver.SetFECMode(OPT_FECENABLE);
Transceiver.SetUARTBaudRate(UDR_9600);
Transceiver.SetPullupMode(OPT_IOPUSHPULL);
@KrisKasprzak any ideas?
Hello. I am studying your library as part of an IoT project involving an Espressif ESP32 using an EBYTE E22-900T30S chip for communication. I am aware of the command set difference talked about in #20 , as well as confirmed it, and I was intending to use this library as a starting point for the project. However, the catch is that the project involves communication with a LoRaWAN gateway. Now, I am aware that the EBYTE E22 series speaks the LoRa radio protocol but does not, by itself, implement the LoRaWAN stack at all. On the other hand, I have found a few libraries that purport to implement LoRaWAN, such as https://github.com/beegee-tokyo/SX126x-Arduino . On this library, for example, the tested chip is an E22-900M22S that is controlled over SPI and appears to have more options.
The basic question is: is the lack of LoRaWAN support something that can be fixed in software by using a LoRaWAN stack and plugging it into the E22 UART interface? Or does the E32/E22 UART interface isolate the programmer from the radio link to the point that speaking LoRaWAN is impossible? What do I need to know about the LoRaWAN stack to find out?
Hi! Thank you for your great work!
Model no.: 0
Version : 45
Features : 32
Mode (HEX/DEC/BIN): C0/192/11000000
AddH (HEX/DEC/BIN): 0/0/0
AddL (HEX/DEC/BIN): 0/0/0
Sped (HEX/DEC/BIN): 1A/26/11010
Chan (HEX/DEC/BIN): F/15/1111
Optn (HEX/DEC/BIN): 44/68/1000100
Addr (HEX/DEC/BIN): 0/0/0
and this is the receive result:
Receiving: 248 ,18.20 °C, 63.02 %U, Uuid: ��⸮R<x⸮�⸮K⸮%
Searching:
218175
Receiving: 250 ,18.20 °C, 63.05 %U, Uuid: ��⸮R<x⸮�⸮K⸮%
Searching:
220218
Receiving: 252 ,18.19 °C, 63.16 %U, Uuid: ��⸮R<x⸮�⸮K⸮%
Searching:
222338
Receiving: 254 ,18.19 °C, 63.20 %U, Uuid: ��⸮R<x⸮�⸮K⸮%
Searching:
224358
Receiving: 256 ,18.16 °C, 63.28 %U, Uuid: ��⸮R<x⸮�⸮K⸮%
Searching:
226478
Receiving: 258 ,18.16 °C, 63.32 %U, Uuid: ��⸮R<x⸮�⸮K⸮%
Searching:
228498
Thank you Luca
The functions to set the three parameters below are missing:
_OptionTrans
_OptionPullup
_OptionFEC
I added the functions in EBYTE.cpp / EBYTE.h and it worked perfectly for my use, but maybe you should add it to your code.
Hi, I'm working with ESP32. The sender sends only the first packet. If i put one more supply from an out source (5v 2.5A power supplier ) and supply with it only the E32-868T30D the problem it's the same. When i detach the E32 power supply and reattach it it sends only the first packet (seen on a receiver, an other ESP32 with another E32-868T30D).
what could be the problem?
thank you in advance
LucaM
Is this a proper way of putting E220 to sleep when not needed?
digitalWrite(PIN_M0, LOW); digitalWrite(PIN_M1, HIGH);
And wake it up using:
digitalWrite(PIN_M0, LOW); digitalWrite(PIN_M1, LOW);
Thank you!
Hi,
I need some help I can't get the code running .
I have a wemos D1 mini version 2.2.0 and a E32-868T20D.
In the first step I try to send out something and check with a rtl_sdr stick if the E32 is sending something.
I am wondering that I do not see any parameters (all zero). Maybe the cabling is not correct I also do not see any thing on 868 MHz. The E32 is preconfigured on channel 10.
Serial output
14:16:43.836 -> 2dO,4⸮$48⸮lb8⸮⸮⸮Starting Sender
14:16:46.552 -> ----------------------------------------
14:16:46.585 -> Model no.: 0
14:16:46.585 -> Version : 0
14:16:46.619 -> Features : 0
14:16:46.619 ->
14:16:46.619 -> Mode (HEX/DEC/BIN): 0/0/0
14:16:46.652 -> AddH (HEX/DEC/BIN): 0/0/0
14:16:46.685 -> AddL (HEX/DEC/BIN): 0/0/0
14:16:46.718 -> Sped (HEX/DEC/BIN): 0/0/0
14:16:46.751 -> Chan (HEX/DEC/BIN): 0/0/0
14:16:46.751 -> Optn (HEX/DEC/BIN): 0/0/0
14:16:46.784 -> Addr (HEX/DEC/BIN): 0/0/0
14:16:46.817 ->
14:16:46.817 -> SpeedParityBit (HEX/DEC/BIN) : 0/0/0
14:16:46.884 -> SpeedUARTDataRate (HEX/DEC/BIN) : 0/0/0
14:16:46.917 -> SpeedAirDataRate (HEX/DEC/BIN) : 0/0/0
14:16:46.950 -> OptionTrans (HEX/DEC/BIN) : 0/0/0
14:16:46.983 -> OptionPullup (HEX/DEC/BIN) : 0/0/0
14:16:47.083 -> OptionWakeup (HEX/DEC/BIN) : 0/0/0
14:16:47.083 -> OptionFEC (HEX/DEC/BIN) : 0/0/0
14:16:47.149 -> OptionPower (HEX/DEC/BIN) : 0/0/0
14:16:47.182 -> ----------------------------------------
cabeling
D1 mini E32
3,3V -- VCC
G -- GND
D2 -- M0
D1 -- M1
RX -- TX
TX -- RX
D5 -- AUX
code
#include <SoftwareSerial.h>
#include "EBYTE.h"
#define PIN_M0 4 // Wemos D1 mini = D2
#define PIN_M1 5 // Wemos D1 mini = D1
#define PIN_AX 14 // Wemos D1 mini = D5
..
.
SoftwareSerial ESerial(1, 3);
EBYTE Transceiver(&ESerial, 4, 5, 14);
.................
Hope that somebody can help
I get the following output when calling Transceiver.PrintParameters();
----------------------------------------
Model no.: 0
Version : 0
Features : 0
Mode (HEX/DEC/BIN): 0/0/0
AddH (HEX/DEC/BIN): 0/0/0
AddL (HEX/DEC/BIN): 0/0/0
Sped (HEX/DEC/BIN): 0/0/0
Chan (HEX/DEC/BIN): 0/0/0
Optn (HEX/DEC/BIN): 0/0/0
Addr (HEX/DEC/BIN): 0/0/0
SpeedParityBit (HEX/DEC/BIN) : 0/0/0
SpeedUARTDataRate (HEX/DEC/BIN) : 0/0/0
SpeedAirDataRate (HEX/DEC/BIN) : 0/0/0
OptionTrans (HEX/DEC/BIN) : 0/0/0
OptionPullup (HEX/DEC/BIN) : 0/0/0
OptionWakeup (HEX/DEC/BIN) : 0/0/0
OptionFEC (HEX/DEC/BIN) : 0/0/0
OptionPower (HEX/DEC/BIN) : 0/0/0
----------------------------------------
Here's the code I'm using:
#include "EBYTE.h"
#define PIN_RXD2 16
#define PIN_TXD2 17
#define PIN_M0 19
#define PIN_M1 22
#define PIN_AX 21
// 868T20D
EBYTE Transceiver(&Serial2, PIN_M0, PIN_M1, PIN_AX); // using hardware serial2 on RXD2/TXD2
void setup() {
Serial.begin(9600);
Serial2.begin(9600, SERIAL_8N1, PIN_RXD2, PIN_TXD2);
Transceiver.init();
Transceiver.PrintParameters();
}
void loop() {
}
First of all, thank you for your stable work. I'm working with arduino nano. There is no problem in getting the value, but after a while, arduino nano: 26th value, value is uno: 40th value. nano always return 0.
What could be the reason for this?
Hello.
Does the parameters has to be the same on both modules?
thanks.
Marc.
Hi @KrisKasprzak,
Is there any way that E220 would know if the transmitted message was delivered? I've been doing some research on this and it seems there is not.
I am currently using a very crude way to ensure delivery:
Thank you so much for your help!!
Hello Kris ..
is there any possibility to get RSSI or SNR values ??
I would like to be able to estimate the possible capacity because I plan to use the modules in a mobile vehicle ... and this value would be very necessary ...
please answer :-)
best regards..
Hi Kris, and thank you very much for the heavy work you've done on this library.
As I was doing a project using an STM32 BluePill, I got an E32 on the Serial(1) of the BluePill, and the debug was made on the Serial3. So I made some modifications to your library to make it work.
Code still compile for AVR board. if you find it useful, you can add it to Master branch.
Note : In my opinion there is a better way to do it, as some STM32 boards have more that 3 Serial ports, but it's a start.
Hi thanks for your solution!
I tested the new E32-900T20D no changing parameters in your example.
The sender sends messages every 1000ms but the receiver receives 1 message yes and 1 not.
the sender is ... 32... 33... 34... 35... 36
the other receives 32... ... 34... ... 36... ... 38 and so on
why?
thenk you
bye
Hey Kris!
I have a breadboard Arduino that works with 8MHz external crystal on 3.3V. I use my E32-TTL-100 on this board. I set the Lora module's parameters via the parameter setting software created by EBYTE. I set the parameters successfully but when I upload your Transciever.PrintParameters() code, I get this,
14:13:20.610 -> Mode (HEX/DEC/BIN): 0/0/0
14:13:20.650 -> AddH (HEX/DEC/BIN): 0/0/0
14:13:20.690 -> AddL (HEX/DEC/BIN): 0/0/0
14:13:20.730 -> Sped (HEX/DEC/BIN): 0/0/0
14:13:20.730 -> Chan (HEX/DEC/BIN): 0/0/0
14:13:20.770 -> Optn (HEX/DEC/BIN): 0/0/0
14:13:20.810 -> Addr (HEX/DEC/BIN): 0/0/0
14:13:20.810 ->
14:13:20.810 -> SpeedParityBit (HEX/DEC/BIN) : 0/0/0
14:13:20.879 -> SpeedUARTDataRate (HEX/DEC/BIN) : 0/0/0
14:13:20.914 -> SpeedAirDataRate (HEX/DEC/BIN) : 0/0/0
14:13:20.948 -> OptionTrans (HEX/DEC/BIN) : 0/0/0
14:13:20.983 -> OptionPullup (HEX/DEC/BIN) : 0/0/0
14:13:21.052 -> OptionWakeup (HEX/DEC/BIN) : 0/0/0
14:13:21.087 -> OptionFEC (HEX/DEC/BIN) : 0/0/0
14:13:21.122 -> OptionPower (HEX/DEC/BIN) : 0/0/0
14:13:21.155 -> ----------------------------------------
But I set the parameters to the following values which definitely not all 0s as you can see below.
In the previous issues, I see that you think this error might be caused by the MCU. My MCU seems to work fine because I've worked with it before and I check the wirings a hundred times and they seem fine also. Just to give you more insight into the problem, I've tried another library (https://github.com/xreef/LoRa_E32_Series_Library) and it also gave the same error of printing my parameters different from the ones I set using the EBYTE software.
So why do you think this happens? Could you please give some more info on why this problem might be caused by the MCU? I'm doing my senior project on these modules and I'm stuck here.
Thank you in advance!
C.
Your supplied examples contain NO comments!
Please add copious comments explaining exactly what you are doing and why.
Also, as these units are both send and receive, please consider an example of a half-duplex bi-directional link (with comments of course). This would seem to be a common requirement with most comms requiring some form of acknowledgement.
Is it possible to communicate a ES32-91520D with a SX1276 (SPI interface with Arduino)?
Do we know the LoRa settings in the ES32-91520D?
Hi!
I have a question, have you been testing your library with E22 modules?
I think there might be an issue because they have different command formats and responds.
As well as for E22 programming mode is different, for E32 (M0 M1) was (1 1), for E22 it's (0 1).
Sorry that I can't test it myself since since my modules are still being shipped what takes years this days.
Thanks in advance for any help,
Aleksander
hello, I am trying to communicate this type of ebyte e32 modules with ttgo lora esp 32, but it has not been possible to change the addresses, the frequency set them to 915 mhz and I have not yet been able to communicate them between them ..... I hope you can help me thanks
How can we set the sync word? There is no available method.
Hi, I have 2 pieces of E22-400T30S using 1W SMD wireless modules and I'm trying to figure out how these 2 can communicate. Even if I have set the address and things like that, I do not see the changes been made into the configurations. Is it possible if you could share more about how to use the library? Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.