The Process of Designing and Ordering a PCB- Signal Generator Using FPGA
by yazansaleh in Circuits > Electronics
2049 Views, 13 Favorites, 0 Comments
The Process of Designing and Ordering a PCB- Signal Generator Using FPGA


As an electrical engineering student, we had a class in the 5th semester that was entirely evaluated on a project done in less than 2.5 months.
This project was a Direct Digital Synthesizer (DDS) based on a Field Programmable Gate Array (FPGA).
After brainstorming the idea was to make a device that synthesizes signals (Sinus, Cosine, Triangle, Saw-tooth, Rectangular and Noise). The frequency range should be between 1Hz and 1MHz, and the whole system should be based on FPGA (Read more about it here and why an FPGA is super cool).
The FPGA was programmed in VHDL- a hardware description language using Xilinx software. The FPGA should have a block memory or a BRAM that has the values of each signal to be synthesized or what is known as a look up table (LUT). The FPGA clock would trigger the LUT that has 1024 values and on each cycle, the value in the respective address will be read and sent as a hexadecimal number (12bit).
The cool thing about FPGA's everything is done parallel inside its core unlike a microcontroller for example that has to wait a full clock cycle to make a change in a General Purpose Input/Output (GPIO) for example. This allowed the12 bits from the LUT to be sent to 12 different GPIO at the same time.
Since FPGA are only digital interfaces, those 12bits from the different GPIO's were sent to a 12 bit Digital to analog converter (DAC) which spits out an accurate analog converted signal with the correct clock timing as programmed.
The last step of this system is a two stage operational amplifier (Op-Amp)which converts the differential signal coming out of the DAC to a steady pos/neg signal in the first amplification stage. The second stage of aplification was added to change the amplitude of the output signal.
This Instructables will only cover the Printed Circuit Board(PCB) design and schematics. More to the theory of the whole device and how it works follow in the next Instructables.
This is an entry to the PCB Challenge by Instructables.
Understanding the Functionality Helps With the Hardware Design!

As most engineers would say, a good design starts on a paper with a pencil!
In this case it was a white board and a marker! I wish I was more organized but this is the only photo that I have and lots of sketches on my notebook that are summed up in the next few steps!
To start with the design process, I started laying down all the functionality that I needed in my device to understand the different sections there is and what components I'll need and how everything should be working with each other.
After the brainstorming those were the main functions that I needed for my device in terms of hardware:
- FPGA connected with headers (So that it can be replaced)
- To have two channels at the output (meaning 12 pins on the FPGA x 2 = 24) + extra GPIO for input/output/clock signals
- Frequency Range (Output signal) 1Hz-1MHz
- 2 channels 12 bit DAC
- 2 channels, 2 stage Op-amp. The First stage is differential and the second is to change the amplitude
- The signal should be variable between +/- 1v on the output
- Power consumption does not exceed 300mA at any time, and no component use more than 5V
- Variable frequency using a Linear Potentiometer, also a Linear Potentiometer to change the amplitude
After gathering this information it was time for component hunting!
Component Hunting! FPGA+ DAC


Now we know what the board should do a week long component hunting/adventure took place!
Given that this was a project for the university almost all the components that are used were provided from the university (Except for the PCB itself).
Two of the most important components in this device were already in the university, and we used what's available. Those were the FPGA and the DAC. Provided in the university there was a couple of the CMOD S7 from Digilent and
It featured:
- 32 FPGA digital GPIO pins
- 2 Internal analog input (Analog to digital converters- XADC)
- An external power input rail
- 4 LED's, RGB LED, 2 Buttons all on board
- Small factory size
- USB-UART built in with a micro USB onboard
- 12 MHz onboard RC Clock
Perfect!
The DAC was also available it was a good fit for the function we needed it for. The AD9765 from Analog Devices was chosen.
It featured:
- 12 bit Dual channel Digital to Analog Conversion
- 125 MSPS update rate
- 5 V or 3.3 V operation
- Power dissipation: 380 mW @ 5 V
- Sleep functionality with power dissipation of 50mW @ 5 V
- 48-Lead LQFP SMD package (Small enough to make the board compact)
Also Perfect!
Component Hunting! Op-amp+ Linear Potentiometer


