KrisKasprzak / EBYTE

Libraries to program and use UART-based EBYTE wireless data transceivers
239 stars 75 forks source link
arduino e32 e44 e44-ttl e50 e50-ttl e51 e51-ttl ebyte iot library lora microcontroller module sx1278 teensy transceiver wireless

Updates

  • 8/10/2024, fixed attempt iterator if connection is not made

  • EBYTE Transceivers

    This library is intended to be used with UART type EBYTE transceivers (E44-TTL-100 for example), small wireless units for MCU's such as Teensy and Arduino. This library lets users program the operating parameters and both send and receive data. This company makes several modules with different capabilities, but most #defines here should be compatible with them All constants were extracted from several data sheets and listed in binary as that's how the data sheet represented each setting. Hopefully, any changes or additions to constants can be a matter of copying the data sheet constants directly into the #defines. Usage of this library consumes around 970 bytes.

    You only really need this library to program these EBYTE units.

    For reading data structures, you can call readBytes method directly on the EBYTE's Serial object:

    ESerial.readBytes((uint8_t)& MyData, (uint8_t) sizeof(MyData));

    For writing data structures you can call write method directly on the EBYTE's Serial object

    ESerial.write((uint8_t
    ) &MyData, (uint8_t) sizeof(MyData) );


    EBYTE Model numbers (only a partial list shown) Old model number scheme E30-TTL-100,E30-490T20D, E31-TTL-100, E32-TTL-100, E32-TTL-500, E32-TTL-1W, E41-TTL-100, E41-TTL-100, E44-TTL-100, E44-TTL-500, E44-TTL-1W, E50-TTL-100, E50-TTL-500, E51-TTL-100, E51-TTL-500, E51-TTL-1W

    New model number scheme E22-900T22S, E22-230T22S, E22-400T22S, E22-230T30S, E22-400T30S, E22-900T30S, E30-433T20S3, E30-170T20D, E30-170T27D, E30-780T20S, E30-868T20S, E30-868T20D, E30-915T20D, E30-490T20D, E30-433T20S, E30-433T20D, E30-915T20S, E30-490T20S, E31-433T30S, E31-433T17S3, E31-230T33D, E31-230T17D, E31-230T27D, E31-433T17S, E31-433T17D, E31-433T27D, E31-433T30D, E31-433T33D, E32-433T20DC, E32-433T20S, E32-433T20S2T, E32-433T27D, E32-433T30D, E32-433T30S, E32-868T20D, E32-868T20S, E32-868T30D, E32-868T30S, E32-915T20D, E32-915T20S, E32-915T30D, E32-915T30S, E32-170T30D, E32-400T20S

    Note: check the EBYTE website to make sure the selected module supports UART communications, some modules are SPI only.

    Here is a YouTube video on library usage: https://youtu.be/hMjArKGucFA

    Module connection

    Module MCU Description

    1. MO Any digital pin* pin to control working/program modes
    2. M1 Any digital pin* pin to control working/program modes
    3. Rx Any digital pin* pin to MCU TX pin (module transmits to MCU, hence MCU must receive data from module
    4. Tx Any digital pin* pin to MCU RX pin (module transmits to MCU, hence MCU must receive data from module
    5. AUX Any digital pin pin to indicate when an operation is complete (low is busy, high is done) (you can omit with -1, but fixed recovery time used and may not be long enough to complete the operation)
    6. Vcc +3v3 or 5V0, note the units may run warmer with 5V0 and consume more power
    7. Vcc Ground Ground must be common to module and MCU

    notes

    1. caution in connecting to Arduino pin 0 and 1 as those pins are for USB connection to PC so you can't have the EBYTE connected during programming. I recommend NOT using Arduino pins 0 and 1
    2. The signal lines for these units are 3V3 but are 5 volt tolerant, however 5 volts may result in communication failures. If using a 5 volt MCU such as arduino, you may need to do the following. a) You may need a 4K7-10K pullup to Rx and AUX pins (possibly Tx) if using and Arduino b) If using an Arduino you may need a series 4K7 resistor between MCU Tx and the transceiver Rx.
    3. In some of my applications, I did not have enough digital pins to connect the Aux pin. No worries (just pass -1 in the argument list in the object create code). The library has a built-in delay to provide an appropriate delay to let the transmission complete--you may have to experiment with the amount.
    4. Serial pins for connection is dependent on the MCU, Teensy 3.2 for example: Serial1 are Rx=0, Tx=1, Serial2 Rx=9, Tx=10, Serial3 Rx=7, Tx=8. Arduino can be most serial pins using SoftwareSerial(MCU_Rx_pin, MCU_Tx_pin), except pins 0 and 1 as those are for USB usage
    5. 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.

    Manufacturers website

    http://www.ebyte.com/en/ example module this library is intended to be used with http://www.ebyte.com/en/product-view-news.aspx?id=174

    General code usage

    1. Create a serial object
    2. Create EBYTE object that uses the serial object
    3. begin the serial object
    4. init() the EBYTE object
    5. set parameters (optional but required if sender and receiver are different)
    6. send or listen to sent data (single byte) OR create and send a data structure

    Tips on usage

    For best range:

    Data transmission packets

    Debugging