Archives: 2023

C++ client bindings for moteus

For a long time, moteus has had a python library, that lets most people quickly develop motion control applications. However, python is not a suitable solution in every domain. Embedded systems often either don’t have access to python, or cannot tolerate the resource or timing penalties it imposes. In some cases, managing interoperability between python asyncio and systems using legacy python IO like ROS can be challenging. For others, python is just not familiar. The new C++ client library included in the moteus repository is designed to handle all of these scenarios with a flexible, yet ergonomic approach that makes simple things simple, and complex things possible.

New "hold position" watchdog timeout mode for moteus

For a while now moteus has had the ability to configure what action takes place upon a CAN message watchdog timeout during position control mode. If configured with ['servo.default_timeout_s'](https://github.com/mjbots/moteus/blob/main/docs/reference.md#servodefault_timeout_s) moteus requires that CAN messages be sent at a regular rate. If ever a message is delayed by more than the timeout period, the mode switches in a latching manner to the “timeout” mode, where a special action is undertaken. This is configured with servo.timeout_mode in tview, and as of firmware release 2023-07-25 the available values are as follows:

moteus getting started video 2023 edition!

The perils of technical videos is that they can become out of date pretty quickly. For the moteus getting started guide, it has amazingly held up pretty well, but enough has changed since 2021 that it is time for a new one. Now we can use acceleration and velocity limited commands instead of the deprecated stop position and get nicer 4k b-roll for all the intermissions. Everything in the old video, and in this new one, is applicable to both the moteus-r4.11 and the moteus-n1.

STM32G4 ADC performance part 2

Back last year, I walked through bisecting and debugging an annoying problem that caused the STM32G4 ADC on the moteus controller to exhibit higher than expected noise in result largely to either the exact placement in flash of the initialization code, or to the exact timing of the initialization. While the immediate glaring sharp edge was removed, the resulting performance still was confusing to me, and looked like it was not yet optimal. Further, a moderate percentage (2% or so), of production boards failed end-of-line tests related to the current sense noise in ways that were hard to fix by swapping components. Because of this, I wanted to dive in and investigate further. This is that process.

5 Side PCB Test Fixture

If you look around online, there are lots of examples of PCB test fixtures used to perform end of line testing. In the low to medium volume scale, nearly all of these are either clamshell or 2 side affairs, where probe pogo pins or interfaces are connected to the bottom and top of the board.

When developing the moteus-n1, one of the challenges was the number of right angle board edge connectors it has. Those right angle connectors are what allow it to maintain a very low overall stack height when installed in applications, but are also much harder to perform testing on, since by definition the access points are not vertical. On the base n1, there are 6 total right angle connectors, 2 on each of 3 sides, and future variants may have additional bottom side CAN and power connectors populated to make 8 total right angle connectors.

moteus firmware releases

I don’t normally post about moteus firmware releases, but there have been many in the last few months that fix some long standing bugs and regressions. First, the current release as of this post is:

With that out of the way, here some of the fixes:

Position drift with non-unity gear reduction

It is embarrassing how long this issue has been outstanding, but ever since the flexible I/O system was introduced, there has been an issue where if the gear reduction was configured to a value other than 1, then the output position would drift from the source encoder over time. If control was not active, you would see the position drift, and if control was active, then moteus would report the correct position, but the actual position would drift.

power_dist r4.5b

Here is yet another new product announcement! In the same line as the new pi3hat, here is a new minor revision of the power_dist, the r4.5b:

The changes are largely the same as for the new pi3hat:

  • The input voltage range is extended from 10-44V, to 10-54V.

  • The CAN-FD port has +-58V bus fault protection, up from +-12V.

  • Additionally, the measurement noise of the output current has been improved from 300mA to approximately 30mA.

moteus-n1 beta release

Implied by my previous writeup on pin selection for external connectors, we’ve got a new variant of the moteus controller to announce today in beta form, the moteus-n1!

This variant is intended to be more feature-full, higher performance (and higher cost). Here are some bullet points of the biggest differentiators with r4.11:

moteus n1 moteus r4.11
Price $159 USD @ qty 1 $104 USD @ qty 1
Size As small as 46mmx46mmx8mm with optional back connectors omitted. 58% of the volume, 87% of the top down footprint size of r4.11 53x46x12mm
External Peripherals Each of the auxiliary connectors supports SPI, UART, ADC, SW & HW Quadrature, Hall sensors, and I2C. 5V and 3.3V is provided on each connector to power peripherals (100mA for each voltage available combined between both connectors). I2C pullups are configurable on each connector. All 4 pins on AUX2 are 5VT, the two non-SPI pins on AUX1 are 5VT. ENC (AUX1) supports SPI, Hall and ADC. ABS (AUX2) supports UART and I2C and are both 5VT.
RS422 Built in RS422 transceiver for communicating with RS422 / BiSS-C encoders (BiSS-C / SSI not yet supported in software). None
Voltage 8-54V, 48V nominal 8-44V
Peak Output 100A output phase current, 1200W 100A output phase current, 500W
Continuous Output 9A output phase current ambient, 18A w/ thermal management 11A output phase current ambient, 22A w/ thermal management
CAN fault tolerance 58V bus fault tolerance 12V bus fault tolerance
Power Connectors Solder pads for DC bus input, one always present XT30, one optional XT30 2x XT30

The short form is that the n1 does not really expand the set of motors that can be usefully driven, but does enable operation in 48V systems, is more compact and electrically robust and provides significantly improved external peripheral support.

moteus external connector pin selection

moteus r4.11 has two external connectors, the ABS connector (AUX2) and the ENC/AUX1 connector. The ABS connector was designed initially just to have 2 I2C pins. The ENC connector just has the random pins that were used for the onboard encoder SPI plus one more. Thus the range of external accessories that can be connected is somewhat haphazard and not necessarily all that useful.

When working on a more ground up revision of the controller, I wanted to improve that situation to expose more connectivity options on still a relatively limited connector set. The idea was to use 2 connectors, one which has 5 I/O pins and the other with 4 I/O pins. The onboard encoder SPI would still be accessible on the larger connector to use for at least one external SPI encoder, but how much other functionality could be crammed into the remaining pins? To start, lets see what possible options there are in the current firmware and supported by the STM32G4 microcontroller that moteus uses: