if the transmitter sends within 2sec, then the Micropython programme as receiver is terminated with the error unicode-error at line 636 in lora_e220.py.
What could be the reason for this? The message is only a few bytes long:
“Hello World! 1”. The next message is then “Hello World! 2” and so on.
Hi Renzo,
I have now found a little time to reproduce the error.
When I send a message every second I get the following message in the Thonny editor:
Traceback (most recent call last):
File "<stdin>", line 127, in <module>
File "/lib/LoraWanE220/lora_e220.py", line 636, in receive_message
UnicodeError:
I’ve been experimenting some with data corruption on my setup sending between arduino and pi pico(micropython).
Factors to consider:
1. Timing
2. Forward Error Correction
3. “ReceiveMessageUntil()”, i have experimented with this setting as i was receiving two messages packed into one… eg. “Msg0Msg1”, using this setting seems to help??
If both devices are powered up at same time, and one LoRa begins receiving half way through the senders transmission, it will only receive half the message, hence corrupted data. I have only noticed this happening with FEC off, but more testing needed.
Once I’m able to log into forum here on my computer I will post my code for the working setup I’m putting together.
I am using bare ATMEGA328P chip on arduino side, and pi pico on the other side.
When I enter the following in the Thonny IDE, I get an error message:
>>> b'\xf0'.decode()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeError:
>>>
I think the problem is the character \xf0.
This does not seem to be a Unicode character. Unfortunately, µPython does not allow you to specify a second parameter in the decode() function, e.g. data.decode('UTF-8','ignore').
This does not work.
But how can this be solved?
This reply was modified 10 months, 3 weeks ago by woto.
Hi renzo,
I think I have a solution for myself, maybe for others too.
I have created a new static method in the class LoraE220:
@staticmethod
def _cleanData(_data):
data = bytes(_data)
ret_values = []
ret_arr = bytearray(ret_values)
for i in range(len(_data)):
if _data[i] <= 127 :
ret_arr.append(_data[i])
return ret_arr
This methode is called before the decode function:
str_ret = LoRaE220._cleanData(data)
data = str_ret.decode('utf-8')
msg = data
Now the decoding function works and if I define a separator for the sender, I can separate the messages from each other.
This reply was modified 10 months, 3 weeks ago by woto.
Hi Woto,
thanks. It’s very interesting and helpful.
I’m going to examine the situation, but with your help, I think It will become simpler.
Thanks again, 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.