Learn by contributing - Find a problem and try to help solve it

Learn by contributing - Find a problem and try to help solve it

Datagod's photo
·Sep 9, 2021·

2 min read

Contributing to a project or a pool of knowledge is a great opportunity for learning.

When I saw a person asking for help with reading messages from a LORA device (LOng range RAdio) using python, I decided to take a crack at it.

I downloaded and installed the python module, opened up Visual Studio Code and started to explore.

I created a new python file on my PC and figured out how to auto-push it to the raspberry pi using SSH. This is all part of Visual Studio now. I am still learning, so I don't have all the phrasing down yet. Is it a module? An extension? Still working on that.

Reading through the Meshtastic-python documentation, I found a small example of how to connect to the device using Python (over a USB cable from the Pi) and start listening to packets as they arrive.

2021-09-09 09_55_19-meshtalk.py - pi [SSH_ meshtasticPi.local] - Visual Studio Code.jpg

I added some print statements and a filter, because I really only wanted to see the payload. These little devices are quite chatty it turns out. They run in a mesh network and will relay messages back and forth from all devices in range.

Using the Android app, I sent a message out to the network. This is how it looks on the tiny 1 inch screen on my TTGO Meshtastic device:

2021-09-09 10_29_12-C__Users_Bill_Documents_AirDroid_PublicStaging_20210909_101842.jpg  _  8_36 file.jpg

Using my meshtalk.py program, this is what it the decoded message looks like:

2021-09-09 10_20_14-pi@meshtasticPi_ ~_meshtastic_meshtalk.jpg

My next task is to clean up this little bit of code and upload it to GITHub. Hopefully the next time somebody googles "how to receive Meshtastic messages using python" my expanded example will help them out.

I learned so much by taking on this simple task. If an old programmer like me can do that, you can too.

Share this