Jumper cables with DuPont headers are an essential part of your toolkit. Any dabbler in electronics will have drawers of the damn things – and probably not a few wandering randomly around the workbench.
But when the time comes to buy more (where do they go?) there’s always a dilemma. Do you need male-male, female-female or female-male? And how many of each?
You’re going to have to buy them in various lengths anyway. Also having to buy in three lots of header combinations just makes for more expense and increases the likelihood you’ll run out of the type you most need just when you most need it.
I hate the male ones. Seriously, hate is not too strong a word. The pins are always so thin and feeble. When you plug them into breadboards, they wiggle about in a manner that fails to inspire confidence about long-term connectivity. But you do need male headers to plug into breadboards or devices such as many types of Arduino that have female headers.
Female headers are designed to attach to male header pins such as the Raspberry Pi’s GPIOs, or the little row of solder-them-yourself header pins that every Adafruit breakout seems to arrive with – usually loose in the bag.
You know the kind I mean – they come in rows, allowing you to snap off as many as you need. The pin on one side of the plastic housing is short and is for soldering to a PCB or prototyping board. The pin on the other side (okay, I know it’s the same pin that just runs right through the plastic) is longer – long enough to give a good purchase for a female DuPont header.
Hmm, hang on.
It’s also possible to buy long header pins which are long on both sides of the plastic. With one of these pins, you can easily connect two female headers together. Or to look at another way, a long pin acts as a gender changer for a female header.
So instead of worrying about which jumper wires to buy, it’s easy – just buy female-female ones plus a bunch of long header pins.
Wait a second…
We haven’t got to the good bit yet, because there are other real advantages to doing this.
For one thing, the long header pins are generally thicker than those you get on male jumper wires. They therefore make a better, more secure connection, especially into breadboards.
It’s often the case that you have a number of individual jumper cables plugged into various points on a breadboard, Raspberry Pi, Arduino or whatever, but would prefer to treat these as a single cable. For example, one wire might go to VCC, one to ground and two to the SDA and SCL pins for an I2C connection. In this case, using a row of four connected header pins pulls them together and makes for a much tidier solution.
Where you’re plugging multiple jumpers into a breadboard, grouping them together with connected header pins like this stops them wiggling about and becoming disconnected as they are wont to do if left unsupervised for more than a few seconds.
As an aside, if I have a group of separate wires that logically belong together, I will often replace their individual plastic shrouds with two-, three- or four-way ones as a means of cable management.
Having a female-only cable policy also helps when designing circuits, regardless of whether these are implemented on breadboards, PCBs or proto boards. Wherever you need to put headers for cables, you can adopt a policy of always using male ones, knowing that your jumper cables are always female. Or you could always use female and use long pins as gender changers again. I prefer the former. But whichever approach you adopt, it removes a lot of decision-making.
Downsides? Sometimes, when you pull a cable out of a breadboard, the pin stays behind. It’s not that big a deal.
Now, I know you old hands are probably shaking your heads and muttering, “yes, dufus, we know this already…” But it took me ages to work this out and I bet someone else out there hasn’t yet arrived at this conclusion. You’re welcome.