LORA E32 na ESP32 Micropython

Home Forums esp32 LORA E32 na ESP32 Micropython

Viewing 4 reply threads
  • Author
    Posts
    • #31084
      Peter
      Participant

        Hi.

        I am learning to work with LORA E32 using your articles. I have ESP32_devkitc_V4 or ESP32_devkit_V1, LORE E32 433T30D. I program in Python. I use the codes from your articles: https://mischianti.org/ebyte-lora-e32-micropython-specifications-overview-and-first-use-1/ . On the first test with the code

        #############################
        #
        # Simple send receive test
        #
        # by Renzo Mischianti
        # www.mischianti.org
        #
        #############################
        from machine import UART, Pin
        import utime
        
        # UART configuration Raspberry Pi Pico (Arduino)
        #uart1 = UART(1, 9600, rx=Pin(9), tx=Pin(8))
        # UART configuration Raspberry Pi Pico (MicroPython)
        # uart1 = UART(1, 9600)
        # UART configuration ESP32
        uart1 = UART(2, 9600)
        
        print("Hi, I'm going to send message!")
        uart1.write("Hello, world?")
        utime.sleep_ms(500)
        
        while True:
            if uart1.any():
                char = uart1.read(1).decode('utf-8')
                print(char, end='')

        the device worked well. The transmitter sent the message and the receiver received it.

        When using the library and code

        #############################
        #
        # Simple send receive test
        # with the micropython library
        # pip install ebyte-lora-e32
        #
        # by Renzo Mischianti
        # www.mischianti.org
        #
        #############################
         
        from lora_e32 import LoRaE32, print_configuration, Configuration
        from lora_e32_operation_constant import ResponseStatusCode
        from machine import UART, Pin
         
        # Initialize the LoRaE32 module
        # UART configuration Raspberry Pi Pico (Arduino)
        # uart1 = UART(1, 9600, rx=Pin(9), tx=Pin(8))
        # UART configuration Raspberry Pi Pico (MicroPython)
        # uart1 = UART(1, 9600)
        # UART configuration ESP32
        uart1 = UART(2, 9600)
         
        lora = LoRaE32('433T30D', uart1)
        code = lora.begin()
        print("Initialization: ", ResponseStatusCode.get_description(code))
         
        # Send a string message (transparent)
        message = 'Hello, world!'
        code = lora.send_transparent_message(message)
        print("Send message: ", ResponseStatusCode.get_description(code))
         
        # Receive a string message (transparent)
        while True:
            if lora.available() > 0:
                code, value = lora.receive_message()
                print(ResponseStatusCode.get_description(code))
        
            print(value)

        ESP32 gives me an error after the reset:

        rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
        configsip: 0, SPIWP:0xee
        clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
        mode:DIO, clock div:2
        load:0x3fff0030,len:4728
        load:0x40078000,len:14888
        load:0x40080400,len:3368
        entry 0x400805cc
        E (1639) uart: tout_thresh = 244 > maximum value = 101
        Traceback (most recent call last):
        File “main.py”, line 25, in <module>
        File “lora_e32.py”, line 305, in begin
        OSError: (-258, ‘ESP_ERR_INVALID_ARG’)
        MicroPython v1.22.2 on 2024-02-22; Generic ESP32 module with ESP32
        Type “help()” for more information.
        >>>
        
        

        I have connected the circuits according to the article. The only modification of the code is the change of the original module to E32 433T30D.

        Thanks for help.
        Peter

      • #31113
        Renzo Mischianti
        Keymaster

          Hi Peter,
          I have the same error when I do wrong wiring or power supply problem,
          Can you verify this?
          Bye Renzo

        • #31200
          Peter
          Participant

            Hi.

            The entire circuit is powered by a USB cable from the computer. I am using the ESP32 DevKit V4 module. E32 is powered from pin 5V. Mo and M1 are connected to 0V. AUX, TXD and RXD are connected via 4k7 resistors to pin 3V3 on the ESP32 module. RXD and TXD are connected to the TX2 and RX2 pins of the ESP32 module. The GND pin of the E32 module is connected to the GND pin of the ESP32 module and the GND of the USB cable.
            According to the pictures in your article it should be fine.

            What connection error did you have?

            Hi Peter.

          • #31201
            Peter
            Participant

              Hello, I am still sending a photo of my connection.

            • #31208
              Renzo Mischianti
              Keymaster

                Ahh, wait, you use uart directly to send messages.
                If I remember, I applied encoding in the library to prevent problems with not-in-range characters.
                Use the library.
                Bye Renzo

            Viewing 4 reply threads
            • You must be logged in to reply to this topic.
            Exit mobile version