Develop custom firmware for the M181 LCR Meter which is made/sold by 'JyeTech'.
The makers firmware is somewhat dire (at the time of writing this), it totally ignores any user input (buttons) after about a minute of being powered up.
Anyway ..
Original author (not the seller) of this custom open source firmware who very kindly shared their own source code
- Jaishankar M .. https://github.com/Jaishankar872/LCR_Meter_Proto_M181
- Official product page link here
- Note, you will eventually pull/lift the two probe jack sockets off the PCB, this is a serious beginner/non-experienced HW design flaw, but can also be an indication of that awful practice of 'planned obsolescence' (done by ALL commercial companies) :(
- ALL terminating connectors to the outside world must always be secured by through-hole methods (ie through-hole pins and/or casing etc). PCB SMD alone will never be strong enough for this.
- Change some PCB component values to add a 10kHz option (see LTspice sims), although this will probably need the OPAMP to be swapped out for a TLV9064IDR.
- Press HOLD button to toggle display hold/pause
- Press S/P button to cycle through serial, parallel and auto mode
- Press RCL button to cycle through R, L and C modes (inc their fast modes, currently no auto LCR mode)
- Hold down HOLD button to perform OPEN probe calibration
- Hold down S/P button to perform SHORTED probe calibration
- Hold down RCL button to cycle through the measurement frequencies (currently 100Hz, 1kHz)
- Hold down S/P and RCL buttons at the same time to reboot
- Hold down HOLD and S/P buttons at the same time to clear all settings (inc calibs) and reboot
- For a list of commands so far implemented and what they do, just send (on the serial link) '?' or 'help' followed by line feed (or cr/lf, lf/cr or cr). What you get back though is defaulted to just LF line terminations.
- Programmer → Raspberry pi debug probe (**modified)
- Interface → SWD
- IDE → PlatformIO
- Framework → STM32Cube
- Programmer → STLink-V2 (chinese clone)
- Interface → SWD
- IDE/Compiler → VSCode + PlatformIO
- Framework → STM32Cube
- Ser → Calculation mode Series or Parallel
- 1.0kHz → Frequency signal used for measurement
- V0.20 → Firmware Version
- C → Capacitance **Mode Change
- V → RMS Voltage across the DUT
- A → RMS Current flowing via DUT
- ER → Equivalent Series Resistor(ESR)
- D → Dissipation factor (or) Tan Delta
STM32F103C8 drop-in replacements with FPU's to improve computation time and increase flash/RAM space ..
- STM32F303CBT6
- STM32L412CBT6
- STM32L431CCT6 .. this one also has FIR/IIR (multiply-add) HW
- STM32L433CBT6
- streamed uart data from the M181 to the windows test GUI (compiled with Borland c++ builder v6) ..
no Goertzel filter, no block averaging, no DC offset removal ..
no Goertzel filter, with block averaging, with auto DC offset removal ..
with Goertzel 64 sample length filter (1 sine cycle), with block averaging ..
with Goertzel 128 sample length filter (2 sine cycles), with block averaging ..
We can simply assume clipping is present if there are any ADC samples near the ADC's min/max (0..4095) range.
The other efficient method is to create a simple histogram of the sample values (per sample block) and look for any spikes in the upper section of the histogram. This method is better because it can also easily detect clipping in waveforms that don't reach the ADC's full input range (say if an OPAMP output starts clipping before the ADC input does).
There are other methods, such as monitoring the output level of a simple band pass filter (in DSP firmware) centered on double the sine wave frequency, the BPF output level will be near zero if no clipping, but rises sharply once clipping begins.
Waveform as seen on TP4/V4 pin (ADC input pin) ..
Change C8 from 100nF to 18nF.
This is the cause for the DC shift/spike, the transcondutance OPAMP stage has a DC offset error, the x101 gain stage amplifies this to the 1.3V or so spike that we see ..
The author only fully scans all modes if need be (makes perfect sense) ..
The level of leakage (unwanted noise) getting back into the ADC input, it matches the cheaper 20kHz voltage inverter frequency that the seller is fitting to the board (different to what their schematic states) :( ..
Their design also does not use any kind of anti-alias low pass filtering before the ADC what so ever :(
To reduce this leakage/noise level ..
- add a 100n cap to the ADC input pin
- change R35 to 1k
- add a 10n cap across R20
- add an extra 10uF to -5V line directly next to R32
- swap R31 and R32 for inductors - yet to do, none currently to hand, need to order some >= 100uH 0805 inductors that will fit the board
The main seller (jyetech guy) is using a counterfeit MCU (STM32F103C8) on this board, we did not know this at the time of buying :( .. selling counterfeit parts is a prison sentance in some countries.
Also, the voltage inverter they are fitting to the board is NOT as stated on the schematic. The device they are fitting is quite different (MUCH lower switching frequency that is causing noise problems).
Such is the way of the 'inhuman' race :(
So if you use the STM32CubeIDE to compile and program the MCU, don't be suprised if it refuses to flash program the MCU - can't blame ST for doing that !
Further details by Jaishankar M Wiki page