LCR Meter Plot Software - Page 1
Forum section: electronics / testgear

author: mawyatt
author_rank: Super Contributor
timestamp: March 23, 2023, 03:56:29 pm
content: Finally getting the Tonghui TH2830 serial port working, we set out to try and create a plotting routine.https://www.eevblog.com/forum/testgear/tonghui-th2830-lrc-meter-serial-port-how/msg4207222/#msg4207222Decided to try python and used some Hioki python routines for accessing the TH2830, later we'll try working with the Hioki IM3536.After a few attempts with a PC, we gave up and decided to use a RPi 3 and achieved some success! Biggest issue was finding the RPi serial port address, then things began to move forward.This is a simple Python routine that allows plotting of the TH2830 DUT by serial RS232 connection using a USB to serial adapter, and doesn't have any error checking.From the code we are obviously not well versed at Python programming, well any programming, but are providing this routine to hopefully help others more capable.If folks are successful in getting/adapting this routine operating on a PC or Mac, or adds features, cleans thing up, please return results here so others (ourselves included) can benefit.Anyway, here's a few plots of some components.Now off to try and get the IM3536 workingBest,

author: mawyatt
author_rank: Super Contributor
timestamp: March 23, 2023, 03:59:12 pm
content: A few more plots of Inductor and LC Networks.Best,

author: oz2cpu
author_rank: Frequent Contributor
timestamp: March 24, 2023, 05:16:26 pm
content: WOW this is nice, super cool looking curves , exactly what i was dreaming of..for us who dont understand python ? how easy is it to make this run on a PC ?or even via testcontroller ?if only a working TH2830 driver was made for testcontroller ??

author: mawyatt
author_rank: Super Contributor
timestamp: March 24, 2023, 06:09:54 pm
content: Originally tried to get it working on PC, but routine had issues with trying to find the pyserial files. There was something about how a PC installs Python and the supporting files path?Maybe someone with more experience with Python on a PC can help?BTW just updated the TH2830 version and added the Hioki IM3536 version. Have both running at same time on RPi the TH2830 on TTYUSB0 and the IM3536 on TTYUSB1.Here's an impedance plot from the IM3536 of a 1uF Mylar cap from 4Hz to 8MHz!Edit: This is so easy to do, so added more plots (later with dual variable capability) from the IM3536, note some of the capacitor impedance levelsThis shows how the effective impedance of the small 100uF 25V Polymer impedance compares with the much larger physically and capacitance 1000uF 16V Electrolytic, and the small 470uF 6.3V PolymerBest,

author: mawyatt
author_rank: Super Contributor
timestamp: March 25, 2023, 02:04:23 am
content: Decided to use a quality 5uF Polypropylene cap as a final test subject for the day. This reveled some subtle resonate features of the capacitor and setup which uses the Tonghui TH26048A plug in test fixture with the Hioki IM3536 LCR meter.You can observe the subtle resonance in the ESR plot around 3~6MHz, along with the primary sharp impedance resonance ~400KHz. Also note the low ESR ~ 0.01 Ohms at 1MHz and dipping down to ~0.003 ohms at lower frequencies.Best,

author: mawyatt
author_rank: Super Contributor
timestamp: March 26, 2023, 01:09:52 am
content: Had some time today and worked on the Tonghui TH2830 version, decided to try and include most of the measurement and display functions. This meter has quite a list of available measurement display modes, here's the list shown below.One mode that was lacking was the ability to show DUT Magnitude Impedance and Real Impedance on the screen which is limited to just two non-programmable display functions (they are only shown in displayed pairs, each display pair can be changed but not individually, while IM3536 has 4 display functions and each is independently programmable).Since we often want to "see" DUT Impedance Magnitude and the effective "Real" part vs frequency, not just the "Angle", we decided to create this mode function (Mag) with the RX function which returns the R -jX from the DUT. The modes we've included are all shown but the GB, YTD, YTR, and DCR (no need to plot DCR with frequency).Also working on the plotting routines which now allow dual Y-axis independent plotting, scaling (Linear/Log) & labeling.Anyway, here's the version 2 for the TH2830, a few plots gathered from such and hoping some others may find this useful and maybe adapt to other LCR meters.Best,

author: mawyatt
author_rank: Super Contributor
timestamp: April 12, 2023, 06:11:00 pm
content: Finally able to get things working on PC with the TH2830, and even included versions which allow DC Bias Sweeps with Bias Fixture and external Power Supply.https://www.eevblog.com/forum/projects/bias-network-for-lcr-meter/This uses VISA and requires Serial Ports be encoded (didn't bother with user input). These ports can be located with the Python gui script attached, then entered into the routine as a fixed USB serial port address.Two external Power Supplies are supported, the GPP-4323 and SPD3303X, the SPD uses USB since it has no RS232 port. Various USB to RS232 adapters with appropriate "Null Modem Adapter" were used and work, the SPD3303X just uses a standard direct USB cable.With these PS the Voltage read function is used to read back the PS setting DC voltage as the DUT voltage. This is generally OK, but for large capacitive DUT the actual voltage across the DUT can be significantly lower than the applied PS DC voltage and one needs to wait between voltage steps to allow the DUT Capacitor to charge up. Not allowing the DUT time to charge can also introduce a DUT parameter reading error as the Bias voltage across the DUT is changing as the LCR meter is reading the applied AC test voltage. In the DC Bias fixture mentioned, the external applied DC Bias time constant is ~3 seconds (30uF and 100K), if a large DUT capacitance is testing this should be increased by adding the additional DUT RC time constant where R is ~100K.We also added the capability to use an external DMM (HP34401A) to read the actual voltage across the DUT under test. The HP is setup to use High Z mode for DC Readings and a separate external Banana jack (Yellow) is shown on the mentioned DC Bias Fixture, this is connected to the DUT + with a 100K series R for isolation. If one does a TH2830 Open and Short Calibration with everything connected (PS & DMM), then the effects of these external items should be accounted in the Open & Short Cal routine.Here's the latest Python routines (routines are a work in progress, esp the plots) for use with a PC. Note the myvisa.py (also main and gui) must be included in the file directory as this is the routine for USB serial connection.Anyway, these routines have proven very useful in evaluating various DUT behavior over frequency and DC Bias voltage, and hope this helps some folks which also should be adaptable to other bench type LCR meters ( & DMMs).BestEdit: To answer a question on how to connect things up for frequency sweep:1) Connect PC to TH2830 with a USB to RS232 cable, use a Null Modem adapter on the RS232 connector (DB-9) on the TH2830.2) Setup TH2830 System for RS232 communications with 9600 BAUD.3) Find RS232 Port, (Use gui Python script or other means (VISA Interactive Control) to get port information).4) Edit (you can use IDLE for this edit) TH2830_4.py file with RS232 port name (note must be in quotes as shown);Line 24: TH2830 = "port name"5) Run routine in IDLE6) Enter parameters for sweep measurement, and sweep range.7) Collected sweep data is displayed as ongoing list.8 ) Select plot parameters, and select plot.For GPP and/or SPD routines which sweep DC Bias Voltage at fixed frequency:1) Follow above but enter ports for TH2830, Power Supply (GPP or SPD), and HP34401A DMM if used (be sure to setup each instrument for proper communications).2) Note that SPD is connected with just standard USB cable (has no RS232 port). You still enter USB port as above, use gui.py or NI-MAX to show USB port.3) Connect PS to DC Bias Adapter, and DMM to DC Bias Port Sense Terminal (Yellow) if using DCBias Adapter shown above in link.4) Enter parameters and make sure to allow enough time for DC Bias Steps to settle between measurements for accurate measurements.5) Collected data is displayed as ongoing list.6) Plot results with selected plot parameters.

author: mawyatt
author_rank: Super Contributor
timestamp: April 22, 2023, 01:45:26 pm
content: File updates above, plots improved for a more "Engineering" type display.Best,

author: mawyatt
author_rank: Super Contributor
timestamp: April 22, 2023, 03:42:50 pm
content: Some might find this thread interesting.https://www.eevblog.com/forum/testgear/capacitive-impedance-plots-with-sds2104x-plus-bode-function/Best,

author: RoGeorge
author_rank: Super Contributor
timestamp: April 24, 2023, 08:56:09 am
content: Quote from: mawyatt on March 23, 2023, 03:56:29 pmGood software skills!The file corresponding to this quoted figure is called "P_100uF_ESR.png" in the OP. The ESR plot goes lower with the frequency increase. I don't know if the instrument properly measures the ESR at each frequency, and don't know much about ESR behavior with frequency either, so I thought I'd better ask.I would expect (based on common sense) to see higher and higher ESR with frequency for many reasons, from causes like the skin effect, or the dielectric losses (that I assume will be higher at higher frequency). The plot reminds me of the Xc of a capacitor, but I don't know the instrument and what it measures, Xc or ESR.Is this common for a 100uF to have lower and lower ESR at higher frequencies?

