Author Topic: TeensyLCR – A Teensy based DIY LCR Meter  (Read 74888 times)

0 Members and 6 Guests are viewing this topic.

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #25 on: March 05, 2024, 05:27:15 pm »
And thank you for sharing the simulation.

At the moment I do not plan to make a redesign. The current design works well for frequencies up to 20kHz. I'll try to get more reliable results at 90 kHz with replaced opamps.
If it works, great. More than I expected. If not, then it is still a useful device. And I've learned a lot.  :-+
 

Offline jbb

  • Super Contributor
  • ***
  • Posts: 1335
  • Country: nz
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #26 on: March 06, 2024, 07:54:37 pm »
It looks like a really nice addition to the bench. It would be great to have the design files and software - even if they aren’t perfect :-).

I’m certainly tempted to make one of my very own. Considering a couple of mods:
- use a CODEC chip with built-in headphone amplifier (saves 2 opamps) and PGAs (saves 2 opamps and 2 muxes)
- replace the Teensy 4.1 with I.MX RT1024 or similar chip (smaller version of the Teensy 4.x microcontroller)

Edit: you'll laugh... I went through an exercise of trying assorted MUXes to find a good capacitance vs on resistance trade; I eventually found the MAX4052 was about the best fit :D
« Last Edit: March 06, 2024, 08:26:46 pm by jbb »
 

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #27 on: March 08, 2024, 08:03:03 pm »
Yeah, the classics are still good enough for this kind of stuff.

I will put everything on Github. Need to setup a Github account first...
 

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #28 on: March 10, 2024, 08:48:10 am »
Here are some insights about the phase calculation:

Teensy Audio System Design


A sine wave is send to audioOutI2S1 to get the sine wave signal source.
audioInI2S1 provides the I2S data from the CS4272 codec. Channel 1 is the measured voltage and channel 2 is the measured current.
Additional, there are two AudioSynthWaveform objects that create a unity magnitude square wave with 0° and 90° phase. Both are multiplied by the voltage and current signals respectively.

The phase is calculated by
Code: [Select]
phase = atan(mean2.read() / mean1.read()) - atan(mean4.read() / mean3.read());

// cap phase to +-90°
if (-phase > PI / 2) {
  phase = phase + PI;
}
if (phase > PI / 2) {
  phase = phase - PI;
}

The impedance is calulated by
Code: [Select]
impedance = analyzeRmsV.read() / analyzeRmsI.read();
The code lines are simplified. The actual code is a bit more complex due to analog level calibration and moving average calculation.

Basically the same math explained in the TIDA-060029.
 

Offline jbb

  • Super Contributor
  • ***
  • Posts: 1335
  • Country: nz
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #29 on: March 10, 2024, 09:34:18 pm »
That makes sense. I can see how using the Teensy audio system saves you a great deal of messing around in code.

Might I suggest that instead of atan(mean2.read() / mean1.read()) you try using atan2(mean2.read(), mean1.read()) ? It won’t blow up if mean1.read() happens to be (very close to) zero.
 
The following users thanked this post: WeTec

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #30 on: March 11, 2024, 08:46:06 pm »
Thanks jbb for the hint! This helped me to fix a bug where I get the correct phase but with wrong sign. Now the phase calculation looks like this:
Code: [Select]
phase = atan2(mean2.read(), mean1.read()) - atan2(mean4.read(), mean3.read());

// cap phase to +-90°
if (-phase > PI / 2) {
  phase = -PI - phase;
}
if (phase > PI / 2) {
  phase = PI - phase;
}

Further information: https://stackoverflow.com/questions/283406/what-is-the-difference-between-atan-and-atan2-in-c
 

Offline jbb

  • Super Contributor
  • ***
  • Posts: 1335
  • Country: nz
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #31 on: March 13, 2024, 07:22:49 pm »
I’m glad that helped! atan2 is a helpful one.

On further looking, I see you’re generating the excitation signal with ‘sine1’ and the mixer signals with ‘squarewave’ and ‘squarewave_90’… I wonder if this arrangement will be sensitive to 3rd, 5th harmonic tones in the measured signals? I would have expected the scheme to use ‘sine1’ and a new ‘sine_90’ signal.

Edit: you can also consider the mixer results (once low pass filtered) to be:
V1 = mean1 + j mean2
V2 = mean3 + j mean4

Thus:
mag(V1) = sqrt(mean1**2 + mean2**2)
mag(V2) = sqrt(mean3**2 + mean4**2)
Which may be a little less sensitive to noise than the RMS.
« Last Edit: March 13, 2024, 07:27:35 pm by jbb »
 

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #32 on: March 25, 2024, 06:54:12 pm »
I've replaced all opamps now:
  • U1, U4, U12 - OPA192
  • U5, U6 - OPA2192
  • U7, U8 - AD8032

