Wireless communications have always fascinated me. In school, I took digital signal processing classes, Radar signal processing classes, and even a course on wireless communication theory. But I never dived down into the electromagnetic theory. I am by no means an antenna designer, this is my first foray into antenna theory design and actual manufacturing.
I wanted to create a 2.4GHz directional patch antenna that had a bit of gain and fit in a relatively small form factor. This is where I had to begin researching. I found lots of journal papers as well as a few PowerPoints and a great website called Antennatheory.com by just googling around the web.
Through these sources, I gained a basic knowledge of microstrip patch antenna design, which is basically creating a directional antenna structure using printed circuit board (PCB) material.
Antenna Background
A patch antenna is made of several components first is the ground plane which acts as the reference for the antenna to sit on top of. Next is the dialectic layer, which is the FR4 PCB material. Then there is the antenna structure which will radiate at the desired frequency (hopefully as we will see later). The last piece is the antenna feed, this is where we will attach our signal to the antenna. This can be an SMA connector or similar 50-ohm interface.
There are several ways to feed a patch antenna but I will only touch on two of them. One is probe fed, where the feed is attached directly to the antenna from underneath. The other way is to use a microstrip transmission line either directly connected to the patch. The difference comes down to managing the impedance of the antenna for a given feed structure.
Impedance is essentially the complex resistance and reactance of a structure at a given frequency. Impedance is important because it determines our antenna’s ability to accept a signal at our desired frequency instead of reflecting the power back. For example, a transmitter connected to an incorrectly matched antenna will not radiate effectively. The antenna will reflect the transmitted power back into the transmitter causing it to heat up or even damage itself.
For a probe fed design the width of the antenna is our main mechanism to tune the antenna’s impedance. For a microstrip fed design we have a few more options. First, we can still use the antenna’s width, but we can also use a 1/4 wavelength microstrip connection. This is used to tune the impedance of the patch by varying the microstrip width. Alternatively, we can inset the microstrip feed into the patch. The antenna can then be tuned by varying the depth of the inset.
MATLAB Software
I’m not going to lie, antenna modeling software is super expensive! Many University students are given free access to the software and if you are just doing this for personal/home use there are some reduced prices, you can also do 30-day evaluations of the toolboxes before you decide on a purchase.
MATLAB has a wide array of example content on how to use its various toolboxes and the Antenna Toolbox is no exception. With a getting started guide, a parameterized antenna catalog, a PCB Fabrication guide, and a lot more. Documentation can be found on the Mathworks website Antenna Toolbox Documentation
But in any documentation, there is always something or two missing. If there is anything I have learned using MATLAB is that it can be very confusing when you first try to use a specific toolbox. The people at Mathworks put an amazing amount of work into these toolboxes and are very powerful in the hands of someone that knows all the small details. This really only benefits professionals with good foundational theory in the subject.
I will try to go over the details of my design in a simple concise way, as well as walk you through the Matlab tools.
Start with the examples
There are several ways of using the Antenna Toolbox, I would first advise anyone to run the Mathworks examples. This will give you a good idea of the software flow. For PCB antenna fabrication I started looking at the Design, Analysis and Prototyping of a Microstrip-Fed Wide Slot Antenna example. This example contains a good portion of what I wanted to do, design a prototype antenna and create files for manufacture. It also adds some analysis plots as well to determine the impedance of the antenna. I also found Design Variations On Microstrip Patch Antenna Using PCB Stack example useful as well, as it goes through different variations of patch antenna design.
Here is where you get to start having fun, change parameters in the Matlab example code and see what happens! Most likely it will not compile and start throwing errors but that’s ok. This is how you learn what the code is doing. This is how I learned and distilled down the necessary components I needed to create my antenna design.
Parameters
First, we need to define our physical parameters, which include values like the speed of light, our desired center frequency, the PCB material thickness, and its dielectric constant as well as several length and width values we will want to play with as we analyze the antenna.
%% Physical constant
c = physconst('lightspeed');
%% Design Parameters
%center frequency
fc = 2670e6;
%dialectric constant
er = 4.2;
%Hight of the substrait
h = 1.524e-3; %m 1.524mm
%microstrip width 50ohms
mw50 = 2.685e-3; %m
%microstrip width 100ohms
mw100 = .565e-3; %m
%Length of antenna patch
%L = c/(2*fc*sqrt(er)); %m
L = .02560;
%Width of antenna patch
W = .03;%L; %m
%Length of ground plane
Lg = .045; %2*L;
%Width of ground plane
Wg = .04; %2*W;
%Inset notch width
Nw = mw50*3;
%Inset notch length
Nl = mw50*1.7;
Create the Antenna Stack
Now that we have our parameters we need to create the layers that make up the antenna. This is done using the antenna primitives, adding and subtracting different geometries to create the final result. The primitives can also be moved around in the layer by offsetting their local center from the center of the layer plane.
%% Create antenna primatives
patch = antenna.Rectangle('Length', L, 'Width', W);
groundplane = antenna.Rectangle('Length', Lg, 'Width', Wg);
notch = antenna.Rectangle('Length', Nl, 'Width', Nw, 'Center', [(L/2)-(Nl/2),0]);
microstrip_feed = antenna.Rectangle('Length', Lg/2, 'Width', mw50, 'Center', [(Lg/4),0]);
substrait_material = dielectric('Name','FR4','EpsilonR', er, 'Thickness', h); %dielectric('FR4');
build_patch = (patch-notch) + microstrip_feed;
Now that we can manipulate the primitives we want to create the inset fed patch. For this, we start with the basic ground plane that will extend beyond the edge of our radiating element. Next, we define the radiating element, this is just a basic rectangle at the plane center with our length and width specified from our parameters section. Next, we define the inset notch, this will be a tune-able element that we can adjust to match our impedance. The inset is created like a normal antenna.Rectangle() but will now be offset from the center and then subtracted, leaving a small notch in the radiating element. Next, we need to create the microstrip feed line. This will connect our feed point, at the PCB edge, to the radiating element.
The width of the microstrip influences the impedance, so it needs to be calculated for our manufacturing process. There are several web calculators that can help get close to the desired 50 ohms matching impedance. Once we have the desired width, we create another antenna.Rectangle() for the microstrip and offset it so that it connects the feed point to the Radiating element. This is done by adding it to our notched Radiating element. The substrate material can be set using the dielectric function. This specifies the material and the dielectric constant that we will be manufacturing with.
We then define the pcbStack object with the BoardShape, defined by the ground plane layer and the BoardThickness as the height parameter. The Layers can then be defined with the patch on top, the substrate material in the middle and the ground plane on the bottom. We then set the feed point with the FeedLocations defined on the top layer at the edge of the board.
%% Define the properties of the PCB stack.
basicPatch = pcbStack;
basicPatch.Name = 'Spectrum Buddy Basic Patch';
basicPatch.BoardThickness = h;
basicPatch.BoardShape = groundplane;
basicPatch.Layers = {build_patch,substrait_material,groundplane};
basicPatch.FeedLocations = [Lg/2 0 1];
This section required a bit of math and geometry to get the elements to line up correctly but is easy to understand once you play with the objects a bit. I used a pen and paper to draw out the design first and then worked backward to locate each elements’ position with relative coordinates. This allowed me to iterate quickly as I tuned the parameters for my frequency of interest.
Simulation Analysis
In order for us to tune our antenna geometry, we must first measure the current geometry and compare it against our desired result. Here I will look at a few metrics that will define my antenna. First is the antenna radiation pattern, this is number one because the main goal of this antenna is to be directional and along with this is the directional gain. Next is the impedance where we will look at the resistance and reactance of the antenna. Here we want the resistance to be 50 ohms at our desired frequency and the reactance to be zero there as well. Next is the s11 parameter, this is a combination of the impedance resistance and reactance to measure the reflected power at a given frequency. There are many more parameters such as bandwidth, polarization, etc. that I will not explore at the moment. With each modification to our geometry, we must rerun all these computations. Thankfully my design is quite quick to simulate but other designs can take much much longer.
Rev1 Design
Here is my revision 1 design for the 2.4 GHz patch antenna that I wanted to design. Before I get into the details of the simulation, I made some mistakes. While I did design this antenna for 2.4 GHz it seems I got the dialectic wrong for the Oshpark service. This means that my antenna did not hit my desired mark on frequency but after adjusting that parameter it seems the simulation does match reality fairly well! Ok now let’s dive in!
Let’s show the current patch design based on our stack up.
figure
show(basicPatch)
Here we can see the top layer of the design With the show() function. This displays the radiating element and the feed structure in yellow, the green layer below is the substrate FR4 material, and the red dot is the feed excitation point.
To plot the radiation pattern of the antenna we can use the pattern() function at our desired frequency. Here we see our antenna situated in the bottom left with the associated radiation pattern in the center. We also get a maximum and minimum gain value in the upper left. Here we see about 6dBi of gain extending upward from the radiating element.
%% Plot the radiation pattern of the basic patch antenna.
figure
pattern(basicPatch, fc)
Next, we can calculate the impedance of the antenna with the impedance() function. Here we want to do this over a frequency sweep centered around our frequency of interest.
%% Plot the impedance of the basic patch antenna.
%enumerate frequencies
freqs = linspace(fc-0.05*fc,fc + 0.1*fc,100);
%plot complex impedance
figure
impedance(basicPatch,freqs)
Then using the same frequency vector we can calculate the s-parameters of the antenna with the sparameter() function. This shows how much energy is being reflected back from the antenna. Here the lower the value corresponds to the antenna accepting more energy at that frequency.
%plot RF s-parameters
S = sparameters(basicPatch, freqs);
figure;
rfplot(S);
This shows that our patch antenna should be 50-ohm matched at 2.658GHz.
Manufacturing
Matlab has the ability to auto-generate the GERBER files needed by various online manufacturing services to create a physical copy of your desired antenna. There are a few things we need to add to our design before we send it off.
The first thing we need to do is add an RF connector. Matlab has a small library of connector objects for basic connectors such as SMA and UFL connectors. The issue is that placing the connector can be a pain. For example, I could not find an easy way to rotate the connector … Which caused me to have to rotate my entire design to fit the connector placement.
%% PCB GERBER generation
%connector
connector = PCBConnectors.SMAEdge;
connector.SignalLineWidth = mw50;
connector.EdgeLocation = 'east';
connector.ExtendBoardProfile = true;
%pcb service
service = PCBServices.OSHParkWriter;
service.Filename = 'Basic_2.4GHz_Patch.zip';
%write gerber
PW = PCBWriter(basicPatch,service,connector);
PW.ComponentNameFontSize = 4;
PW.DesignInfoFontSize = 4;
gerberWrite(PW);
I used the Oshpark service to create my antennas, this was mostly for the quick turnaround time as I wanted them before I traveled to the Hackaday Supercon so I could show them off (more on that in a bit). We can then call the PCBWriter function with our defined silkscreen font size. Then we can call the gerberWrite() function on the PCBWriter object to have Matlab create our zip file. One issue that I have with the Matlab PCBWriter object is that it looks like it adds a Matlab watermark to the PCB silkscreen THAT YOU CAN’T TURN OFF! But when submitting the files to the board house they mysteriously disappear … So don’t be alarmed by them or try to force them off the design.
After you submit the order you get some beautiful purple PCBs a few days later. Here are a few pictures of my antenna. I want to try the after-dark solder mask next time!
Physical Testing
Unfortunately, I do not have a VNA. So I needed to find a way to test my antennas. In a previous post, I used a Pluto SDR and a Reflection Bridge, with a Matlab script, to test some antennas that I have, you can check that out here Pluto SDR Matlab SNA.
I set up the SNA with my new antenna to see if I got the impedance matching correct by measuring the s11 parameter, basically measuring the reflected power.
This allowed me to get a basic idea of the performance, but since the frequency is at the higher end of my reflection bridge I didn’t want to trust these results on their own.
Help from the Twitter Universe!
Here is where I got some amazing help from Mike Walters @assortedhackery. I had posted about my antenna on Twitter and got a wonderful response from the maker electronics community. We were both headed to the 2019 Hackaday Supercon and he was kind enough to test one on his VNA and send me the results!
From the plot, we can see that the 2.4 GHz center frequency is a few hundred megahertz off at 2.67 GHz with a 5dB bandwidth of about 60 MHz from what I can tell. Compared to my SNA result this is much cleaner and rightly so given that this is actual calibrated test equipment.
Final Thoughts
Overall this has been a fun project that has gotten me more interested in antenna design and theory. The Matlab antenna toolbox is a wonderful resource that allows me to iterate on my design and just try different parameters to see what happens. This experimentation allows me to gain an intuition about antenna design moving forward. The other amazing thing is that I was able to get the antenna manufactured and shipped straight to my door. This gave me real-world feedback on the design and the limitations of my modeling assumptions as well as the abilities of my “test equipment”.
Moving forward I will retool my design to actually center around the 2.45 GHz frequency as well as modify my other designs in progress to match these changes.
Matlab Code
If you made it this far and want to try this design feel free to clone my GitHub repo and start hacking. Thanks!
Github: 2.67GHz Antenna Design
2.4GHz Design update
After a while, I decided to try my hand at updating this antenna to actually be a 2.4GHz patch antenna and actually got it right this time. Check out the new post below.
Other PCB Antenna Projects
If you liked this post on antenna design, check out my Vivaldi antenna!