Skip to content

Python-based control system with QT-based GUI class and separate server class to talk to peripheral devices like Arduino, Teensy, power supplies, etc.

License

Notifications You must be signed in to change notification settings

DanielWinklehner/pycontrolsystem

Repository files navigation

pycontrolsystem

Introduction

Python-based control system with QT-based GUI class and separate server class to talk to peripheral devices like Arduino, Teensy, power supplies, etc.

Warning: As of right now, this is only tested in Windows 10. It should work on Linux distributions, but we will have to test it further before claiming that.

Installation

The spec-file.txt in the root folder contains an Anaconda environment with all the dependencies of the pycontrolsystem. After installing Anaconda3, the following can be used in Windows from a Anaconda command prompt:

conda create --name pycontrolsystem --file spec-file.txt

or using the Import button in Anaconda Navigator.

Note: If you are using Anaconda, do the following steps in a shell openend with the Anaconda environment created for the pycontrolsystem.

The only module not available from Anaconda is pyusb. Install it simply by using pip

pip install pyusb

Either use pip to install the pycontrolsystem directly from the github repository

pip install git+https://github.com/DanielWinklehner/pycontrolsystem.git

or download the source first

git clone https://github.com/DanielWinklehner/pycontrolsystem.git

then, navigate to the pycontrolsystem folder containing setup.py and run

python setup.py install

Simple Example

In the example folder, there are three files:

server_example.py
client_example.py
2TestDevices.txt

Copy them into a test directory. From your Anaconda shell start the server with

python server_example.py

The server in the server example is actually just a simple dummy server returning a cos(t) signal for any channel queried for. It knows two devices (with ID's Dummy1 and Dummy2). Then start the GUI with

python client_example.py

In the Client GUI, click Load Session and load the 2TestDevices.txt file. In the Devices tab, one click on the different devices and cannels and see the ID's and other parameters.

Adding a Slack notification

In the "Procedures" Dialog, there is a checkbox for Slack notifictions. In order for the control system to be able to actually send one, the user has to create an app and bot according to https://api.slack.com/slack-apps. They can then install the app to their workspace and obtain an authorization token.

This token will have to be entered in the Slack dialog accessible from Configure->Slack... in the GUI. A channel name that the bot is authorized to post in should also be specified.

Changing the GUI using PyQt5

Note: This is just a random assortment of useful hints for GUI modifications

pyuic

In order to generate python files from QtDesigner-generated .ui files use the following command from an Anaconda shell (assuming pyqt >= 5.0.0 is installed):

python -m PyQt5.uic.pyuic UIFile.ui -o ui_PythonFile.py

About

Python-based control system with QT-based GUI class and separate server class to talk to peripheral devices like Arduino, Teensy, power supplies, etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published