Skip to the content
2 layers90 × 60 mmFrontend test, the printed circuit board in 3D

Repository for the development of an FPGA based DSP Lock-In Amplifier

Size
90 × 60 mm
Copper layers
2
Thickness
1.6 mm
Parts
47
Nets
48
Pads
162
Tracks, vias
247, 65
Pours
6
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
29 Aug 2019
Updated
11 May 2023

Overview

Frontend test is an open-source printed circuit board by nkrackow, from the nkrackow/SingularitySurfer-FPGA-Lock-In-Amplifier repository on GitHub, published under the MIT licence. It is a 2-layer board of 90 × 60 mm with 47 parts on 48 nets, routed with 247 tracks and 65 vias.

It is built around the AD8253ARM and AD8675AR. Its parts include 23 capacitors, 10 resistors, 6 ICs, 4 connectors and 3 diodes.

Main components

2

README

README.md

SingularitySurfer: An FPGA Lock-In Amplifier

Repository of an FPGA based DSP Lock-In Amplifier.

Fotos:

Board front Board sinde Measuring the change of phase due to changing the distance of two speakers (of which one functions as a crappy microphone): Measuring the change of phase due to the distance of two speakers (of which one functions as a crappy microphone)

Block Diagram:

Block Diagram

Overview:

Lock-In amplifiers are a very useful tool in many physics and bio experiments where your signal of interest might be covered by a lot of noise and interference. It does so by effectively correlating out the signal of interest. As analog components are always subject to noise, drift and non-linearities, performance in a DSP Lock-In can be far superior. The project leverages the affordable ICE40 FPGA with its fully open source toolchain to implement the digital signal processing. Analog components are implemented in a manner that strikes a balance between performance and cost. As the analog frontend mostly determines the overall performance, a focus was put on its implementation. The total BOM cost is below 70€. The SingularitySurfer was developed as a personal learning platform that I share so others can get design ideas and see my approach. It does not intend to give reference designs or to teach the subject. Cores from other people:

The next sections will describe the features of the various sub-systems, their development and the design decisions made.

Digital architecture:

All of the FPGA cores run at a 36MHz base clock and the numeric oscillator, DDS, PLL and DACs also run at this sample frequency. However the ADC samples at 900kHz and the digital filters further downsample the signal by a factor of 1024. The DDS and the ADC produce signed 16 bit signals, while the output of the multipliers and filters are signed 32 bit. The phase signals from the PLL and oscillator are 18 bit. Due to FPGA LUT constraints, the CORDIC core only uses signed 16bit precision and the algorithm is terminated after 9 iterations. Most of the cores, especially the CORDIC core, make use of pipelining to maintain the 36MHz clock. The full design takes up about 85% of the FPGA LUTs.

FPGA:

The Lattice ICE40UP5K is an ideal platform for a small DSP project like this. It offers:

  • sufficient LUTs for all of the wiring, UI, display and housekeeping
  • 8 16x16 hardware multipliers for signal processing
  • 1Mbit of internal SRAM for storing a high fidelity sine lookup table
  • QFP package which is easily soldered by hand
  • affordable price at just 5€
  • fully open source toolchain!

Analog frontend:

As all of the digital signal processing is deterministic and can be upgraded at a later point, the Lock-In’s performance is ultimately determined by the analog frontend. The goal is to transfer the signal into the digital domain with little disturbance. This requires high dynamic range, low noise and high linearity. But as cost was also a factor in the development, compromises had to be made. The design employs:

  • ADC: MCP33131D, 1MSps, 16bit, 91.3dB SNR
  • Voltage reference: REF5050, low noise, low drift
  • PGA: AD8253, 0-60dB gain, low distortion, low noise, instrumentation amplifier
  • OpAmp: AD8675, low noise
  • Voltage regulator: LT3032-15, dual +-15V, low noise

At the input there is a 100kHz RC lowpass and the ADC AA filter is tuned to 100kHz as well. The PGA doubles as the ADC driver, using the AD8675 to make the signal differential. This setup was used to cut the cost of a dedicated ADC driver. Unfortunately it does limit performance, as it does introduce some distortion due to the PGA output not being fast enough to drive the ADC (which is not critical as distortion is essentially the same as noise well outside the passband of the digital lowpass). Broadband noise from the analog components was below the quantization noise and therefore not visible at the ADC output.

DDS and numeric oscillator:

The direct digital synthesis core generates a digital representation of a sinusoidal using a 1/4 sinus look-up table stored in the 1Mbit SRAM. The other 3/4 of the sine and the cosine can be easily generated from the first 1/4 using symmetries. Therefore a high fidelity, 16bit amplitude, 18bit phase representation of the sinusoidals can be generated. When using an external reference signal, the DDS uses the phase of the digital PLL locked to the external reference signal. When generating its own reference signal, a numeric oscillator with an internal 32bit phase accumulator is employed. In order to avoid spurious tones in the output spectrum of the DDS when using the internal oscillator, dithering of the last phase-bit is applied using a linear-feedback shift register. Unfortunately the ICE40 SRAM blocks don't support initial values in the FPGA bitstream. Therefore the look-up table is permanently stored in the external SPI flash and loaded into SRAM after every startup.

DAC:

As the Lock-In’s performance is not dependent on the output reference signal (as long as it contains a strong spectral component exactly at the reference frequency and other spectral components are masked by the noise added in the DUT), a basic sigma-delta DAC is used. Same goes for the X/R and Y/Theta "baseband" outputs, as they are essentially just DC (however DC accuracy has to be considered here) . The sigma-delta DACs require just a single FPGA pin and a passive second order lowpass with buffered output as external hardware in order to generate analog signals. Inside the FPGA the DAC uses a basic first-order sigma-delta modulator. With a modulator frequency of 36 MHz and 100kHz lowpass cutoff, the SNR is still better than 60dB. However switching many single-ended FPGA pins at these frequencies might lead to high EMI emissions. This was tried to be avoided by placing the lowpass filter close to the FPGA pins.

PLL (experimental):

The all-digital PLL gets a clean digital input signal by the use of a Schmitt-Trigger at the reference input. It uses a 32bit phase accumulator and 17bit phase increment word which leads to good phase precision. The DP controller can update the phase increment word without the need for multipliers by simply bit shifting the error signals. The controller can therefore only be tuned very coarsely which was done by simple trial and error. With this setup the controller can lock and track any reference signal between 500Hz and 100kHz. However it can get stuck in "limbo" with an aperiodic input signal and needs a reset to recover.

Multipliers and CIC filter:

Twor 16x16 hardware multipliers directly "mix" the incoming ADC samples with the sine/cosine signals from the DDS core. The output is therefore a 32bit signal at ADC sampling speed. This signal needs to be lowpass filtered to get rid of the undesired mixing products, ideally with a very low cutoff frequency (i.e. long time-constant). At ADC sampling speed this would require a lot of memory. But as the desired signal is bandlimited to a very low frequency (10s or 100s of Hz), a high sampling rate is unnecessary. A cascaded integrator comb (CIC) filter can downsample and lowpass filter the signal at the same time. Furthermore the cutoff frequency can easily be changed in powers of two and it doesn’t require hardware multipliers. The downside is that the frequency response is far from an ideal lowpass. Fortunately in the case of the lock-in, this is not critical, as the cutoff frequencies are so low and the upper mixer output products are far higher than fc (it will just let more noise through which can be counteracted by a longer filter time constant). In fact right now, only a single IC stage is used in the SingularitySurfer, as there is already not enough memory for a second integrator. A good improvement would be to follow the CIC with an IIR filter using the remaining hardware multipliers.

(update 2020) Multiplier less IIR filter

The SingularitySurfer was recently upgraded with a better lowpass using a very clever first order IIR filter. It uses the fact that you can multiply by a number close to 1 with bitshifting in hardware. E.g x*(15/16) can be accomplished via x-(x>>4). See PYTHON_FILTER for a python demonstration.

CORDIC:

The CORDIC algorithm computes the angle and magnitude of the sine and cosine signals. The original core by Dale Dickard was extended to support full 360 degree rotation and modified to fit into the remaining ICE40 logic.

Display and UI:

The display allows direct monitoring of the Lock-In outputs and user interaction with the UI. The UI is controlled via four buttons on the side of the display. This way the user can navigate through the device settings:

  • Filter time constant: between 2^0 and 2^15 milliseconds
  • PGA gain: 0dB, 20dB, 40dB, 60dB
  • Internal/external reference
  • Internal reference frequency: 500Hz, 1kHz, 2kHz, 5kHz, 10kHz, 20kHz, 50 kHz, 100kHz
  • Internal reference output amplitude: 0.45V, 0.9V, 1.6V, 3.3V (peak to peak)

