Git Product home page Git Product logo

pslab-desktop's Introduction

PSLab Desktop

Desktop application for the Pocket Science Lab (PSlab) open hardware platform.

Development Build Status Mailing List Gitter Twitter Follow

This repository holds the PSLab Desktop application. It is using ElectronJS running React on top as UI renderer and uses Python scripts under the hood for device communication. The goal of PSLab is to create an Open Source hardware device (open on all layers) and software applications that can be used for experiments by teachers, students and scientists. Our tiny pocket lab provides an array of instruments 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. Our website is at PSLab.io. See also the screenshots and demos.

PSLab Banner

Buy

Communication

Please join us on the following channels:

Downloads and Distribution

We are providing binary packages. Please see the releases page for downloads.

Python library

As this app uses the PSL library under the hood for device communication, you need to have it installed as well. Instructions are provided in the pslab-python repository.

As of now, you need to have the latest version installed.

Arch Linux

If you are running Arch Linux or another distribution based on it, install pslab-desktop.

Other Linux distributions

There are packages in .deb format (Debian, Ubuntu and derivatives), .rpm (Fedora, openSUSE etc), and .tar.xz archives.

Windows

There are installers as .exe executables, based on NSIS.

If you are using Chocolatey, you can install the app via:

choco install pslab-desktop

The package is available at https://community.chocolatey.org/packages/pslab-desktop and currently maintained at https://github.com/tunisiano187/Chocolatey-packages.

macOS

There are .dmg image files and .zip archives.

Open the PSLab-*.dmg file, drag and drop the PSLab icon to the Application directory within the installation window, and PSLab will appear in your Launchpad.

Development

Features and Implementation Status

Feature Description Status
Home Screen Show status and version of PSLab device ✔️
Instruments Exposes PSLab instruments like Oscilloscope, etc ✔️
Oscilloscope Shows variation of analog signals ✔️
Multimeter Measures voltage, current, resistance and capacitance ✔️
Logical Analyzer Captures and displays signals from digital system ✔️
Wave Generator Generates arbitrary analog and digital waveforms ✔️
Power Source Generates programmable voltage and currents ✔️
Lux Meter Measures the ambient light intensity
Barometer Measures the Pressure
Accelerometer Measures the acceleration of the device
Gyrometer Measures the rate of rotation
Compass Measures the absolute rotation relative to earth magnetic poles
Thermometer Measures the ambient temperature
Gas Sensor Detects gases, including NH3, NOx, alcohol, benzene, smoke and CO2
Robotic Arm Controller Allows to control 4 servo motors of the robotic arm independently ✔️

Roadmap

The goal of the project is to provide a fully functional science application that works with PSLab and other open scientific hardware. Furthermore the application should be fully compatible and feature matching to the PSLab Android app. Current status of the development:

  • Implement all major instruments
  • Have an effective build system for linux and windows
  • Have a basic data logging feature in place
  • [/] Implement interface for I2C sensors
  • Implement more minor instruments
    • Lux meter
    • Gas meter
    • Compass
    • pH meter
    • Accelerometer
    • Barometer
  • Make data logging and playback more robust
  • Code refactoring and architecture improvement

How to Contribute

Great you are interested in contributing! Please check the issue tracker for open bugs and feature requests and read the FOSSASIA community guidelines to get started.

Branch Policy

  • The development branch is the standard branch of the project. Pull requests are merged to this branch and tests run through Travis CI.
  • The master branch is currently not maintained and held the stable releases of the project and merged the development branch regularly after it was tested thouroughly.
  • The install branch is outdated and holds autogenerated install images for some Linux distributions and Windows. It was generated through Travis CI on merged pull requests in the development and master branches.
  • The gh-pages is currently outdated, but is intended to hold information of the project from the Readme.md and /docs folder.

Setting up a Development Environment

  1. Fork the project to get a copy of the repository in your GitHub profile.
  2. Clone the forked project from your profile (not from FOSSASIA): git clone [email protected]:your-profile/pslab-desktop
  3. Change into the project folder: cd pslab-desktop
  4. Add the original FOSSASIA repository as a remote: git remote add upstream https://github.com/fossasia/pslab-desktop.git

Prerequisites and Dependencies

