KrisKasprzak / EBYTE

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

E32-868T20D: transceiving doesn't work #43

Closed KirillKhudoyarov closed 2 years ago

KirillKhudoyarov commented 2 years ago

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

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

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

TxScheme Rx RxScheme Tx

KrisKasprzak commented 2 years ago

Kirill, Privyet! Good to hear from my comrades in Russia. I've had the pleasure of visiting Moscow a few times over the years, hopefully I can visit Russia again. Here's a photo of me at the Kremlin back in 2005. Thanks for sending the wiring diagram and I see the issue. the Rx line on the MCU must connect to the Tx line on the EBYTE. This is a strange, but the EBYTE transmitter sends data through the Tx line and the MCU receives through the Rx line. You will need to reverse the connections for your transmitter and reciever. Let's start there and see if that helps. Spi Ceba,

Kris Kasprzak

On Tuesday, October 12, 2021, 02:51:06 AM CDT, KirillKhudoyarov ***@***.***> wrote:  

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

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

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

KirillKhudoyarov commented 2 years ago

Thanks for your answer. Seems there is no such a mistake. Radio’s pins TxD and RxD are connected to MCU’s pins 10 and 7 respectively. The 10th pin is initialised as Rx, the 7th - as Tx, if I understand a program code correctly. Can’t see your Moscow photo.

KrisKasprzak commented 2 years ago

OK, The wiring diagram showed Tx to Tx and Rx to Rx, these just need to be Tx to Rx and Rx to Tx. Try this, In setup add the line Transceiver.PrintParameters() for both your transmitter and receiver. The printout should show all parameters read from the EBYTES, while there can be different settings for each, most of the settings must match (like channel, address, air data rate, and a few others. I guess correspondence removed my pic. 

Thanks, Kris Kasprzak

On Tuesday, October 12, 2021, 10:43:02 AM CDT, Kirill Khudoyarov ***@***.***> wrote:  

Thanks for your answer. Seems there is no such a mistake. Radio’s pins TxD and RxD are connected to MCU’s pins 10 and 7 respectively. The 10th pin is initialised as Rx, the 7th - as Tx, if I understand a program code correctly. Can’t see your Moscow photo.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

KirillKhudoyarov commented 2 years ago

Hi, Kris. I’ve got this, the same for both the transmitter and the receiver B658BE74-9410-4C39-803B-A17E59E91495

KrisKasprzak commented 2 years ago

I can't see the image, however, i'm not sure about the wiring. I'm looking more at your wiring diagram and i'm confused as to what you are trying to do. It looks like you are powering one EBYTE from a NANO--I guess you want to power it with 5 volts? But it's communicating with a pro mini a 3v3 device. I'm not sure what  the Tx signal voltage will be from the EBYTE, but if outputting 5V0 i'm not sure what will happen the the pro mini. I'm not sure what the USB to TTL is for maybe to power the pro mini? The other EBYTE is powered from 5v0 buck converter but using the pro mini regualtor to give it 3v3--again this may be problematic since the EBYTE may spit out 5v0 for the Tx.

Note. The EBYTE is a 3v3 device but 5V0 tolerant, so I would recommend powering the pro-mini and EBYTE from 3v3. Maybe this vid will help. Wireless for MCU projects made easy

|

Wireless for MCU projects made easy

|

|

|

Thanks, Kris @.***

On Thursday, October 14, 2021, 11:23:08 AM CDT, Kirill Khudoyarov ***@***.***> wrote:  

Hi, Kris. I’ve got this, the same for both the transmitter and the receiver

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

KirillKhudoyarov commented 2 years ago

Thanks. I’ll think about what you’ve written a bit later. Here’s the image. All params equal zero 6AA28867-683A-4189-84AC-162F9D1A314C

KrisKasprzak commented 2 years ago

When all parameters are zero the unit is not connecting to the MCU. some possible reasons could be:

  1. either the unit is not getting powered2. Rx connected to Rx3. powered from 5v0 (I can't duplicate but others indicate this issue)4. MCU pin recover is too slow    in EBYTE.h, change         #define PIN_RECOVER 50 to         #define PIN_RECOVER 200 

Thanks, Kris @.***

On Thursday, October 14, 2021, 12:58:59 PM CDT, Kirill Khudoyarov ***@***.***> wrote:  

Thanks. I’ll think about what you’ve written a bit later. Here’s the image. All params equal zero

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

KirillKhudoyarov commented 2 years ago

Thank you. I’ll try to do smth and then will text you

KirillKhudoyarov commented 2 years ago

Hello, Kris. Could you tell why do these “trying”s (look at the attached picture) appear in the serial monitor? 75210BAF-4530-4820-BE15-BF3931B79DF3

KrisKasprzak commented 2 years ago

It means the reader is not receiving any data.

KirillKhudoyarov commented 2 years ago

These “trying”s appear between the lines 58 and 63 before starting the loop. Could it be a problem with an init? 83C7CBE0-DD64-458E-8370-67DA244CB4C1

KrisKasprzak commented 2 years ago

There is a print statement indicating if the model information can't be read. The function actually tries to communicate several times before giving up. I'm not sure if you got the wiring sorted, it's possible the pin recovery on the MCU is very slow. Open the EBYTE.H (in notepad or something) and find the line around line 85

define PIN_RECOVER 50

Change the 50 to say 200, save the .h file and recompile everything Thanks, Kris @.***

On Monday, November 1, 2021, 01:42:37 PM CDT, Kirill Khudoyarov ***@***.***> wrote:  

These “trying”s appear between the lines 58 and 63 before starting the loop. Could it be a problem with an init?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

KirillKhudoyarov commented 2 years ago

I’ve changed 50 to 200 - it’s not helped. Also I’ve tried to power the module from the Nano’s 3v3 - nothing’s happened. I’ve improved and repainted the wiring diagrams. Hope they’ve become more readable (D-SUN is a 9V to 5V converter, CP2102 is for powering ProMini and reading its data). Are there any mistakes? 236BF465-7151-4AD1-A58E-DF1252AAAEC9 EE88ED61-1B91-419A-A962-86AF7E905C0A

KrisKasprzak commented 2 years ago

The wiring on the Rx is still weird. Not sure why you are using a NANO to power another MCU--why just not use the NANO. And you are still powering the EBYTE from 5v0. Until you get this issue sorted I would use the NANO for the Rx. The CP device may be intercepting some serial communication.  However, get rid of the library completely at least for now. I had wrote this code, not tested. but if you can't get the units communication by basic serial.print and serial.read there's a wiring issue, damaged devices, or something else.  // transmitter

include

define PIN_RX 10#define PIN_TX 7

SoftwareSerial ESerial(PIN_RX, PIN_TX);

void setup() { Serial.begin(9600);ESerial.begin(9600);Serial.println("Starting Sender"); } void loop() {ESerial.print("A");delay(100);} //Receiver

include

define PIN_RX 10 #define PIN_TX 7 

SoftwareSerial ESerial(PIN_RX, PIN_TX);byte b; void setup() { Serial.begin(9600);ESerial.begin(9600);Serial.println("Starting reader");} void loop() {if (ESerial.available()) {b = ESerial.read();Serial.println(b);}else {Serial.println("No data");}delay(100);}

Thanks, Kris @.***

On Tuesday, November 2, 2021, 03:35:23 AM CDT, Kirill Khudoyarov ***@***.***> wrote:  

I’ve changed 50 to 200 - it’s not helped. Also I’ve tried to power the module from the Nano’s 3v3 - nothing’s happened. I’ve improved and repainted the wiring diagrams. Hope they’ve become more readable (D-SUN is a 9V to 5V converter, CP2102 is for powering ProMini and reading its data). Are there any mistakes?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

KirillKhudoyarov commented 2 years ago

Kris! Transceiving is working. The 10th arduinos’ pin doesn’t work as ESerial Rx for some reasons. I’ve changed it for the other one and everything’s become fine. Thank you very much for your participation! I’m happy you decided to help me. I continue working with your library. Perhaps new questions will appear soon)

KrisKasprzak commented 2 years ago

Glad to hear you got it working.  Thanks, Kris Kasprzak

On Friday, November 5, 2021, 03:55:58 PM CDT, Kirill Khudoyarov ***@***.***> wrote:  

Kris! Transceiving is working. 10th arduinos’ pin doesn’t work as ESerial Rx for some reasons. I’ve changed it for the other one and everything’s become fine. Thank you very much for your participation! I’m happy you decided to help me. I continue working with your library. Perhaps new questions will appear soon)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.