I do not have any parts with known values at 90 kHz, so I cannot say much about accuracy. I also have no access to a real LCR meter so I cannot do measurements to compare. The only thing I can do is to measure 0.1 % resistors that I have in stock. The results are pretty good I think. About 2-3% of at 90kHz.

Here is a ESR measurement with a Würth capacitor WCAP-PT5H Aluminium-Polymer 180 µF:

Capacitor connected:


inputs shorted:


9 mOhm @ 90 kHz.
Pretty much close to the maximum value of 10 mOhm @ 100 kHz value from the datasheet.

(Ignore the Cs values. They are typically far of at 90 kHz.)
 

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #33 on: April 12, 2024, 06:23:10 pm »
The source code is public now! Please check the github project page: https://github.com/wschuma/TeensyLCR
 
The following users thanked this post: kripton2035, KE5FX, coromonadalix, Roehrenonkel

Offline KE5FX

  • Super Contributor
  • ***
  • Posts: 2635
  • Country: us
    • KE5FX.COM
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #34 on: April 12, 2024, 08:18:21 pm »
Nice job.  The ability to see multiple parameters on the display at once is attractive next to my TongHui LCR meter, which requires a lot of button-pushing in everyday use.  :-+
 
The following users thanked this post: WeTec

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #35 on: April 13, 2024, 11:03:14 am »
If someone (including me) wants to do a redesign, I would recommend to do the following changes to the PCB:

Major improvements:
  • Improve input protection
  • Replace the single ended PGAs by differential ones

Minor improvements:
  • Add button cell holder (for RTC)
  • Add I2C test points (would be usefull for debugging)
  • Add GND test points (makes it easier to connect your oscilloscope probes)

For those who want to rebuild the current design (R1) I have uploaded the gerber files to GitHub.
 

Offline Achu

  • Contributor
  • Posts: 49
  • Country: in
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #36 on: September 20, 2024, 02:03:54 pm »
Hi,

@KE5FX I hope you see this.

I have a doubt. The test frequency is 1KHz, at 1KHz the reactance of 1pF is 159.15 Mega Ohms, and a current of only 6.28nA peak will flow through it. Even with a 100K resistor in the TIA, the output voltage is 628uV. At such smaller voltages won't the noise of the Opamps and resistors make everything messy?
« Last Edit: September 20, 2024, 02:05:33 pm by Achu »
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 2296
  • Country: us
    • The Messy Basement
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #37 on: September 20, 2024, 04:23:49 pm »
We use Agilent E4980 LCR meters at work and they get really noisey at the higher impedances and lower levels. I have to believe they work by similar means, though I think they have a lot of custom chips and can't be serviced by anybody other than Agilent (Keysight). To get the higher precision you have to set them to "slow" mode and a high number of averages. Max freq is 2 MHz. They're also absurdly expensive to have calibrated and only the factory has the necessary standards to do it. None of our local labs would touch it. Why? It's the same instrument they use to cal other stuff! I think you've got a great project here!
« Last Edit: September 20, 2024, 04:25:21 pm by Conrad Hoffman »
 
The following users thanked this post: Achu

Offline Achu

  • Contributor
  • Posts: 49
  • Country: in
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #38 on: September 20, 2024, 07:05:28 pm »
I intend to DIY one. I plan to use TL08x opamps like many LCR kits seems to use. 

I hope this question is suitable here, the datasheet of the opamp says the following about the noise specs of TL08x opamps

Input Noise = 9.2uVpp and 1.4uVrms @ f = 0.1Hz to 10Hz
Input voltage noise density = 31nV/sqrt(Hz) @ f = 1KHz and 21nV/sqrt(Hz) @ f = 10KHz
worst case offset = 4mV

Now If I use these opamps in the front end of my LCR meter which will have a Ftest = 100KHz, what would be the minimum voltage of across the DUT that I can amplify without being affected by the noise? I guess it has to do with the desired SNR? But I don't know anything other than  that.
 

Offline KE5FX

  • Super Contributor
  • ***
  • Posts: 2635
  • Country: us
    • KE5FX.COM
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #39 on: September 20, 2024, 09:51:23 pm »
Hi,

@KE5FX I hope you see this.

I have a doubt. The test frequency is 1KHz, at 1KHz the reactance of 1pF is 159.15 Mega Ohms, and a current of only 6.28nA peak will flow through it. Even with a 100K resistor in the TIA, the output voltage is 628uV. At such smaller voltages won't the noise of the Opamps and resistors make everything messy?

