Gaugette

Building gauges and gadgets with Arduinos, Raspberry Pis and Switec stepper motors.

Making Wiring Harnesses

Permalink

A quick note about wiring harnesses for these motors. I’ve found it really handy to make harnesses from 4-wire CD audio cables. My harnesses use push-on connectors at the motor end so I never accidentally cook the motor by soldering to the motor pins.

image

The cables I’m talking about have 4-pin JST connectors on each end, and are used to connect the analog audio signal from a PC’s internal CD player to the motherboard or sound card. I have accumulated a bunch of these over the years, so I’m glad to have a use for them.

I also use 0.1” breakaway headers and heatshrink tubing, both from AdaFruit.

image

  • Chop the audio cable in half (each half makes one wiring harness),
  • Strip and tin the wires on the cut end,
  • Cut off a 4-pin section of breakaway header,
  • Solder the wires to the header with the two black wires in the center positions,
  • Protect the connections with heat-shrink tubing.

image

  • Pull up the plastic tabs on the JST connector and slide the crimped terminator out of the block,
  • Use pliers to close the crimp connectors a little, but don’t crush them entirely. The pins on the Switec motors are really small, so you need to squeeze it down a little to create a tight fit.

image

You’ll notice that these harnesses have two black wires, which would normally be a bit annoying. However it turns out that the wires to pins 2 and 3 on the Switec motors are interchangable so you don’t need to distinguish between them.

Wire your motor up like this:

Motor PinWire ColorArduino Pin
1white4
2black5
3black6
4red7

Be careful not to bend the pins on the motors when you slide the crimp connectors on. Also note that the pins on the motor are flat, not round, so the orientation of the crimp connector matters; if it is too tight or too lose, try rotating the connector 90 degrees.

Finally, if you plug the header into an Arduino so that white is at pin 4, and red is pin 7, you can define your motor in code like this:

SwitecX25 motor1(MOTOR_STEPS, 4,5,6,7);

Comments