STM32 Robot Controller PCB – Connector Choice for Motor and Encoder Wiring?

Hi everyone,

I’m working on a custom STM32-based robot controller board that will interface with a pair of DC gear motors, quadrature encoders, and several distance sensors.

The prototype is currently running on a development board and works well, but I’m now designing the first PCB revision and trying to decide how to handle the external wiring.

The robot will experience constant movement and occasional vibration, so I’m concerned about connector reliability over time. At the moment I’m considering locking connectors for the motor and encoder cables, but I’m not sure if that’s overkill for a small mobile robot.

A few questions for those who have built custom motor-control PCBs:

  • What connector types have proven most reliable for motor and encoder wiring?
  • Do you route motor power and encoder signals through separate connectors or combine them into a single cable assembly?
  • Have you encountered noise issues from motor wiring coupling into encoder signals?
  • Are there any PCB layout practices you would recommend when placing motor driver circuits near an STM32 MCU?

I’d appreciate hearing about any lessons learned before I send the board out for fabrication.

Thanks!

Hello.

It is difficult to offer specific recommendations without having much to context for your robot beyond “small mobile robot,” but in case it helps, here are some of the connectors we use on the motors we offer with integrated encoders:

And here is a link to our broader connectors category.

Of the connectors I mentioned, the JST PH-style ones are probably the strongest, but none of them have locking mechanisms. Also, for all of our motors with encoders we include the motor power wires in the same cable and to the best of our knowledge, EMI from the motor power has never caused issues for the digital encoder signals from our Hall effect encoders. That might be different in applications with very high power motors, more sensitive encoder signals, or long transmission distances, but I would not expect any of those issues with a small mobile robot using motors like ours.

Beyond just generally trying to keep logic signal paths separated from high current power paths, I do not have any particular PCB layout recommendations.

- Patrick

For a mobile robot, I don’t think locking connectors are overkill at all. Vibration, repeated movement, and occasional impacts can quickly expose weaknesses in friction-fit connections.

For motor wiring, I’ve had good results with locking Molex-style connectors and similar connector systems that provide positive retention. For encoder signals, I generally try to keep them physically separated from motor power wiring whenever practical, especially if the motors are PWM-driven.

Noise coupling into encoder lines can definitely become an issue. Twisted-pair wiring, proper grounding, and keeping encoder traces away from high-current motor paths on the PCB can help significantly. Some designers also add filtering or differential signaling for longer cable runs.

From a PCB perspective, I’d keep the motor driver section isolated from the STM32 and sensitive signal circuitry as much as possible, with a solid ground plane and careful return-current paths. Having separate GND and power planes is the best practice, saves a lot of headache.

If you’re sending the design out for fabrication, it may also be worth reviewing the layout for EMI and power integrity before ordering the first revision.

It sounds like a fun project. What motor current levels are you expecting, and are the encoders single-ended or differential?