Author Topic: Homebrew Lock-In Amplifier  (Read 9411 times)

0 Members and 2 Guests are viewing this topic.

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #125 on: May 11, 2024, 02:33:45 pm »
I have no protoboards left to solder, so I have to place an order and wait. In the meantime I'm going to try to design a custom PCB for the assembly I already have done.
I have added one small change: another connection from the microcontroller to the integrator with a larger resistor so I can make two triangular waves. One of higher frequency than the other.
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #126 on: May 12, 2024, 07:17:50 am »
I found a small piece of prototyping board to solder and managed to assemble the analog part with SMD components.
« Last Edit: May 12, 2024, 07:27:57 am by Picuino »
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #127 on: May 12, 2024, 07:28:31 am »
I am starting it up and everything works fine except the amplifier gain, which is zero.
The amplifier output is always 2.5V, regardless of the input signal. I have checked continuity and the reference and output pins of the amplifier are not connected.
I have also re-soldered the 47 Ohm resistor on pins 2 and 3.
I don't know what to do anymore. The circuit was working fine on the breadboard.
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #128 on: May 12, 2024, 09:29:31 am »
I have changed the amplifier integrated for another one and it still does not amplify.
When I change the reference voltage (pin 6), the output voltage (pin 7, V_out) also changes with the same value. But the pins are not shorted together.

The negative input has a ramp signal of almost 5Vpp and the output maintain 2.5V of DC.

When I connect the ramped signal to the positive input and the negative input to ground, the output only increases in value when the positive input rises above 4 volts.

Attached:
Yellow = V_out
Blue = V_in+
V_in- = GND
 

Online gnuarm

  • Super Contributor
  • ***
  • Posts: 2234
  • Country: pr
Re: Homebrew Lock-In Amplifier
« Reply #129 on: May 12, 2024, 10:42:24 am »
I'm not completely following your description of what you are measuring.  When you say Vin+, is that pin 1 or pin 4 on the connector on the schematic?

You have a DC blocking cap on pin 1.  If you ground that connector pin, it will be only an AC ground.   What is the signal like on pin 1 of U1?
Rick C.  --  Puerto Rico is not a country... It's part of the USA
  - Get 1,000 miles of free Supercharging
  - Tesla referral code - https://ts.la/richard11209
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #130 on: May 12, 2024, 10:56:07 am »
Vin- = pin 1 U1 / pin 1 J4
Vin+ = pin 4 U1 / pin 4 J4

If I ground pin 4 by connecting it to pin 3 of J4, R3 grounds pin 1 also in DC.

EDIT:
The schematic is the same as the one I had mounted on the breadboard. Therefore the schematic should not have any errors.
« Last Edit: May 12, 2024, 11:00:23 am by Picuino »
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1270
  • Country: de
Re: Homebrew Lock-In Amplifier
« Reply #131 on: May 12, 2024, 11:27:46 am »
I think you are (significantly) overdriving the input. The input voltage range is only -0.1V...3V. If pin4 is grounded, the maximum AC input voltage on connector pin 1 would be 200mVpp. And even that would still drive the output into saturation (gain 1000).
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #132 on: May 12, 2024, 11:38:06 am »
Yes, I am overdriving the input. It is the only way to get the output to show variation. With any other smaller signal, the output remains unchanged at 2.5V.
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #133 on: May 12, 2024, 01:24:11 pm »
I have mounted on the breadboard another instrumentation amplifier circuit with an AD8421 to start from scratch.
https://www.analog.com/media/en/technical-documentation/data-sheets/ad8421.pdf
I continue to encounter problems. It does not amplify.

I don't know what the hell I'm doing wrong.
I've changed ICs, I've tried a different IC on the breadboard, I'm also trying it on solder board and in all cases the instrumentation amplifiers are not working.
And this after it was working yesterday without problems.

I'm pretty patient, but in this case I'm starting to get nervous.
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1270
  • Country: de
Re: Homebrew Lock-In Amplifier
« Reply #134 on: May 12, 2024, 01:55:32 pm »
Again, take care of the (rather narrow) input voltage range of the AD8421 with 5V single-supply. See red curve in figure 14 of the datasheet.
You need to bias the inputs with a common mode voltage of about 3V above the negative supply rail (which is GND in your case). 2.5V is already outside the range.
The other opamp was better suited for 5V single-supply.
« Last Edit: May 12, 2024, 01:58:27 pm by gf »
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #135 on: May 12, 2024, 02:18:12 pm »
I mounted the first AD8220 I removed, again on the breadboard. Now it works correctly.

