Python Bluetooth LE subscription on Windows 10 - python

So I fear this is going to be a no, but is there a way to have python 3 on windows 10, discover, connect and get subscription updates from a bluetooth Low Energy device? Bleak and other similar libraries do not seem to work.
If that is not a solution, is it possible that something like C++ would work? My end goal is to have something connect to a bluetooth device, the script/program to read what the device is sending it, then translate that into keyboard inputs.
I am willing to pick up another language to make this happen, just not really sure where to start.

Related

How to program a atMega328p MCU with a Raspberry Pi 4 (Python)

I been looking everywhere online for this exact configuration but can't find much.
I want to program my AtMega328p MCU (its on a breadboard) using Python from my Raspberry Pi 4 but I am not sure how to check if communication is going on between them? I have the MISO, MOSI, SCLK, and CE0 pins from the Pi connected to the MISO, MOSI, SCK, SS pins on the AtMega328p respectively.
I understand I have to use SPI communication, however how can I exactly send data from the Raspberry Pi to the MCU to ensure there is communication between the two? Maybe some code to send to the MCU and receive it back? I been using the SPI Dev Python libraries but can't find much info on it. Thank you in advance!!
To load code onto the AVR (program it), you want to use existing software like avrdude that already speaks the AVR ISP protocol. avrdude already has support for using the RPi SPI headers - just use the linuxspi programmer type.
Here's an article by the author that explains it (although there are probably more recent articles if you search around) http://kevincuzner.com/2013/05/27/raspberry-pi-as-an-avr-programmer/
Is there a reason you want to do this from Python specifically? Or are you referring to communicating between the uC firmware and some Python code on the Pi?

Approaches to automatic Plug and Play Raspberry PI WebSockets

This question is more about advice on how to approach the best solution and possible frameworks to look at.
Desired Result
I am currently attempting to create a very basic plug and play raspberry-pi which can be controlled via an API to perform various tasks such as stream a webcam or turn an led on. The device should connect to anyway wifi and automatically be able to be controlled by the API.
Current Problem
The goal of the app is to create a very easy to use plug and play solution. However I am running to to problem when trying to create a WebSocket on the PI as I cannot seem to be able to access it from an external network. I have looked into automatic port forwarding solutions such as UPnP however all of the results are extremely old. I have also thought about creating the Python WebSocket on a cloud server and use the PI as the client to connect and pass data. Please correct me if I am wrong, however this method does not seem very scalable when there are 10s/100s/1000s of pi's connecting to the same socket.
Any advice would be greatly appreciated.

How to connect raspberry to plc via Ethernet?

I have wrote a simple program using Python on RSPPi, that count time between the falling edges, signal is provided by PLC (Rexroth CML40). It works great, but now I want to send more signals from PLC but I don't have any free output spots. So, I think the solution to that is making a connection between Raspberry and PLC through Ethernet. My question is, what should i need to make to receive data from PLC (state of the 3 variables) to Raspberry?
I found this https://wiki.python.org/moin/TcpCommunication but I don't really understand it. Is it Raspberry a server? Right? If yes then how can I make client code work on PLC... It is really incomprehensible to me
You first need to find what Ethernet-based protocols the L40 controller has available. This sales guide shows that some of the IndraMotion software packages include OPC-UA, which is a good option because there is a robust Python OPC-UA library. Your controller may also have the EtherNet/IP add-on module, which would also work. Your distributor or sales rep should be able to point you in the right direction.
The second step is to find a library that allows to you communicate over that protocol. I've personally had success with OPC-UA, many options though. Some Recommendations:
Python OPC-UA
CPPPO — EtherNet/IP

Issues finding Thorlab device using pyserial on a mac running high-sierra.

I am trying to modify a package called thorpy in order to communicate with a a FTDI device sold by Thorlab. The device is an APT TDC001 T-Cube which use a USB and an RS-232 interface. I would like to know the best way to send and receive communication with a device like this one. What are some of the considerations one must take into account when trying to establish communication with a usb device from a proprietary vendor. The vendor provides a pdf intended to help in the creation of new interfaces. Any help will be appreciated. I am not an expert with python, but I have a strong background in programming. Thank you in advance.

How can I communicate between a Siemens S7-1200 and python?

I am running a process on a S7-1200 plc and I need it to send a start signal to my python script, after the script is done running it needs to send something back to the plc to initiate the next phase. Oh, and it has to be done in ladder.
Is there a quick and dirty way to send things over profibus or am I better off using just a RS232 thing?
I would go with SNAP7 and python-snap7 libraries. Example on how to install it on a Raspberry pi found in this blog:
http://simplyautomationized.blogspot.com/2014/12/raspberry-pi-getting-data-from-s7-1200.html
Update:
Video walkthrough on how to set it up: https://youtu.be/yJNEsI5KJxs
After failing with libnodave and OPC, I created a TCON,TSEND and TRECV communication thing. It transmits a byte over TCP and it works.
I would use libnodave on PC side to change value of some M tag or a DB tag in a PLC. You can easily make a ladder rung which will monitor this tag and execute further actions. Although libnodave doesn't support Python natively, you can find a python wrapper here.
Well, a quick google of 'python rs232' turned up some site talking about doing robotics controls through rs232 using pySerial. So if you know how to hook your widget up to rs232, you could go that route.
There is a commercial library called "S7connector" by Rothenbacher GmbH (obviously it's not the "s7connector" on sourceforge).
It is for the .NET framework, so could be used with IronPython.
It does work with S7-1200 PLCs. You just have to make sure a DB you want to read from / write to is not an optimized S7-1200 style DB, but a S7-300/400 compatible one, an option which you can set when creating a DB in TIA portal.
This lib also allows to read and write all I/O ports - the "shadow registers" (not sure what they're called officially) and directly as well, overriding the former.
There are several Modbus TCP Clients available for Python, I have used pyModbusTCP successfully. TIA Portal the IDE for the S7-1200 has Modbus Server function that you can load to your PLC that will allow you to read and write directly to the PLC.
https://support.industry.siemens.com/cs/ww/en/view/83130159
Ther best way to communicate with S7-1200 PLC cpu's is with OPC UA or Classic OPC (ommonly known as OPC DA. ) Libnodave is made for S7-300 and S7-400 not for S71200 (2.x firmware).
If you use a third party solution to communicate with S7-1200 (or S7-1500) you have to decrease the security level at the PLC by allowing the put and get mechanism. Put and get are pure evil to use. You open the memory of the CPU for every process. Don’t use them anymore. Siemens should actually block this.
This applies for all firmware release for S7-1200.
Siemens pushes people you use OPC UA as default communication from PLC. What makes sense, because OPC UA is the protocol for industry 4.0 and IIoT.
Edit: rewrite everything. Info was heavily outdated.
If you use a firmware 2 or 3 1200, consider replacement or upgrade. These versions are no longer supported and contains the worm issue.

Categories