Skip to content

OneOfEleven/M181-LCR-Meter-Firmware

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Goal

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

Hardware - M181 LCR Meter

  • Official product page link here

image

image

  • 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.

Tasks to be completed on this firmware

  • 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.

Buttons ..

  • 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

Serial commands

  • 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.

System Overview ..

RPI MCU programming

  • Programmer → Raspberry pi debug probe (**modified)
  • Interface → SWD
  • IDE → PlatformIO
  • Framework → STM32Cube

image

STLinkV2 MCU programming

  • Programmer → STLink-V2 (chinese clone)
  • Interface → SWD
  • IDE/Compiler → VSCode + PlatformIO
  • Framework → STM32Cube

image

Output parameter

image

  • 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

New firmware displays

image

Windows test GUI

  • 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 ..

image

no Goertzel filter, with block averaging, with auto DC offset removal ..

image

with Goertzel 64 sample length filter (1 sine cycle), with block averaging ..

image

with Goertzel 128 sample length filter (2 sine cycles), with block averaging ..

image

How I'm detecting sine wave clipping in HI-gain mode ..

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.

image

HPF modification to improve mode switching time

Waveform as seen on TP4/V4 pin (ADC input pin) ..

Change C8 from 100nF to 18nF.

image

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 ..

image

Original (the seller) firmware mode scanning

The author only fully scans all modes if need be (makes perfect sense) ..

image

Bad PCB layout/schematic design

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) :( ..

image

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 ..

image

  • 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

image

BEWARE !

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 !

Wiki

Further details by Jaishankar M Wiki page

About

Re-worked M181 LCR meter firmware, original by Jaishankar M

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published