adafruit_motorkit

CircuitPython helper library for DC & Stepper Motor FeatherWing, Shield, and Pi Hat kits.

  • Author(s): Scott Shawcroft, Kattni Rembor

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_motorkit.MotorKit(address=96, i2c=None, steppers_microsteps=16, pwm_frequency=1600)

Class representing an Adafruit DC & Stepper Motor FeatherWing, Shield or Pi Hat kit.

Automatically uses the I2C bus on a Feather, Metro or Raspberry Pi if no I2C bus is supplied.

Alternately, if using with multiple I2C devices, you can specify the I2C bus.

frequency

The overall PCA9685 PWM frequency in Hertz.

motor1

:py:class:~adafruit_motor.motor.DCMotor controls for motor 1.

The following image shows the location of the M1 terminal on the DC/Stepper FeatherWing. The label on the FeatherWing is found on the bottom of the board. The terminal is labeled on the top of the Shield and Pi Hat.

Motor 1 location

This example moves the motor forwards for one fifth of a second at full speed.

import time
from adafruit_motorkit import motorkit

kit = MotorKit()

kit.motor1.throttle = 1.0
time.sleep(0.2)

kit.motor1.throttle = 0
motor2

:py:class:~adafruit_motor.motor.DCMotor controls for motor 2.

The following image shows the location of the M2 terminal on the DC/Stepper FeatherWing. The label on the FeatherWing is found on the bottom of the board. The terminal is labeled on the top of the Shield and Pi Hat.

Motor 2 location

This example moves the motor forwards for one fifth of a second at full speed.

import time
from adafruit_motorkit import motorkit

kit = MotorKit()

kit.motor2.throttle = 1.0
time.sleep(0.2)

kit.motor1.throttle = 0
motor3

:py:class:~adafruit_motor.motor.DCMotor controls for motor 3.

The following image shows the location of the M2 terminal on the DC/Stepper FeatherWing. The label on the FeatherWing is found on the bottom of the board. The terminal is labeled on the top of the Shield and Pi Hat.

Motor 3 location

This example moves the motor forwards for one fifth of a second at full speed.

import time
from adafruit_motorkit import motorkit

kit = MotorKit()

kit.motor3.throttle = 1.0
time.sleep(0.2)

kit.motor1.throttle = 0
motor4

:py:class:~adafruit_motor.motor.DCMotor controls for motor 4.

Motor 4 location

This example moves the motor forwards for one fifth of a second at full speed.

import time
from adafruit_motorkit import motorkit

kit = MotorKit()

kit.motor4.throttle = 1.0
time.sleep(0.2)

kit.motor1.throttle = 0
stepper1

:py:class:~adafruit_motor.stepper.StepperMotor controls for one connected to stepper 1 (also labeled motor 1 and motor 2).

The following image shows the location of the stepper1 terminals on the DC/Stepper FeatherWing. stepper1 is made up of the M1 and M2 terminals. The labels on the FeatherWing are found on the bottom of the board. The terminals are labeled on the top of the Shield and Pi Hat.

Stepper 1 location

This example moves the stepper motor 100 steps forwards.

from adafruit_motorkit import MotorKit

kit = MotorKit()

for i in range(100):
    kit.stepper1.onestep()
stepper2

:py:class:~adafruit_motor.stepper.StepperMotor controls for one connected to stepper 2 (also labeled motor 3 and motor 4).

The following image shows the location of the stepper2 terminals on the DC/Stepper FeatherWing. stepper2 is made up of the M3 and M4 terminals. The labels on the FeatherWing are found on the bottom of the board. The terminals are labeled on the top of the Shield and Pi Hat.

Stepper 2 location

This example moves the stepper motor 100 steps forwards.

from adafruit_motorkit import MotorKit

kit = MotorKit()

for i in range(100):
    kit.stepper2.onestep()