#############################
#
# 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
This topic was modified 3 months, 3 weeks ago by Renzo Mischianti.
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.
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
Maintaining a repository (or site or forum) is a lot like tending to a garden - it requires constant care and attention to keep it thriving. If you're a skilled gardener (or coder!) and want to help keep our repository blooming, we'd love to have you on board! We're also looking for talented writers and forum moderators to help us grow our community. Interested in joining our team? Don't hesitate to reach out and let us know how you can contribute!
Are you a fan of electronics or programming? Share your knowledge with others, write a simple tutorial or how to make a great project Contact me: share_your_ideas@mischianti.org
The content displayed on this website is protected under a CC BY-NC-ND license. Visitors are prohibited from using, redistributing, or altering any content from this website for commercial purposes, including generating revenue through advertising. Any unauthorized use is a violation of the license terms and legal action may be taken against individuals or entities found to be in violation.
You must also provide the link to the source.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.