Hello, welcome to the forum.
First off, the PWM signal. We're outputting an 100 KHz signal with a duty cycle of 90% (What i extrapolated from the JAL code). However, I thought ESR meters use small pulses? So should it be 10% by any chance?
ESR meters are actually AC ohmmeters. The duty cycle of the source is not important, what is important is that it is an AC signal.
The 90% duty cycle was chosen due to the inverting amplifier at the input. The PIC actually measures the inverted 10%.
Next question is the first stage push-pull amplifier. Why a push pull amplifier with a PWM signal? The PWM signal will never trigger the lower PNP transistor correct? I'm just curious cause i'm trying to understand the circuit so I can solve my problems
Remember there is a capacitor at the output.
Finally, the trim / pot in the AC feedback loop of the common emitter amplifier has to go all the way down to zero for me to get the highest possible output reading. I zero the meter with an HEX value of about 0x1070 and with a 10 ohm resistor at input i'll max get a value of 0x3D0, so I guess my gain isn't as good as it could be. Should I adjust the emitter resistor?
I assumed you have tried different values. The adjustment procedure was an iterative process. You have to repeat the "zero" step after you have adjusted the potentiometer.
Note that the calibration using the trimmer resistor is only useful if you have used identical components. If not, then there will be issues with the amplifier gain especially if you have used a different type of transistors.
What the circuit does is basically a digital AC ohmmeter; you have an AC current source, an amplifier, a rectifier and a meter (the PIC adc).
All that needs to be done is correlate the resistance with the ADC readings. This step is performed by the "full calibration", where a set of lookup tables are made. Please take a look at the original analog version
of the meter, this is where I got the idea from.
Feel free to ask questions if this is not clear.