author: mawyatt
author_rank: Super Contributor
timestamp: April 25, 2023, 01:51:20 am
content: Think this file is 680uF_ESR.These are what's reported when one plots Rseries of a "Cseries and Rseries" capacitor model and are computed by the LCR meter from the magnitude and phase of the voltage and current of the DUT. All the electrolytic, ceramic, film and polymer types we've evaluated exhibit this Equivalent Series Resistance decreasing with frequency over this frequency range.Thanks for the thumbs up, but think we have a long way to go before being able to do anything somewhat serious code-wise!! Altho this has really augmented the Tonghui TH2830 into a level of a much more expensive class of Lab LCR meter which can produce nice plots vs. frequency without resorting to a spread sheet and CVS files, same for the Hioki IM3536, altho it started out pretty expensive, but does cover 8MHz!!Anyway, just grabbed about 20 various caps of all sorts and sizes and did a frequency sweep per the plot, and took maybe 10 minutes all toll, and the graphs looked nice as well!! Now we've got the external DC sweeping capability and enabled the IM3536 DC built-in capability, now curiosity has us thinking about a tiny temp chamber to "sweep" temperature also. We've seen and plotted how bad the high dielectric ceramics are with voltage, might be interesting to see how well they standup over temperature as well as some of the plastic films types, maybe even some PN junctionsBest,

author: RoGeorge
author_rank: Super Contributor
timestamp: April 25, 2023, 07:28:23 am
content: Temperature behavior would be interesting.I would expect the ESR to get lower while increasing the temperature. Saying this because electronics that are malfunctioning because of bad ESR caps might still start and run when the caps are heated with hot air, but won't start when the caps are cold. No idea what to predict about the resonant frequency.About making a temperature chamber, only couple of weeks ago I've measured a veryweird behavior from a power resistorthat kept heating for hours while under constant voltage. It was not much power and small size, would have expect to settle in minutes at most, not hours. Turned out the resistor was pumping heat into the rubber mat that was covering the workbench, which rubber mat was keep heating slowly by conduction from the power resistor. When suspended in air, same resistor comes to thermal equilibrium very fast.My point is, I expect small thermal inertia to be more important than being a good thermal insulator when choosing the materials for making a thermal chamber, or else the temperature might settle too slow. Or maybe just Capton-tape a temperature probe to the capacitor and don't wait for the temp chamber to stabilize. If the instrument measures fast enough relative to the temperature slope, then it all can be done while heating/cooling, without waiting for the temperature to stabilize.Still can't find any decent argument for why the ESR will go lower with frequency. Will have to read more about ESR, then hook a capacitor and an oscilloscope to the AWG to get a grip of it.Thank you for sharing these results.

author: mawyatt
author_rank: Super Contributor
timestamp: April 25, 2023, 02:02:03 pm
content: Not an expert on capacitor design/construction and their behavior, if you find something on such please share.Agree the low thermal mass is the way to go, and maybe doing a ramp to the highest temperature, then allowing DUT to return to ambient while recording parameters during temperature decent with removing heating source. Since we aren't interested in going below ambient or highly accurate & stable temperature, this just requires heating and no TEC.One simple idea is to use a chunk of metal heated on a plate with DUT and thermistor taped to surface, then allowed to cool when plate removed and parameters recorded.Another is to use a small PCB heating device like the MPH30 and taping the DUT to the small plate along with a thermistor. If we were good at microcontroller & coding (as shown we are not!!!), then one could write some custom firmware for the MPH30 to allow remote operation (this has a USB C port for power and upgrades, so maybe could be reconfigured for remote control)?Another is a using a power resistor with flat surface area (like panel mount types, or cheap ceramic long square types), tape DUT and thermistor to power resistor. This could be placed within a "Closed Control Loop" by means of a controlled power supply within the measurement routine.Anyway, lots of options for doing some temperature sweeps (maybe other types or combinations) now we've gathered a "handle" on controlling these LCR meters from Python and utilizing the nice plotting capability.Lots of options to consider if we only had the timeBest,

