Introduction: Female and Male Header Pins for Cheap Robots
I apologize that this time my Instructable isn't going to be as impressive as my previous For Cheap Robots ones. As a college student, I have a varying workload, and for the past two weeks it's been somewhat high. Still, after my motor controller Instructable, I realized that I needed to add some header pins to my motors and figured I may as well make it into an Instructable as well! So here we are!
Connectors are hugely important. They see some of the most wear and tear when you're working on a project because chances are you're going to need to plug and unplug them several times over the course of trying out different configurations. Connectors can also be extremely important when you want to re-use parts, like motors, for another project. They have to be sturdy and generic so you can use them in as many different projects as possible.
This Instructable is all about adding a couple of very simple male and female header pin connectors to some motor leads. These style of connectors show up on everything from the Arduino to bread-boards, so they can be used almost anywhere! I'm also going to show you a couple tricks for making these connectors sturdy enough to withstand being plugged and unplugged all the time.
Let's get started!
Step 1: What Are Male and Female Connectors?
I'll be honest. This question confused me to no end as a child. So while it may be obvious to most of my readership, I'm going to include a quick explanation here for the child who, like myself, doesn't quite get it.
Male connectors are any connector or plug where the metal contact sticks out, and is intended to be inserted into something else.
Female connectors, on the other hand, is any connector or plug where the metal contacts are hidden inside a casing of some point (usually). They're intended to have something (usually the male connector of that type) stuck in them to to complete the connection.
Now, if you still don't understand why a sticky-outie-bit makes a male connector a male connector, and the reverse a female connector... go ask your parents.
Step 2: What You'll Need
For this project you'll need the following hardware:
- Wire cutters.
- Wire strippers
- (Optional) A file. If you have a multitool with pliers and a file like I do, all the better!
- A soldering iron and solder. Try to get lead-free solder! Your brain will thank you!
- A hot glue gun.
- (Optional) A heat gun. You'll use this to shrink the heat shrink tubing. You can also use a regular lighter if you're careful. (I suspect that a simple hair dryer will work for this as well, but I can't say for sure. If anybody has
You'll also need the following components:
- Something with leads that need a connector. I'm using a couple of motors, but you can use anything really.
- Some male or female header pins. You can get these from Adafruit (male, female) or Sparkfun (male, female, both).
- (Optional) Heat shrink tubing. Yes you can also use electrical tape for this, but I strongly suggest you use heat shrink tubing. It's sturdier and won't eventually peel away, leaving behind a nasty glue residue. I can personally recommend the Heat Shrink Tubing Kit from Fry's because it has a bunch of different sizes, in tons of different colors.
Step 3: Cutting Your Female Headers to Lenth
If you read the comments on the Sparkfun female header product page, you'll see that there's a lot of confusion about how to cut these headers to length. Clearing up this confusion is half the reason why I wanted to do this Instructable. Actually, this is a rather simple process, and while you do lose a pin, and the result can have some unsightly edges, it works very well!
Start by removing one pin after the last pin you want for your header. As you can see in picture two, I want to make a connector with two pins, so I remove the third with my pliers.
Next, use your wire cutters to cut through the connector for the pin you just removed. Make sure you're only cutting through the space where the pin used to be, because you wouldn't want to cut into one of the pins to either side.
The result will be a little lopsided, and there'll be some unsightly edges left over by the pin space you cut through. This is where having a file comes in handy! File away those unsightly edges, but be careful not to file away too much because the walls between connectors are usually very thin!
Step 4: Cutting Your Male Headers to Length
Compared to cutting female headers to length, cutting male headers is trivial. That said, I wanted to go over two different ways to do it that I've come across, and why I prefer one way over the other.
First is the method using pliers. Use your pliers to grip your header pins at the last pin that you want for your connector. In picture two, you can see that I want a two-pin header, so I use my pliers to grip the second pin. Now, place your fingers as close to the joint next to your pliers as possible and bend until the headers break. This should focus all the stress on the joint between pins and snap it cleanly.
Now for the method using wire cutters. This method is much easier to explain, but I feel it gives worse results. You simply use your wire cutters to cut the join in between pins. Be careful to either hold both sides of the header pins, or "aim" them towards something to catch them, because sometimes cutting things with pliers can launch the half that's not being held across the room and down into some nook where you'll never find it.
Finally, I want to point out picture six in this step. That's a picture of the results of the wire cutter method (left) right next to the pliers method (right). As you can see, the pliers produce a much cleaner edge. In my experience, using wire cutters for this is much riskier, and can even destroy the last pin on the header you intended to use. Personally, I always break my headers with pliers. It's faster, you don't risk launching your parts across the room, and it always produces better results.
Step 5: Adjusting Your Male Headers
Male headers don't always come with a pin-length that you like. I decided that these pins were too small, and I wanted my plastic connector piece to sit more towards the middle of my pins. Thankfully it's not too hard to adjust this.
You're going to want a hard, flat surface like a table-top or a clip-board. Use your pliers to hold your pins by the shorter side (assuming you want to make them longer). Place the longer pins against the table, and try to keep them perpendicular. Relax your grip on the pliers so it lets go of the pins, but doesn't open up enough to slip off the plastic piece. What you want to do is push down on the plastic piece so it slides along the pins.
It may take a couple tries to get the hang of, but once you do it right, your pins should be adjusted to a better length!
Step 6: Stripping Your Wires
Once again, this is a pretty obvious step, but for those just starting out, I wanted to share a couple tips that've helped me out before.
First, be generous with how much wire you strip. We're going to want to use these ends for wrapping around the leads of our connectors, so strip off maybe 3/8 to 1/2 inch (or about 1 cm for those with a more civilized unit system).
Second, for most components you'll run into, battery packs, motors, anything that's not intended for people to be messing with directly, will have multi-strand wire, instead of the nice solid-core wire I prefer to use for my projects. Dealing with all those tiny wires is made much easier if they're wound together to act more like one solid wire, so I usually use my fingers to wind them together like in pictures five and six in this step.
Step 7: Cutting Your Heat Shrink
DON'T FORGET TO ADD YOUR HEAT SHRINK BEFORE YOU SOLDER YOUR CONNECTOR ON! This is the single biggest mistake I always make when soldering connectors onto the ends of my wires, and it drives me nuts! For this project, it's not so vital, but when dealing with bulkier connectors you definitely want to be in the habit of threading your heat shrink onto your wires now.
Start by figuring out which size of tubing to use. For this project, you want the tube to just fit over your connector. Try a couple sizes until you find one that fits. As a general rule, use the smallest size you can get away with, while still covering your solder joints.
Furthermore, when cutting your tubing to length, you want to make it long enough that your tubing completely covers the joint. It's okay to make it a little too long, because that'll just cover up some of your wire leads, which is fine. For my joints, I cut my tubes to a little under an inch long (about two cm for everywhere that's not Myanmar, Liberia, or the US).
Step 8: Attaching Your Header
I say "attaching" your header, because it's not quite as simple as just soldering your header on.
First, in order to get your wires to behave and stay still long enough to solder, you're going to need to wrap your wire leads around your connector's leads. With parts this small, that can be a bit of a pain, but I found a technique that worked well, even with my big, blunt fingers. Start by holding the tip of your wire against your connector, like in picture one in this step. Then use your other hand to wrap your wire around the connector lead. You should end up with something like picture 3. Do this for all your leads and you're ready to solder!
It's very important that you test your connectors once they're soldered. They might have shorts, or they might not be properly connected. You don't want to find out that you've accidentally shorted your two leads together after everything's already neatly wrapped up in heat shrink like I did. If I had simply used a battery to check that my leads were good before moving on, I wouldn't have to re-do that connector.
Once you've checked your connections, you're going to want to use some hot-glue to cover both leads. This does two things for us. First, it fills the gap between the two leads to help prevent them from getting jostled and shorting out later. Second, it physically connects our wires to the connector. This removes stress from our wires and solder joints, which are brittle and will break if pulled or moved too much.
Step 9: Shrinking Your Heat Shrink
This step is very simple. Slip the heat-shrink that you've had threaded onto your wires this whole time over your connector, then heat it up with the heat gun or a match, and you're good to go!
This may seem like a lot of fuss to make over something so small, but I think you'll find it's well worth the effort. With all the stuff that can go wrong with your electronics projects, it's downright frustrating to have something as simple as a connector break! That's why you should definitely make the effort to make your connectors as solid as possible before getting caught up with the rest of your project!
As always, please let me know if there was anything in this Instructable that you liked, or if you've got anything you might suggest to make it better! I've gotten a lot of good help and feedback from you folks on my previous tutorials and I really appreciate it!