Gas station without pumps

2018 January 1

Robot moving, but unreliably

Filed under: Robotics — gasstationwithoutpumps @ 10:05
Tags: ,

I got some time last week to play with my uncompleted robot from the mechatronics course.  I wired up all the motor and encoder connections and wrote a short program that was supposed to move the robot in a square (forward for 12″, 90° right turn, repeat).  I did not expect it to work well—some calibration of the distances was clearly going to be needed, but I expected repeatable motion.

I got sort of repeatable motion on the wooden dining-room floor, though the angle of the turns was not right, but on the rougher tile floor in the breakfast room and kitchen it would occasionally get stuck turning in a circle with one wheel stopped and the other running forward continuously.

Diagnosing the problem was fairly simple—the count for the number of steps from the encoder of the continuously turning wheel was not increasing, so the robot thought that no progress was being made and kept running that motor, while slowing down the motor whose count was still increasing until that motor stopped (near the target number of counts).  The reason that the count was not increasing was that the connector from the encoder to the PC board was shaking loose—pressing the connection sideways would often restore the counting and return the robot to its advance-and-turn behavior.

Fixing the problem is more difficult.  I had crimped female headers onto the wires from the motor and encoders to the PC board, and even put a little solder in the crimped joint, because the 28-gauge stranded wires did not work well with the crimped headers.  The connection failure now seems to be between the male header pins and the female crimp-on connector, which is hard to do much about.

The short wires from the motor and encoders are on a 6-pin 2-mm-pitch female connector (similar to the JST PH connector, though probably not a brand-name connector—that connector seems to be made by all the major connector manufacturers and knockoffs made in China are common). I can get cheap cable assemblies for such connectors, with either bare wire ends (as came with the motor) or with the female connector on both ends of the cable.  Because the pitch is 2mm, rather than 2.54mm, such connectors are not usable with breadboards or perfboards.

I’m now facing two choices:

  • Solder the motor/encoder cables to my perfboard, rather than using the failing header-pin connections.
  • Make a custom PC board for the motor controller with the 6-pin 2mm-pitch connectors for pluggable connections.

The soldering would be a quick fix, at least until the thin wires broke, but is a bit of a pain, as my power board was crammed rather tight. The PC board is a better long-term option, but I need to look ahead to all the different things I might want the robot to do, as it will be difficult to rewire or reassign pins with a PC board.  If I do a PC board, I again have two options:

  • Do a motor-controller-only PC board, with 4-pin or 6-pin headers to the existing processor board.
  • Put the processor, motor-controller, and interface electronics all on one mother board, with cable connections to the sensors.

The combined board would reduce the cabling and number of connectors that might fail, as well as taking up less total space (on-board connections are much more compact than connectors and cables), but I’d need to figure out what I want to do with all the pins of the Teensy 3.2, as adding connections later would be tough, unless I allowed for expansion now.

If I’m going to do a custom PC board, I should do it this week, before classes start, as I’ll be spending all my time on the applied electronics course (lecturing, running labs, and grading) once the quarter starts.

The vibration on the rough surface of the tile floor also revealed another problem for the robot—the M3 bolts (machine screws) that held the bumper on vibrated loose, resulting in the bumper drooping and getting caught on my sleeve when I picked the robot up.  The bumper then cracked at the narrowest part.  I need to get some M3 lock nuts, I think, and redesign the bumper to be a little more robust.  Unfortunately, I no longer have access to the labs that have SolidWorks installed (turned off when all the student access to the labs was turned off), though I still have access to the laser cutter—I may have to request access again.

Incidentally, AliExpress recently sent me a suggestion for a slightly better way to connect the bumper switches: These switches are mounted on a PC board with a sturdy connector and an LED that lights up when the switch is pressed.  Unfortunately, the 3-wire connection they use does not follow the standard used for servo wiring, as they put the positive connection on the outside and the GND in the middle, swapping these two wires.


  1. Broken wires and bad connectors always have been the biggest mechanical problem in my designs. And headers and connectors are usually the most expensive parts too. So I avoid to have connectors and cables as much as possible, or if the robot has to be reliable I use rather expensive ones. Using lock nuts is the best thing, but what I have used in some cases is to glue the locks with wood/paper glue: this keeps the nut in place and can be easily removed.

    Comment by Erich Styger — 2018 January 1 @ 22:27 | Reply

    • I was considering also low-temperature hot-melt glue to keep the nuts from shaking loose—it is also fairly easily removed from steel.

      Comment by gasstationwithoutpumps — 2018 January 1 @ 22:57 | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: