The part number is 45603. It's kind of a sentimental journey. I still use SPIKE/Robot Inventor from time to time to engage with younger audience. My favorite robot is Swinging Monkey. It is then high time we reverse engineered the SPIKE medium motor. The motor is equipped with an absolute encoder and a microcontroller. The connector gives direct access to the DC motor terminals. There is no direct access to the encoder chip. The encoder is managed by the microcontroller (STM8S103). My guess is that this is to enable zero position calibration (motor homing) that is then stored in the STM8's EEPROM. The hub negotiates 115200 Bd with the motor. After such a handshake, the STM8 starts sending position readings over UART. This repo copycats the handshake and the heartbeat to let you use the motor in your projects with any microcontroller.
Sniffing the original SPIKE hub:
Mimicking with the Nucleo board:
Note
The motor module sends some data (@2400 Bd) when powered up. The line periodically (around every 3200 ms) goes low for about 500 ms. The handshake should start there. I use bit banging to mimic the sequence sniffed in the original setup. The sequence of twenty 2 ms LOWs plus 18 ms HIGHs could probably be generated by reconfiguring the UART peripheral on the fly. I leave implementing that elegant solution to you 😎 After successful handshake the motor switches to 115200 Bd and starts sending frames that contain speed, single-turn encoder position and accumulated angular distance.
| Pin | Signal/Power |
|---|---|
| 1 | DC motor terminal A1 (PWM, LiPo 2S) |
| 2 | DC motor terminal A2 (PWM, LiPo 2S) |
| 3 | GND |
| 4 | VCC (3V3) |
| 5 | UART (hub/STM32U5 to device) |
| 6 | UART (device to hub/STM32U5) |
- The Powered Up connector (Philippe 'Philo' Hurbain)
Don't worry 🙂 Just log in to MyST and hit Alt-K to generate /Drivers/CMCIS/ and /Drivers/STM32U5xx_HAL_Driver/ based on the .ioc file. After a couple of seconds your project will be ready for building.
- The Powered Up serial link protocol (Philippe 'Philo' Hurbain)
- MyOwnBricks (ysard)
- SpikePrimeHub (GianCann)
- LEGO MINDSTORMS Inventor Hub documentation (LEGO System A/S)
- Pybricks
- delsum (8051Enthusiast)
- What internal electronics do Spike Prime and Mindstorms Robot Inventor use? (Bricks Stack Exchange)
- What electronics are inside the SPIKE Prime angular motors? (Bricks Stack Exchange)
- What's inside the SPIKE Essential small angular motor? (Bricks Stack Exchange)
- AN4908 Getting started with USART automatic baud rate detection for STM32 MCUs (STMicroelectronics)
Copycat the speed control loop and add a proportional (P) position control loop.
Create your own home laboratory/workshop/garage! Get inspired by ControllersTech, DroneBot Workshop, Andreas Spiess, GreatScott!, bitluni's lab, ElectroBOOM, Phil's Lab, atomic14, That Project, Paul McWhorter, Max Imagination, Nikodem Bartnik, Stuff Made Here, Mario's Ideas, Aaed Musa, Haase Industries, and many other professional hobbyists sharing their awesome projects and tutorials! Shout-out/kudos to all of them! Promote README-driven learning 😎
Warning
LEGO Education SPIKE / MINDSTORMS Robot Inventor medium motors - do try them with DIY control hardware and software ❕
220+ challenges to start from: Control Engineering for Hobbyists at the Warsaw University of Technology.
Stay tuned!