Conclusion: The AD8220 integrated circuits work correctly, but what doesn't work is the soldered PCB and I don't know why.
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #136 on: May 12, 2024, 02:35:27 pm »
Eureka, I got it.
The breadboard at the top has pads that connect to the bottom. I had trimmed the pins of R1 on the AD8220 board, but it was still making connection to the bottom of the board.
Diagnosis: Rg (R1) shorted to ground.
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #137 on: May 12, 2024, 03:34:39 pm »
I already have readings from several components

Program:
Code: [Select]
/*
   Version 4.4 (12/05/2024)

   Copyright 2024 Picuino

   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software and associated documentation files (the "Software"), to deal
   in the Software without restriction, including without limitation the rights
   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   copies of the Software, and to permit persons to whom the Software is
   furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included
   in all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
   IN THE SOFTWARE.
*/
#include <stdint.h>

#define CLK_BOARD  16000000
#define UART_BAUDS  115200
#define MEASURE_TIME  1.0

#define PIN_SIGNAL_OUT 3
#define PIN_DEBUG_OUT 5
#define PIN_ANALOG  A6
#define PIN_ANALOG_MUX 6

#define PIN_SCK  13
#define PIN_SDI  12
#define PIN_CNV  10

#define SAMPLES_16

#ifdef  SAMPLES_32
#define SAMPLES_PER_WAVE 32
#define ADC_PRESCALER (0b110)

#define TIMER2_PERIOD  220
#define TIMER2_FREQ  (CLK_BOARD / ((TIMER2_PERIOD + 1) * 64 * 2))

#define TIMER0_PERIOD (110 - 1)
#define TIMER0_PHASE_ADJUST (0.40)
#define TIMER0_FREQ  (CLK_BOARD / ((TIMER0_PERIOD + 1) * 8))

#define SAMPLES_PER_MEASURE (SAMPLES_PER_WAVE * (long) ((MEASURE_TIME) * (TIMER0_FREQ) / SAMPLES_PER_WAVE))

const float BOARD_CALIBRATION = 0.2520 / (SAMPLES_PER_MEASURE);  // Converts measure to milliohms
const float BOARD_PHASE_ADJUST = -0.1074;  // Radians adjust
const float BOARD_ADDED_RESISTOR = 0.0;  // Substract board probes resistor. Sistematic Error

const int16_t SIN_INTEGER[SAMPLES_PER_WAVE + SAMPLES_PER_WAVE / 4] = {
  5, 14, 23, 31, 38, 43, 47, 49,
  49, 47, 43, 38, 31, 23, 14, 5,
  -5, -14, -23, -31, -38, -43, -47, -49,
  -49, -47, -43, -38, -31, -23, -14, -5,
  5, 14, 23, 31, 38, 43, 47, 49,
};
#endif


#ifdef  SAMPLES_16
#define SAMPLES_PER_WAVE 16
#define ADC_PRESCALER (0b111)

#define TIMER2_PERIOD  220
#define TIMER2_FREQ  (CLK_BOARD / ((TIMER2_PERIOD + 1) * 64 * 2))

#define TIMER0_PERIOD (220 - 1)
#define TIMER0_PHASE_ADJUST (0.4)
#define TIMER0_FREQ  (CLK_BOARD / ((TIMER0_PERIOD + 1) * 8))

#define SAMPLES_PER_MEASURE (SAMPLES_PER_WAVE * (long) ((MEASURE_TIME) * (TIMER0_FREQ) / SAMPLES_PER_WAVE))

const float BOARD_CALIBRATION = 0.2512 / (SAMPLES_PER_MEASURE);  // Converts measure to milliohms
const float BOARD_PHASE_ADJUST = +0.1074;  // Radians adjust
const float BOARD_ADDED_RESISTOR = 69.0;  // Substract board probes resistor. Sistematic Error

const int16_t SIN_INTEGER[SAMPLES_PER_WAVE + SAMPLES_PER_WAVE / 4] = {
  9, 26, 39, 46,
  46, 39, 26, 9,
  -9, -26, -39, -46,
  -46, -39, -26, -9,
  9, 26, 39, 46,
};
#endif


volatile int32_t adc_acc_inphase;
volatile int32_t adc_acc_quadrature;
volatile int32_t adc_samples;
volatile uint8_t adc_measuring;
volatile uint8_t level_state;
volatile uint8_t level_state_old;

float impedance_inphase;
float impedance_quadrature;
float impedance_sign;


void setup() {
  Serial.begin(UART_BAUDS);

  // Set up output reference signal pin
  pinMode(PIN_SIGNAL_OUT, OUTPUT);
  pinMode(PIN_DEBUG_OUT, OUTPUT);

  // Print initial info
  print_info();

  // Set up peripherals
  timer0_setup();
  timer2_setup();
  timer_synchronize();
  adc_setup();

  // Inits measure
  measure_init();
  while (adc_measuring == 1);
  measure_init();
}


void loop() {
  // Main Loop
  while (1) {
    if (adc_measuring == 0) {
      read_float_values();
      phase_adjust();
      print_values();

      measure_init();
    }
  }
}


void read_float_values(void) {
  // Read accumulator values
  impedance_inphase = -adc_acc_inphase;
  impedance_quadrature = -adc_acc_quadrature;

  // Rescale values
  impedance_inphase *= BOARD_CALIBRATION;
  impedance_quadrature *= BOARD_CALIBRATION;
}


void phase_adjust(void) {

  // Get impedance sign
  if (impedance_quadrature > 0) {
    impedance_sign = 1;
  }
  else {
    impedance_sign = -1;
  }
  impedance_quadrature = abs(impedance_quadrature);

   
  // Phase adjust
  float module = sqrt(impedance_inphase * impedance_inphase + impedance_quadrature * impedance_quadrature);
  float phase;
  if (abs(impedance_inphase) < 0.1) {
    phase = 90;
  }
  else {
    phase = atan(impedance_quadrature / impedance_inphase);
  }
  phase *= impedance_sign;
  phase += BOARD_PHASE_ADJUST;
  impedance_inphase = module * cos(phase);
  impedance_quadrature = module * sin(phase);
 
  // Get new impedance sign
  if (impedance_quadrature > 0) {
    impedance_sign = 1;
  }
  else {
    impedance_sign = -1;
  }
  impedance_quadrature = abs(impedance_quadrature);
 
  // Substract board resistance (sistematic error)
  impedance_inphase -= BOARD_ADDED_RESISTOR;
}



void print_info(void) {
  Serial.println();
  Serial.print("SAMPLE_FREQUENCY = ");
  Serial.print(1.0 * TIMER0_FREQ);
  Serial.println(" Hz");

  Serial.print("MEASURE_SIGNAL_FREQUENCY = ");
  Serial.print(1.0 * TIMER2_FREQ);
  Serial.println(" Hz");

  Serial.print("SAMPLE_TIME = ");
  Serial.print(1.0 * SAMPLES_PER_MEASURE / TIMER0_FREQ);
  Serial.println(" s");
}


void print_values(void) {
  Serial.print(impedance_inphase, 1);
  Serial.print("\tmOhm R  \t");

  if (impedance_sign > 0) {
    Serial.print(impedance_quadrature, 1);
    Serial.print("\tmOhm Z_L \t");
    if (impedance_quadrature > 5.0) {
      Serial.print(impedance_quadrature * 1000.0 / (TIMER2_FREQ * 2.0 * 3.1415927));
      Serial.println("\tuHenrys");
    }
    else {
      Serial.println();
    }
  }
  else {
    Serial.print(impedance_quadrature, 1);
    Serial.print("\tmOhm Z_C \t");
    if (impedance_quadrature > 5.0) {
      Serial.print(1000000000.0 / (impedance_quadrature * TIMER2_FREQ * 2.0 * 3.1415927));
      Serial.println("\tuFarads");
    }
    else {
      Serial.println();
    }
  }
}


void adc_setup(void) {
  analogRead(PIN_ANALOG);
  cli(); // Stop interrupts

  ADMUX = (1 << 6) |
          (0 << ADLAR) |
          (PIN_ANALOG_MUX << 0);
  ADCSRA = (1 << ADEN) |
           (0 << ADSC) |
           (0 << ADATE) |
           (0 << ADIE) |
           (ADC_PRESCALER);  // Division factor
  ADCSRB = 0x00;

  sei(); // Allow interrupts
}


void measure_init(void) {
  delayMicroseconds(1000);
  cli();
  adc_acc_inphase = 0;
  adc_acc_quadrature = 0;
  level_state = SAMPLES_PER_WAVE * 0.25;
  level_state_old = 0;
  adc_samples = 0;
  ADCW = 0;
  sei();

  while ((PIND & (1 << PIN_SIGNAL_OUT)) != 0);
  while ((PIND & (1 << PIN_SIGNAL_OUT)) == 0);
  adc_measuring = 1;
}


void timer0_setup(void) {
  cli(); // Stop interrupts

  // set compare match register
  TCCR0A = (0 << 6) | // OOM0A. 0=OC0A disconnected. 1=Toggle OC0A on compare match (p.84)
           (0 << 4) | // COM0B. 0=OC0B disconnected. 1=Toggle OC0B on compare match (p.85)
           (2 << 0);  // WGM0.  PWM mode. 1=phase correct 2=CTC  (p.86)
  TCCR0B = (0 << 7) | // FOC0A.
           (0 << 6) | // FOC0B.
           (0 << 3) | // WGM02.
           (2 << 0);  // CLOCK source.
  OCR0A = TIMER0_PERIOD;
  OCR0B = TIMER0_PERIOD / 2;
  TIMSK0 = (0 << 2) | // OCIE0B. Match B Interrupt Enable
           (1 << 1) | // OCIE0A. Match A Interrupt Enable
           (0 << 0);  // TOIE0. Overflow Interrupt Enable
  TIFR0 = 0;
  TCNT0 = 0; // Initialize Timer0 counter

  sei(); // Allow interrupts
}


void timer2_setup(void) {
  cli(); // Stop interrupts

  TCCR2A = (1 << 6) | // OOM2A. 0=OC2A disconnected. 1=Toggle OC2A on compare match (p.128)
           (2 << 4) | // COM2B. 2=Clear OC2B on compare match (p.129)
           (1 << 0);  // WGM2.  PWM mode. 1=phase correct   (p.130)
  TCCR2B = (0 << 7) | // FOC2A.
           (0 << 6) | // FOC2B.
           (1 << 3) | // WGM22.
           (4 << 0);  // CLOCK source.
  OCR2A = TIMER2_PERIOD;
  OCR2B = TIMER2_PERIOD / 2;
  TIMSK2 = (0 << 2) | // OCIE2B. Match B Interrupt Enable
           (0 << 1) | // OCIE2A. Match A Interrupt Enable
           (0 << 0);  // TOIE2. Overflow Interrupt Enable
  TIFR2 = 0;
  TCNT2 = 0; // Initialize Timer2 counter

  sei(); // Allow interrupts
}


void timer_synchronize(void) {
  cli(); // Stop interrupts
  GTCCR = (1 << TSM) | (1 << PSRASY) | (1 << PSRSYNC); // halt all timers
  TCNT0 = 0; // Initialize Timer0 counter
  TCNT2 = 0; // Initialize Timer2 counter
  GTCCR = 0; // release all timers
  sei(); // Allow interrupts

  while ((PIND & (1 << PIN_SIGNAL_OUT)) != 0);
  while ((PIND & (1 << PIN_SIGNAL_OUT)) == 0);

  TCNT0 = TIMER0_PERIOD * TIMER0_PHASE_ADJUST; // Initialize Timer0 counter
}


// Timer0 interrupt handler
ISR(TIMER0_COMPA_vect) {
  int16_t adc_value;

  if (adc_measuring == 1) {

    // ADC Start Conversion
    ADCSRA |= (1 << ADSC);

    // Read last conversion
    adc_value = ADCW;

    // Accumulate values (10us)
    adc_acc_inphase += (int32_t) adc_value * SIN_INTEGER[level_state_old];
    adc_acc_quadrature += (int32_t) adc_value * SIN_INTEGER[level_state_old + SAMPLES_PER_WAVE / 4];


    // Update next state
    level_state_old = level_state;
    level_state++;
    if (level_state >= SAMPLES_PER_WAVE)
      level_state = 0;

    adc_samples++;
    if (adc_samples > SAMPLES_PER_MEASURE) {
      adc_measuring = 0;
    }
  }
}


// Timer2 interrupt handler
ISR(TIMER2_COMPA_vect) {

}


void debug_pin_pulse(void) {
  PORTD |= (1 << PIN_DEBUG_OUT);
  delayMicroseconds(4);
  PORTD &= ~(1 << PIN_DEBUG_OUT);
}



Resistor 1 ohm 5% (I have calibrated the board so that this component gives an accurate value):
Code: [Select]
SAMPLE_FREQUENCY = 9090.00 Hz
MEASURE_SIGNAL_FREQUENCY = 565.00 Hz
SAMPLE_TIME = 1.00 s
1001.3 mOhm R  0.4 mOhm Z_C
1001.3 mOhm R  0.5 mOhm Z_C
1001.4 mOhm R  0.4 mOhm Z_C
1001.2 mOhm R  0.3 mOhm Z_C
1001.2 mOhm R  0.4 mOhm Z_C
1001.3 mOhm R  0.4 mOhm Z_C
1001.3 mOhm R  0.4 mOhm Z_C
1001.2 mOhm R  0.4 mOhm Z_C
1001.1 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.8 mOhm R  0.4 mOhm Z_C
1001.0 mOhm R  0.4 mOhm Z_C
1001.0 mOhm R  0.4 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.4 mOhm Z_C
1001.0 mOhm R  0.4 mOhm Z_C
1000.7 mOhm R  0.4 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.6 mOhm R  0.2 mOhm Z_C
1000.9 mOhm R  0.2 mOhm Z_C
1000.7 mOhm R  0.1 mOhm Z_C
1000.9 mOhm R  0.2 mOhm Z_C
1000.7 mOhm R  0.2 mOhm Z_C
1000.8 mOhm R  0.2 mOhm Z_C
1000.8 mOhm R  0.2 mOhm Z_C
1000.8 mOhm R  0.3 mOhm Z_C
1000.8 mOhm R  0.4 mOhm Z_C
1001.0 mOhm R  0.3 mOhm Z_C
1000.7 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.8 mOhm R  0.3 mOhm Z_C
1000.7 mOhm R  0.3 mOhm Z_C
1000.8 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.8 mOhm R  0.4 mOhm Z_C
1000.9 mOhm R  0.2 mOhm Z_C
1000.7 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.9 mOhm R  0.3 mOhm Z_C
1000.6 mOhm R  0.3 mOhm Z_C
1000.8 mOhm R  0.4 mOhm Z_C
1000.7 mOhm R  0.3 mOhm Z_C


Capacitor 1000uF 16V 20%:
Code: [Select]
-0.7 mOhm R  310.7 mOhm Z_C 906.69 uFarads
-0.8 mOhm R  310.3 mOhm Z_C 907.67 uFarads
-0.8 mOhm R  310.6 mOhm Z_C 906.91 uFarads
-1.0 mOhm R  310.3 mOhm Z_C 907.80 uFarads
-1.1 mOhm R  310.3 mOhm Z_C 907.90 uFarads
-1.2 mOhm R  310.2 mOhm Z_C 908.01 uFarads
-1.2 mOhm R  310.4 mOhm Z_C 907.49 uFarads
-1.2 mOhm R  310.3 mOhm Z_C 907.87 uFarads
-1.4 mOhm R  310.3 mOhm Z_C 907.79 uFarads
-1.3 mOhm R  310.4 mOhm Z_C 907.46 uFarads
-1.3 mOhm R  310.3 mOhm Z_C 907.76 uFarads
-1.4 mOhm R  310.3 mOhm Z_C 907.71 uFarads
-1.2 mOhm R  310.3 mOhm Z_C 907.75 uFarads
-1.3 mOhm R  310.3 mOhm Z_C 907.92 uFarads
-1.4 mOhm R  310.2 mOhm Z_C 908.22 uFarads
-1.3 mOhm R  310.3 mOhm Z_C 907.94 uFarads
-1.3 mOhm R  310.1 mOhm Z_C 908.40 uFarads
-1.5 mOhm R  310.3 mOhm Z_C 907.85 uFarads
-1.4 mOhm R  310.2 mOhm Z_C 908.20 uFarads
-1.4 mOhm R  310.2 mOhm Z_C 908.20 uFarads
-1.4 mOhm R  310.2 mOhm Z_C 907.98 uFarads
-1.5 mOhm R  310.5 mOhm Z_C 907.36 uFarads
-1.4 mOhm R  310.3 mOhm Z_C 907.77 uFarads
-1.4 mOhm R  310.3 mOhm Z_C 907.85 uFarads
-1.4 mOhm R  310.2 mOhm Z_C 908.01 uFarads


Inductance 68uH 20%:
Code: [Select]
35.0 mOhm R  171.1 mOhm Z_L 48.20 uHenrys
35.1 mOhm R  171.1 mOhm Z_L 48.20 uHenrys
34.8 mOhm R  170.5 mOhm Z_L 48.03 uHenrys
34.7 mOhm R  170.6 mOhm Z_L 48.04 uHenrys
35.0 mOhm R  171.0 mOhm Z_L 48.17 uHenrys
34.8 mOhm R  171.0 mOhm Z_L 48.18 uHenrys
34.8 mOhm R  170.8 mOhm Z_L 48.11 uHenrys
34.8 mOhm R  170.7 mOhm Z_L 48.08 uHenrys
34.4 mOhm R  170.2 mOhm Z_L 47.95 uHenrys
34.5 mOhm R  169.9 mOhm Z_L 47.85 uHenrys
34.1 mOhm R  169.7 mOhm Z_L 47.80 uHenrys
34.2 mOhm R  169.8 mOhm Z_L 47.83 uHenrys
34.1 mOhm R  169.7 mOhm Z_L 47.79 uHenrys
34.2 mOhm R  170.0 mOhm Z_L 47.87 uHenrys
34.1 mOhm R  169.9 mOhm Z_L 47.87 uHenrys
34.1 mOhm R  170.0 mOhm Z_L 47.88 uHenrys
34.2 mOhm R  169.9 mOhm Z_L 47.87 uHenrys
34.1 mOhm R  170.0 mOhm Z_L 47.89 uHenrys
33.9 mOhm R  170.0 mOhm Z_L 47.88 uHenrys
34.1 mOhm R  170.1 mOhm Z_L 47.90 uHenrys
34.3 mOhm R  170.1 mOhm Z_L 47.90 uHenrys

Obviously I have to calibrate the board resistor better so that the capacitor shows its ESR.
But I like the preliminary results very much.
« Last Edit: May 12, 2024, 03:57:16 pm by Picuino »
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #138 on: May 12, 2024, 04:08:15 pm »
I think it's time to go further.

The initial purpose of this thread was to make a Lock-in Amplifier and for that I have to get a more generic instrument that is capable of generating a square signal and a sine signal of the same frequency. The instrument must samples faster and has a wider bandwidth.
Finally the outputs must be continuous and use a low pass filter.

I don't really know where to start. Perhaps making a multistage input amplifier so that the gain of each stage is lower and the total bandwidth is higher.
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #139 on: May 12, 2024, 04:12:31 pm »
I have placed an order for samples with Analog Devices and have been turned down because the shipping address is not a work address.
I will try to reorder the samples to have them shipped to work and if I get rejected again I will have to order them from Mouser or Digikey.
Components are not cheap, but more expensive is any other hobby. Even going out on a bike.
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1270
  • Country: de
Re: Homebrew Lock-In Amplifier
« Reply #140 on: May 12, 2024, 07:30:31 pm »
SAMPLE_FREQUENCY = 9090.00 Hz
MEASURE_SIGNAL_FREQUENCY = 565.00 Hz
SAMPLE_TIME = 1.00 s

Why 9090 Hz? It must be exactly 565 * 16, and that would be 9040.
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #141 on: May 12, 2024, 08:19:23 pm »
It is the result of rounding an integer operation. It is already corrected.
I have also corrected the working frequency, which could not be that high because the ADC operates at a somewhat lower frequency.

The following posts I am going to move them to a different thread that only deals with milliohm meter because in this thread I want to continue with other different setups more related to Lock-in Amplifiers.

New thread for milliohm meter: https://www.eevblog.com/forum/projects/milliohm-meter-picuino
« Last Edit: May 12, 2024, 08:32:02 pm by Picuino »
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1270
  • Country: de
Re: Homebrew Lock-In Amplifier
« Reply #142 on: May 13, 2024, 09:07:25 am »
I think it's time to go further.

The initial purpose of this thread was to make a Lock-in Amplifier and for that I have to get a more generic instrument that is capable of generating a square signal and a sine signal of the same frequency. The instrument must samples faster and has a wider bandwidth.
Finally the outputs must be continuous and use a low pass filter.

