Sunday, June 19, 2016

Arduinos, New Arduinos, and Pin Header

With a new crop of Arduino compatible boards in "non-traditional" form factors, you may need to consider what type of header pins you want to use on the boards.

Pin header is typically used for:
  • Easier connection to a breadboard or to connect wires (electrical)
  • Connecting other boards via stacking (mechanical)
Below is the classic Arduino stacking header shield (for prototyping) and that board stacked on an Arduino R3 (right). The shields for the classic Uno R3 are an 8 pin + 10 pin header on top (half-pin space between), and a six pin and 8 pin header opposite (one pin space between, some boards put a nonfunctional header pin between like on the new Arduino Uno WiFi). Boards made since the Arduino Zero have an additional ATN pin on the side closest to the power jack.
Arduino Stacking Shield with female header with long pins (via adafruit.com)
A shield will need long male pins beneath and the Arduino typically has female pins on top to make the connection.  Note the shield above has female pins on top so another shield may be stacked on top of that.  If a shield does not need to have another shield stacked on top, you can use plain male header.
Arduino compatible Feather with long female pins for Breadboard, display "shield" on top with male non-stacking pins (via adafruit.com)
The pictures above demonstrate several things: The Adafruit Feather arduino-compatible board on the left has female header with long male pins to be able to be pressed into a breadboard.  The display on top has regular male pins soldered on.  The picture on the right shows the two types of header.

Mail order companies (Adafruit, Sparkfun, Farnell, eBay, etc.) sell a lot of different types of header for your making use. Male, female short, female long, single row, double row, and header with 90 degree bends. Male header even comes in extra long for certain applications. Header can come in many widths, the most common when buying header alone is in 40 pin pieces/sticks, although vendors will often sell shorter lengths for specific purposes.

A few different types of header (yes there are many more types)
Most header is built with a tenth of an inch spacing between pins (0.1" or 2.54 millimeters metric). For some items like XBee radio and some ESP8266 breakouts, they use 2 mm spacing, and some boards may use other spacings. Be careful on guessing the spacing for certain components, boards, displays, etc. Always measure or count twice.

Now on to some of these new Arduino compatible boards coming out. The header pins in the Arduino R3 pictures are nice but they are usually made for 14 on the short side and 18 on the other side. These will not work on some other boards.  Here are the header pin counts for some modern boards:

Adafruit Feather has 12 pins on one side, 20 on the other

Arduino.cc MKR1000 has 14 pins on both sides

The Adafruit Huzzah ESP8266 Board has 10 pins on either side (they give you a few extra pins in the header strips)

The NodeMCU ESP8266 board has 15 pins on either side

Making Custom Header Widths


If you have header that is longer than the board you need it for, you can usually cut the header pieces to fit. This may also save money, buying 40 pin sticks and cutting to fit your project.

You should wear eye protection and use caution when preparing to cut header, pieces will fly off!!

Use a good pair of diagonal cutters.  Some header, like the male ones, have a groove between pins, making it easy to make a clean cut (often called "breakaway header").  Female header is trickier. Center the cut about in the middle of the next pin after counting out the number you need.  Make a straight cut.  Be careful as the gold pin will fly out

Cutting male header (left) and female header (right).  Via learn.adafruit.com
This will leave that side with a bit of a U shape. You can use good cutters to do further trimming. Then use a file to get a nice smooth edge.

Soldering Header


The secret: Use a breadboard or another board with header pins to hold the board to be soldered in place. Have a hot soldering iron and heat each pad+pin and solder.

learn_arduino_solder5.jpg
Using one board to hold pins for another (via learn.adafruit.com)

With a breadboard, put the pin header in, then the board, then solder.  You can also put a piece of male header in a breadboard to secure a female header to solder onto a board (a good use for the extra-long male header). Be sure the board you are soldering is level, once the solder cools, it is hard to level out.

What are your tips for using header in your projects?