I am working with an E34 radio module from ebyte. The radio defaults to 9600 baud for serial communication, but I need to increase this. The datasheet indicates that a couple of mode lines are to be driven high, to place into "command" mode. Then, a six-byte command string is sent (at 9600 baud) to change the speed. For example, C0 00 00 20 00 00 should change the speed to 19200. I have an array of: uint8_t baudSet[6] = {0xc0,0x00,0x00,0x20,0x00,0x00}.
I'm using serial1 on a mega, so I have defined it as radioSerial
I send this using radioSerial.write(baudSet,6);
When I look at the TX pin with a 'scope, the bits do not seem to match what I think I should see.
Just for fun, I sent an array of 6 zeros. The scope showed multiple high bits between the (expected) low bits for the zeros. What are these bits? It looks as if the Arduino is pulling the TX pin high for one bit time between the bytes. Is this normal for all serial comms? I don't know if this is why I cannot seem to get the radio to change modes, but there's something odd going on, and I'm stuck right now.
Start bit ?
Links to products and data sheets ?
Code (in code tags)
I think I figured it out. I completely spaced it on serial data format which has a start and stop bit for each byte! DOH! Now, it all makes sense. The module not changing modes was a result of my not reading carefully, and realizing I had to add a delay in certain portions of the radio setup. Both radios now cooking at 38400 baud. Sorry to have wasted your time, I appreciate that you took a look!
I looked up the website of ebyte of this product
https://ebyteiot.com/de/products/2-4g-wireless-transceiver-receiver-ebyte-e34-2g4h20d-100mw-sma-k-antenna-iot-dip-long-range-wireless-communication-module
Not much information there.
You should provide a link to the datasheet.
As a general advice: before you buy a product do a google-search
with keywords Github arduino "NameOfProduct/TypeNumber"
to check if there are libraries provided.
Check if the datasheet has detailed information
The productpage mentions nRF2401+
This is a well known radio-transmitter-chip.
Though it stays unclear if ebyte is using it in the same way as most other manufacturer or if they developed something on their own that differs from the "standard" nRF24-modules
Post your complete sketch as a code-section
On the website there are two emailadresses. I would write immidiately to both email-adresses asking for demo-codes
With duckduckgo I found this GiPo which seems to be a PC software for configuring this module. Though unsure if it really fits to your product.
The E34.cpp-file has functions how to configure the parameters
best regards Stefan
Hello Stefan,
Thank you for your reply. The particular version I’m using incorporates some kind of 8-bit microcontroller that handles buffering and other interface needs. I could not find a library for this version. Interestingly, the actual RF chip inside the module IS an nRF24L01, but it is not directly addressable, so existing libraries (which I have use din other projects) will not work.
I was able to figure out my problem, and it was a combination of not carefully reading the data sheet (although the English translation from Chinese leaves much to be desired) and for some reason, I totally forgot that async serial sends a start and stop bit for each byte, unlike SPI.
If you are interested, the particular module I am using is the E342G4D27D
Regards,
Dave Telling
It would be a big thank you and giving back to the community of you would post your working code and the translated datasheet or at least the not translated datasheet
best regards Stefan
Hello Stefan,
I would be glad to add this information. What would be the best way to do this? Just add to the existing thread, or is there another area for item such as this?
Regards,
Dave Telling
Yes in this thread. Modify the titel so the titel mentions the manufacturer "EBYTE" and the exact typenumber of the module.
add your working code as a code-section
and upload the datasheet as an attachment.
Best regards Stefan
This radio, made by eByte, is a 2.4GHZ transceiver that can run in simplex or duplex modes. It is based upon the nRF24L01 “core” but has both a microcontroller for buffering and handling instructions from the user, and a power amplifier. The manufacturer’s webpage is here: E34-2G4D27D_nRF24**_SPI/SOC/UART_Module_Chengdu Ebyte Electronic Technology Co., Ltd The datasheet can be downloaded from the link on the product page.
I have a client who wanted to use this radio, and the default settings of the module allow simplex or duplex operation at 9600, 8N1. The existing Serial classes for transmitting and receiving work with this. However, my client needed to run the system faster, and this post explains how I modified my code to change the TX/RX speed. It is nothing fancy, and I make no representation that it is the best way or optimized in any way. However it does work.
It is written for a mega2560 Arduino, but would likely run on an Uno, but since one would have to use SoftwareSerial for the UART, rather than the hardware port that the 2560 has, that may impact how fast the system could run.
In addition to the standard TX and RX lines, the radio uses an “Aux” line that is used as a status indicator, and if you want to use anything more than the default parameters in simplex mode, you need two additional control lines, labeled “M0” and “M1”.
ALSO – and this was a bit confusing at first, the TX and RX lines are “swapped”, i.e. the TX line of the Arduino is connected to the RX line of the radio, and the RX line of the Arduino is connected to the TX line of the radio.
The radio can run from 3.3 or 5V, but the manual cautions that in the highest power setting, it pulls several hundred mA of current, so make sure your system can handle that. The other option is to use the command setting process to lower the output power.
The code below is written for my particular hardware setup, but should be easily adaptable to other applications if the pins used in the code are not available. As I mentioned, 5 data lines are used (in addition to power and ground) .
/* After my includes, I define the radio to use the 2560 Serial1 UART */
#define radioSerial Serial1
/* I also have to make a byte array that has the instructions to
change the speed */
const uint8_t baudSet38400[6] = {0xc2,0x00,0x00,0x28,0x00};
/* In the setup portion of the sketch we have to define our control pins: */
#define M0 2
#define M1 3
#define auxPin 4
pinMode(M0,OUTPUT);
pinMode(M1,OUTPUT);
pinMode(auxPin,INPUT_PULLUP);
delay(2); // I added this to give the radio module time to start up
/* NOTE: If you wanted to use the radio with the defaults, at this point, you would set M0 and M1 per the data sheet for the mode you wanted – simplex or duplex. However, I have to send some instructions to change the speed, so there is more “housekeeping” to do. */
radioSerial.begin(9600); // start the radio serial interface
/* Wait until the radio is up and running, this will bring the aux line high */
while(!digitalRead(auxPin)) // auxPin going high indicates module ready
{
;
}
delay(2); // I added this delay to ensure that the radio is fully ready
for instructions. It may not be necessary, but it is cheap insurance */
digitalWrite(M0,HIGH);
digitalWrite(M1,HIGH);
delay(2);
/* Send instruction for higher baud rate */
radioSerial.write(baudSet38400,6);
delay(2); // this delay gives the radio time to do the internal settings.
/* Originally, I set both mode lines low to force the simplex mode.
However, I experimented and found that I could run in duplex mode reliably,
So I commented out the line that sets M0 low. This places the radio in duplex mode */
//digitalWrite(M0,LOW);
digitalWrite(M1,LOW);
delay(2);
// close old 9600 baud
radioSerial.end();
// now re-open with higher baud rate
radioSerial.begin(38400);
So, at this point, the radio is running in duplex mode at 38400 baud. The datasheet says that duplex is good for up to 57600 baud, but I have not tried that yet.
I hope this explains my use of this radio. I am not an expert in this area, but I will try to answer questions that relate to this post. Please don’t ask for specific communications code for your app, everyone is slightly different.
E34-2G4D27D_UserManual_EN_v1.1.pdf (978.7 KB)
Some how. It would be much more usable if you simply post your complete sketch from the very first to the very last line of code.
inside the arduino-IDE
You can copy the complete sketch to the clip-board by pressing
- ctrl-T for autoformatting
- in IDE 2.X press Ctrl-Shift-C
- paste clipboard-content into a posting
and the very very best support for others would be if you change the title to
code for testing the EBYTE 2,4 GHz serial radio-module type E34-2G4D27D
best regards Stefan
Hello Stefan,
The sketch I am developing is really not suitable as an example, as it is constantly changing, and is a very specialized application. Since the actual question I had was related to getting the transceivers working correctly, I believed that it was only necessary to show that particular aspect, as the rest of the sketch would be meaningless to others.
Regards,
Dave Telling
Yes might be. So a reduced sketch that can be copy & pasted and does compile and after flashing demonstrates send/receive a single byte or sends "Hello World" would be very nice as a starting point for others.
best regards Stefan
I agree with Stefan - Please post complete code so we can compile it and see how it works and modify it for our own needs. It doesn't matter if it's still experimental.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.