Metadata-Version: 2.4
Name: Spectral_BLDC
Version: 1.20
Summary: Python module for Spectral BLDC motor controllers
Author: Source robotics (Petar Crnjak)
Author-email: <info@source-robotics.com>
License: MIT
Project-URL: Documentation, https://source-robotics.github.io/PAROL-docs/
Project-URL: Source, https://source-robotics.github.io/PAROL-docs/
Keywords: python,BLDC,CANBUS,Robot,Source robotics,robotics
Classifier: Development Status :: 1 - Planning
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Operating System :: Unix
Classifier: Operating System :: Microsoft :: Windows
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-can
Requires-Dist: pyserial
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: summary


# Spectral-BLDC



[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)  ![Issues](https://img.shields.io/github/issues/PCrnjak/Spectral-BLDC-Python) ![release](https://img.shields.io/github/v/release/PCrnjak/Spectral-BLDC-Python)



Python lib for controlling Spectral BLDC motor controllers over CAN bus. For more info about this API and all available commands check [DOCS](https://source-robotics.github.io/Spectral-BLDC-docs/apage7_can/)



# Related projects



| Product | Description | Links |

|---|---|---|

| **Spectral Micro BLDC Controller** | Compact brushless motor controller with CAN bus, position/velocity/torque/impedance control modes | [GitHub](https://github.com/PCrnjak/Spectral-Micro-BLDC-controller) |

| **SSG-48 Adaptive Electric Gripper** | Adaptive electric gripper controllable over CAN bus | [GitHub](https://github.com/PCrnjak/SSG-48-adaptive-electric-gripper) |

| **MSG Gripper** | Compliant AI stepper gripper with force control, open-source firmware, GUI and Python API; designed for assembly tasks and AI training | [Store](https://source-robotics.com/products/msg-gripper) · [GitHub](https://github.com/PCrnjak/MSG-compliant-AI-stepper-gripper) · [Docs](https://source-robotics.github.io/MSG-gripper-docs/) |

| **STEPFOC Stepper Controller** | FOC-based stepper motor controller that turns low-cost steppers into high-performance robotic servos; CAN & UART, 14-bit encoder, open-source | [Store](https://source-robotics.com/products/stepfoc-stepper-controller) · [GitHub](https://github.com/PCrnjak/STEPFOC-stepper-controller) · [Docs](https://source-robotics.github.io/STEPFOC-docs/) |



# How to install



  pip install Spectral-BLDC



# Basic example





``` py 

import Spectral_BLDC as Spectral

import time





Communication1 = Spectral.CanCommunication(bustype='slcan', channel='COM41', bitrate=1000000)

Motor1 = Spectral.SpectralCAN(node_id=0, communication=Communication1)



while True:



    Motor1.Send_Respond_Encoder_data()



    message, UnpackedMessageID = Communication1.receive_can_messages(timeout=0.2)



    if message is not None:



        Motor1.UnpackData(message,UnpackedMessageID)

        print(f"Motor position is: {Motor1.position}")

        print(f"Motor speed is: {Motor1.speed}")



    else:

        print("No message after timeout period!")

    print("")

    time.sleep(1 )

```





# More examples



Check out the [Examples folder](https://github.com/PCrnjak/Spectral-BLDC-Python/tree/main/examples) for more examples!

Available examples:

* Send_respond_1

* Get_encoder_data

* SSG48_gripper_test







This project is entirely open-source and free for all to use. Any support, whether through donations or advice, is greatly appreciated. Thank you!



 [![General badge](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://paypal.me/PCrnjak?locale.x=en_US)

[![General badge](https://img.shields.io/badge/Patreon-F96854?style=for-the-badge&logo=patreon&logoColor=white)](https://www.patreon.com/PCrnjak)

