A popular question is the resistance between nodes in an infinite grid of resistors, like this:
This project implements a 30x30 node resistor mesh for testing it approximately. The mesh contains 1,740 resistors (870 horizontal + 870 vertical connections), each a 1kΩ 0805 SMD resistor with 0.1% precision.
For creating the PCB layout, I used the mesh.py Python script, which automates the placement of the resistors, connections, and vias on each node for easier measurement in the grid pattern, for a KiCAD board, looks like this:
You can download the board here: mesh.kicad_pcb.
The board was manufactured by JLCPCB, including populating all resistors, using the following production files:
- Gerber files - PCB fabrication data
- BOM (Bill of Materials) - Component list
- Pick and Place file - SMD assembly positioning data
5 boards, 2 of them with populated resistors, did cost $259.99 with shipping.
- Adjacent nodes (15,15) to (16,15): 500.2 Ω
- Diagonal nodes (14,14) to (15,15): 640 Ω
- This is a (1,1) separation: 1 node horizontally, 1 node vertically
- Knight's move (14,14) to (16,15): 778 Ω (as in xkcd #356)
- This is a (2,1) separation: 2 nodes horizontally, 1 node vertically
For an infinite 2D square resistor grid with resistance R per element, the theoretical analysis gives the resistance between nodes separated by (m,n) as:
General formula (equation 9 from the analysis):
This integral evaluates to specific values:
Adjacent nodes (1,0):
Diagonal nodes (1,1):
Knight's move (2,1):
Since our grid is finite (30x30), edge effects cause small deviations from the infinite grid values. The simulate_grid.py script uses nodal analysis to solve the exact resistance values for the finite grid:
Method: The simulation builds an admittance matrix based on Kirchhoff's current law, injects 1A between two nodes, and solves for all node voltages using sparse matrix methods.
Simulated values for 30x30 grid:
- Adjacent (15,15) to (16,15): 500.61 Ω (vs infinite: 500.00 Ω)
- Diagonal (14,14) to (15,15): 637.84 Ω (vs infinite: 636.62 Ω)
- Knight's move (14,14) to (16,15): 776.29 Ω (vs infinite: 773.24 Ω)
Comparison of measured values with theory:
| Configuration | Measured | Infinite Grid | Finite Grid (30x30) | Error vs Infinite | Error vs Finite |
|---|---|---|---|---|---|
| Adjacent (1,0) | 500.2 Ω | 500.00 Ω | 500.61 Ω | 0.04% | 0.08% |
| Diagonal (1,1) | 640.0 Ω | 636.62 Ω | 637.84 Ω | 0.53% | 0.34% |
| Knight's move (2,1) | 778.0 Ω | 773.24 Ω | 776.29 Ω | 0.62% | 0.22% |
These results demonstrate:
- The 30x30 mesh closely approximates an infinite grid (measured values within 0.62% of infinite theory)
- Edge effects account for most of the discrepancy (finite grid simulation explains the differences)
- The 0.1% precision resistors and JLCPCB assembly quality are excellent (< 0.34% error vs simulation)