Please note: If you are in China, you need to configure a mirror for npm. In short, add the following to your ~/.npmrc file (create it if it doesn't yet exist):

registry = http://registry.npm.taobao.org/

While in your project folder, run npm install. This will install all the necessary dependencies required by the app to run.

Using a virtual enviroment

To isolate the Python dependencies, it is recommended to use a virtual enviroment for development. To create a virtual enviroment, run the following command while in your project repository:

python3 -m venv venv

Now activate the virtual enviroment in your current shell session:

# For bash/zsh users:
source ./venv/bin/activate
# For Windows cmd.exe users:
.\venv\Scripts\activate.bat

(If you use a different shell, check the Python venv docs for the full list.)

Within your virtual enviroment, now install the Python library:

python3 -m pip install pslab

With the virtual enviroment activated, the app will run using the libraries installed in the virtual enviroment, and not the global Python location.

To deactivate the virtual enviroment, run:

deactivate

If you are also working on the Python library, set PYTHON_PATH to point to its directory in order to have your local version available to the desktop app.

Starting the app

All commands to start and debug the app are outlined in the package.json file. To simply get it running run the following command while in your project repository and the virtual enviroment is active.

npm start

And wait for Electron to open.

IPC and Stack

The stack comprises multiple pieces:

  • pslab-hardware, offering phyiscal ports
  • pslab-firmware, running on the PIC MCU
  • pslab-python, a Python library that communicates with the MCU via USB serial
  • the bridge here in scripts/, which talks to the Python library
  • the Electron app itself, which offers the GUI and communicates with the bridge via stdin/stdout

Electron builds on top of Node.js and Chromium. The UI is running in its own rendering process, requiring IPC in order to communicate with the main process. See public/electron.js for the entry point in this project.

To communicate with the Python bridge, there are extra Electron processes that spawn Python processes. See background_tasks/.

Any action from the UI thus requires the following:

  • an appropriate handler to pick up the action from the UI element
  • a function invoking the corresponding IPC method
  • an Electron-side IPC method definition (public/electron.js)
  • a Python-side IPC method definition (scripts/bridge.py)

Building the App

First you need to follow the instructions to set up a development environment.

While in the project root, run the build scripts as defined in package.json:

npm run build
npm run build:electron

For a platform-specific build, run the following instead, where PLATFORM can be any of linux, mac, or win:

npm run build
npm run build:electron -- --$PLATFORM

If you do not want to create an archive or package:

npm run build
npm run pack

This will produce two directories in the project root. The build/ directory contains the optimized React files, while the dist/ directory contains the final Electron build with everything else.

License

This project is Free and Open Source software. The project is licensed under the GPL v3. Copyright is owned by FOSSASIA. More details in the license files.

Maintainers

The project is maintained by

pslab-desktop's People

Contributors

2dsharp avatar abhijay007 avatar adityastic avatar ayushns9 avatar bessman avatar cloudypadmal avatar cweitat avatar cynthi8 avatar dishebh avatar fragm3 avatar hpdang avatar jensgr avatar jithinbp avatar kumuditha-udayanga avatar mariobehling avatar ojasgulati avatar orangecms avatar paltrickontpb avatar pipe-runner avatar priyanshunayan avatar rafaelleeimg avatar sagarbaba avatar schneiderl avatar sid911 avatar suyashsingh234 avatar viveksb007 avatar wavicles avatar zorlax5002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pslab-desktop's Issues

Create calibration utility using ADS1115

The PSLab unit's analog and digital features must be calibrated in order to make it accurate.
The ADS1115 16-bit ADC is a 4-channel, 0-3.3V ADC that can be interfaced via I2C

  • Add the following features :
    • Calibrate CH1, CH2, CH3 & PV1, PV2, PV3 using ADS1115. Generate Cubic interpolation functions for each
    • Calibrate PCS using a measured Load resistor, and calibrated analog channel. Generate interpolation function
    • Calibrate CAP using precision capacitors
    • Write all calibration constants into flash memory after assigning a timestamp
    • Store raw calibration data in a client-side folder

Create a /docs/ folder and move all documentation there

At present, experiment specific helpfiles are located in psl_res/HTML/ , and these will be moved to /docs/

Once the YayDoc generator has been setup correctly, setup.py must copy the docs folder to a known location, and the path must also be updated in PSL_Apps/bin/Experiments .

Enable pip cache for Travis-CI

The present configuration downloads and installs dependencies from source in the following way

before_install:
    - curl -L http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.5/sip-4.16.5.tar.gz -o /downloads/sip.tar.gz 
    - curl -L http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.3/PyQt-x11-gpl-4.11.3.tar.gz -o /downloads/pyqt4.tar.gz

install:
    - pushd sip-4.16.5
    - python configure.py
    - make
    - sudo make install
    - popd
    # PyQt4
    - tar xzf /downloads/pyqt4.tar.gz --keep-newer-files
    - pushd PyQt-x11-gpl-4.11.3
    - python configure.py -c --confirm-license -e QtCore -e QtGui -e QtTest -e QtDesigner
    - make
    - sudo make install
    - popd
...

This method is inefficient, and takes a long time to build.
Instead, python-pip should be used , for which TravisCI has a built in caching process also.

Makefile needs to be compatible with Travis

The Makefile tries to build both python2.7 as well as Python3 , and this breaks Travis.
Up until this point, the makefile was not being invoked, but that needs to change because xml templates should be compiled during the build process.
Previously, compiled .py files generated from .ui files by pyuic were part of the repository.

Relevant section from the Makefile

	#cp docs/misc/build/*.html $(DESTDIR)/usr/share/doc/pslab/html
	# create ditributions for Python2 and Python3
	python setup.py install --install-layout=deb \
	         --root=$(DESTDIR)/ --prefix=/usr
	python3 setup.py install --install-layout=deb \
	         --root=$(DESTDIR)/ --prefix=/usr

Errors from Travis:

./psl_res/GUI/A_TEST_AND_MEASUREMENT/A_TandM/templates/ipy.ui
python setup.py build
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    from setuptools import setup, find_packages
  File "/home/travis/virtualenv/python3.2.6/lib/python3.2/site-packages/setuptools/__init__.py", line 12, in <module>
    import setuptools.version
  File "/home/travis/virtualenv/python3.2.6/lib/python3.2/site-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/home/travis/virtualenv/python3.2.6/lib/python3.2/site-packages/pkg_resources/__init__.py", line 77, in <module>
    raise RuntimeError("Python 3.3 or later is required")
RuntimeError: Python 3.3 or later is required
make: *** [all] Error 1
The command "make" failed and exited with 2 during .
Your build has been stopped.

Travis build fails due to Sip version mismatch

======================================================================
ERROR: Failure: ValueError (API 'QString' has already been set to version 1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/travis/build/fossasia/pslab-desktop-apps/psl_res/GUI/E_MISCELLANEOUS/B/B_testing.py", line 14, in <module>
    from PSL_Apps.utilitiesClass import utilitiesClass
  File "/home/travis/build/fossasia/pslab-desktop-apps/PSL_Apps/utilitiesClass.py", line 6, in <module>
    sip.setapi("QString", 2)
ValueError: API 'QString' has already been set to version 1
======================================================================
ERROR: Failure: ValueError (API 'QString' has already been set to version 1)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/travis/virtualenv/python2.7.13/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/travis/build/fossasia/pslab-desktop-apps/psl_res/GUI/E_MISCELLANEOUS/B/testing.py", line 13, in <module>
    from PSL_Apps.utilitiesClass import utilitiesClass
  File "/home/travis/build/fossasia/pslab-desktop-apps/PSL_Apps/utilitiesClass.py", line 6, in <module>
    sip.setapi("QString", 2)
ValueError: API 'QString' has already been set to version 1
----------------------------------------------------------------------

Possible causes:

  • import PyQt4 statement was called before setting the Sip version to 2. The default version is 1

Since the Experiments App imports all the experiment apps before launching, this can be tricky to locate. Local build is executing without throwing the Sip error 💭

Remove all references to pre-compiled template files

template files ( *.ui ) are compiled by pyuic to ui_*.py files via the Makefile
These files must be generated during the build process, and not be stored in the repo, so git has been configured to ignore files that match ui_*.py
But, a lot of Apps use compiled templates that do not start with 'ui_' , and were compiled outside of the makefile. The references in these apps need to be updated, and pre-compiled templates untracked.

Fix Makefile to properly install pslab-python dependency

The travis build fails while trying to install pslab-python dependency . The libraries by the pslab-python Makefile are not in a virtualenv accessible path . Error:

from PSL.commands_proto import applySIPrefix
ImportError: No module named 'PSL'

It is proposed to use python setup.py install instead

Fix DUST_SENSOR.py

  • Is not providing accurate data
  • save option does nothing . Include it.
  • is plotting occupancy ratio. Should plot dust concentration.
  • Include configuration options for
    • Integration time per sample
    • total samples
  • missing help file

Convert psl_res/HTML/*.html to markdown format with Jekyll compatibility

The current set of helpfiles are written in plain HTML, and are not easily editable.
It is also difficult to provide links to other resources, or insert a Table of Contents.

Therefore, there is a need to convert these files to markdown format, and set up a static site generator such as Jekyll to create pages with appropriate formatting, and user friendly cross-links

Task list :

  • Convert existing help files to markdown format
  • Configure URLs such that relative links in the static site built by Jekyll work properly regardless of location.

Speed up travis build process using cached dependencies

Currently, the repository downloads the source of pretty huge dependencies such as PyQt4, and then proceeds to build them before proceeding to actually testing the repository.
This feels like an avoidable waste of resources and time. Is it possible to prevent re-installation of repositories each time?

Create a landing page for the in-app documentation

The present landing page at docs/experiments.html shows only a small python code snippet.

The README.md of pslab-desktop-apps can be adapted to create a suitable landing page
This page should eventually serve as a getting started guide

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.