author: mawyatt
author_rank: Super Contributor
timestamp: April 26, 2023, 03:55:24 am
content: Well we can't evade curiosity, and have little patience, kind of a curse from the beginningSo grabbed a 10W ceramic 10 ohm resistor, the common long square type, and decided to use this as a temperature "chamber". Put some thermal tape along the top and mounted a K type thermocouple along with the DUT which were a couple disc ceramic capacitors. 100nF cheap 50V type and another 10nF 1KV "Blue" disc, don't know the ceramic material type but from the plots these are from the high dielectric constant types, then tried a 220nF mylar film type, which is much more stable, and a 1nF Mica type. Finally a 100uF Polymer Type.The setup uses a TH2830 LCR meter, with a SDP3303X Power Supply and SDM3065 with a "K" Type thermocouple for reading the 10W ceramic resistor temperature. Set the voltage and current limits to 10V and 1A to keep the resistor within 10W rating, this produces a standing (on leads as shown) resistor temperature top range of >100C. The thermocouple and DUT were held in place by the thermal tape and a plastic clamp as shown, the cardboard U shaped piece is to keep the plastic clamp from melting!!A Python routine was created to sweep the PS voltage, read the resistor temperature, then read the LCR parameters, adapted from the previous DC Sweep routines.Anyway, this kludge actually works reasonably well and at least shows how the capacitance of different types varies with temperature. Still need to work on the Python routine and such, but this did satisfy our curiosityEdit: Added 1000uF 16V CapBest

author: mawyatt
author_rank: Super Contributor
timestamp: April 26, 2023, 07:16:00 pm
content: Ran a couple more devices just for fun while working in the yard. A small 1mH inductor, 10nF Mylar (cheap flat Green type) cap and a 1N4148 diode. Inductor and Diode measured at 100KHz, Cap at 1KHz.Geeze, see we can't even spell temperature properly in all the graphsPlease use the conversion factor 1 degrees C temparture = 1 degrees C temperatureBest,

author: RoGeorge
author_rank: Super Contributor
timestamp: April 26, 2023, 09:21:54 pm
content: Thanks!A Ge diode would be interesting, too, to compare its temp variation with the Si one.

author: mawyatt
author_rank: Super Contributor
timestamp: April 27, 2023, 03:20:10 am
content: You are welcome!!Don't have any Ge diodes (or SiC), agree would be interesting to see their behavior!!Do have some others tho, here's Zener and SBD.Best,

author: Hexley
author_rank: Regular Contributor
timestamp: April 28, 2023, 04:04:26 pm
content: Quote from: mawyatt on April 12, 2023, 06:11:00 pmDo you have any charts with extended range DC sweep (from zero to 32 volts, say) done with the GPP-4323? Apologies if they are already posted, but I did not spot them when going through this thread.I saw your post in the TestController thread related to controlling the GPP-4323, and was curious to see if you found any artifacts in the setpoint and readback of the GPP sweep when it changed ranges internally. I have seen those in similar applications (V-I measurements of UV diode strings, for example) when sweeping the GPP-4323 with a script. Nothing that cannot be dealt with, just something to be aware of.

author: mawyatt
author_rank: Super Contributor
timestamp: April 28, 2023, 04:24:22 pm
content: We've added using Quadratic Regression to extrapolate the Quadratic Coefficients to estimate the fixture temperature with applied DC voltage. Now Temperature Sweep is entered as Start, Stop, Step and Time Delay and a LCR measurement of selected parameters is done at each Step temperature increment, rather than entering DC voltages to achieve a given temperature. Also used heat shrink tubing to hold the thermocouple to the ceramic power resistor body.Anyway, attached is version 2 of the Python routine which uses the TH2830 LCR meter, with SDP3303X Power Supply, SDM3065 DMM with "K" Thermocouple and a Ceramic 10 Ohm 10W resistor as heat source. Also a plot of a cheap 100nF 50V Ceramic Disc @ 1KHz that shows the capacitance and ESR variation with temperature, note the slight improvement with ESR at ~40C. We've seen this before in some cheap bypass type capacitors and suspect this is a characteristic of the high K dielectric ceramic material utilized. Added another plot of a small 6.3V 1000uF Polymer.Best,

author: mawyatt
author_rank: Super Contributor
timestamp: April 28, 2023, 04:42:34 pm
content: Quote from: Hexley on April 28, 2023, 04:04:26 pmDon't have any more plots with the GPP, but don't recall any serial port or read back issues with it, worked just like the SDP3303X. However, wasn't paying close attention but do remember that it was quite stable after leaving it running for almost an entire day.One issue with the GPP we were/are having is trying to communicate thru the USB port, can't get the port to even open, but since we were able to get the RS232 port working didn't pursue this at the time.BTW if you want I can set up the GPP and check it, let me know.Best,

author: Hexley
author_rank: Regular Contributor
timestamp: April 28, 2023, 07:08:24 pm
content: Quote from: mawyatt on April 28, 2023, 04:42:34 pmNo need to set up anything, but thanks for the offer.Q: When you were trying to communicate through the USB port, did you trythe USB "driver" that Instek lists on their downloads page for the GPP-4323?

author: mawyatt
author_rank: Super Contributor
timestamp: April 28, 2023, 10:23:13 pm
content: Quote from: Hexley on April 28, 2023, 07:08:24 pmNo didn't use the USB driver, as everything else seems to work directly with VISA without any additional driver(s), USB, RS232, or otherwise.May give that GW driver a try when we get back to using the GPP, but honestly don't like having to mess around with drivers and such.Best,

author: Hexley
author_rank: Regular Contributor
timestamp: April 29, 2023, 05:44:18 pm
content: Quote from: mawyatt on April 28, 2023, 10:23:13 pmOK, I just had to look into this a bit. Results are posted in the TestController thread, but the bottom line is that Instek seems to have used some uncommon implementation of serial-over-USB. So they require their own driver to make a USB-connected GPP-4323 appear as a virtual serial port.Seems like an odd implementation choice.I verified that indeed Windows did not see the GPP-4323 USB connection as a serial port unless and until the Instek driver was loaded. After that, it worked as expected.I share your dislike of devices needing drivers, which is why I am using the LAN port for control. Even a USB-to-serial dongle on the PC requires a driver, after all, though that may be hidden if Windows supports the particular dongle natively. I kind of miss the days of 16550 UARTs and ISA adapter cards. (Just kidding!)

author: mawyatt
author_rank: Super Contributor
timestamp: April 29, 2023, 06:08:58 pm
content: That special driver works, thanks!!Best,

author: oz2cpu
author_rank: Frequent Contributor
timestamp: November 14, 2023, 11:33:18 pm
content: super inspired by mikes idea about a curve tracer for the LRC instrument TH2830,we had a great day making a little java versionit run in a random browser and any platformno sw install needed, no skils needed, it is so far just two txt files in a folder, one is a HTML fileand it also works perfectly fine on a PCanyone like to hear more about this ?

author: mawyatt
author_rank: Super Contributor
timestamp: November 15, 2023, 01:20:53 am
content: Quote from: oz2cpu on November 14, 2023, 11:33:18 pmYes, definitelyBest,

author: oz2cpu
author_rank: Frequent Contributor
timestamp: November 16, 2023, 08:29:30 am
content: here you go mike.. and anyone else with a TH2830 :-)webx dot dk / th2830 dot zipunpack the two txt files into folder of you own free choiseopen the htm filecom port is connected to your th2830, i use 9600 baud, so that is what it defaults too,also setup : avarage 1, speed medium.this is first demo version,so far you just setup the type of measurement on your th2830 hit lock to get back to local modethe software take both measurements selected on the th2830 and perform auto scale traceyou can zoom and move and all that, add peaks and save csv file too,ideas for next version : let the sw handle all the measurement modes,and scale to pF nF uF and such correctly, that could be coolso far the sw readout the values as they are delivered from th2830that means capacitance is in Farads :-) and that is a little bit ignoring,but there is a comment line, where you can edit a multiplier, enable that to make it read out in uFas explained in the txt file

author: mawyatt
author_rank: Super Contributor
timestamp: August 08, 2024, 07:53:15 pm
content: Thomas,Can you make this active again?Not sure if we've looked at your version, memory is going fast!!ThanksBest,

author: KungFuJosh
author_rank: Super Contributor
timestamp: August 23, 2024, 01:17:03 am
content: Does this only work on USB/serial, or did you also get it to work over ethernet?Thanks,Josh

author: mawyatt
author_rank: Super Contributor
timestamp: August 23, 2024, 01:50:05 am
content: RS232 to USB.Best,

author: mawyatt
author_rank: Super Contributor
timestamp: August 27, 2024, 01:45:52 am
content: We've updated the IM3536 plotting routines, cleaning up some things and adding the ability to handle Engineering Input notation like k (kHz) and M (MHz).Here's a few plots of a 32.786KHz Crystal using the Custom Split-Kelvin SMD LCR Fixture with the IM3536. These are with 1Hz steps with Linear Frequency Plots.Note how the Phase transitions between -90 degrees Capacitive to +90 degrees Inductive and back to -90 degrees Capacitive. This occurs as the Frequency sweeps up to Series Resonance, then to Parallel Resonance, and past Parallel Resonance. Also note how RS (Effective Series Resistance) peaks at Parallel Resonance.Will include the TH2830 version if anyone is interested (needs some testing tho).Best,

author: KungFuJosh
author_rank: Super Contributor
timestamp: August 27, 2024, 02:02:06 am
content: That looks great!

author: chilternview
author_rank: Frequent Contributor
timestamp: March 26, 2025, 08:09:05 pm
content: Quote from: mawyatt on August 27, 2024, 01:45:52 amHi Mike, do you still have the TH2830 plotting script? I have a (newly acquired) TH2827C and am interested in plotting impedance vs frequency, I'm not sure how similar the two lcr meters are but hopefully enough to get something working for mine? Thx.

author: mawyatt
author_rank: Super Contributor
timestamp: March 27, 2025, 02:04:44 am
content: Quote from: chilternview on March 26, 2025, 08:09:05 pmIt's been awhile since we've used this, but think this is the Python LCR Plotting Routine for the TH2830. Uses RS232 Interface for Comms with PC, also has USB Interface.Also a DC Plotting Routine for DC Bias Sweeps (PC_TH2830+SPD_6_DC.py) which uses SDP3303X DC Bias Source (USB) and HP34401A DC Reading (RS232). This works with the LCR DC Bias Interface Adapter and Special SMD LCR Meter Fixture DC Bias Adapter we developed awhile back.Best

author: chilternview
author_rank: Frequent Contributor
timestamp: March 27, 2025, 05:35:33 am
content: Thanks Mike, what RS232 cable do you need from PC to the LCR meter? a 'null modem' cable? Or will a USB to RS232 D type connector work?

author: thephil
author_rank: Regular Contributor
timestamp: March 27, 2025, 09:01:01 am
content: Nice! I love controlling my instruments via Python – lots of flexibility. Unfortunately, I don't have a Tonghui. Only a East-Tester LCR meter (works for me...).But what I really wanted to say: Have you considered publishing your program on a place like github? That makes it easy to find and adds an easy way for others to contribute. I so that wiht my scrips, even if they address a limited audience.

author: mawyatt
author_rank: Super Contributor
timestamp: March 27, 2025, 12:22:39 pm
content: Quote from: chilternview on March 27, 2025, 05:35:33 amWe use a cheap USB to RS232 cable with Null Modem Adapter like shown.Best

author: mawyatt
author_rank: Super Contributor
timestamp: March 27, 2025, 12:43:55 pm
content: Quote from: thephil on March 27, 2025, 09:01:01 amObviously (from these routines) Coding/Software is not our thing, so only develop such when necessary like these examples. We've never used or done anything with GitHub and not sure how beneficial these examples would be in present form. Probably better for someone with good coding skills to hone these examples into something more refined and presentable then post on Github.Anyone is welcome to use and adapt these and post here and/or on Github.We don't have a East-Tester but changing the interface parameters and the control/measure parameters to fit should work. This is what we did when going from the Hioki IM3536 to the Tonghui TH2830, as the routine was originally developed for the Hioki.Anyway, hope you can adapt for your East-Tester!!Best

author: chilternview
author_rank: Frequent Contributor
timestamp: April 02, 2025, 06:35:28 pm
content: Quote from: mawyatt on March 27, 2025, 12:22:39 pmI had a USB type B to USB type A cable so I tried that with the Tonghui and a PC. Using PyVisa it works if I set the BUS MODE to USBTMC, and e.g the following:import pyvisa as visarm = visa.ResourceManager()lcr_meter=rm.open_resouce(<usb resource name>)lcr_meter.query('*IDN?')However, when trying to do a frequency sweep and using triggering e.glcr_meter.write('TRIG:IMM')result=lcr_meter.query('FETC?')it seems to timeout on the query. I've tried setting long timeouts and inserting a wait between writing the trigger and querying the result but to no avail. The strange thing is that it only seems to timeout when running from within the python for loop; if I try the above commands manually then they work just fine. And it seems only reading data from the lcr meter is a problem, writing (to set voltage, frequency, mode etc) works just fine.

author: mawyatt
author_rank: Super Contributor
timestamp: April 03, 2025, 12:37:15 am
content: Try using RS232 to USB like we mentioned, works for us with TH2830!!Best

author: chilternview
author_rank: Frequent Contributor
timestamp: April 03, 2025, 05:27:22 am
content: Mike, I will try RS232 today - need a null modem lead for that. One other difference though, I see you are importing a python module called 'myvisa' not 'pyvisa' as I am... what's the difference?

author: chilternview
author_rank: Frequent Contributor
timestamp: April 03, 2025, 09:23:19 am
content: I found that the following does not work when trying to use python/pyvisa scripts for the TH2827, as it gives a timeout error on the read cmd:lcr_meter.write('TRIG:IMM')lcr_meter.write('FETC?')result=lcr_meter.read()But if I do this it does work!lcr_meter.write('*TRG')result=lcr_meter.read()According to the documentation, *TRG triggers the unit and sends the results to the output buffer. Which you would have thought was the same as doing a TRIG:IMM followed by a FETC?, but no. I thought maybe the read or write termination character might be the source of the problem but using either '\r' or '\n' made no difference.

author: mawyatt
author_rank: Super Contributor
timestamp: April 03, 2025, 01:11:08 pm
content: This is what we used in Python (see python routines above).#Trigger and Read Datawait = 0.5serial.send_msg('*TRG')serial.send_query_msg('FETC?', Timeout_default)msgBuf= serial.msg_bufDon't know what the difference between myvisa which we used and pyvisa.Best

author: chilternview
author_rank: Frequent Contributor
timestamp: April 03, 2025, 02:46:40 pm
content: Quote from: mawyatt on April 03, 2025, 01:11:08 pmWell it's a completely different beast, those routines (send_msg for example) don't exist in pyVisa.The main problem has been that the documentation is very poor, and it takes some experimenting to figure out the command and response format.A frequency sweep point using read() gives:['1.01611E+00', '8.99431E+02', ' 0', ' 0', ' 5\r']Note the '\r' at the end - not a linefeed as you might expect.I have managed to get list mode working on the TH2827C, which is great - you set up to 201 frequency points for a sweep and it goes away and runs them all.

author: mawyatt
author_rank: Super Contributor
timestamp: April 03, 2025, 03:43:58 pm
content: Did you try the routine we mentioned? Maybe try Myvisa?Would expect the TH2827C command set would be "similar" to the TH2830, probably worth a check.We just turned on the TH2830 and connected up our PC (Windows 10), using the USBCDC Mode in TH2830 Setup which shows up on PC as Com Port 4.############################################################################################Serial port for PC and TH2830, Null Modem Adapter & Cable, set TH2830 to RS232 Serial 9600#For USB use TH2830 USBCDC Mode and direct USB cable#Routine works with RS232 or USB Connection from PC to TH2830 under Myvisa###########################################################################################TH2830 = "ASRL4::INSTR" #USB PC address, use gui Python script, must be in quotes "address"serial.open(TH2830) #Open TH2830time.sleep (1)Here's a plot we just did of an LC Network (470uH || 0.22uF) using the routine shown above.Best

author: chilternview
author_rank: Frequent Contributor
timestamp: April 03, 2025, 06:56:16 pm
content: Here's one with a 0.28mH choke in parallel with a 5600pF capacitor. Used 40 points/decade. The list sweep is limited by the unit to max 201 points which is not a problem. However a LIST:FREQ cmd does seem to have a limit to the length of the remainder of the cmd, or maybe that's a write buffer limit in pyvisa; I had to cut down the number of digits after the decimal point to 2. Again not really a problem.

author: mawyatt
author_rank: Super Contributor
timestamp: April 03, 2025, 07:38:04 pm
content: Looks goodDid you use USB or RS232 to talk with the meter?Best

author: chilternview
author_rank: Frequent Contributor
timestamp: April 03, 2025, 07:51:39 pm
content: I used USB, seems to work the same as RS232. Just set the bus mode to 'USBTMC' in the system page. It's not entirely clear to me what the difference between USBTMC and USBCDC mode is, but only the former worked with pyvisa.

author: mawyatt
author_rank: Super Contributor
timestamp: April 04, 2025, 01:49:31 pm
content: We couldn't get USBTMC to work with our Tonghui, but USBCDC does....go figureBest

author: chilternview
author_rank: Frequent Contributor
timestamp: April 04, 2025, 02:23:32 pm
content: I googled them, says:Key Differences Summarized:Feature USBCDC USBTMCPurpose Virtual COM port for serial communication Instrument control, emulating GPIBCommunication Virtual COM port VISA-based, USBTMC protocolDrivers Vendor-specific drivers VISA drivers (e.g., NI-VISA)Use Cases Serial communication for various devices Test and measurement instrumentsWhich would explain why USBTMC works with VISA, whereas USBCDC works with serial comms.

author: mawyatt
author_rank: Super Contributor
timestamp: April 04, 2025, 03:17:46 pm
content: We can get the TH2830 to work with USBTMC if weDirectlyconnect the USB cable to the PC Laptop, if we use an USB Expander Port it only works with USBCDC??Best

author: mawyatt
author_rank: Super Contributor
timestamp: April 05, 2025, 04:18:56 pm
content: Quote from: chilternview on April 03, 2025, 06:56:16 pmThe TH2830 List Sweep function requires entrees for each Sweep Parameter, at least each Frequency Points at minimum, which make this quite tedious for manual initial entry for more than a few points.We prefer the simple routine we've posted for Sweeping Frequency in Linear or Decade fashion.Another interesting thing we've found with our TH2830, evidently the returned measurement values withFETC?command are in a different format or corrupted when using USBTMC vs USBCDC or RS232.Since we don't use USBTMC not an issue for our needs, however others may want to investigate.BTW we have some updated routines for the TH2830 and IM3536 if interested.Best

author: chilternview
author_rank: Frequent Contributor
timestamp: April 06, 2025, 12:37:25 pm
content: Quote from: mawyatt on April 05, 2025, 04:18:56 pmFor manual entry there is the option in the TH2827, of filling from a start freq to a stop freq with either a linear or log distribution. But I've only used list mode so far for frequency sweeps under program control where they are faster than setting/measuring point by point.Quote from: mawyatt on April 05, 2025, 04:18:56 pmHaven't tried that yet as only using USBTMC. Might get round to trying RS232 though. It is a pity that the setup for BUS MODE is not remembered through power cycles - seems to always reset to RS232 mode which is a pain. And of course you need to set it manually if you want to use another mode!

author: mawyatt
author_rank: Super Contributor
timestamp: June 17, 2025, 06:11:05 pm
content: From over here discussing plot routines for the Tonghui TH28XX types;https://www.eevblog.com/forum/testgear/th2830-vs-th2832/We've ported our TH2830 routine with Enhanced Center Sweep ability to the Hioki IM3536. Here we show a 4.096MHz Quartz Crystal at Series and Parallel Resonance which normally would have taken some time, however the Center Sweep with Enhanced Mode made quick work of this.Both the Tonghui and Hioki routines are still a work in progress, however do produce some very nice plots IMOThis Center Sweep Routine allows Center Frequency, Span and Step frequencies selection, with the "Expanded" feature this allows addition resolution around the Center with Enhanced Span and Enhanced Step (Higher Resolution over the Enhanced Span around the Center).BTW be sure and see the nice work by "chilternview" in the mention link aboveAnyway, we'll keep updated these as we plug alongUpdated to "D" version.Best

author: KungFuJosh
author_rank: Super Contributor
timestamp: June 17, 2025, 09:01:40 pm
content: Why not have the axis label update to MHz rather than the 1e6 in the corner?Thanks,Josh

author: mawyatt
author_rank: Super Contributor
timestamp: June 17, 2025, 09:25:36 pm
content: That's just what the Python plot routine does from matplotlib we use. Here's a couple we added fine grids.Best

author: mawyatt
author_rank: Super Contributor
timestamp: October 05, 2025, 08:12:16 pm
content: We've updated the routine for the Tonghui TH2830 and Hioki IM3536. Corrected some issues and allowed multiple repeated plots with the collected data.On the TH2830 we've added a mode (Mag/R) to allow the plotting of the DUT Magnitude Z and the Real Part of R+-jX. This allows similar plots like the one created with the IM3536 shown with Z and R, as the TH2830 doesn't have a Z with R mode, only Z and Phase/Q/D. This was calculated based upon the R+-jX mode by calculating Magnitude Z as square root of R^2 and X^2.Best