Skip to content

Instantly share code, notes, and snippets.

@tomek-szczesny
Created May 7, 2022 20:54
Show Gist options
  • Save tomek-szczesny/2b564c007973d123dfd7c40d08258b47 to your computer and use it in GitHub Desktop.
Save tomek-szczesny/2b564c007973d123dfd7c40d08258b47 to your computer and use it in GitHub Desktop.
Differential pairs on cheap 2-layer PCBs
#!/bin/bash
# Requires GNU parallel and atlc to run.
# Three cases:
# Case 1: Trace width 0.28, diff pair spacing 0.15, diff pair to ground plane spacing 0.15
# Case 2: Trace width 0.31, diff pair spacing 0.15, diff pair to ground plane spacing 0.20
# Case 3: Trace width 0.40, diff pair spacing 0.20, diff pair to ground plane spacing 0.20
# create_bmp ... w s g ...
# trace width, pair space, outer space
create_bmp_for_microstrip_coupler -b 8 0.28 0.15 0.15 1.593 0.035 1 4.5 case1.bmp
create_bmp_for_microstrip_coupler -b 8 0.31 0.15 0.2 1.593 0.035 1 4.5 case2.bmp
create_bmp_for_microstrip_coupler -b 8 0.40 0.2 0.2 1.593 0.035 1 4.5 case3.bmp
parallel -j3 "atlc -d ac82ac=4.5" ::: case1.bmp case2.bmp case3.bmp
# Expected results
# case1.bmp 3 Er_odd= 2.450 Er_even= 2.554 Zodd= 50.215 Zeven= 105.864 Zo= 72.910 Zdiff= 100.429 Zcomm= 52.932 Ohms VERSION=4.6.1
# case2.bmp 3 Er_odd= 2.470 Er_even= 2.599 Zodd= 50.304 Zeven= 112.704 Zo= 75.296 Zdiff= 100.609 Zcomm= 56.352 Ohms VERSION=4.6.1
# case3.bmp 3 Er_odd= 2.517 Er_even= 2.628 Zodd= 50.084 Zeven= 103.586 Zo= 72.028 Zdiff= 100.168 Zcomm= 51.793 Ohms VERSION=4.6.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment