The Python library for the Pocket Science Lab from FOSSASIA.
This repository hosts the python library for communicating with the Pocket Science Lab open hardware platform (PSLab). This can be installed on a Linux or Windows system. Using this library you can communicate with the PSLab using a simple Python code. The Python library is also used in the PSLab desktop application as a backend component. The goal of PSLab is to create an Open-Source hardware device (open on all layers) and software applications that can be used by teachers, students, and scientists for various experiments. This tiny pocket lab provides an array of variety of instruments useful for doing science and engineering experiments. It provides functions of numerous measurement tools including an oscilloscope, a waveform generator, a frequency counter, a programmable voltage, current source, and even a component to control robots with up to four servos.
Check out our website https://pslab.io for more details.
- You can get a Pocket Science Lab device from the FOSSASIA Shop.
- More resellers are listed on the PSLab website.
- Join PSLab chat channel on Gitter.
- You can also subscribe to PSLab Mailing List for regular updates.
To install PSLab on Debian based GNU/Linux system, the following dependencies must be installed-
- Python 3.6 or higher Link to Official download page
- Pip (Supported package installer)
- NumPy (Support Library For numerical calculations)
- PySerial (Support Library For device connection)
- iPython-qtconsole Optional
Note: If you are only interested in using PSLab as an acquisition device without a display/GUI, only one repository pslab-python needs to be installed. If you like a GUI, install the pslab-desktop app and follow the instructions of the 'Readme' file in that repository.
As root (or with sudo):
# pip install git+https://github.com/fossasia/pslab-python@master
That's it!
Step 1: Install the latest Python version on your computer and configure PATH variable to have both the Python installation directory and the Scripts directory to access pip tools. In Windows, Python is installed in C: drive by default. We can set $PATH by opening the Environment variables dialog box by following the steps below:
- [Right click on My Computer]
- Select "Properties"
- Open "System Properties"
- Click on "Advanced" tab
- Click "Environment Variables" button
- Look for "PATH" in "System Variables" section and click on it and press "Edit" button
- To the end of "Variable value" text box, append "
C:\Python34\;C:\Python34\Scripts\;" (without quotes and34may differ depending on the python version installed. It could be 35, 37 ...) - Click "OK" twice to save and move out from path windows
Step 2: Open up command prompt and execute the following commands to install the required dependencies.
$ pip install pyserial
$ pip install numpy
- Download the PSLab-Python library from this repository and extract it to a directory.
- Browse into that directory and create a new file named
test-pslab-libs.py - Paste the following code into that file and save it.
from PSL import sciencelab
I = sciencelab.connect()
capacitance = I.get_capacitance()
print(capacitance)
- Plug in the PSLab device and check if both the LEDs are turned on.
- Now run this file by typing
python test-pslab-libs.pyon a command prompt and observe a numerical value printed on the screen along with PSLab device version and the port it is connected to.
To set up the development environment, install the packages mentioned in dependencies. For building GUI's you can use Qt Designer or create a frontend using any other compatible technology. The PSLab desktop app is using Electron for example.
- install sphinx by running the following command
pip install -U Sphinx
- go to pslab/docs and run the following command
$ make html
The library is free and open-source software licensed under the GPL v3. The copyright is owned by FOSSASIA.