RoadTest: Trinamic TMCM-0960-MotionPy SBC + Stepper Motor
Author: redcharly
Creation date:
Evaluation Type: Development Boards & Tools
Did you receive all parts the manufacturer stated would be included in the package?: True
What other parts do you consider comparable to this product?:
What were the biggest problems encountered?: This is a kit that uses the new approach with MicroPython and therefore there is few material on the net and few examples of applications already made. Trinamic is making many application notes to simplify the work of developers.
Detailed Review:
Hi, my name is Carlo Russo and today I will tell you about the "Trinamic TMCM-0960-MotionPy SBC + Stepper Motor" roadtest. Last year I already carried out a roadtest on a Trinamic kit ( Trinamic TMC2300 EVAL KIT (2-PH Stepper Motor) - Review ) and I still remember the good impression it gave me. The positive experience I had with Trinamic products prompted me to participate in this roadtest.
My roadtest was posted with a delay due to problems in the board configuration. In the following I will describe what I have done with the kit in recent months, the problems I have had and the results I have obtained.
Opening a box that comes from the other side of the world and that contains things you love is always a very strong emotion. I have already praised Trinamic for the quality level of the packaging and above all of the materials used.
The board TMCM-0960 is a magnificent example of quality electronic components, optimal distribution of connections and easy accessibility to the four buttons and 4 LEDs.
The PD42-1-1270-TMCL is a real gem. When you hold it in your hand you can see its build quality and, from an aesthetic point of view, it is also beautiful to see. The control board, that is integrated into it, is well positioned at the base of the motor and the all-metal construction allows for good heat dissipation.
{gallery} Unboxing |
---|
The kit consists of two components:
The TMCM-0960-MotionPy board ( TMCM-0960-MotionPy_HW_Manual_V10 (6).pdf ) is an open-source running MicroPython board that can use several communication protocols such as CAN, RS485, UART.
The power supply voltage is included in a very large range, from 6V to 50V and this makes the board easy to use in any application context even if it is a board that was created for industrial automation and robotics.
When reading the manual, you must immediately pay attention to some aspects that require special precautions:
It is possible to power both components, both the board and the motor, with the same power source.
The board is rich of connectors that are easy to be recognized and used because the names of the individual pins are printed on the board.
The TMCM-0960-MotionPy power supply is provided by a USB-C female connector; this board offers three separated input/output headers, directly connected to the MCU (STM32F405RGT6), four buttons, one reset and the other software-defined, and four LEDs (white, blue, red, and green), which can also be managed via software.
The manual on the first page says that to use this board you need to have the latest version of the TMCL-IDE but this is one of the things that drove me crazy for several days and that I solved only after several contacts with Trinamic assistance. At the moment (June 2021) the TMCM-0960-MotionPy board does not interface directly with Trinamic's TMCL-IDE. This is, in my opinion, a pity as the environment created by Trinamic is really simple to use and graphically very pleasant.
The board we are testing was created instead to use a different technology, not linked to any particular IDE but which makes use of the increasingly widespread MicroPython in order to be used by everyone. The MicroPython, in fact, is used in many hardware platforms (esp32, esp8266, pic16but, arm, stm32, windows, etc.) and this makes it a universal way to manage and control your IoT devices.
PD42-1-1270-TMCL is an easy-to-use smart stepper motor. The module is controlled by a CAN bus interface and is produced using two firmware options, the TMCL and the CANopen. This board features different technologies, like stealthChop for a silent PWM mode, the spreadCycle for a smart mixed decay, stallGuard2 for load detection and coolStep for automatic current scaling.
As the manual (PD-1270_hardware_manual_hw1.00_rev1.11_01 (1).pdf) says: "The PANdrive™ PD42-1270 is a full mechatronic solution with state of the art feature set. It is highly integrated and offers convenient handling via CAN interface. The PD42-1270 includes a stepper motor, driver electronics, and a fully-featured hardware motion controller. It can be used in many decentralized applications and has been designed for 0.20...0.47 Nm maximum holding torque and 24V DC nominal supply voltage. With stealthChop™, the PD42-1270 offers absolutely silent and smooth motor operation for lower and medium velocities. With spreadCycle™, the PD42-1270 offers a high-performance current-controlled chopper mode for the highest velocities with perfect zero crossing performance. With stallGuard2™, a sensorless load detection feature is provided for an automatic end step detection and load monitoring. stallGuard2 is also used for the automatic current scaling feature coolStep™. The PD42-1270 comes with a CAN bus interface and four (4) digital IOs".
General features are:
There are also Trinamic's unique features:
Dimension: 42 x 42 x 45.5
Weight: 260g
The PD42-1270 offers two connectors - one 10-pin connector for power supply, communication (CAN) and four Inputs, and one four-pin connector for connecting the motor.
Trinamic, in the motor manual, recommends a few things:
The PD42-1270 includes two LEDs: one green status LED and one red error LED.
The PD42-1270 driver/controller’s wiring is straightforward as shown in the following figure.
As for the software part, the TMCM-0960-MotionPy board requires the installation of Micropython and PyTrinamic, a python library that allows communication with TRINAMIC modules and evaluation boards. It allows you to automate all operations that were previously only available using the TMCL-IDE manually.
Configuring the software is a rather complex operation and is described in the guide (https://www.trinamic.com/fileadmin/assets/Products/Modules_Documents/AN061-TMCM-0960-MotionPy.pdf published on 2021 May 07).
This is a brief guide on how to get started using the MotionPy with a TMCL-Module. First, check out the required hardware:
First, you have to build the PYBv11 STM32 firmware. The description of the operation is done in the MicroPython repository.
Before building the firmware for a given board the MicroPython cross-compiler must be built; it will be used to pre-compile some of the built-in scripts to bytecode. The cross-compiler is built and run on the host machine, using:
$ make -C mpy-cross
This command should be executed from the root directory of this repository. All other commands below should be executed from the ports/stm32/ directory.
In the kit I'm analyzing, this has already been done, so the kit is ready to use after simply installing the SD card.
After reading the roadtest forum and understanding that the board was already configured with MicroPython by TRINAMIC, it became easier to play with the board.
First you need to install the software that can be found on GitHub ( https://github.com/trinamic/PyTrinamicMicro ) on the SD card. The operation is very simple and generally should not give any problems but, in my case, I had many problems that made it impossible to use the kit for many days.
In the Getting Started you can read:
install.py
. For full installation, run the command python install.py D:\
, assuming python
is properly linked to your python binary and D:\
is the installation directory for the target platform. As installing incrementally is not supported atm, invoke python install.py D:\ -c
if you have already an installation in that target directory.main.py
and boot.py
scripts for the desired platform manually out of PyTrinamicMicro/platforms/x
to the platforms root.low
signal on the NRST
pin, or power cycle.COMX
for Windows (determine X in the Device Manager), or /dev/ttyACMX
(determine X in the mounted devices in /dev
) for Linux.exec(MP.script("blinky"))
.
In practice, the install.py file was executed but was unable to create the complete structure on the SD. Even some folders on the SD card had to be created manually and there were also problems with some libraries, for example the "logging" library.
First I connected the motor to a power supply of 18V and I powered the board with a USB C cable.
I then used Putty, in portable version, to connect to the board. To find out the COM port to which the board is connected, just, on Windows 10, open "device manager" and look for which serial port is active in our PC. In my case the active port is COM3 so I connected using Putty to the COM3 serial port.
I repeated the installation procedure many times but always getting errors and I asked the Trinamic technicians for help who were very kind and very helpful in helping me to solve some of the problems encountered. Unfortunately my kit still didn't work.
When I read the roadtest created by navadeepganeshu. and I saw that he had not had any problems I asked for his help to be sure that the problems I encountered were not due to hardware problems and he helped me!.
So the board worked! At this point, I believe that the errors I encountered depend only on some Python problems in my PC and I intend to solve the problem as soon as possible.
Now I can finally start seeing my kit at work.
Warning: you may have errors in executing simple scripts taken from the "Getting started" file as in some examples there is a path containing the "motionpy" folder instead of "motionpy1" or "motionpy2", for example you have to correct: "exec(open("PyTrinamicMicro/platforms/motionpy/examples/io/blinky.py").read())" in: "exec(open("PyTrinamicMicro/platforms/motionpy1/examples/io/blinky.py").read())".
The first step was to see the board do something, after weeks of unsuccessful attempts. For this reason I loaded the blinky.py script. Running the script was really very simple. The only drawback is that, in the board manual, the path is wrong (it is MotionPy1 instead of MotionPy), as I said before.
"PyTrinamicMicro/platforms/motionpy1/examples/io/blinky.py"
After making a small change to main.py, the script will be loaded when the board boots.
''' MicroPython main file. Place as main.py at the root of the Flash memory. Created on 12.10.2020 @author: LK ''' # Imports from PyTrinamicMicro.platforms.motionpy1.MotionPy import MotionPy as MP # Initialize main configuration MP.init() #blinky code exec(MP.script("blinky"))
Finally I saw my board do something!
In the video you can see the script running.
The next step is to study other aspects of the board.
A nice application is to configure the board to act as a bridge and control the motor using Trinamic's TMCL-IDE software. I have already used this software in an old roadtest so I decided to see other aspects of the board. navadeepganeshu described this configuration in its roadtest and I invite you to admire the power and ease of use of this software in his roadtest.
The TMC1270 board can be managed using the "pyb" class.
Let's see some of the most interesting methods:
The first example I want to show is a simple code. It is one of the many codes released by Trinamic on GitHub.
In particular I will use the code "E:\PyTrinamicMicro\platforms\motionpy1\examples\modules\TMCM1270\TMCM1270_rotate.py"
it is a very simple program that can be a great starting point for working with this kit.
''' Rotate the motor with TMCM1270 using CAN interface. Created on 05.10.2020 @author: LK ''' from PyTrinamic.modules.TMCM1270.TMCM_1270 import TMCM_1270 from PyTrinamicMicro.platforms.motionpy1.connections.can_tmcl_interface import can_tmcl_interface from pyb import Pin import time con = can_tmcl_interface() module = TMCM_1270(con) en = Pin(Pin.cpu.A4, Pin.OUT_PP) en.low() module.rotate(0, 1000) time.sleep(5) module.stop(0) en.high() con.close()
As you can see, the code is extremely simple and, after importing the necessary libraries, it initializes the motor, makes it rotate with speed "1000" and, after 5 seconds, stops it.
The execution of the code is very simple, just run the file seen by modifying the boot file "boot.py".
# boot.py -- run on boot-up # can run arbitrary Python, but best to keep it minimal import machine import pyb pyb.country('US') # ISO 3166-1 Alpha-2 code, eg US, GB, DE, AU pyb.main('PyTrinamicMicro\platforms\motionpy1\examples\modules\TMCM1270\TMCM1270_rotate.py') # main script to run after this one #pyb.main('main.py') # main script to run after this one #pyb.usb_mode('VCP+MSC') # act as a serial and a storage device #pyb.usb_mode('VCP+HID') # act as a serial device and a mouse
Thanks to the same script we can test the board by commanding it with the serial port thanks to Putty.
Just delete the lines beyond 24 and, once the connection has been initialized, just enter the commands from the serial to control the stepper motor.
We have seen that our kit is easily manageable using MicroPython directly through the serial connection of the board.
The last application that I would like to cover in this roadtest is the stepper motor command using a few lines of code in python to create a very simple graphical interface to be able to control the motor easily.
The code is very simple and the graphics are minimal. My goal was just to demonstrate how the electric motor can be controlled using a graphics program.
Obviously it is only a draft and could be enriched with absolute position information or it could implement the "moveTo" and "moveBy" commands.
Other commands that would be nice to try are "analogInput" and "digitalInput".
We can say that thanks to MicroPython, we can control the stepper motor with ease.
I would like to show this work to my students in order to see a stepper motor in action and understand how to control it using MicroPython.
An interesting thing to study thanks to this kit would also be the CAN protocol.
You can find all the contents in this roadtest in the following video.
Thanks to navadeepganeshu. for his help.
Thanks to Trinamic and Element14 community.
Top Comments
Nice road test report.
DAB
Nice review! The custom Python based GUI for motor control is lit.
Right, the packaging was by far the best one I have seen(I now use it to keep my very fragile RedPitaya Oscilloscope )
Thanks, glad that…