I don't really know where to start. Perhaps making a multistage input amplifier so that the gain of each stage is lower and the total bandwidth is higher.

Start by specifying your requirements in quantitative terms.
Which carrier frequency (or frequencies)? How much bandwidth? Which signal levels do you want to measure?
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #143 on: May 13, 2024, 10:07:19 am »
In this second assembly I want to get just a little bit more. With 100kHz bandwidth I will be satisfied.
Signal levels from 100nV (max resolution) to 100mV (full scale max input).
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
« Last Edit: May 13, 2024, 11:28:09 am by Picuino »
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1270
  • Country: de
Re: Homebrew Lock-In Amplifier
« Reply #145 on: May 13, 2024, 12:06:03 pm »
100nV and 100kHz bandwidth do not go well together.
If you aim for only 10dB SNR at a signal level of 100nV, we are talking about 0.1nV/sqrt(Hz) :phew:
Which opamp do you have in mind?
Maybe your rethink and lower your expectations?

Note that your current circuit can achieve the low noise level because the filter has such a low bandwidth.
(1Hz equivalent noise bandwidth with 1s measuring time)

And what is the desired carrier frequency?
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #146 on: May 13, 2024, 12:12:37 pm »
In principle I will experiment with the ADC of the board itself. I don't have any external ADC of that speed and I would have to work with an FPGA which I am not familiar with.
I will design a bandwidth around 100 khz and see how far the circuit can go.

EDIT:
The instrumentation amplifier will be the same AD8220 that I already have. I have not started with the design. I will try to use of the samples I have, while I look at new Opamps to place a new order.
« Last Edit: May 13, 2024, 12:22:03 pm by Picuino »
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14317
  • Country: de
Re: Homebrew Lock-In Amplifier
« Reply #147 on: May 13, 2024, 12:32:50 pm »
A lockin amplifier has a certain bandwidth for the input signal, that can be relatively large, like up to 100 kHz. That would be the maximum carrier frequency.
The other point is the bandwidth after the mixer / demodulator and output fitler. Here the bandwidth is usually relatively low (like 1 Hz  or 10 Hz) and thus low bandwidth is what allows for low noise.
With a digital implementation the filtering often is a FIR type / sliding average and not necessary a classic 1st / 2nd order low pass.

The ADC inside the STM32 is only 12 bit. This can be OK for some signals, but could be limiting with more demanding cases. To at least use most of the resolution one would than want fine (like 1:2) steps for the gain, and not just decades. It can would for a demonstartion / proof of principle, but would not be a really good instrument. AFAIR the early digital lock in amplifiers used 16 and 18 bit ADCs.

So far the example use as a mohm meter is using a carrier frequency that is generated from the same circuit. This is a common and easy case. A general lock-in would also allow an external signal (e.g. from a mechanical chopper). If one wants a mechanical chopper, one could still consider starting with the electronic clock and have a PLL type speed regulator for the motor.
 

Online gf

  • Super Contributor
  • ***
  • Posts: 1270
  • Country: de
Re: Homebrew Lock-In Amplifier
« Reply #148 on: May 13, 2024, 12:45:49 pm »
For the 3rd use case mentioned here
https://www.eevblog.com/forum/projects/homebrew-lock-in-amplifier/msg5475103/#msg5475103
it rather looks like the bandwidth after demodulation is expected to cover audio (i.e. at least 4 kHz, better 10+ kHz).
This rules out a narrow 1-10 Hz filter.

EDIT: And I wonder which kind of modulation the vibrations of the glass apply to to the excitation signal. Really AM? Isn't rather time of flight modulated, resulting in FM (Doppler effect)?
« Last Edit: May 13, 2024, 12:58:17 pm by gf »
 

Offline PicuinoTopic starter

  • Frequent Contributor
  • **
  • Posts: 913
  • Country: 00
    • Picuino web
Re: Homebrew Lock-In Amplifier
« Reply #149 on: May 13, 2024, 12:59:44 pm »
Making a Lock-in Amplifier similar to those currently on the market is beyond my intentions.
It would be very difficult and expensive, more so than buying a second hand LIA.
As the STM32 has 2 ADCs, one of them can be used to sample the reference signal and the other ADC to sample the input signal.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf