Skip to the content
2 layers120 × 130 mmSingularitySurfer V1, the printed circuit board in 3D

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

Size
120 × 130 mm
Copper layers
2
Thickness
1.6 mm
Parts
174
Nets
119
Pads
560
Tracks, vias
1,227, 415
Pours
12
Routed
Yes
KiCad
KiCad 5 (file 20171130)
Created
29 Aug 2019
Updated
11 May 2023

Overview

SingularitySurfer V1 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 120 × 130 mm with 174 parts on 119 nets, routed with 1,227 tracks and 415 vias.

It is built around the ICE40UP5K-SG48ITR50, 74LVC1G17Z and AD8253ARM, with the AD8675AR, BD81870EFV-ME2 and OPA1679ID among its other parts. Its parts include 64 capacitors, 13 ICs, 12 diodes, 2 inductors and 1 connector. It belongs with the FPGA and CPLD boards of this library.

Main components

9

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

174
QtyValueFootprintReferences
39RResistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder , R1, R2, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, R22 +23
38CCapacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolderC2, C3, C10, C11, C12, C13, C14, C15, C16, C17, C18, C26, C27, C28, C29, C31 +22
18CCapacitor_SMD:C_1206_3216Metric_Pad1.42x1.75mm_HandSolderC1, C4, C19, C20, C21, C22, C23, C24, C25, C36, C37, C38, C39, C40, C41, C42 +2
9TestPointTestPoint:TestPoint_Keystone_5000-5004_Miniature , , , , , , , ,
7D_Schottky_x2_Serial_AKCPackage_TO_SOT_SMD:SOT-23D4, D9, D10, D11, D14, D15, D17
6Conn_CoaxialConnector_Coaxial:SMA_Molex_73251-2200_Horizontal , , , , ,
6LEDLED_SMD:LED_0805_2012Metric_Pad1.15x1.40mm_HandSolder , , , , ,
5CCapacitor_SMD:C_0402_1005MetricC30, C52, C61, C62, C63
4MountingHole_2.2mm_M2_DIN965_PadMountingHole:MountingHole_2.2mm_M2_DIN965_Pad , , ,
4SW_PushButton_Switch_THT:SW_PUSH-12mm-1, +1, MENU1, SET1
210uCapacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolderC33, C34
2Conn_01x02Connector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical ,
2Conn_01x03Connector_JST:JST_EH_B3B-EH-A_1x03_P2.50mm_Vertical , J13
2DDiode_SMD:D_2010_5025Metric_Pad1.52x2.65mm_HandSolderD1, D2
2D_ZenerDiode_SMD:D_SOD-323D13, D16
2INDUCTORInductor_SMD:L_Taiyo-Yuden_NR-40xx_HandSolderingL1, L2
11uCapacitor_SMD:C_1206_3216Metric_Pad1.42x1.75mm_HandSolderC35
174LVC1G17Package_TO_SOT_SMD:SOT-23-5_HandSolderingU6
1AD8253Package_SO:MSOP-10_3x3mm_P0.5mmU12
1AD8675Package_SO:MSOP-8_3x3mm_P0.65mmU11
1AP2114-1.8Package_TO_SOT_SMD:TO-252-3_TabPin2U14
1BD81870EFVPackage_SO:SSOP-20_4.4x6.5mm_P0.65mmU1
1Conn_01x02_MaleConnector_PinHeader_2.54mm:PinHeader_1x02_P2.54mm_Vertical
1Conn_01x04_MaleConnector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical
1Conn_01x12Connector_PinHeader_2.54mm:PinHeader_1x12_P2.54mm_Vertical
1DDiode_SMD:D_SOD-123FD3
1DFA-S11Oscillator:Oscillator_SMD_Fordahl_DFAS11-4Pin_7.0x5.0mmX1
1ICE40UP5K-SG48ITRSingularitySurfer:QFN-48-1EP_7x7mm_P0.5mm_EP5.6x5.6mmU5
1LOGOSingularitySurfer_Logo:SingularitySurfer_LogoG***
1LOGOSingularitySurfer_Logo:radiationG***
1LT3032SingularitySurfer:DFN-14-1EP_split_bottom_pad_3x4mm_P0.5mm_EP1.7x3.3mmU13
1MCP33131DPackage_SO:MSOP-10_3x3mm_P0.5mmU9
1MIC5504-3.3YM5Package_TO_SOT_SMD:SOT-23-5_HandSolderingU2
1OPA1679Package_SO:SOIC-14_3.9x8.7mm_P1.27mmU7
1REF5050ADPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU10
1SW_DIP_x01Button_Switch_THT:SW_CuK_JS202011AQN_DPDT_Angled
1SW_PushButton_Switch_THT:SW_PUSH_6mm
1TLV70212_SOT23-5Package_TO_SOT_SMD:SOT-23-5_HandSolderingU3
1USB_B_MicroConnector_USB:USB_Micro-B_Amphenol_10103594-0001LF_HorizontalJ1
1W25Q32JVSSPackage_SO:SOIC-8_5.23x5.23mm_P1.27mmU4
1WC1602ADisplay:WC1602A

The 173 most common of 174 parts.

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

1
  • 2 layers90 × 60 mmFrontend test, the printed circuit board in 3D

    Frontend test

    nkrackow/SingularitySurfer-FPGA-Lock-In-Amplifier

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

    47 parts80MIT

Similar boards

  • 2 layers77.5 × 50.8 mmPdb, the printed circuit board in 3D

    Pdb

    0x007E/pdb

    Power Development Board

    118 parts
  • 4 layers99.1 × 83.8 mmIbm-5151-pcb, the printed circuit board in 3D

    Ibm-5151-pcb

    asinghani/ibm-5151-controller

    Building a VT100 emulator out of an IBM 5151 monitor and an FPGA

    85 partsMIT
  • 2 layers25.6 × 0 mmIce40 wearable v1, the printed circuit board in 3D

    Ice40 wearable v1

    asinghani/ice40-wearable

    iCE40 FPGA boards in wearable form-factors

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

    STM

    jherkenhoff/STM

    DIY scanning tunneling microscope (STM)

    307 parts88
  • 2 layers47 × 55 mmPDH photodiode, the printed circuit board in 3D

    PDH photodiode

    TU-Darmstadt-APQ/PDH_photodiode

    Fast photodiode for PDH-laser-locking

    38 parts9
  • 2 layersCurry2, the printed circuit board in 3D

    Curry2

    etf-lth/rasdaq

    Rasdaq Raspberry Pi Data Acquisition: Hardware, Firmware, Tools

    168 parts2
  • 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

Questions

How big is the SingularitySurfer V1 PCB?

It measures 120 × 130 mm and has 2 copper layers, 1.6 mm thick.

What parts does the SingularitySurfer V1 use?

174 parts, built around the ICE40UP5K-SG48ITR50, 74LVC1G17Z, 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 SingularitySurfer V1 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/SingularitySurfer_V1/SingularitySurfer_V1.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the SingularitySurfer V1 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).