Let's try to make an ESR meter (part 1: AC Signal)

 I've stumbled upon this : https://ludens.cl/Electron/esr/esr.html

A 100% hw ESR meter.

The principle is simple enough : 

- Generate an "AC" signal

- Go through a transformer to lower voltage/increase current 

- Measure the impedance across the capacitor to measure (and assume ESR >> Z at that fq ?)

Let's do it with a MCU and a salvaged transformer from a 5v usb power supply.


AC ?

Since we are using a transformer, we NEED to use a AC source. DC will just heat the transformer.

At first i used a sine oscillator made with an opamp, it sort of worked but was very unreliable in terms of replicating the circuit (gain was to be manually tweaked, its oscillation was changing, single fq ...)

The 2nd try was with a plain square oscillator, driven by the MCU. It worked fine, but caused inductance effect on the transformer because the signal was square. The transformer output signal was very distorted.

I could have used a CH32F103 or a GD32Fxx, which contain a DAC, but i already soldered a STM32F103 and could'nt be bothered to swap them.

So what can we use instead ?


PWM to the rescue!

We can use PMW + DMA + low pass filter.

The idea is to modulate the PMW duty cycle with the sine waveform and then filter out the PWM frequency.

The PWM signal (without filtering) looks like this :


And it works fine. I can have a signal very close to a sine at the input at the transformer and as a result something very close to a sine at the output of the transformer.

We use a PWM base frequency of 1.2 Mhz and generates the table(s) to create a sine at the frequency we want.

As the base frequency is ALWAYS 1.2 Mhz, we can use fixed RC low pass filter to get our 10k..50k sine signal.



Comments

Popular posts from this blog

Component tester with STM32 : Part 1 ADC, Resistor

Fixing the INA3221

INA3221, weird wiring