# Calculating the Capacitance Between Pins of a Pin Header¶

We model the pin headers as two long parallel cylinders of conductor separated by free space. See the cross section below.

To find the capacitance, we need to put $+q$ Coulombs of charge on one pin, and $-q$ on the other; then we calculate the voltage between the two pins. The capacitance is the ratio of charge to voltage, $C = q/v$. To find the voltage between the two pins we first use Guass' law to calculate the electric field, $\mathbf{E}$ for one long cylinder. The voltage between the two cylinders will be twice the voltage between one and where the other would be, with it removed. This is seen by symmetry.

We calculate the electric field of a single cylinder of radius $a$. Let the charge per unit length, $l$, is $\lambda$. The charge on a length of cylinder is then $\lambda l$. By symmetry, the electric field is pointing perpendicular to the cylinder in the radial direction. Guass' law: $$\int \mathbf {E} \cdot d \mathbf{A} = \frac{q_{enclosed}}{\epsilon_0}$$ $$E 2\pi \rho l = \frac{\lambda l}{\epsilon_0}$$ This gives the electric field as $E = \lambda /(2 \pi \epsilon_0 \rho)$ in the radial, $\rho$, direction.

Finding the voltage between the two cylinders comes from integrating the electric field of one cylinder from $d-a$ to $a$ and doubling it to account for the two charged cylinders. $$V = - \int \mathbf {E} \cdot d \mathbf{l} = -2\int_{d-a}^{a} \frac{\lambda}{2\pi \epsilon_0 \rho} d\rho = \frac{\lambda}{\pi \epsilon_0} ln((d-a)/a)$$

The capacitance per meter, $c$, is $$c = \lambda/V = \frac{\pi \epsilon_0}{ln[(d-a)/a]}$$
Polulu kindly gives us the pin header dimensions, so we can calculate the capacitance between two pins.

So in millimeters, the lengths, $l = (3 +2.5 + 6)$, $a = 0.65/2$, $d = 2.54$. Note the units don't matter for $a$ and $d$, because they cancel. Using $C = cl$ for the capacitance, we get.

In [6]:
import numpy as np

l = (3 + 2.5 + 6)/1000  # convert to meters
a = 0.65/2
d = 2.54
epsilon0 = 8.854e-12
c = (np.pi * epsilon0)/np.log((d-a)/a)
C = c*l
print('The capacitance between pins of a pin header is: ', C*1e12, 'pF.')
The capacitance between pins of a pin header is:  0.16667518881411675 pF.
In [ ]: