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

0 Members and 1 Guest are viewing this topic.

Offline WeTecTopic starter

  • Contributor
  • Posts: 22
  • 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: 1145
  • 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: 22
  • 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: 22
  • 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: 1145
  • 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: 22
  • 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: 1145
  • 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: 22
  • 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: 22
  • 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: 1894
  • 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: 22
  • 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf