Skip to content
/ l6470 Public

STM L6470 stepping motor driver control library by Python3

License

Notifications You must be signed in to change notification settings

DaiGuard/l6470

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

L6470

Python library for coontrolling STMicroelectronics L6470 using SPI.

Install

Clone l6470 repogitory local from github.

$ git clone https://github.com/DaiGuard/l6470

Install using setuptools.

$ cd l6470
$ sudo python3 setup.py install

Demo Hardware

This demonstration is performed using JetsonNano (Nvidia) and AE-L6470DRV (Akizukidenshi).
and the motor uses P-PMSA-B60D3 (Plexmotion).

The pin assignment is show in the table.

Jetson Nano AE-L6470DRV
Pin 19 (SPI_MOSI) --> CN4-7 (SDI)
Pin 21 (SPI_MISO) <-- CN4-5 (SDO)
Pin 23 (SPI1_SCK) --> CN4-6 (CK)
Pin 24 (SPI1_CS0) --> CN4-8 (#CS)
Pin 25 (GND) <-> CN4-3 (GND)

Usage

Sample code samples/sample_run.py

# coding: utf-8

# import l6470 module
from l6470 import l6470

import time

if __name__ == '__main__':

    device = None

    try:
        # open spi device bus:0, client0
        device = l6470.Device(0, 0)

        # reset L6470 
        device.resetDevice()

        # parameter value setting
        device.setParam(l6470.MAX_SPEED, [0x10, 0x00])
        device.setParam(l6470.STEP_MODE, [0x03])
        device.setParam(l6470.KVAL_HOLD, [0x39])
        device.setParam(l6470.KVAL_RUN,  [0x39])
        device.setParam(l6470.KVAL_ACC,  [0x39])
        device.setParam(l6470.KVAL_DEC,  [0x39])

        # exec "run" command
        device.run(True, [0x00, 0x10, 0x00])

        for i in range(5):

            time.sleep(1)

            # get device status
            status = device.updateStatus()
            print(status)

    except KeyboardInterrupt:
        pass
    finally:
        if device is not None:
            # exec "soft_stop" command
            device.softStop()

Run the sample with the following command

$ cd l6470/samples
$ python3 sample_run.py

Test

$ cd l6470
$ python3 setup.py test

About

STM L6470 stepping motor driver control library by Python3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages