There are a couple of different ways to power the project: either with a 3x AAA battery holder, or with a USB battery pack. Which power source you choose determines how things should be connected…

Wiring for 3X AAA Battery Holder

Advantages of using a 3x AAA battery holder are that it's inexpensive and the connection is robust; it’s not likely to fall out. You can also get replacement batteries just about anywhere. And the power wire is more discreet.

Alkaline batteries are recommended for this configuration; rechargeable NiMH cells have a lower voltage and won’t drive the servo with sufficient force. This is also why we’re not using a 3.7V LiPoly battery.

You’ll need to add a JST connector to the Trinket, and a JST extension cable. The battery pack can then be carried in a pocket.

Start by “tinning” one of the JST pads on the back of the Trinket…heat the pad and apply solder so the whole surface is covered.

 

Hold the JST socket in place (tweezers recommended) and re-melt the solder, allowing the part to sink into position.

 

Once this first pin is tacked down, the rest are easy. Remember to heat the parts, then apply solder…do not melt solder on the iron and “wipe” it on the parts…that makes a weak cold solder joint. Properly done, the connections should be shiny and smooth.

 

Congrats, you’ve done surface-mount soldering!

Clip off the connector from the servo, leaving about 3 inches of cable attached, then strip and tin the ends of the wires. Then solder the following connections:

Servo

Trinket

Brown wire

GND

Red wire

BAT +

Orange wire

Pin #0

Wiring for USB Power

I'm not especially fond of USB batteries for wearable projects — USB plugs lack a latching connector and pull out too easily — but the fact remains that a lot of people already have these battery packs around for charging a cell phone, and may want to put it to other uses.

You don’t need the JST socket or extension when using USB power, just a suitable USB cable. The battery can be carried in a pocket.

Clip off the connector from the servo, leaving about 3 inches of cable attached, then strip and tin the ends of the wires. Then solder the following connections:

Servo

Trinket

Brown wire

GND

Red wire

USB +

Orange wire

Pin #0

Just three connections! Simple and adorable.

Why the different connections for USB vs AAA?

Servos sometimes need a lot of current. Best way to ensure this is to wire directly to the power source. The Trinket’s '5V' pin is only rated for 150 milliamps, but the servo may want as much as 350 mA at times. The 'USB+' pin goes directly to USB, and 'BAT+' directly to the battery pack.

In reality, we probably could get away with using the 5V pin…the servo only operates intermittently…but that would set a bad example. You might decide to adapt this project into new things that make more vigorous use of servos…wired wrong, either the servo response would be anemic or one would risk burning out the voltage regulator. So instead, there’s different wiring for different power sources.

Can I use a 3V Trinket instead?

Sure! In the Arduino IDE, select “Trinket 16 MHz” from the Tools→Board menu regardless.

I’m using a different servo with different-colored wires. Will it work?

Most likely, yes. The +V wire is always red. Ground is usually black or sometimes brown. Signal may be orange, yellow, white or blue.

This guide was first published on May 10, 2015. It was last updated on May 10, 2015. This page (Wiring) was last updated on Nov 22, 2019.