The signal monitoring can easily be switched between X/Y and R/θ view. The display is a simple 2x16 character LCD display with built-in character ROM. Unfortunately, the maximum update rate of such a display is about 2Hz. A higher update rate would lead to a more direct user feedback when monitoring signals. The logic to drive the display, show text, decimal numbers, etc., is actually not trivial and a small embedded processor could be a better idea in a future project.

Parts

47
QtyValueFootprintReferences
1310uCapacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolderC2, C5, C7, C8, C9, C10, C11, C13, C19, C20, C21, C22, C23
10RResistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolderR1, R2, R3, R4, R5, R6, R7, R8, R9, R10
7CCapacitor_SMD:C_1206_3216Metric_Pad1.42x1.75mm_HandSolderC3, C4, C12, C14, C15, C16, C17
210nCapacitor_SMD:C_1206_3216Metric_Pad1.42x1.75mm_HandSolderC1, C6
2D_Schottky_x2_Serial_AKCPackage_TO_SOT_SMD:SOT-23D1, D2
11uCapacitor_SMD:C_1206_3216Metric_Pad1.42x1.75mm_HandSolderC18
1AD8253Package_SO:MSOP-10_3x3mm_P0.5mmU1
1AD8675Package_SO:MSOP-8_3x3mm_P0.65mmU5
1AP2114-1.8Package_TO_SOT_SMD:SOT-223U3
1Conn_01x02Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_VerticalJ2
1Conn_01x03Connector_JST:JST_EH_B3B-EH-A_1x03_P2.50mm_VerticalJ4
1Conn_02x10_Top_BottomConnector_PinHeader_2.54mm:PinHeader_2x10_P2.54mm_VerticalJ3
1Conn_CoaxialConnector_Coaxial:SMA_Molex_73251-2200_HorizontalJ1
1D_ZenerDiode_SMD:D_SOD-323D3
1LT3032-15SingularitySurfer:DFN-14-1EP_split_bottom_pad_3x4mm_P0.5mm_EP1.7x3.3mmU4
1MCP33131DPackage_SO:MSOP-10_3x3mm_P0.5mmU2
1REF5050ADPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU6

The 46 most common of 47 parts.

More from nkrackow/SingularitySurfer-FPGA-Lock-In-Amplifier

1
  • 2 layers120 × 130 mmSingularitySurfer V1, the printed circuit board in 3D

    SingularitySurfer V1

    nkrackow/SingularitySurfer-FPGA-Lock-In-Amplifier

    Repository for the development of an FPGA based DSP Lock-In Amplifier

    174 parts80MIT

Similar boards

  • 2 layers160 × 120 mmSTM, the printed circuit board in 3D

    STM

    jherkenhoff/STM

    DIY scanning tunneling microscope (STM)

    307 parts88
  • 2 layers145 × 98 mmStmshieldfull, the printed circuit board in 3D

    Stmshieldfull

    sgenomics/pcbs

    There are my personal PCBs... contact me for licensing information.

    178 parts2
  • 2 layers160 × 136.5 mmSchematic Backup 9, the printed circuit board in 3D

    Schematic Backup 9

    PickyPointer/SrE

    the SrE software suite - with more jimmies

    140 parts1
  • 2 layers30 × 61.3 mmModuleV450, the printed circuit board in 3D

    ModuleV450

    stuartpittaway/diyBMSv4

    Version 4 of the diyBMS

    47 parts1.1k
  • 2 layers114 × 61.4 mmLHS Breakbeat, the printed circuit board in 3D

    LHS Breakbeat

    lhndo/LH-Stinger

    Fast, Precise, Cartesian, FDM 3D Printer

    47 parts1.1k
  • 2 layers80 × 35 mmV0 Display RP2040, the printed circuit board in 3D

    V0 Display RP2040

    VoronDesign/Voron-Hardware

    Cool Hardware designed by the Voron Design group

    47 parts1.1kGPL-3.0
  • 2 layers100 × 66.7 mmMacroPad1, the printed circuit board in 3D

    MacroPad1

    hackclub/OnBoard

    💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

    47 parts915

Questions

How big is the Frontend test PCB?

It measures 90 × 60 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Frontend test use?

47 parts, built around the AD8253ARM and AD8675AR. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Frontend test KiCad files?

From the nkrackow/SingularitySurfer-FPGA-Lock-In-Amplifier repository on GitHub, at the commit this page was made from: the board is BOARD/Frontend_test/Frontend_test.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Frontend test design in my own project?

Its repository publishes it under the MIT licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).