After reading through and understanding how the signal from the DAC can be converted to a readable one, a couple of circuits on the data sheet helped with the first stage amplification stage this can be found here.
Always read the DATA SHEETS and USER MANUALS. No source of data is more reliable than the manufacturer!
Provided that we need two channels (From the FPGA, to the DAC and finally thought the OP-amp and to the output) and the two stage application suggest that a Quad Op-amp will be most logical since 4 op-amps are in one package and the +/- power supply should be driven across the PCB to one component.
Given that the needed frequency range is between 1Hz and 1MHz, a quad op-amp with similar range would be make sense here.
For the full signal range (+/-1V), the Op-amp should be getting negative and positive voltages.
I use mouser.de to find components with specifications. Use a website that you like and can deliver to you!
I gave those parameters in the search engine of mouser.de and multiple quad op-amps came out of this research as a fit. I went with STMicroelectronics TL074CD.
It covers our parameters of:
- 3MHz Bandwidth
- Quad Op-amp
- Enough power through each channel of 40mA
- Power Dissipation :680 mW
- Dual Supply Voltage of +/- 3 V to +/- 9 V
-
Rail-to-Rail Op-amp Type
With this range and given that we won't use more than 5V in voltage, and the minimum voltage of +/-3V wont be used either. I went with +/-4V. Midway is the best way :D
With that, the prototyping of the analog part started. The flow from Op-amp stage 1 to stage 2 and for stage 2 to be controlled using a Linear Potentiometer. For that I used a linear 10kohm.
Component Hunting! POWER!

Gathering all components, whats left is a couple of resistors, capacitors etc.
Also, power for the whole board!
Given that:
- FPGA uses 5V and takes it from USB this voltage can be used on Pin 24 externally.
- DAC uses 3- 5V for the Digital part and 3-5V for the analog part
- Op-amp uses +/-4V
With this information the power supply part specifications were ready.
- 5V for the FPGA
- 3.3V for the Digtial part of the DAC
- +/- 4V for the Op-amp
Given that USB connection can provide 500mA @ 5V it will be sufficient to use the USB only!
The conversion of voltages will look like this
- 5V -> 3.3V (Digital)
- 5V -> +4V (Analog)
- 5V -> -5V (Analog)
- -5V -> -4V (Analog)
With help from the professor we got the needed IC's for the PSU
- TPS76933 for 5V -> 3.3V
- TPS76901 for 5V -> +4V
- LM2611 for5V -> -5V
- TPS72301 for-5V -> -4V
As mentioned earlier, the data sheets gave us the needed circuit for each of the IC's and the formulas necessary for the voltage calculation with regard to the resistors, capacitors and diodes. This will be shown in the following steps.
Prototyping!


Knowing the power requirements, circuits needed and components to be used it was time for prototyping on a breadboard and using a calculator and a piece of paper to measure the rest of the components! This is beyond this Instructable scope. I'll just share some photos.
PCB Laout

Trying to visualize the PCB layout I drew a quick sketch using LibraOffice, and it included all the sections of the PCB.
The PCB is a mixed signal one. Meaning that it has an analog section and a digital one. This left side of the PCB is the digital part where half of the DAC Input pins, FPGA and PSU- Digital/Input are. The Right side is the analog one, where the Potentiometers, Amplification, Output, and PSU- Digital parts are.
I needed 4 screws on the corners to be able to attach it to a 3D printed case that ill design later for the purpose. The holes should fit M2 screws. The board size shouldn't exceed 100mm in width and 80mm in height (Eagle CAD software- Student Version limitation)
Now moving on to designing!
PCB Rules

To get the PCB done professionally it was outsourced from the University and manufactured in China from JLCPCB. Therefore, I went to their website and found the capabilities section.
The most important restrictions for me were:
- Max. Dimension
- Dimension tolerance
- Drill hole size
- Via hole size and tolerance
- Pad Size
- Clearances
- Trace width and spacing
I wrote the numbers on a piece of paper and opened EAGLE CAD Software.
PCB Schematic Design on EAGLE




After prototyping and using my sheet of components, I started laying out the components on the schematic section of EAGLE. Some components were not available, and I had to use some online community libraries or design it myself (the CMOD S7 FPGA for instance). To design a component you need to either measure it with a caliper or look in the data sheet (it's usually there).
Some important measurements are:
- Surface Mounted Device (SMD) or Through Hole Technology (THT)
- Size of the component
- Number of pads (for SMD) or legs (for THT)
- Distance between pads
Here is a Tutorial by EAGLE Academy that helps with creating a component on eagle.
After having all the components needed laid out on the schematic section of EAGLE, I started connecting the traces between the different components. I used labels to be able to make the schematics more transparent and clear. For the Ground, I used two different grounds.GNDA which is the analog ground showing as two lines above each other. The Digital ground has only one and is marked GND. The Digital and Analog grounds are separated and connected only through a Ferrite bead to lower the noise between both grounds and the components on both.
Grounding in mixed signal circuits is a tricky task that should be done properly to avoid interference. Here is a good guide.
AVCC+ indicates the analog +4V voltage and AVCC- indicates the analog -4V voltage.
The Schematics were split into four parts (In the photos above):
- FPGA and DAC
- Amplification and Output
- PSU Input 5V || Output -5V, 4V, -4V, 3.3V
- Bypass Capacitors and Headers for inputs/outputs/PSU control
*Make sure that you get the polarity of the components right
**Right down the pinout of the FPGA in relation to the other components to make it easier for later to program.
PCB Board Design on EAGLE


Switching view on EAGLE from Schematic to BOARD you will find all the elements of your schematic in midair not connected and showing only airwires. Start by changing the board size to your requirements.
Go to -> Edit -> Design Rules and change those according to your manufacturer capabilities. Just like in step five.
Start laying out the components on the PCB similar to the layout in step four.
Connect all the traces, leaving enough space between them and make sure that no trace has a 90degree angle corner/bend it should be either round or larger than 100degrees! This will help the signal moving around the traces at high frequencies to reduce interferences/reflections inside the trace itself.
Once that Is done, and if the manufacturing process allows make a polygon of Digital/Analog ground areas and run ratsnest to connect the grounds to the pads.
Check, double check, triple check your PCB before sending it to the manufacturer!
Check the traces, number of pads/legs, layout, component size/packages, all of labeling and the traces are well-connected (Sometimes a trace can be very close to a pad or another trace and not be connected) use the ESC check tool to make sure that your schematic doesn't have problems and then check again with the DRC tool to make sure there is no airwires or mistakes in your board.
Once done, export it as a Gerber file by going to File -> Generate CAM data ->ok -> Save as ZIP file.
Ordering the PCB




As mentioned the manufacturer of choice was JLCPCB since they are affordable and have delivery option within a week!
- Head to their website
- click on get a quote now
- Upload the Gerber files from the previous step
- Change the settings that you want as shown in the picture
- Save to cart
- Check if there are any errors using their online tool
- Checkout!
It is that simple!
All you have to do now is wait and your PCB will be on its way!
(Or work on the software)
Finish It Off!






Congrats! Your PCB is here!
Now all you have to do is have the components ready and get to soldering! Here is a good tutorial!
For soldering, I will suggest making a soldering plan to make sure that everything is working fine before having half of the components on the PCB and then discovering a mistake!
For this example, I started with the 3.3V IC Circuit, made sure that it was stable at 3.3V, and it doesn't take suck a lot of current (When a component takes more current than expected it means that you have to double-check your board, circuit or component!). I Then moved on to soldering -5V Circuit then -4V then +4V.
Once the PSU was ready I moved on to the Op-Amp circuit and all the headers.
The DAC was up next, and it was the most challenging component given its size and the space between the pads. I needed a microscope and a good amount of flux for this step!
The FPGA was up next and then the potentiometers (I did use potentiometer for one channel only!!)
You will encounter some problems in the first couple PCB's in your life, but troubleshooting can be a fun learning tool when it's not so frustrating!
3D Case and Results!




I used Fusion 360 to design a small two part enclosure for my board to make sure it doesn't get destroyed while I transport it to the University and back specially that it has ESD sensitive components!
The board did it job! I got a Sinus out of it with 1MHz stable and up to 2MHz (More than intended!) and the voltage was between +/-1V variable. The wave shape can be changed using the buttons on the CMOD S7.
Throughout soldering/measuring and evaluating the board I had to make a few changes on the resistors/capacitors and remove some of them that were either unnecessary or had the wrong value!
If you have any interest or questions feel free to contact me on my email: arori.yazan@gmail.com.
This PCB is open hardware! Email me if you want the Gerber files!
Let the Hardware be always Open!