Go Down

Topic: ESR meter with Arduino (Read 196937 times) previous topic - next topic


Feb 15, 2012, 08:47 pm Last Edit: Feb 15, 2012, 09:10 pm by szmeu Reason: 1
Hi, I looked at the protesus schematic drawn by you, as I see some things are not right, here are my observations:
- Q2 should be a PNP transistor (BC327) (In your schematic I see Q2 as NPN BC337) not to mention that is not wired up properly, the correct transistors used in the schematic are complementary one is BC327 the other BC337, see original schematic.
- the part that leads signal to the AIN0 pin is not correctly wired either, look at the the original schematic carefully, the diodes and the 10k resistor's (R7 your schematic) one side should be tied to the ground not in parallel with the 470R resistor (R6 your schematic).
- please check carefully with the original schematic to make the proper corrections.

As for the code part you can comment out this part (after you corrected the hardware part):
Code: [Select]
eeprom_read_block((void*)&esrCal, (void*)0, sizeof(esrCal));
Code: [Select]
   esrCal = (miliVolt)/current;
   lcd.print(" done!");
   //writing calibration value into EEPROM so we don't have to calibrate on restart
   eeprom_write_block((const void*)&esrCal, (void*)0, sizeof(esrCal));
   lcd.print("saved to EEPROM");

After commenting see if you can produce some readings (should be resistance value of wires + resistance of DUT, zeroing is needed only to eliminate the resistance of the cables used, you will uncomment the part of code when you have some meaningful readings and need a proper zeroing.) For when the hardware is corrected you can test if it is working like this: when a DUT is not conected you should read on the AIN0 pin the max voltage permited by the anti-parallel diodes (around 700 mV, depends on diodes) and when the leads to the DUT are tied together this value should drop to a very small value.


Hello szmeu

Firstly, I'd like to thank you for sharing your design with everyone.
I also intend to make this meter but have a question...

I have lots of transistors in stock but unfortunately, dont have the same ones that you've used.
If I post a list of the transistors I have, would you be able to suggest a couple that might be suitable?

Thanks again, I look forward to building my new toy :)



The transistors are not critical, you need a pair of complementary transistors that have similar characteristic to the BC, something like general purpose low-power amplifying or switching applications transistor, a good candidate would be 2N2222 and 2N2907, I think the 2N3904 and 2N3906 pair can be used also.


Feb 16, 2012, 07:05 pm Last Edit: Feb 16, 2012, 08:04 pm by nurbit Reason: 1
Thanks for that, I'll have a look through my collection and see what I can find :)

I also have a question about the 47uf bipolar capcitor...

Does it have to be an electrolytic or would a ceramic cap work?
Also if I get to electrolytics and use them pole to pole, would it be ok to have a larger value or does it have to be 47uf?

I'm still learning myself so it will help me to understand why those particular parts were used.
I ok at building a circuit from a schematic but I don't really know why certain parts are chosen over others

Thanks again


Thanks for your time and help.
I am getting some reading now doing the simulation with Proteus .
My next step is to bread board and see what I get.


Feb 17, 2012, 11:00 pm Last Edit: Feb 17, 2012, 11:20 pm by szmeu Reason: 1
I currently use a 47uF, 35V non-polarized electrolytic capacitor, a polarized electrolytic would not be really good (there is the AC component), but a non-polarized ceramic capacitor with the proper C*V values might work, definitely you should give it a try, an interesting experiment would be obtaining a pseudo "non-polarized" cap from two electrolytic wired in series, experiment and see what results you can get. The ESR readings should not be taken as an exact measurement, as ERS really varies with frequency, temperature, capacitance, one will rather use this device to compare two capacitors with same characteristics to see which has a lower ESR, or test if the selected capacitor has a low ESR value, don't get me wrong, the device produces some good readings but I had no possibility to compare it to a reference, the sub ohm (miliohm) measurement precision for pure resistive load is pretty good once calibrated :)

I'm glad you can see some results there, keep trying and the device will work, it's not a very complicated schematic but is very rewarding once you get it going. (at least it was for me as I learned a lot building it). If there are questions and I have the answers I'll gladly help.
Keep us posted with the progress.


My diodes have arrived in the post today :)

I was wondering about the 1% resistors though.
Did you choose them because you had them laying around or is it vital they should be 1%?
Will 5% resistors work but with less accurate results?

I'm going to put it together with parts I have in stock and then replace certain parts if I'm not getting the correct results.

I'll let you know how it goes :)


Sorry, I have another question regarding the transistors

I have some 2222A s but I'm struggling for the PNP transistor.
I do have some A1015 s which seems to match the voltage but the collector current is only -150 instead of -800

Will this suffice or should I try to find something better matching?



Feb 21, 2012, 10:27 pm Last Edit: Feb 21, 2012, 10:41 pm by szmeu Reason: 1

If you have time and will follow the link at the start of the topic to dr. Le Hung's page from where I got the original schematic you can find some good information on how this ESR meter works.

Until then I will try to explain in a few words some basic things that will help you understand why some components are used.
To calculate the ESR we use ohm's law for which the formula is V = I * R, for us the ESR is represented by the R from this equation, thus R = V / I, now we have to get these two values from somewhere so we can compute a result.

For this we setup a circuit which will connect the DUT to a known current that in turn will produce a voltage drop on the DUT which we can measure through the analog pin of the arduino, depending on the resistance (esr) we need to measure we might need different current values, the sketch implements just the 50 mA branch, a 5mA branch is available on the schematic and can be easily used switching to the proper pin for higher ESR measurement (in case of lower value capacitors, let's say 10uF and smaller) thus it can be implemented as an auto-range function.

How we obtain the constant current:
For a 50 mA current we have: (I = V / R) = 5 / 100 = 0.05 A. Values are from: for Vcc = 5, this is supplied by the arduino's on board voltage regulator and R = 100 (obtained from R8 + the resistance of the transistor at saturation which should be very close to 0 ohm, thus 100 ohm).
So the reason to use low tolerance resistor in the current circuit is to ensure the value of the current is exactly as expected and calculated.

The 1 k ohm 1% resistor (R4) branch can give us a current of 5 mA (I = V / R) = 5 / 1000 = 0.005 A. I have to mention that the 5 mA current is not implemented in the sketch, so you can leave it out for now, this is necessary if you want to measure higher ESR or higher value resistors.

Some more things about the way we measure: we need to pulse the DUT with a very short pulse so that the capacitor we are measuring (especially if is a lower value) will not have time to charge and mess up the reading, plus charging and discharging fast is needed so that we measure the capacitor with a frequency as high as possible so capacitive reactance will be negligible (this is the reason I tried to speed up the analog read by changing the prescaller).

Conclusion: you can use 5% resistor (you can try to calibrate the device from the variables in the sketch), I guess the A1015 should be good too for a 50mA current, give it a try and see what are the results :)


Hi szmeu

Thanks for that explanation... it did help.
I haven't yet studied the link you supplied but I will do after posting this :)

Your explanation has made things MUCH clearer as to why you've shoen the parts you have.
I'll go and put the circuit together and get some new parts ordered so that I can replace my alternative parts when they arrive.

Thanks again for the explanation and your time.


Is the updated sketch posted here still updated to the posted schematic?  Except for the ESR pin which is A0, the pulse pin does not seem to match the schematic based from the sketch.


Will this ESR work in circuit? What is the output voltage P-P? Thanks!


You are right, for the sketch to work with the schematic you should edit the define lines (I updated the sketch also):

Code: [Select]
//define the input and output pin we will use
#define ESR_PIN A0
#define PULSE_SMALL 8 //this is not used in the sketch, implement it as needed (for 5mA current needed for smaller cap value measurement)
#define PULSE_PIN 9
#define BUTTON_PIN 0

and for the lcd use pin 5, 6, 10, 11, 12, 13 as in schematic.

Yes, this should work in circuit, voltage P-P should be 300mV (max permited by antiparalel Schottky diodes.)


Thank you for sharing your ESR with Arduino, nicely done.

You said "The DUT should be connected to CN1 between GND (pin3,pin4) and pulse and AIN0 (pin1,pin2) using a setup with four wires." I am assuming that you would attach/solder probes to use for testing, but to which wires? (you have four).




To be honest I did use only two wires to the DUT and worked well (one wire from gnd and only one wire from AIN0 and pulse, this means that on CN1 you tie together pin1 and pin2 thus resulting the point of connection for the probe), for more accuracy a four terminal sensing should give better results, you can read more here  http://en.wikipedia.org/wiki/Four-terminal_sensing


Go Up