I'm not involved in the project and haven't looked at its implementation details, but often when you are dealing with noise levels that low, synchronous (aka "lock-in") measurement of the signal in question is the best way to go.  Stimulus-response measurements are ideal for that, because you're in control of the stimulus (or at least have access to a low-noise copy of it.)  So perhaps he is doing something along those lines.

Even without performing true synchronous detection, just knowing the frequency of the stimulus signal lets you improve the SNR greatly.  You can measure the response in a very low bandwidth via aggressive bandpass filtering, or simply by evaluating a single Fourier bin while ignoring the rest.

Either of those techniques would allow you to make measurements at the nanovolt level, but not necessarily very quickly.
 
The following users thanked this post: Achu

Offline Achu

  • Contributor
  • Posts: 49
  • Country: in
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #40 on: September 21, 2024, 03:40:43 am »
I tagged you because I felt that you are knowledgeable in this. I wasn't wrong it seems :)
 

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #41 on: September 23, 2024, 04:29:26 pm »
I'm working with an input buffer with 1920 samples length. A 100 Hz wave fits exactly once in the buffer. A 200 Hz wave two times and so on. So the stimulus is syncronous to the response measurement. Additional I use up to 256-fold averaging. A 1 kHz stimulus gives me 10 times averaging on top. Averaging is very effective against non-deterministic noise.
 

Offline mawyatt

  • Super Contributor
  • ***
  • Posts: 6109
  • Country: us
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #42 on: September 23, 2024, 06:25:55 pm »
This is indeed an interesting project, quite nicely done we might add.

So hats off to WeTec :-+

Noted something in the schematic that might need addressing. The BAV199 protection diodes for Lpot are returned to the analog supplies. In normal operation Lpot potential should be ~ virtual ground (0 volts), so one could return the back to back diodes to ground as they should have almost no voltage across them during normal operation, maybe placing them on the "inside" of the series protection resistor to limit current.

Also the same BAV199 diodes are used for Hcur and Lcur, might consider higher current types for better protection. The Hpot BAV199 protection diode might serve better on the "inside" of the series protection resistor.

We can offer to help folks wrt components that are "characterized" at various frequencies with our best LCR Lab Meter a Hioki IM3536 which supports frequencies up to 8MHz. We have developed various custom LCR Meter "fixtures" to allow better results with SMD precision components. These "characterized" components could be utilized as sort of a "reference" component to help with setting up these initial LCR Projects.

Are there any updates wrt to the project in the works, like V2 of the PCB and updated firmware expected?

Anyway, just some thoughts.

Best,
Curiosity killed the cat, also depleted my wallet!
~Wyatt Labs by Mike~
 
The following users thanked this post: WeTec

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #43 on: September 24, 2024, 07:04:54 pm »
Thanks, mawyatt.

Definitive a good idea to connect the Lpot diodes to GND. Moving the Hpot and Lpot protection diodes on the right side of the series resistors requires an additional resistor between diodes and the input of the opamp. Just to make sure that the current flowing into the opamp input diodes doesn't reach the absolute maximum (10mA). However, moving the diodes and using types for higher currents does not help against the increase in rail voltages in the event of an overvoltage. I think this is the weakest point here.

Thanks for the offer to use caracterized reference components. I will come back to you if I want to be precise. For me, being better than 1% is super precise :D

At the moment there are no updates in the firmware and PCB. I will post any updates here.
 

Offline mawyatt

  • Super Contributor
  • ***
  • Posts: 6109
  • Country: us
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #44 on: September 24, 2024, 07:30:03 pm »
Thanks, mawyatt.

Definitive a good idea to connect the Lpot diodes to GND. Moving the Hpot and Lpot protection diodes on the right side of the series resistors requires an additional resistor between diodes and the input of the opamp. Just to make sure that the current flowing into the opamp input diodes doesn't reach the absolute maximum (10mA). However, moving the diodes and using types for higher currents does not help against the increase in rail voltages in the event of an overvoltage. I think this is the weakest point here.

Thanks for the offer to use caracterized reference components. I will come back to you if I want to be precise. For me, being better than 1% is super precise :D

At the moment there are no updates in the firmware and PCB. I will post any updates here.

For Lpot since it's clamped to ground you shouldn't need another series resistor. For Hpot diodes returning to the analog supply rails should be OK to protect the Op-Amp with a series resistor, you could split the present resistor and include before and after the clap diodes for more protection if you see fit, personally don't think the extra resistor is necessary tho.

For Lcur, some back to back to ground higher current diodes should be considered, also higher current diodes to the supply rails for Hcur. If you are concerned about Power OFF conditions with an application of a voltage on the terminals, specifically Hcur, consider adding shunt Zener Diodes across the + and - rails to ground, these can be rated slightly above the nominal supply voltage so they don't conduct any supply current, but limit the voltage buildup due to a external accidental applied voltage.

Would think these should do a reasonable job of protecting your LCR Meter from accidental applied external voltages to any terminals wether the LCR is power ON or OFF. Of course as always experimental verification is in order   ;)

BTW we had considering developing a custom LCR meter awhile back, but our software skills are limited and has kept us from moving forward. Your project and efforts are quite impressive, so we'll follow your project instead :-+

Best,

Curiosity killed the cat, also depleted my wallet!
~Wyatt Labs by Mike~
 

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #45 on: January 05, 2025, 08:58:27 pm »
I have added open and short correction function. It is only for one frequency spot. The short correction is very helpfull at low impedances (mili ohms range). The open correction is for high impedances (pico farad capacitors) but the acurracy at this range is worse than the correction helps. However, it turns out that the resolution is better than I thought. I have updated the minimum display range values. See the README in the github project page.
 
The following users thanked this post: croma641

Offline HaiLun

  • Newbie
  • Posts: 2
  • Country: hk
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #46 on: January 17, 2025, 04:12:33 am »
An interesting project !!  You are a wise, very warm-hearted man!

How accurate is the resistance measurement?  See  all the pictures most of them are capacitors, almost  no resistance!  The 4-wire method is particularly suitable for low resistance, such as  0.001~0.5 ohm.

If you reduce the sampling frequency a little, can the Cs4272 use RP2040 or ESp32 as a driver?  If you'd like to guide, I'd like to try it 。 Usually, the entry-level professional meter is only 100HZ、120HZ、200HZ、400HZ、800HZ、1KH、2KH、4KH、8KH and 10KHZ sampling rate.  But it's accurate enough to do it very well. I have an entry-level  LCR Meter in my hand,its maximum sampling rate is only 10KHZ, and even compared it with a 6 and a half bit multimeter,0.001~0.5 ohm, the accuracy is not lost. The 4-wire has a strong advantage.

This 4-wire resistance is very cheap, has a variety of resistance values, the accuracy is good, does not require 6 and a half bit multimeter or other expensive standard components. That's good enough for a reference, especially when it comes to used parts, which are cheaper. There's nothing under the case, it's just a resistor, and 4-wire mode is the best package.I send picture in the attachment .

An Very  interesting project !!Happy life!! [/img]
« Last Edit: January 24, 2025, 12:40:27 am by HaiLun »
 

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #47 on: January 22, 2025, 04:31:24 pm »
I did some measurements with low value resistors to test how well the correction function works:

Resistor SampleReferenceCorr OFFDeviationCorr ONDeviation
1R0,99981,00230,25 %0,9973-0,25 %
500m506,1509,90,75 %504,8-0,26 %
220m221,8225,91,85 %220,9-0,41 %
100m100,1104,564,46 %99,53-0,57 %
50m49,7654,178,86 %49,13-1,27 %
3m (WSL2726 4-Terminal)2,9977,82160,93 %2,8-6,57 %

The reference value is determined by 4-wire measurement with a 34461A and a current source.

I'm planning to create an accuracy chart similar to the ones in Agilent or B&K Precision LCR meter specifications. To accomplish that I need to do a lot of measurements with reference impedances over the full impedance and frequency range of the meter, put the results into a big Excel sheet and create a chart.
 
The following users thanked this post: HaiLun

Offline WeTecTopic starter

  • Contributor
  • Posts: 36
  • Country: de
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #48 on: January 22, 2025, 04:41:13 pm »
I'm sure the processing power of RP2040 or ESP32 is sufficient. But you need a way to get the Teensy Audio Library to work. Not an easy task I think. Perhaps there are other audio libraries for these processors that can be used.
 
The following users thanked this post: HaiLun

Offline LinuxGuy123

  • Regular Contributor
  • *
  • Posts: 83
  • Country: ca
Re: TeensyLCR – A Teensy based DIY LCR Meter
« Reply #49 on: January 23, 2025, 12:51:45 am »
Very nice project. 

I'd like to add a good transistor hFE tester to this.  Something that could test with base current > 1.0 uA, VCE > 1 volt and read betas higher than ~600.  These are the parameters of most of the current transistor testers.

It would be great if it had a thermistor attached to the transistor and it measured hFE at different temperatures as the transistor heated up.
 
 
The following users thanked this post: maelh


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->