I have for the first time installed the OpenCV module for python3, and i am trying to find the best way to use OpenCV with a connected MCU (Microcontroller Unit) such as Arduino, or to control I/O of a Raspberry Pi 3..
In the past:
I have written a python GUI with tkinter and programmed the MCU to be controlled via serial communication. The MCU receives a string of data that is being written to the port. When I click a button in my python GUI, it then executes the programmed functions.
I have then also turned the host computer into a web server, and have written a front end using HTML/CSS/JavaScript, more specifically using AJAX, which then makes a call to a PHP back end script that in turn executes a python script(could use bash script), which is sending commands to a MCU.
(Yes it's secure. And mildly confusing to most people.)
In saying that, I have had some time to have a play around with some examples of OpenCV, but it has been quite difficult finding documentation that is clear and gives me an idea of how to use the module within robotics/mechatronics and industrial automation projects. All the uses I have seen have been mentioned using Arduino and processing.
So my question after explaining this is, how do I start using OpenCV object/face recognition and have it send commands serially?
Is Arduino processing the only option or can this be achieved with just the python modules and the code embedded on the MCU?
Thank you in advance to anyone who may be able to give me some guidance.
Related
I have a client based application written in python. It is using some sensitive api's. A way to prevent people to find these would be to check for known debbuger processes running, but this can easily be tricked by renaming the process or runnning the script on a pc, getting debugged by an external device checking the traffic.
Would there be a way to detect if the internet connection is running trough a normal ip and not a proxy or the internet traffic is being watched?
I not looking for a specific pythonic way, just a general solution that I can convert into a python script later.
Im writing a python program that performs a redundant task. After the program loops a certain number of times I need to be able to switch VPN servers and start over. So i'm basically trying to use Nord VPN as a proxy in python. Can anyone point me in the right direction?
I am not sure, but it seems their python API might be doable for the task described. It does enable you to connect to VPN servers through python, so I suppose you can just detect, when you need to change the server, and then just connect to it with their API.
Check it out here: NordVPN Python
with the command "scutil --nc stop "NordVPN NordLynx""
To put you all in the perspective, I have a Raspberry Pi 4, I want to use it as a (python socket) server and on the client side, I will use my Computer.
The problem is when I try to execute a program using AF_BLUETOOTH on windows (10) , it always says that there is no thing called AF_BLUETOOTH.
I also searched many forums and I saw that AF_BLUETOOTH is not supported by windows 10's python (3.8).
I am asking for confirmation of this information because I wasted a lot of my time trying to make it work...
s = socket.socket(socket.AF_BLUETOOTH,socket.SOCK_RAW,socket.BTPROTO_RFCOMM)
This is my work after reading the documentation, I couldn't find any good tutorial on the internet about this topic.
Thank you.
In my application I want to turn on certain GPIO pins that are on the Raspberry Pi from my PC's C++ script. My PC is currently running on Windows 10 and my Raspberry Pi on Raspbian.
The general idea I had was to write python scripts on the Raspberry Pi itself and run them somehow from my PC when needed. Although, I am not sure how to do this or if it's possible in C++. I know I can ssh into my Raspberry Pi and run scripts manually but the idea of this application is automation. I am able to connect my PC to the Raspberry Pi either by Ethernet or USB cables.
I have seen USB to GPIO modules that would probably work better although for now I am stuck with my Raspberry Pi.
Any knowledge or resources on how to do this is greatly appreciated.
Maybe be what you need is a client and server program to control your GPIO pins. Check out my client and server programs and dont forget to read the answer and its comments and make the change accordingly for the program to work.(My progams motives is to control an LED through the client and server programs , similar to controlling the GPIO pins )
Program getting stuck at accept statement
PS: I hope you are having some knowledge about Threading and sockets.
This answer will be pretty broad so feel free to leave a comment with questions.
The first things that are needed, are the python scripts on the Pi which control the GPIOs in however fashion we like. From then on we are able to execute these commands via ssh from almost any device. Although, we want this process to be automated. In other words, the user doesn't have to enter credentials to ssh into the Pi but rather have the program automatically do so.
Luckily, this library allows us to do so. -> https://www.libssh.org/
There is nice documentation as to how to create ssh sessions and executing the commands that we want. So I won't go into much detail. Although I will comment on one procedure that the documentation recommends but gave me a problem.
When authenticating the user via password we use method ssh_userauth_password(ssh_session session, const char* username, const char* password). The documentation suggests setting the second parameter to NULL. Which was what was giving me the problem.
Simply change this to the login name you use when you normally ssh into the Raspberry Pi. For most the default name is "pi".
ssh_userauth_password(my_ssh_session, "pi", password);
I have an interactive console application and I need to work with it using Python (send commands and receive output). The application is started by another one, I can't start it from Python script.
Is it possible to connect to already running console application and get access to its stdin/stdout?
Ideally the solution should work both in Windows and Unix, but just Windows version would also be helpful. Currently I am using the solution found here
http://code.activestate.com/recipes/440554/
but it doesn't allow connecting to existing process.
Thanks for any input,
Have you considered using sockets since they are straight forward for simple/streaming. They are also platform independent.
The most critical point is thread safety where having to pass IO streams between threads/processes tends to be hectic.
If on the other hand you use a socket, a lot can be communicated without adding too much complexity to how the processes work(coding an error prone RPC for instance).
try Documentation or
example