Skip to main content

SMCC

The SMCC (SMC-Core) is a simple python based API that allows to interface via serial port with the SMCD (SMC-Driver). This allows the SMCC to be imported to your own projects without having to drag the GUI with it.

Index

Installation

To install the SMCC just use pip as follows:

$ pip install smcc

The project is hosted on the pypi register: https://pypi.org/projects/SMCC

Example use

Quick Start

Configure a 3.75°/step stepper motor to perform a full clockwise rotation at 20 rpm:

# Imports
import serial
import time
from SMCC.Commands import SETUP_CMD, STEP_CMD, generateControlDict, sendCommand

# Configure motor
ctrl_dict = generateControlDict()
ctrl_dict['degrees_per_step'] = 3.75

# Serial port configuration
port='/dev/ttyACM0'
br = 9600
to = 10 # seconds
ctrl_dict['comms'] = serial.Serial(port, baudrate=br, timeout=to)
# Wait 10 seconds for Arduino to reboot
time.sleep(10)

# Configure speed
ctrl_dict['speed'] = 20
# Configure freq from speed
_, real_freq, counter = getFrequency(ctrl_dict)
ctrl_dict['freq'] = real_freq
ctrl_dict['freq_counter'] = counter

# Send setup CMD
setup_cmd = SETUP_CMD(ctrl_dict)
setup_response = sendCommand(ctrl_dict['comms'], setup_cmd)

# Set rotation direction and number of steps
n_steps = int(360/ctrl_dict['degrees_per_step'])
ctrl_dict['steps'] = n_steps
ctrl_dict['direction'] = True

# Send step cmd
step_cmd = STEP_CMD(ctrl_dict)
step_response = sendCommand(ctrl_dict['comms'], step_cmd)

# Wait for the motor to complete rotation before closing port
wait_time = 20 #Seconds
time.sleep(wait_time)

ctrl_dict['comms'].close()

In depth examples

Two detailed explained examples are provided on Examples:

  1. python_example.py : Shows the basic operation of the API, by performing the configuration and then a full counterclockwise rotation of the stepper motor.
  2. jupyter_example.ipynb: Shows the basic operation of the API, performs a clockwise and then a counterclockwise rotation of the stepper motor.

All the examples are designed to work with the SMCD (Serial Motor Controller Driver)

Reference

The REFERENCE.md provides a detailed explanation of every function and constant provided on the API.

Metadata

Release files for SMCC 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SMCC 0.0.2
File Size Uploaded
smcc-0.0.2.tar.gz 104.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SMCC 0.0.2
File Interpreter ABI Platform
smcc-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 124.8 kB

Release files / smcc-0.0.2.tar.gz

Download URL smcc-0.0.2.tar.gz
Size 104.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0ecbf60ce6c5448f7d7d2567a42c3016bd1afcabd54071becbcf76c3ab4b92be
BLAKE2b-256 checksum
How to use checksums
607a30b8d6eb80b25d11a5896ccbf451923f1ac23fca0ef5fc2f2f585525fa90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release files / smcc-0.0.2-py3-none-any.whl

Download URL smcc-0.0.2-py3-none-any.whl
Size 20.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82aa6f8ddfb9f93e50d93d43cf34292662cbe69d28569f1f7b2093152dd81eef
BLAKE2b-256 checksum
How to use checksums
37f17d0c26694579e482c3b1943e1c00b129ea3620069378b2775dc52d6d7e9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.17

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page