
Smol servo tmc6200
dognotdog/smol_servo
circuitry and software for controlling NEMA17 size brushless motors and stepper motors as servos.

circuitry and software for controlling NEMA17 size brushless motors and stepper motors as servos.
Smol servo rpi2350-tmc6200 is an open-source printed circuit board by dognotdog, from the dognotdog/smol_servo repository on GitHub. It is a 4-layer board of 48 × 44.5 mm with 151 parts on 171 nets, routed with 1,538 tracks and 421 vias.
It is built around the RP2354B, AS5047D and FUSB302BMPX, with the TMC6200-TA, TPS71550DCK and CC0402KRX5R8BB104 among its other parts. Its parts include 57 resistors, 48 capacitors, 10 diodes, 9 transistors and 8 ICs. It belongs with the robots and motor control boards and the RP2350 boards of this library.
Contains files specific to 48pin STM32G431 on the stm32-nema17-servo board.
Firmware for Mechaduino's SAMD21G18A Cortex M0+.
Hardware design files for Schematic and PCB.
There is a basic harness in place to use Unity for unit testing. Create foo_test.c modules for testing, and foo_test.mk makefiles for additional setup.
Rated continous current 8A, max. Bus Voltage 50V, min. load 1R
With a 1R load on a 50V bus, up to 50A could flow at once, but hopefully motor inductance smoothes that out. Assuming 50kHz, 2mH winding inductance: V = L * di/dt -> di/dt = V/L = 25kA/s @ 50kHz = 0.5 A/cycle
The required charge pump current is I_VCP = 3 * Q_G * f_PWM.
DRV8323 charge pump VBUS limits: 6V -> 10mA 8V -> 15mA 10V -> 20mA 13V -> 25mA
Q_G = 35.5 nC
I_VCP = 3.55 mA @ 100kHz I_VCP = 1.78 mA @ 50kHz
Charge pump current capacity is well over required charge pump current.
Q_G < 88 nC
I_VCP = 8.8 mA @ 100kHz I_VCP = 4.4 mA @ 50kHz
Q_G ~ 15 nC Q_gd ~ 3.4 nC
3.3V, 5pF gate capacitance, 8mA sink/source per pin -> 412.5 Ohm minimum resistance
f_RC = 1 / 2pi R C
for R=470 that is 67.7MHz for R=1k that is 31.8MHz for R=2.2k that is 14.4MHz
max SPI frequency is 10MHz. 1k for both lines seems sufficiently fast and will not exceed max current on pin. Only one will be actively pulled high, the other will be in high impedance mode, but 1k is safe even if both are actively driven against the NSS pin.
The principal equation for an RL circuit, as is assumed for a motor winding, describing the relationship between voltage and current is:
V = L * di/dt + R i
or in differential form
V - R i
di/dt = -------
LIn discrete time, with n=0,1,2... indices going backward in time, the equation becomes
V_0 = L * (i_0 - i_1) / T + R i_0
solving for L
V_0 - R i_0
L = T -----------
i_0 - i_1solving for R
V_0 - L * (i_0 - i_1) / T
R = -------------------------
i_0assuming a measurement at n=0 for R and n=1 for L, and substituting
V_0 - L * (i_0 - i_1) / T
V_1 - i_1 -------------------------
i_0
L = T -----------------------------------
i_1 - i_2
V_1 i_0 - i_1 V_0 i_1 (i_0 - i_1)
L = T ----------------- + L ---------------
i_0 (i_1 - i_2) i_0 (i_1 - i_2)
V_1 i_0 - i_1 V_0
L = T ----------------------------------
i_0 (i_1 - i_2) - i_1 (i_0 - i_1)
V_1 i_0 - i_1 V_0 i_0 - i_1
L = T ----------------- = T V ---------------
i_1^2 - i_0 i_2 i_1^2 - i_0 i_2
V_1 - R i_1
V_0 - ----------- (i_0 - i_1)
i_1 - i_2
R = -----------------------------A Bipolar hybrid stepper motor typically has 200 steps/rev on 2 phases.
An electrical revolution is four full steps: A+ -> B+ -> A- -> B-
NEMA 17 typically up to 3A current (eg. Nanotec ST4118D3004)""
winding current: 3A winding inductance: 2.7mH winding resistance: 1.1R Holding Torque: 0.8Nm Rotor Inertia: 1.02e-5 Kg m^2 Torque Constant (mech): 0.267 Nm / A [or V / rad s]
At 48V, the motor should be able to spin (theoretically, discounting nonlinear effects) at 179.7 rad/s, about 1716 rpm or 28.6 rev/s.
at 30 rev/s with 200 steps/rev, we have to make 6000 full steps per second.
A BLDC has 3 phases, which are most simplistically driven with trapezoidal voltage curves instead of sinusoidal ones.
_ _
A / \ /
- -
_
B \ / \ /
- -
_ _
C \ / \
- -A ~ sin(alpha) B ~ sin(alpha + 2pi/3) C ~ sin(alpha + 4pi/3)
In a typical configuration, the three windings A,B,C are connected in a star pattern, with the endpoints named U,V,W.
V U
B \ / A
*
| C
WA =
U-V = A V-W = B-C = sin(a + 2pi/3) - sin(a + 4pi/3) = sin(a) cos(2pi/3) + cos(a) sin(2pi/3) - sin(a) cos (4pi/3) - cos(a) sin(4pi/3) = sin(a) - sqrt(3) cos(a) W-U = C-A
Crystal-less USB Setup in MX
HSI481CRS SYNC to USB_FS in RCC Mode & ConfigSof Enable in USB device settingsFull-Speed USB (12Mbps) has a max. packet size of 64 bytes for regular packets, only isochronous might be up to 1023.
APP_RX_DATA_SIZE and APP_TX_DATA_SIZE to at least 64CDC_SET_LINE_CODING that can be output on CDC_GET_LINE_CODINGADC1: internal sensors, voltage reference ADC2: CH3, CH13, CH17 inputs for current sense resistors, from V0.2 CH14 for VBUS sense
I2C3: I2C for communicating with the outside world SPI2: connected to MOSFET driver and encoder ICs USART1: external UART
TIM2: CH1 brake resistor, CH2,CH3,CH4 A,B,C PWM outputs for half bridges TIM3: external quadrature encoder input TIM4: CH1,CH2,CH3 LED RGB PWM output (CH4 connects to SYNC) TIM6: Timer for performance counter with PSC=169 to get a 1us count resolution @ 170MHz clock
TIM1,TIM7,TIM8,TIM15,TIM16,TIM17: unused
Firmware update for probe:
dfu-util -d 1d50:6018,:6017 -s 0x08002000:leave -D <blackmagic-native.bin>
~/Applications/ARM-Toolchain/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb
target extended-remote /dev/cu.usbmodem79A760B81
monitor swdp_scan
attach 1Correction: Hardware NSS does NOT work because it requires opposite clock signal polarity :/
Enable hardware NSS control as master with pulsing between data words
This enables use of DMA transfers for reading data from sensors.
Adds two additional 10uF capacitor to VBUS, for a total of 60uF capacitance. For a 50V bus, and a 1R load, which is 50A max current, and 50kHz PWM, that means a single full PWM cycle can drain 50*20e-6 = 1000 uC. At 50v, the cap charge is 3000uC, so the bus voltage could still drop by nearly 20V without an external buffer cap.
Same load with 10V, it's a 10A max and thus only a 100uC discharge, which is a 2V drop, or again 20% of bus voltage.
VBUS caps have been relocated so that each FET pair gets one next to it, plus one at the VBUS input.
Sensing VBUS was added for controlling the brake resistor when the voltage rises too much.
Sensing VDD is for ...?
Power connectors have been moved to portrude from the 42x42mm footprint, so that the board can be mounted on the back surface or very close to the back surface of a motor without the through-hole power connectors being in danger of touching the motor casing.
G441, G491, GG4A1, G473, G483, G474, G484
The nRF5340 is the successor of the nRF52 series, and is a dual-core design at 128MHz and 64MHz, respectively
The ADC can be configured for acquisition times between 3 and 40 us, with a minimum of 10us for VDD monitoring. The conversion time is 2us, giving us a max. sample rate of 200kHz
The timers only run at 16MHz, which at 100kHz would only give a resolution of 160 counts for a PWM signal. This is compared to the full 168MHz resolution of the STM32G4, giving 1680 counts, roughly 10x the resolution, for an effective 10 bits vs 7 bits.
An ARM Cortex M33 core @ 150MHz, in a 0.5mm pitch BGA package.
2 MSPS 16bit ADC, 160 MHz ARM Cortex M33, 5x5mm, 0.5mm pitch BGA
120MHz ARM Cortex M4, no FPU though. 100pin BGA 7x7, 0.65mm pitch.
This part has both the 3ph driver and current sense.
Higher voltage, similar part
The DRV8300 needs extra current sense amplifiers and a high-side bootstrap, pluss VDD supply. Looks like INA190 or INA210 can do bidirectional sensing
interesting integrated half bridge for up to 20A
| Qty | Value | Footprint | References |
|---|---|---|---|
| 17 | 100n | Capacitor_SMD:C_0402_1005Metric | C1, C8, C13, C19, C21, C37, C39, C40, C41, C42, C43, C44, C45, C46, C47, C48 +1 |
| 10 | 0R | Resistor_SMD:R_0402_1005Metric | R37, R38, R39, R40, R42, R43, R44, R46, R47, R48 |
| 8 | 1K | Resistor_SMD:R_0402_1005Metric | R20, R21, R22, R23, R24, R50, R52, R53 |
| 7 | 10u 60V | Capacitor_SMD:C_1210_3225Metric | C7, C23, C24, C25, C31, C32, C33 |
| 7 | NVTFS5C658NL | stm32-nema17:WDFN8 | Q1, Q2, Q3, Q4, Q5, Q6, Q7 |
| 5 | 3.3V 1mA | Diode_SMD:D_0402_1005Metric | D3, D4, D5, D7, D8 |
| 5 | 5K1 | Resistor_SMD:R_0402_1005Metric | R15, R17, R19, R29, R32 |
| 4 | 120K | Resistor_SMD:R_0402_1005Metric | R14, R16, R18, R28 |
| 4 | 4.7u | Capacitor_SMD:C_0402_1005Metric | C34, C35, C36, C38 |
| 4 | 4K7 | Resistor_SMD:R_0402_1005Metric | R25, R26, R54, R55 |
| 3 | 10R | Resistor_SMD:R_0402_1005Metric | R41, R45, R49 |
| 3 | 1u 16V | Capacitor_SMD:C_0402_1005Metric | C28, C29, C30 |
| 3 | 5m | Resistor_SMD:R_1206_3216Metric | R9, R10, R11 |
| 3 | 680R | Resistor_SMD:R_0402_1005Metric | R1, R2, R3 |
| 3 | M3 | MountingHole:MountingHole_3.2mm_M3 | H2, H3, H4 |
| 3 | SolderJumper_2_Bridged | Jumper:SolderJumper-2_P1.3mm_Bridged_RoundedPad1.0x1.5mm | JP1, JP2, JP3 |
| 2 | 15p | Capacitor_SMD:C_0402_1005Metric | C49, C50 |
| 2 | 1M | Resistor_SMD:R_0402_1005Metric | R12, R30 |
| 2 | 2.2uF 75V | Capacitor_SMD:C_0805_2012Metric | C10, C11 |
| 2 | 220K | Resistor_SMD:R_0402_1005Metric | R33, R34 |
| 2 | 220p | Capacitor_SMD:C_0402_1005Metric | C2, C3 |
| 2 | 22pF | Capacitor_SMD:C_0402_1005Metric | C14, C15 |
| 2 | 22uF 10V | Capacitor_SMD:C_0603_1608Metric | C16, C17 |
| 2 | 27R | Resistor_SMD:R_0402_1005Metric | R5, R51 |
| 2 | 33uH 800mA | Inductor_SMD:L_Taiyo-Yuden_NR-40xx | L2, L4 |
| 2 | 47K | Resistor_SMD:R_0402_1005Metric | R36, R57 |
| 2 | 60V 500mA | Diode_SMD:D_SOD-882 | D9, D10 |
| 2 | EVP-BB2A9B000 | stm32-nema17:SW_SPST_EVPBB | SW1, SW2 |
| 2 | LT3990 | stm32-nema17:DFN-10-1EP_3x3mm_P0.5mm_EP1.65x2.38mm_ThermalVias | U2, U5 |
| 2 | Screw_Terminal_01x02 | TerminalBlock_Phoenix:TerminalBlock_Phoenix_PT-1,5-2-3.5-H_1x02_P3.50mm_Horizontal | J4, J5 |
| 1 | 100K | Resistor_SMD:R_0402_1005Metric | R27 |
| 1 | 100n 100V | Capacitor_SMD:C_0402_1005Metric | C26 |
| 1 | 100n 16V | Capacitor_SMD:C_0402_1005Metric | C18 |
| 1 | 10K | Resistor_SMD:R_0402_1005Metric | R56 |
| 1 | 10V 0.3mA | Diode_SMD:D_0402_1005Metric | D11 |
| 1 | 113K | Resistor_SMD:R_0402_1005Metric | R35 |
| 1 | 127K | Resistor_SMD:R_0402_1005Metric | R8 |
| 1 | 1u | Capacitor_SMD:C_0402_1005Metric | C4 |
| 1 | 2.2R | Resistor_SMD:R_0402_1005Metric | R6 |
| 1 | 2.2u 6.3V | Capacitor_SMD:C_0402_1005Metric | C20 |
| 1 | 20V | Diode_SMD:D_0603_1608Metric | D2 |
| 1 | 220n | Capacitor_SMD:C_0402_1005Metric | C12 |
| 1 | 220n 100V | Capacitor_SMD:C_0603_1608Metric | C27 |
| 1 | 22K | Resistor_SMD:R_0402_1005Metric | R31 |
| 1 | 22n 100V | Capacitor_SMD:C_0603_1608Metric | C22 |
| 1 | 3.3uH | RP2350_minimal:L_pol_2016 | L5 |
| 1 | 33R | Resistor_SMD:R_0402_1005Metric | R4 |
| 1 | 374K | Resistor_SMD:R_0402_1005Metric | R7 |
| 1 | 576K | Resistor_SMD:R_0402_1005Metric | R13 |
| 1 | ABM8-272-T3 | Oscillator:Oscillator_SMD_Abracon_ASE-4Pin_3.2x2.5mm | Y1 |
| 1 | APA102-2020 | LED_SMD:LED-APA102-2020 | D6 |
| 1 | AS5047D | stm32-nema17:TSSOP-14_4.4x5mm_P0.65mm-inlaid | U4 |
| 1 | BCM856BS | Package_TO_SOT_SMD:SOT-363_SC-70-6 | Q9 |
| 1 | C31-S-RA-CS1A-BK-SS | stm32-nema17:USB_C_Receptacle_Adam_C31-S-RA-CS1X-BK | J2 |
| 1 | Conn_02x10_Odd_Even | Connector_PinHeader_1.00mm:PinHeader_2x10_P1.00mm_Vertical | J11 |
| 1 | DMP3013SFV | stm32-nema17:WDFN8 | Q8 |
| 1 | FUSB302BMPX | Package_DFN_QFN:WQFN-14-1EP_2.5x2.5mm_P0.5mm_EP1.45x1.45mm | U8 |
| 1 | M3 | MountingHole:MountingHole_3.2mm_M3_DIN965_Pad | H1 |
| 1 | Motor_2_or_3_phase | Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical | M1 |
| 1 | RP2354B | RP2350_minimal:RP2350-QFN-80-1EP_10x10_P0.4mm_EP3.4x3.4mm_ThermalVias | U1 |
| 1 | TC-2050 | Connector:Tag-Connect_TC2050-IDC-NL_2x05_P1.27mm_Vertical | J3 |
| 1 | TMC6200 | stm32-nema17:TQFP-48-1EP_7x7mm_P0.5mm_EP5x5mm_ThermalVias | U6 |
| 1 | TPS71550__SC70 | Package_TO_SOT_SMD:SOT-353_SC-70-5 | U9 |
| 1 | UCC27516 | Package_SON:Texas_PWSON-N6 | U3 |

