Python interface to Loadstar Sensors USB devices.
Project description
About
- Name: loadstar_sensors_interface
- Version: 0.9.0
- Description: Python interface to Loadstar Sensors USB devices.
- License: BSD 3-Clause License
- URL: https://github.com/janelia-pypi/loadstar_sensors_interface_python
- Author: Peter Polidoro
- Email: peter@polidoro.io
- Copyright: 2022 Howard Hughes Medical Institute
- Reference: https://www.loadstarsensors.com/
- Dependencies:
- serial_interface
- click
Example Usage
Python
from loadstar_sensors_interface import LoadstarSensorsInterface, ScaleFactor
dev = LoadstarSensorsInterface() # Try to automatically detect port
dev = LoadstarSensorsInterface(port='/dev/ttyUSB0') # Linux specific port
dev = LoadstarSensorsInterface(port='/dev/tty.usbmodem262471') # Mac OS X specific port
dev = LoadstarSensorsInterface(port='COM3') # Windows specific port
dev.get_device_info()
dev.tare()
dev.get_sensor_value()
dev.get_port()
dev.get_model()
dev.get_id()
dev.get_native_units()
dev.get_load_capacity()
dev.set_averaging_window(5) # 1-1024 samples
dev.get_averaging_window()
dev.set_averaging_threshold(25) # 1-100 percent
dev.get_averaging_threshold()
dev.set_scale_factor(ScaleFactor.LB_TO_GM)
dev.get_scale_factor()
dev.set_scale_factor('LB_TO_GM') # ScaleFactor string
dev.get_scale_factor()
dev.set_scale_factor(25.4) # float e.g. in to mm
dev.get_scale_factor()
Command Line
loadstar --help
# Usage: loadstar [OPTIONS]
loadstar --info
loadstar -p /dev/ttyUSB0 --tare -s LB_TO_GM -w 1 -t 25 -f 2 -d 10
Installation
https://github.com/janelia-pypi/python_setup
Linux
udev rules
# Recommended
curl -fsSL https://raw.githubusercontent.com/platformio/platformio-core/master/scripts/99-platformio-udev.rules | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
# OR, manually download and copy this file to destination folder
sudo cp 99-platformio-udev.rules /etc/udev/rules.d/99-platformio-udev.rules
# Restart udev management tool
sudo service udev restart
# or
sudo udevadm control --reload-rules
sudo udevadm trigger
# Ubuntu/Debian users may need to add own “username” to the “dialout” group
sudo usermod -a -G dialout $USER
sudo usermod -a -G plugdev $USER
pip
python3 -m venv ~/venvs/loadstar_sensors_interface
source ~/venvs/loadstar_sensors_interface/bin/activate
pip install loadstar_sensors_interface
guix
Setup guix-janelia channel:
https://github.com/guix-janelia/guix-janelia
guix install python-loadstar-sensors-interface
Windows
drivers
Download and install Windows driver:
Loadstar Sensors Windows Driver
pip
python3 -m venv C:\venvs\loadstar_sensors_interface
C:\venvs\loadstar_sensors_interface\Scripts\activate
pip install loadstar_sensors_interface
Development
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of HHMI nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #+END_SRC
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for loadstar_sensors_interface-0.9.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 73c5c654234717311c443f789d936b2f079ce0e95fd913c1b2ee8d8f52b716a0 |
|
MD5 | 450b18eabe96c1bf4d69ece7bbe3712a |
|
BLAKE2b-256 | 6c41e37e220e6b5d13838788644ec9a3e72f59dad9e8440dfe30afee119ae09e |
Hashes for loadstar_sensors_interface-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d644bbc559a709619f0f6a2483bbbe4808b9d278940deff2bfacf1105c059979 |
|
MD5 | ffe21dd8e1ef9d340dc523418c0b093b |
|
BLAKE2b-256 | 71c678c41a140a418b7c449477e5ef5d0b1d3590d391da4accd64cf3ddcb4f1c |