LoRa HAT communication module doesn't send anything - python

I'm working on a long-range communication system, and I need help. I can't use GSM, WIFI, etc. I am testing a LoRa Raspberry Pi shield, and I bought this, and I have followed this tutorial. Of course I have tested other tutorials, like this, this lib, and others. None of them worked.
I have bought another 2 modules, because maybe my first purchase didn't work, but this wasn't the problem. (I didn't read any data from the other device in receiver module, but in the sender the TX LED was activated).
I want to communicate up to 30km (with a direct view), and I want to send data about 100 kbit per second.
So if you find another way to solve this problem (e.g. better tutorial), I will be grateful. I'm open to any other solution and idea. Thanks for your help.
(If this isn't the best forum for this, I'm sorry)

The problem is with the eByte module on the RPi shield. What module are you using on the other end? The same? Or something else? If it's the same, it should work. But if you are using a non-eByte, regular LoRa module, like an SX1276 or SX1262 attached to an ESP32, forget about it, it won't work. It turns out that the "managed" eByte modules, with a -T- in their name, don't do LoRa, really, but FSK/OOK. So if you are trying to communicate between a RPi shield and a regular LoRa module, you will grow old before it works.
As for 30 km, forget about it. Not with that equipment. And especially not at 100 kbs, lol.

Related

Barcode scanners (Netum Scan) in python

I'm writing code which takes input from several barcode scanners, and I want a way to differentiate between each scanner. I'm on windows 10, and my python version is 3.11.1. And as the title suggests, I'm using scanners from a company called Netum.
I've tried using them as HID devices, but this seems incredibly slow and impractical. If the computer sees them each as keyboards, I have to validate each individual keystroke, rather than entire barcodes. So I've abandoned this approach under that assumption.
I discovered these scanners have what's called "USB COM Port Emulation," and that seems promising. It almost never works, but when it does, it just shoves an entire barcode into my code as a string. The problem is that, most of the time, when it's in this mode, it disconnects the USB dongle the instant I scan anything. But it makes a reference to "needing drivers" for this mode. I checked the device manager, which tells me all my drivers are totally up-to-date. This is really the crux of the problem, as my code works if this mode works reliably.
Also, I'm using PySerial to decode the inputs from the scanners. I dunno if that matters, but I figured I'd mention it. The following is the code I'm using to talk to these janky scanners, and it only works when the scanners don't disconnect from my PC for seemingly no reason.
import serial
scanner = serial.Serial(port='COM3', baudrate=9600, bytesize=8, timeout=1, stopbits=serial.STOPBITS_ONE)
string = scanner.read()
print(string.decode())
scanner.close()
If anyone has any advice, insights, or even just general directions to point me in, it would be appreciated. I'm at the point where I don't even know how to begin solving this.
Comment to answer
Have you installed any Virtual Com Port (VCP) drivers such as from FTDI? ftdichip.com/drivers/vcp-drivers They do a executable for easy install - this may help with your stability issues

Raspberry pi protection against reverse engineering the codes

Problem
I want to secure my Raspberry pi in a special way.
I would like to start up raspberry pi without entering a password as pi user.
However, I want pi user to have zero privilege. Cant read a file, cant copy a file, simply nothing. And without access to root->'sudo su'. On the other hand when raspberry pi starts itself with pi user, I want backend process to be running as root. So to put it simply, I want it like in a zoo - two worlds but neither of them can enter the other. Clients can be present, see what process are running, see files in directories, but cant read it, copy, remove and etc. In the same time I want the backend to be untouched and running and writing files.
Reason:
I have raspberri pi product - customer get it home, when plug in power supply,RPi starts up and runs backend programs with root privilege and communicates with my desktop software.
But I dont want curious customer that plugs in HDMI and see my code. I also dont want him to take the SD card and extract the code.
I heard its possible to reverse engineer the code even if compiled. So I simply want the programs(python script) to be there but cannot be accessed in any way.
Is it possible to make such protection?
Thanks in advance
You may consider to use the following approach
Use at least two levels of hashing with MAC address and ARM chip serial number (via cat /proc/cpuinfo) with additional secret keys. Run your program only if the stored license key is the same as the result of doubly-hashed functions.
Optionally, you could rewrite critical part of your code in C, compile it statically, and remove all debug symbols. Call it using Python.
Quick optimization of your code using cython. Call its generated shared objects with a python caller script. Distribute only the shared objects and the python caller script.
This will prevent most people from reverse engineering your codes.
Just to be clear, "cant read a file" means "can't run a program", which means "can't see what process are running, see files in directories".
From your question, I don't understand why you'd even leave the pi user in place...
... runs backend programs with root privilege
Never a good idea - use service accounts instead.
But I dont want curious customer that plugs in HDMI and see my code.
Then don't enable the HDMI output, don't have a graphical desktop installed and disable the login prompt. You might want to look at a "minimal" / "lite" image.
Remember that the UART can present a login prompt, so make sure that's disabled too.
And as the config.txt and kernel need to be in cleartext in the boot partition they can be easily swapped... thus these steps are not going to be terribly effective.
I also dont want him to take the SD card and extract the code.
You could look at encrypting the filesystems (e.g: LUKS), but the Raspberry Pi has no native ability to store data and identify itself... so your encryption key can only be something like the MAC address, or stored in cleartext on the SD card...
Fundamentally this is just going to be a deterrent from casual "oh what's this" investigations.
"Physical access is total access"... once you put it in the customer's hands, you're looking at deterrents more than absolutes.
I heard its possible to reverse engineer the code even if compiled. So I simply want the programs (python script) to be there but cannot be accessed in any way.
Python doesn't get compiled until runtime, so you'll need to ship the device with your source code on it...
If you really want to secure your Intellectual Property, then perhaps the Raspberry Pi isn't the best option? It's up to you to balance cost vs security.

Continuously speech recognition

I'm currently working on a project where I need to create some functionality where the user can talk to the product (Raspberry Pi 3). And with talking I mean that the user should be able to say one or two words something like "product start" to the Pi and then it would get activated and do it's thing.
Now because of this, the Pi would need to be able to continuously listen and get activated when a certain combination of words is said by the user.
I've implemented the SpeechRecognition library, this sort of works but sadly there is a maximum of ~10 seconds where the Pi would listen.
I'm wondering if there are any library's which would help me with my use case, any help is welcome.
Can you explain better what do you mean by
sadly there is a maximum of ~10 seconds where the Pi would listen.
From my experience using CMUSphinx (Let me recomend the pocketsphinx version for your use-case), works continuously without problem.
Did you manage to know if the problem is on the Pi side, or the SpeechRecognition side?
What engine are you using behind SpeehRecognition. CMUSphinx, Google, Microsoft? With Google and Microsoft, it iis normal that they have a 10 seconds limitation. However, using CMUSphinx this should not happen. But, you might need to learn a bit how to set up an ASR system.

Passing Variables from one pi to another

I'm making a Skeeball program and boards that both work off of a raspberry pi and GPIO sensors with a tkinter gui. The first table and program is working great and now I was thinking about the possibility of adding a second table with multiplayer games.
Each pi would have to talk to each other, preferably over a LAN network instead of using I2C or serial pins. Basically I just need something mostly to pass variables from one pi to another.
My first thought was to use pickle to save to a shared network folder since I'm already using pickle to save my highscores. I just have no clue how to set up a shared folder over raspbian and I'm guessing that probably a pretty bad approach to solving the problem.
I'm also really new when it comes to python and raspbian so sorry if this problem is something super easy all I could find online was how to have a pi talk with a windows pc or an arduino.
Thanks for any help you can give me!

Make new software for Windows 95 on 486 machines, what to use?

I have a VB6 application running on a number of old 486 Windows 95 machines and sometimes the application is upgraded. The only way to accomplish this today is to use Hyperterminal and send the file over a null modem cable. Replacing the machines is not an option at this point.
I want to write an application that can take care of transferring the updating app over null modem without rewriting the VB6 app. This means I'm free to use anything I see fit. What alternatives are there?
These are the ones I can think of but I'd like to know if I'm wrong and any pros/cons. Also, I'd prefer to avoid C/C++ if at all possible.
Python with py2exe
Another VB6 app
C/C++
Edit: Some clarifications after reading the comments:
I want to make the process as easy as possible, today we have to remove and dismantle the computer, connect a keyboard and then fire up Hyperterminal to get going. That's why I want something more automatic. I'm open to suggestion of existing solutions but given the specific needs I didn't think there were any.
There is no ethernet on some of the computers either so the solution needs to be able to run RS232.
And again: Replacing the machines is not an option at this point. Just trust me on this.
If you must use a null modem, how about the built in serial line networking support?
Then you can just use normal network methods (psexec, file share, etc) methods to do the update.
Network Method
I would first get network cards installed in everything. If you want something that you can just plugin and go, look for any card compatible with NE2000. That card will work out of the box on Windows 3.11 and 95, no problem. In particular, you can find the 3Com EtherLink II or the 3C509B for very cheap online. It's an excellent card. (The Google Shopping results list several for under $20.)
From there, just enable the Windows File/Print Sharing service over TCP/IP, and you're good to go! After you've done this, you can remotely manage and upgrade these machines, saving you a lot of headache later on.
Serial-Port Method
Deanna's suggestion of using the serial port as a network device and transferring files normally will work as well. However, there is a bit of setup involved, and it can be a hassle if you've never done it. There are several other software options. I recommend LapLink. It's fairly painless.
You could even go all-out and pickup a multi-port serial interface for fairly cheap these days, and manage these computers centrally. RS232 is very robust and can go a long distance over the proper cabling.
Networking over Ethernet is the way to go though. If at all possible, choose that option.
We've got a few testing laboratories in a similar situation-the labs make money for the company so no touching the ancient computers that run the tests under pain of death. :-)
Anyway, pySerial seems like it'd work for this application, maybe take a look at their wxPython examples for some ideas on a GUI.
I guess the answer is pretty simple if you are happy using VB6 and the other app is already VB6, then use it.
That will do whatever serial comms you require quite adequately. Remember though you may want to update the application you write to do the updating in which case you are back to using hyperterminal!

Categories