dognotdog/smol_servo
circuitry and software for controlling NEMA17 size brushless motors and stepper motors as servos.

dognotdog/smol_servo
circuitry and software for controlling NEMA17 size brushless motors and stepper motors as servos.

dognotdog/smol_servo
circuitry and software for controlling NEMA17 size brushless motors and stepper motors as servos.

dognotdog/smol_servo
circuitry and software for controlling NEMA17 size brushless motors and stepper motors as servos.


misko/prompt2device
The separate vNext PCB skill and orchestrator package is available alongside the reference workflow below; existing projects keep their accepted toolchain until an explicit migration.

offgridevices/offgrid-hardware
Open hardware from OffGrid Devices. One folder per board. CERN-OHL-S.


techmiguel/stillpoint
Open-hardware 60 GHz radar ceiling sensor: presence & fall detection without a camera. Matter over Thread, KiCad 4-layer Ø60 mm board.

doug-harriman/E-Display
Electronic display for calendars, weather, etc.

It measures 48 × 44.5 mm and has 4 copper layers, 1.59 mm thick.
151 parts, built around the RP2354B, AS5047D, FUSB302BMPX and TMC6200-TA. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the dognotdog/smol_servo repository on GitHub, at the commit this page was made from: the board is hardware/smol-servo-rpi2350-tmc6200/smol-servo-rpi2350-tmc6200.kicad_pcb and its schematic hardware/smol-servo-nomcu-tmc6200/smol-servo-nomcu-tmc6200.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository states no licence, so its author keeps all rights: ask dognotdog before reusing the design.