Recently I installed a trial version of the new PCB toolbox from Matlab. From Mathworks website:
RF PCB Toolbox provides functions and apps for designing, analyzing, and visualizing high-speed and RF multi-layer printed circuit boards (PCBs). You can design components with parameterized or arbitrary geometry, including distributed passive structures such as traces, bends, and vias. Using the frequency-domain method of moments and other EM techniques, you can model coupling, dispersion, and parasitic effects.
This is an interesting promise. So I tried some examples and made my own. So far, so good. Today I am exploring importing gerber files and creating a PCB stack from gerber files. I have a few gerbers from my previous KiCad projects so I tried one:
This is an older project of mine, a portable SvxLink node for radio. The images above are captured from KiCad Gerber Viewer application. This comes bundled with KiCad and is installed together with main PCB app.
Now, back to Matlab. One can read a gerber file with gerberRead
:
P = gerberRead("RoLink_OPi_4ISC_simplu-Top.gbr");
This creates an Matlab object P
of type PCBReader
. You can specify multiple gerber files and also a drill file:
P = gerberRead("RoLink_OPi_4ISC_simplu-Top.gbr", "RoLink_OPi_4ISC_simplu-Bottom.gbr", "RoLink_OPi_4ISC_simplu-PTH.drl");
The PCBReader
object has several variables
In this example I am creating a PCBReader
object with the specified Gerber and drill files, and an FR4 dielectric layer that I will use between top and bottom copper layers:
clc %this clears the screen topLayer = "RoLink_OPi_4ISC_simplu-Top.gbr"; bottomLayer = "RoLink_OPi_4ISC_simplu-Bottom.gbr"; drillGBR = "RoLink_OPi_4ISC_simplu-PTH.drl"; diel_fr4 = dielectric(Thickness=1.6e-3, Name="FR4", EpsilonR=4.4); % check if gerber stack is empty if isempty(P) P = gerberRead(topLayer, bottomLayer, drillGBR); end
Exploring the PCBReader
object in Matlab, we can see it has a StackUp
property that contains the layers:
PCBObject.StackUp
command (terminal or m file) shows the components of the PCB stack:
>> P.StackUp ans = stackUp with properties: NumLayers: 5 Layer1: [1×1 dielectric] Layer2: “RoLink_OPi_4ISC_simplu-Top.gbr” Layer3: [1×1 dielectric] Layer4: “RoLink_OPi_4ISC_simplu-Bottom.gbr” Layer5: [1×1 dielectric] >>
You can explore each layer’s properties. Creating a StackUp
object and exploring each layer in terminal or code is simple. For example for Layer3:
>> S = P.StackUp; >> S.Layer3 ans = dielectric with properties: Name: ‘FR4’ EpsilonR: 4.4000 LossTangent: 0 Thickness: 0.0016 For more materials see catalog >>
Each layer has several properties accesible via a dot format. For example, Layer3.Name
displays the name etc.
>> S.Layer3.Name ans = ‘FR4’ >> S.Layer3.EpsilonR ans = 4.4000 >>
Next step would be to create a pcbComponent
object. Use the pcbComponent object to create a multiport PCB component consisting of metal and dielectric layers out of PCBReader object and display it:
% make a pcbComponent pcb = pcbComponent(P); figure pcb.Show
Next I will try to create a feedpoint and use the pcb object to simulate current distribution, crosstalk and S params. This new toolbox is very promising. Opens a lot of opportunities for hobbyists too, also because Matlab home license is extremely attractive price-wise. I really wonder if I can use it to evaluate the RF performance of some boards I create. Stay tuned. More to come.
Have a great day and thanks for passing by.
73
Leave a Reply