Arduino Forum

Topics => Science and Measurement => Topic started by: szmeu on Nov 26, 2011, 05:39 pm

Title: ESR meter with Arduino
Post by: szmeu on Nov 26, 2011, 05:39 pm
For those who are new to this topic and wish to build this simple esr-meter I warmly recommend to read all the four pages because from the first post that I made, there were some significant changes that will improve the esr-meter, these changes were contributed and ironed out by the users of the forum, also reading the pages you will find a lot of answers. Thanks goes to the users who improved this simple solution and fixed bugs!

A short resume of what you will find on reading more than just the first page:
- a clear understanding off how this esr meter works and many questions answered;
- the correct formula for calculating the esr!; (the formula on the first sketch is not the correct one, you will find the correct one just a bit deeper in the topic)
- a better stand alone layout and code contributed by users;
- ...


ESR meter for capacitors with Arduino

Hi,
This is my first for a "project" on a forum and playing with electronics is a hobby so please take it as is because this is just amateur work, everything is perfectible.
I was searching for an easy to build ESR meter on the net, found some great projects which helped me understand the basics, than I thought this would be an excellent idea for an Arduino project, so here I am, but before I present this solution I'd like to write two-three more lines a bit off-topic:

Skip if you find this kind of boring.
First I'd like to thank to dr. Le Hung here (http://members.upc.hu/lethanh.hung/LCFESRmero/en/index.htm) for the idea of this simple ESR schematic, he sells a kit for the ERS-meter but also features capacitor and inductance measurement.
Second: I'd like to thank the user tinhead on this forum (http://www.eevblog.com/forum/index.php?topic=1571.0) for making it easy for me to choose which scope to buy for tinkering with the current project (thanks for his work on Hantek DSO50xxx series).
Third thanks for all those people who post and share useful info and projects on the net!
Skip end.


The ESR project:
For those who are wondering what is ESR -> Wikipedia (http://en.wikipedia.org/wiki/Equivalent_series_resistance).
The current project is intended to help measure resistors with low value (under 1 Ohm) and capacitor ESR for those times when we want to test capacitors in a SMPS or other similar situations. Another interesting thing about this project is that it shows that over sampling is useful and can give very good results and can be employed successfully in other projects without the need to use external hardware; I had repeatable results in measuring low ESR capacitors and low value resistor (0.05 to 1 Ohm can be accurately measured). For information on using oversampling I highly recommend reading (http://atmel.com/dyn/resources/prod_documents/doc8003.pdf)

The idea behind this ESR is this: Using the well known formula U=I*R, we will pulse very shortly with a known current the cap or resistor, measuring the voltage on the element we have the necessary information to calculate the resistance. There would be a lot to write about this method and why this is functioning but probably more interesting is hand on experience.

The code: I tried to comment it at every step, it is written only for the 50mA current but very easily can be modified to add more upper range to the measurement (the hardware part is ready for this). Code could be rewritten for better performance using interrupts, etc, here is just a basic idea that works.

The hardware: Schematic is provided below, I designed a shield to arduino, probably not the best layout, be aware that the pcb was not tested yet and I'm not 100% is correct, did not use auto route and tried to make it single side, the schematic is good for sure and tested.

The schematic and pcb are attached (you have to sign in to download the atachment)
(http://s5.postimage.org/kgow4tv13/esr_04.png)

The DUT should be connected to CN1 between GND (pin3,pin4) and pulse and AIN0 (pin1,pin2) using a setup with four wires.

Here comes the rudimentary code:

Code: [Select]
#include <LiquidCrystal595.h>
#include <avr/eeprom.h>

//we have to change prescaler for the ADC to make the conversion happen faster
//this code section was suggested on the arduino forum
#define FASTADC 1
// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

//define the input and output pin we will use
#define DISCHARGE_PIN 7
#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

//function prototype
unsigned long measureESR(void);//measuring function, increases ADC to 16bit resolution through oversampling

//global variables
unsigned long esrSamples;
double miliVolt;
double esrVal;
double esrCal;
double vRef = 1.093;//voltage on the Vref pin (this sketch uses internal voltage reference 1.1V)
double current = 0.046200;//proper calibration can be done entering the right value for the current (U=I*R)
//idealy this is 0.05 A, this condition is fulfilled only if R10 is 100 Ohm, Vcc is exactly 5V and the transistor
//while fully saturated idealy is at 0 ohm.

//this is my display setup, I'm using Stephen Hobley's 3 wire setup and class
//exchange to what is good for you
LiquidCrystal595 lcd(6,4,2);

void setup(void)
{
 lcd.begin(20,2);
 lcd.setLED2Pin(HIGH);
 lcd.setCursor(0,0);
 lcd.print("ESR meter");
 lcd.setCursor(5,1);
 lcd.print("version 0.1");
 delay(1000);

 lcd.print("Seting up...");

 analogReference(INTERNAL);//setting vRef to internal reference 1.1V

 pinMode(ESR_PIN, INPUT);//reading miliVolt
 pinMode(PULSE_PIN, OUTPUT);
 digitalWrite(PULSE_PIN,HIGH);//low enables T1
 pinMode(DISCHARGE_PIN, OUTPUT);
 digitalWrite(PULSE_PIN,HIGH);//low disables T2
 pinMode(BUTTON_PIN,INPUT);//setting up for a button (will use this for zeroing)
 digitalWrite(BUTTON_PIN,HIGH);//enabling the pull up on the button, when button pressed to the ground zeroes out the cable
 delay(1000);
 lcd.clear();
 lcd.print("Please Wait...");

 //seting prescaller to 32 for faster adc (500khz)
 //at 500khz  results are still looking good (same values as if 250khz ADC clock)
 // the shorter the pulse on a small value capacitor it has no time to charge and denaturate de result
 if (FASTADC) {
   sbi(ADCSRA,ADPS2);
   cbi(ADCSRA,ADPS1);
   sbi(ADCSRA,ADPS0);
 }

 //reading calibration value, it will be ok if already calibrated, else it might be bogus depends on the content of EEPROM
 //but will be ok after first calibration
 eeprom_read_block((void*)&esrCal, (void*)0, sizeof(esrCal));
}

void loop(void)
{
 lcd.setLED1Pin(HIGH);
 esrSamples = measureESR();//this function takes a while,)
 // so we don't need other delay for the lcd (this functions time gives the refresh rate for display
 miliVolt = (esrSamples * vRef) / 65.535;//calculating voltage on AIN0 pin
 esrVal = (miliVolt)/current - esrCal;//calculate ESR in miliOhm (pls read forum for correct formula)

 lcd.clear();
 lcd.print("  V:");
 lcd.print(miliVolt,4);
 lcd.setCursor(13,0);  
 lcd.print("mV");
 lcd.setCursor(0,1);
 lcd.print("ESR:");
 lcd.print(esrVal,4);
 lcd.setCursor(13,1);
 lcd.print("m");
 lcd.print((char)244);

 //for zeroing the cables, this can be quite a big resistance compared to the values we intend to measure
 //so it is a good idea to try to reduce in any way possible this influence (short cables, soldering the cables, etc)
 if(!digitalRead(BUTTON_PIN)){
   lcd.clear();
   lcd.print("Zeroing...");
   esrCal = (miliVolt)/current;
   lcd.print(" done!");
   lcd.setCursor(0,1);
   //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");
   delay(400);
 }
}

//this is where the magic happens, it really works and gives some
//incredibly good results! if you need sub milivolt accuracy is a good way to go
//noise is good ;) if in doubt must read oversampling on ADC from AVR docs
unsigned long measureESR()
{
 unsigned long samples = 0;
 unsigned int acumulator = 0;
 int i = 0;
 //oversampling 4096 times (for 16 bit is 4^(desiredResolution - ADCresolution))
 while(i < 4096) {
   digitalWrite(DISCHARGE_PIN,LOW);//disable discharging
   digitalWrite(PULSE_PIN,LOW);//making a miliVolt pulse of 50mA
   delayMicroseconds(1);//on the scope it looks that after enabling the pulse a litle delay is
   //recomended so the oscillations fade away
   acumulator = analogRead(ESR_PIN);//reading value on AIN0
   digitalWrite(PULSE_PIN,HIGH);//stopping pulse
   digitalWrite(DISCHARGE_PIN,HIGH);//discharging the capacitors
   delayMicroseconds(600);//waiting a bit longer to fully discharge before another pulse
   samples += acumulator;//acumulating the readings
   i++;
 }
 //we have samples, let's go and compute value
 samples = samples >> 6;//decimating value
 return samples;//all done returning sampled value
}
Title: Re: ESR meter with Arduino
Post by: pwillard on Nov 30, 2011, 11:10 am
Nicely Done.
Title: Re: ESR meter with Arduino
Post by: grant1842 on Dec 17, 2011, 11:20 pm
Very nice work.
May I ask what software you used to draw the schmetic that supports the arduino IC
Title: Re: ESR meter with Arduino
Post by: szmeu on Dec 19, 2011, 05:28 pm
Thank you all for your appreciation, for the schematic I used the Eagle Cad with freeware licence and the adafruit library (you can find it here http://www.adafruit.com/blog/2010/02/05/b00m-adafruit-eagle-library-an-arduino-package/ (http://www.adafruit.com/blog/2010/02/05/b00m-adafruit-eagle-library-an-arduino-package/)).
Title: Re: ESR meter with Arduino
Post by: grant1842 on Dec 20, 2011, 03:44 am
I am curious will this get the ESR of a low cap value (pF, nF);
Thanks for your comments.
Title: Re: ESR meter with Arduino
Post by: szmeu on Dec 21, 2011, 10:26 pm
Good question, the smallest capacitor I played with was 4,7uF value, this was not a problem to measure, the code presented here uses only the 50mA branch of the schematic (through R8 and the transistor), using the 5mA branch (through R4, the code must be adapted a bit) lower value capacitors can be measured (the smallest cap value that can be measured accurately I don't know). I don't have an reference instrument to compare with, but I guess if one needs to compare two capacitors and sort out the one with the smallest ESR this can be done easily with the current schematic, eventually the schematic can be modified for a lower current (increasing R4's value) so that when the current is applied to the DUT will not charge the small capacitor to quickly and distort the reading (increasing frequency should be necessary to), maybe another schematic with a true sine 100khz constant current generator or even at higher frequency as this is important for the small value capacitors can give better results. Sorry I don't have now this on my breadboard and can't test it. Probably the best way to know if this schematic is good for such small capacitance (pF, nF range) is necessary to study a bit the theory behind ESR measurement and make some calculation to know at least the theoretical limits of this device.

I just took a peak on the net and got to this page where is a calculator for reactance (http://www.electronics2000.co.uk/calc/reactance-calculator.php (http://www.electronics2000.co.uk/calc/reactance-calculator.php)), as it turns out we must use a frequency where reactance will be negligible versus ESR, as this schematic uses aprox. something around 60khz (more or less) reactance becomes an issue beginning with the nF range, for pF we need something with several Mhz oscillations.


Sadly the answer is no measuring the ESR for (pF) range with this schematic, only the upper range of nF (even here reactance should be taken in account).
Title: Re: ESR meter with Arduino
Post by: geotek on Dec 26, 2011, 02:50 am
One question, how do you seperate ESR from ESL? 
Some capacitors, especially those designed for low frequency use, can have very high inductive reactance.  I don't think your device can distinguish this.  You may think you have a cap that has very high ESR, but, in fact works very well at 120Hz, not so good at 10KHz.
Title: Re: ESR meter with Arduino
Post by: szmeu on Dec 30, 2011, 05:47 pm
Good point, probably one way would be to test the capacitors at two different freq. high an low plus measuring the capacitance (computing the ideal values from capacitance and freq to get the ideal reactance and inductance) and than analyze the outcome comparing all the values and decide upon this result for a proper verdict of what the cap is good for and where it can be used, would be nice to have some capacitors with the same value and different ESR and ESL to test for this variable, the sketch could be modified to use different freq. This gives me an idea of a sketch where we could analyze the capacitor's response on a frequency range and plot the value and compare this to the ideal capacitor.
Title: Re: ESR meter with Arduino
Post by: grant1842 on Jan 13, 2012, 02:18 am
I am new to Arduino.
I have a  I2C 1602 LCD module.
Quote

http://www.dfrobot.com/index.php?route=product/product&keyword=DFR0063&category_id=0&description=1&model=1&product_id=135

It works.

I am trying to use it with your code.
I had to comment out 2 lines to get it to compile.
If you could look at it and tell me if I need to modify this code for it to work.
Thanks so much for your time.
Code: [Select]


#include <avr/eeprom.h>

//we have to change prescaler for the ADC to make the conversion happen faster
//this code section was suggested on the arduino forum
#define FASTADC 1
// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

//define the input and output pin we will use
#define DISCHARGE_PIN 3
#define ESR_PIN A0
#define PULSE_SMALL 3
#define PULSE_PIN 5
#define BUTTON_PIN 7

//function prototype
unsigned long measureESR(void);//measuring function, increases ADC to 16bit resolution through oversampling

//global variables
unsigned long esrSamples;
double miliVolt;
double esrVal;
double esrCal;
double vRef = 1.093;//voltage on the Vref pin (this sketch uses internal voltage reference 1.1V)
double current = 0.046200;//proper calibration can be done entering the right value for the current (U=I*R)
//idealy this is 0.05 A, this condition is fulfilled only if R10 is 100 Ohm, Vcc is exactly 5V and the transistor
//while fully saturated idealy is at 0 ohm.

//this is my display setup, I'm using Stephen Hobley's 3 wire setup and class
//exchange to what is good for you
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display


void setup(void)
{
  lcd.begin(20,2);
  //lcd.setLED2Pin(HIGH);
  lcd.setCursor(0,0);
  lcd.print("ESR meter");
  lcd.setCursor(5,1);
  lcd.print("version 0.1");
  delay(1000);

  lcd.print("Seting up...");

  analogReference(INTERNAL);//setting vRef to internal reference 1.1V

  pinMode(ESR_PIN, INPUT);//reading miliVolt
  pinMode(PULSE_PIN, OUTPUT);
  digitalWrite(PULSE_PIN,HIGH);//low enables T1
  pinMode(DISCHARGE_PIN, OUTPUT);
  digitalWrite(PULSE_PIN,HIGH);//low disables T2
  pinMode(BUTTON_PIN,INPUT);//setting up for a button (will use this for zeroing)
  digitalWrite(BUTTON_PIN,HIGH);//enabling the pull up on the button, when button pressed to the ground zeroes out the cable
  delay(1000);
  lcd.clear();
  lcd.print("Please Wait...");

  //seting prescaller to 32 for faster adc (500khz)
  //at 500khz  results are still looking good (same values as if 250khz ADC clock)
  // the shorter the pulse on a small value capacitor it has no time to charge and denaturate de result
  if (FASTADC) {
    sbi(ADCSRA,ADPS2);
    cbi(ADCSRA,ADPS1);
    sbi(ADCSRA,ADPS0);
  }

  //reading calibration value, it will be ok if already calibrated, else it might be bogus depends on the content of EEPROM
  //but will be ok after first calibration
  eeprom_read_block((void*)&esrCal, (void*)0, sizeof(esrCal));
}

void loop(void)
{
  //lcd.setLED1Pin(HIGH);
  esrSamples = measureESR();//this function takes a while,)
  // so we don't need other delay for the lcd (this functions time gives the refresh rate for display
  miliVolt = (esrSamples * vRef) / 65.536;//calculating voltage on AIN0 pin
  esrVal = (miliVolt)/current - esrCal;//calculate ESR in miliOhm

  lcd.clear();
  lcd.print("  V:");
  lcd.print(miliVolt,4);
  lcd.setCursor(13,0); 
  lcd.print("mV");
  lcd.setCursor(0,1);
  lcd.print("ESR:");
  lcd.print(esrVal,4);
  lcd.setCursor(13,1);
  lcd.print("m");
  lcd.print((char)244);

  //for zeroing the cables, this can be quite a big resistance compared to the values we intend to measure
  //so it is a good idea to try to reduce in any way possible this influence (short cables, soldering the cables, etc)
  if(!digitalRead(BUTTON_PIN)){
    lcd.clear();
    lcd.print("Zeroing...");
    esrCal = (miliVolt)/current;
    lcd.print(" done!");
    lcd.setCursor(0,1);
    //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");
    delay(400);
  }
}

//this is where the magic happens, it really works and gives some
//incredibly good results! if you need sub milivolt accuracy is a good way to go
//noise is good ;) if in doubt must read oversampling on ADC from AVR docs
unsigned long measureESR()
{
  unsigned long samples = 0;
  unsigned int acumulator = 0;
  int i = 0;
  //oversampling 4096 times (for 16 bit is 4^(desiredResolution - ADCresolution))
  while(i < 4096) {
    digitalWrite(DISCHARGE_PIN,LOW);//disable discharging
    digitalWrite(PULSE_PIN,LOW);//making a miliVolt pulse of 50mA
    delayMicroseconds(1);//on the scope it looks that after enabling the pulse a litle delay is
    //recomended so the oscillations fade away
    acumulator = analogRead(ESR_PIN);//reading value on AIN0
    digitalWrite(PULSE_PIN,HIGH);//stopping pulse
    digitalWrite(DISCHARGE_PIN,HIGH);//discharging the capacitors
    delayMicroseconds(600);//waiting a bit longer to fully discharge before another pulse
    samples += acumulator;//acumulating the readings
    i++;
  }
  //we have samples, let's go and compute value
  samples = samples >> 6;//decimating value
  return samples;//all done returning sampled value
}
Title: Re: ESR meter with Arduino
Post by: szmeu on Jan 13, 2012, 09:50 pm
@grant1842

Hi, using your display setup is ok, looking at the code I saw that I made a mistake when specifying the columns and rows of my display (16x2) so this code: lcd.begin(20,2) should really be lcd.begin(16,2), as I saw from your lcd object initialization yours to is 16x2 display, for this reason the code should be:

Code: [Select]
lcd.begin(16,2);

The two lines that I suppose to which you refer to and commented out are:
Code: [Select]
//lcd.setLED2Pin(HIGH);
//lcd.setLED1Pin(HIGH);

they have no important role in the code, they just control the back light on my display and another LED.
If the code compiled, everything should be all right, you can test your setup using an 1 ohm resistor (or other small values resistors). If the cables are zero-ed your reading should be accurate (you can further calibrate the meter modifying the value for the double
Code: [Select]
current = 0.046200; variable.)
For any questions I can answer I will help gladly.

Respect,
szmeu
Title: Re: ESR meter with Arduino
Post by: grant1842 on Jan 14, 2012, 03:17 am
Thanks for your help,.
I do not have any bc337 npn trans in my parts bench.

I do have some 2N4401 . Will this be a suggestible replacement ?
Thanks again
Title: Re: ESR meter with Arduino
Post by: szmeu on Jan 15, 2012, 09:17 pm
@grant1842

2N4401 as I see from datasheet should do the job.  :)
Title: Re: ESR meter with Arduino
Post by: grant1842 on Jan 15, 2012, 10:41 pm
Zero Meter.

The lcd I am using is only useing a 2 wire (A4, A5) to show info.

I am confused on the schematic as it uses several connections to the lcd .

I am worndering how to wire up the push button ZERO with my 2 wire LCD display.

Thanks for your help.
Title: Re: ESR meter with Arduino
Post by: szmeu on Jan 17, 2012, 10:08 pm
@grant1842

The button for the zeroing has nothing to do with the LCD, it is just a button tied to a digital pin (in this case D0) which has the pull up resistor enabled, when you push the button that digital pin is put to the ground and this condition is tested in this section of code:

 
Code: [Select]
if(!digitalRead(BUTTON_PIN)){
    lcd.clear();
    lcd.print("Zeroing...");
    esrCal = (miliVolt)/current;
    lcd.print(" done!");
    lcd.setCursor(0,1);
    //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");
    delay(400);
  }


I suppose you have some kind of serial interface LCD so you must set up your LCD to use a proper library, the schematic here shows  HD44780 type LCD wiring using 4bit mode, more on LCD you can find here: http://arduino.cc/playground/Code/LCD
Title: Re: ESR meter with Arduino
Post by: grant1842 on Feb 15, 2012, 01:49 am
Thanks for all your comments.

I have bread boarded this project and the displays reads(Zeroing Done saved to EEPROM) , it is like it is stuck in a loop .
I thought I may be doing something wrong so I used Proteus to do a simulation and I get the same reslut.
Can you look at the schematic and see if I am doing something wrong.
(http://grantspdr.com/gcf/nnn.jpg)
Title: Re: ESR meter with Arduino
Post by: szmeu on Feb 15, 2012, 08:47 pm
@grant1842
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));
and
Code: [Select]
if(!digitalRead(BUTTON_PIN)){
   lcd.clear();
   lcd.print("Zeroing...");
   esrCal = (miliVolt)/current;
   lcd.print(" done!");
   lcd.setCursor(0,1);
   //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");
   delay(400);
 }


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.

Title: Re: ESR meter with Arduino
Post by: nurbit on Feb 15, 2012, 11:21 pm
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 :)
Title: Re: ESR meter with Arduino
Post by: szmeu on Feb 16, 2012, 05:23 pm
@nurbit

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.
Title: Re: ESR meter with Arduino
Post by: nurbit on Feb 16, 2012, 07:05 pm
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
Title: Re: ESR meter with Arduino
Post by: grant1842 on Feb 16, 2012, 11:37 pm
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.

Title: Re: ESR meter with Arduino
Post by: szmeu on Feb 17, 2012, 11:00 pm
@nurbit
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 :)

@grant1842
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.
Title: Re: ESR meter with Arduino
Post by: nurbit on Feb 20, 2012, 09:09 pm
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 :)
Title: Re: ESR meter with Arduino
Post by: nurbit on Feb 20, 2012, 09:31 pm
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?

Thanks
Title: Re: ESR meter with Arduino
Post by: szmeu on Feb 21, 2012, 10:27 pm
@nurbit

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

Title: Re: ESR meter with Arduino
Post by: nurbit on Feb 22, 2012, 09:53 pm
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.
Title: Re: ESR meter with Arduino
Post by: alyas on Apr 29, 2012, 04:49 am
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.
Title: Re: ESR meter with Arduino
Post by: bseishen on Apr 30, 2012, 09:18 pm
Will this ESR work in circuit? What is the output voltage P-P? Thanks!
Title: Re: ESR meter with Arduino
Post by: szmeu on May 01, 2012, 09:26 pm
@alyas
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 DISCHARGE_PIN 7
#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.

@bseishen
Yes, this should work in circuit, voltage P-P should be 300mV (max permited by antiparalel Schottky diodes.)
Title: Re: ESR meter with Arduino
Post by: qz9090 on May 09, 2012, 02:40 am
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).


Thanks.
Title: Re: ESR meter with Arduino
Post by: szmeu on May 11, 2012, 03:52 pm
@qz9090

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 (http://en.wikipedia.org/wiki/Four-terminal_sensing)


:)
Title: Re: ESR meter with Arduino
Post by: ronx on Jul 15, 2012, 10:41 pm
Thank you for sharing your excellent circuit and code.  I made a PCB from your circuit image and used 2n2222 & 2N2907 transistors and 1% resistors. I didn't have a non-polar cap, so I soldered the anodes of two 100uF caps together.  As a test, I tried adding parallel diodes to the caps, but found they made no difference in my readings.   On a pair of used 2200uF 10V caps I got 0.0 Ohms on one that looks good, and 5.600 Ohms on one with a slight top bulge, so it finds bad caps.

The problem I am having is that I am unable to calibrate it.  Using a one Ohm resistor I had to set "double current = 0.007460;" to get the meter to read 1.012, but then a 1/3 Ohm resistor reads .090.  Could the transistors or DIY capacitor cause this?   I'm a beginner, so your post was highly educational and I got a new test tool as well!  Thanks again.

Ron
Title: Re: ESR meter with Arduino
Post by: szmeu on Jul 17, 2012, 10:30 pm
@ronx
I think I made some mistakes in my sketch and assumed wrong how the original circuit worked when reverse engineered Lee Hung's schematic. I assumed it was a constant current circuit, which as I see it now it is not. The formula used in the sketch thus will not give correct results, funny thing is when I tried it by measuring different value resistors, readings were pretty sound. I currently don't have the possibility to test the following but if you have time please replace the formula and post back if this works better.

As I see it now in the circuit we have a voltage divider (see Wikipedia article on this http://en.wikipedia.org/wiki/Voltage_divider (http://en.wikipedia.org/wiki/Voltage_divider)) (from there we get the formula for calculating Z2 = (Vout*Z1)/(Vin-Vout))

replace this line
Code: [Select]
esrVal = (miliVolt)/current - esrCal;//calculate ESR in miliOhm
with this
Code: [Select]
esrVal = (miliVolt*100)/(4.9-miliVolt);//calibration should be done by changing the value of 100 (This is the 1% reference resistor) and/or changing the 4.9 value which is the Vin and it is given by the the voltage regulator on the arduino board

When I have a litle spare time I'll test it.

Greeatings

Title: Re: ESR meter with Arduino
Post by: ronx on Jul 19, 2012, 04:36 pm
Thanks for the reply szmeu.  
I did find the problem, and it was me...  I checked my circuit and for R8 (on the PCB) and found 1 Ohm rather than a 100.  I must have put my 1 Ohms and 100 Ohms in the same bag  last time I cleaned up ;-)   After the fix I calibrated using the original code until I got 1001 on a 1 Ohm resistor. The 1/3 Ohm reads 363, and a 10 Ohm reads 4450 (it's all I have to test with).  Am I correct in assuming this pretty accurate and the 10 Ohm is just too big?   I tried the voltage divider modification, but it gives negative numbers (-112 and -143).  Thanks again for the great code, and sorry for the confusion.  I think this is an extremely useful tool and have built both an arduino shield and a self-contained ardweeny powered meter housed in an old external hard drive case. 

Regards,
Ron
Title: Re: ESR meter with Arduino
Post by: szmeu on Jul 20, 2012, 11:20 am
@ron

I'm glad you found the "bug" in your circuit and managed to get better readings, I will answer to your questions now:

- your assumption are right, with the 100 ohm branch max reading is around 6 ohm (R = U/I) = 0.300/0.05 = 6 ohm (0.300 is max voltage allowed by schottky diode 1N5822), if you need more range there is R4 branch with the 1k ohm 1% resistor (on D8), (you can implement this in the code and can have upper range that will give you the range of the 100 ohm resistor X 10, I think the same way a lower range could be implemented with a proper transistor that can source 500mA of current through resistor of 10 ohm 1%).
- you mentioned in your first post that did not use the diodes, I just want to explain now the role of the two groups of diodes, the first group of antiparalel 1N5822 diodes is to allow in circuit measurements, this diodes assure that we will get max 0.3 V on the probes and will not damage components on the board, the second group of diodes 1N4004 are there to protect the input of the Atmega from charged capacitors, good practice is to discharge caps before measurements.
- 65536 comes from 2^16(using oversampling in code we can have a mapped value between 0 and 65535), if we would take a simple measurement on a AIN pin we would get a 10 bit result which is 1024, but as we are enhancing our reading we get a 16 bit result that needs the proper scaling, thus dividing it by 65535, see http://arduino.cc/en/Reference/AnalogRead (http://arduino.cc/en/Reference/AnalogRead).

I wonder where I am wrong with the voltage divider formula, I currently don't have the hardware assembled and no possibility to test it, if you have spare time and in mood please try the following (would be nice to get better results from this simple hardware):
I think the problem comes from mixing Volts with mVolts in the formula I gave you, probably the reason for negative numbers too, display on your LCD the value of
Code: [Select]
miliVolt and see the representation for a known resistor, say 1 ohm, this should be around 0.05 V or 50 mV:

if milivolt (not good)
esrVal = (miliVolt*100)/(4.9-miliVolt) = (50 * 100) / (4.9 - 50) = 5000 / -45.1 = -110

if volt
esrVal = (miliVolt*100)/(4.9-miliVolt) = (0.05 * 100) / (4.9 - 0.05) = 5 / 4.85 = 1.03 ohm

I have to say it's great to have someone to help testing and give feedback, otherwise it gets boring and can lose interest.

Thanks and glad if I could help :)
Title: Re: ESR meter with Arduino
Post by: ronx on Jul 22, 2012, 10:48 pm
That's it! 
With "esrVal = (miliVolt * 100)/(4.9-(miliVolt/100)); "  I get 339 on the 1/3 Ohm resistor, 987 on the 1 Ohm and 6582 on the 10 Ohm.  My 10V-2200uF good-cap, bad-cap pair now read 21 and 3774 respectively.  Perfect!  I didn't mention the diodes in my first post as they are the same as you used. I just wanted to verify your PCB works, as do homemade non-polar caps and 2N2222 / 2N2907 transistors.

This is such a useful tool; and so cheap and easy to build.  I really hope others build this, make their own modifications, and post their results.  If the arduino has enough processing power it would be great to have an audible tone to check caps without looking at the LCD. When I have more time I hope to learn how your code works and make the circuit in Eagle Cad so I can experiment.  Thanks again for posting this great project and all your help. 
Title: Re: ESR meter with Arduino
Post by: alibenpeng on Oct 21, 2012, 05:04 pm
Hi,

I'd like to build this project but I don't seem to get the thing about the four wire connection to the DUT:

Why use four wires to connect a capacitor that has only two wires? Why not connect pin1 and pin2 of CN1 directly? I've seen other esr meters that use very short wires to connect to the DUT, is this something about wire capacities or something of this kind?

Also, in the original schematic by Le Hung there is an additional BS170 mosfet in the circuit, could anybody clear up what that is about?

I know how a esr-meter works in principle, but this really puzzles me.

Cheers,

Ali
Title: Re: ESR meter with Arduino
Post by: szmeu on Oct 23, 2012, 09:05 pm
Hi there,
1. You can use 2 wires no problem, no need for the 4 wire setup to understand why initially proposed that setup read back as I explained in a previous post.
2. The schematic that uses BS170 is a newer one, version 4.0, the esr meter presented here is based on an older schematic version 3.0 from lee hung. I see the new version has a bunch of modifications compared to ver 3.0. I guess the adition of see it BS170 would be to discharge the cap.
If you build the esr meter with Arduino read the post on this thread as you will find answers and some important modifications to the code.

Restecp ;)
Title: Re: ESR meter with Arduino
Post by: alibenpeng on Oct 31, 2012, 01:04 am
I've built the circuit on a breadboard and it works fine. But for production use I'm aiming at eliminating the whole arduino and building a board with a stand alone atmega 328.

The problem is, I can't really decide on how to build the power supply:

I understand that a clean supply voltage is crucial, so just hooking up a 4*AA-battery-pack is out of the question.

But do I have to power the circuit with 5V or will 3.3V also work (with some adjustments to the code, of course)? And if so, can I use a switching regulator instead of a linear one?
The Arduino as well as other ESR-meter-projects (including Le Hung's) use linear regulators, so maybe using a switching regulator might not be a good idea, because of the ripple it might introduce. Then again, maybe this issue could be addressed with a few caps..

Any input on this is appreciated!

Cheers,

Ali
Title: Re: ESR meter with Arduino
Post by: bobale on Jan 19, 2013, 06:24 pm
Can anybody repost zip file from first post in this topic?
Title: Re: ESR meter with Arduino
Post by: JoeO on Jan 20, 2013, 12:11 am
Here it is
Title: Re: ESR meter with Arduino
Post by: bobale on Jan 20, 2013, 03:58 am
I can't download any attachment from the forum, that's why I've asked for a repost :). If you can host it somewhere online, I would be thankful.
Title: Re: ESR meter with Arduino
Post by: markbee on Jan 20, 2013, 05:41 pm
I get a "Error 503 Service Unavailable" if I try to download the file from the forum...
Title: Re: ESR meter with Arduino
Post by: Totoro on Jan 21, 2013, 09:37 pm
Hi all,
A few weeks ago I was looking for an ESR meter to build and ran across this thread. Thank you szmeu! I have built this up and it works very well.
I just wanted to share some observations. First, the hardware is a great circuit, simple and effective. Thanks again. And the circuit is very tolerant of the non-polarized capacitor value (47microFarad in the original). I used a 10micro I had and it works fine.
Second, you are correct that the pulse is not from a current source and what you want is to calculate as a voltage divider. (BTW, the original code will get you close enough to serve the purpose, especially at low values of ESR.)
Let's say that Vin is your source voltage (near 5V here), Vout is the value between the two resistors (you measure that at AIN0), Rs is the upper resistance (the 100 Ohm resister) and the lower resistance, the ESR, we'll call Rm. The formula is given as follows.
Rm = Rs / ((Vin/Vout) - 1)
It is important to not mix units, so here is an example. Say your AIN0 measurement, 'milliVolts' variable in the code, is 20. So, Vout is 20mV. Using the value of 5V for the source voltage, Vin, we need to express that in millVolts because that's the unit we're using for Vout. So, Vin is 5000mV. Rs is 100 Ohms so the result will be in Ohms.
Rm (in Ohms) = 100 / ((5000/20)-1) = 100 / 249  = 0.402 Ohms
To get milliOhms, multiply times 1000 or 402 milliOhms!

Here is my re-write of the ESR calc routine. This combines the oversample routine with some things were outside in the original code. A couple of lines are re-ordered. The big calculation difference is at the end.

Code: [Select]
// ESR calculation routine
// discharge, start a current pulse, measure the voltage at the ESR_PIN, stop the pulse
// repeat 4096 times and average the results ('oversampling and decimation')
// refer to Atmel Application Note AVR121: 'Enhancing ADC resolution by oversampling'
// http://www.atmel.com/images/doc8003.pdf
double calcESR()
{
  unsigned long accumulator = 0;
  unsigned int sample = 0;
  int i = 0;
  // oversampling 4096 times (for 16 bit is 4^(desiredResolution - ADCresolution))
  while ( i++ < 4096 )
  {
    digitalWrite( DISCHARGE_PIN, HIGH ); // discharge the capacitors
    delayMicroseconds( 600 ); // discharge wait time
    digitalWrite( DISCHARGE_PIN, LOW ); // disable discharging
    cli(); // disable interrupts for the pulse measure
    digitalWrite( PulsePin, PulseActive ); // start current pulse
    delayMicroseconds( 1 );
    // on the scope it appears that after enabling the pulse
    // a small delay is needed for oscillations to fade away
    sample = analogRead( ESR_PIN ); // read ADC value
    sei(); // measured, enable interrupts
    digitalWrite( PulsePin, ! PulseActive ); // stop current pulse
    accumulator += sample; // accumulate
  }
  // sampling is done
  esrSamples = accumulator >> 6; // decimate the accumulated result
  // calculate voltage on AIN0 pin...
  milliVolts = (esrSamples * vRef) / 65.536;
  // calculate ESR in milliOhms...
  double Rm = Rs / ((Vin / milliVolts) - 1); // Rm is in Ohms
  return Rm * 1000; // milliOhms
}


This now consistently measures my 0.1 Ohm and 1 Ohm precision resistors within about 2%. And a 4.7 Ohm resistor reads 4.68. Super!

BTW, I used all those extra pins on the Arduino to drive a 3-digit, 7-segment display. (That's why the code above has interrupt disable/enable calls to protect the pulse measure from the display multiplex interrupts.)

- Totoro

Title: Re: ESR meter with Arduino
Post by: JoeO on Jan 23, 2013, 10:34 pm
Totoro:

Would you make your schematic and code available for others to use.  I would like to make a self contained ESR meter that does not need a voltmeter.

Thanks
Title: Re: ESR meter with Arduino
Post by: Totoro on Jan 24, 2013, 12:13 am
I am happy to post my code. You can download it from here.
http://vondervotteimittiss.com/belfry/downloads/ESR_Meter.ino.zip (http://vondervotteimittiss.com/belfry/downloads/ESR_Meter.ino.zip)
Just keep in mind, it is a work in progress. As it stands, it works with the 'high-current' resistor in the circuit (the 100 ohm resistor which is actually 110 ohm in my circuit and in my code I refer to this as the low range).
As I mentioned, the schematic I used is the same as szmeu originally posted. (OK, not exactly. I use a 110 ohm resistor, because I had one, and a 10microFarad capacitor, because I had one. Adjust the resistor value accordingly in the code.) The pulse generation part of the circuit as szmeu posted is really elegant and needs no change.
The only change I made is in the display. In my breadboard, I use a three-digit, seven-segment display and have programmed the Arduino drive it. (Adjust the SEG_ON/OFF, DIG_ON/OFF defines as appropriate for your display setup and anode/cathode digit switching transistors.)
I am currently working on getting the 'low-current' mode (the 1000 ohm resistor), what in my code is the high range, to work. That should let me measure higher values of ESR, as szmeu suggested.
Please keep in mind that I am new to micro-controller programming! If you have any questions about the code, I'll try to answer as best I can.
And if you have any suggestions how I can improve, please let me know.
Thanks for your interest.
- Totoro
Title: Re: ESR meter with Arduino
Post by: Sreg on Jan 24, 2013, 01:26 pm
Hi all,

Since I do not have an Arduino, I have built szmeu's original circuit around an Atmega8.
The only difference is that I'm using 1N5821 instead of 1N5822.
The firmware has been adapted from Totoro's code.
When connecting a cap or small resistor across pins 1+2 and GND, I'm getting nothing, the ADC value is always 0. (2.56V internal reference)
However, when connecting a potentiometer accross +5V and GND with the wiper going to the ADC (ADC0/PC0 in my case), I'm getting values, so the ADC seems to be working ok.
Charging pulses are generated, measuring about 30mV pp at pins 1+2 (maybe too low?)
Any pointers as to what could be wrong?




Title: Re: ESR meter with Arduino
Post by: dhenry on Jan 24, 2013, 01:27 pm
When you use a resistor to charge-up a capacitor, the current goes down as the capacitor is charging up, exponentially. This is less of a problem initially; but as the capacitor is charged up, the error (from a linear charging up process produced by a ccs) gets bigger (small resistor or small capacitor, or long charge-up time / cycle).

One way to solve this is to taylor-expand the integral of current over time. You only need to expand to its 2nd order derivative to maintain fairly good accuracy.
Title: Re: ESR meter with Arduino
Post by: Totoro on Jan 24, 2013, 11:29 pm
Sreg,
First, just to be sure we're on the same wavelength, short pins 1 and 2 on CN1 (on szmeu's schematic) together and put the  device-under-test (DUT) between these shorted pins and ground. For now, just ignore the possibility for a four-wire setup (actually three wire with the circuit from szmeu).
OK, you've done that. Now, with a 30mV pulse across your DUT, you can do the math and you should have approx. 600milliOhms +/- for the DUT. This assumes that at top of the 100 Ohm resistor, R8, (where it connects to the emitter of Q1) you see a 5V pulse.
If that's the case, then you may want to make sure that the oversampling is set up correctly for your device. You may need to change some of the register set stuff in the original code. This stuff...
  sbi(ADCSRA,ADPS2);
  cbi(ADCSRA,ADPS1);
  sbi(ADCSRA,ADPS0);
Refer to the datasheet for your device and the Atmel document that szmeu mentions.
Then again, it could be something simple like the discharge transistor, Q2, is always on. Or you didn't change the value of Vref in the code. You mention the internal ref on your device is 2.56V. In the code it's 1.1.
This is all just guesses on my part. Maybe you have checked all this stuff. My 2 (euro) cents worth, anyway.
Good luck!
- Totoro
Title: Re: ESR meter with Arduino
Post by: bobale on Jan 25, 2013, 12:07 am
Totoro, have you designed PCB by any chance?
Title: Re: ESR meter with Arduino
Post by: Totoro on Jan 25, 2013, 01:01 am
bobale,
Sorry, I am just a breadboard/point-to-point/proto-board type. My main need for an ESR meter is to troubleshoot old audio gear and test equipment.

Title: Re: ESR meter with Arduino
Post by: bobale on Jan 25, 2013, 01:29 am
I also need it ocasionally, but I would rather build standalone device, but I'm really bad at PCB design, so I'll wait for someone else to do it (someone who needs it more than me) :smiley-mr-green:
Title: Re: ESR meter with Arduino
Post by: Sreg on Jan 25, 2013, 12:33 pm
Totoro,

thanks for your reply!

Sreg,
First, just to be sure we're on the same wavelength, short pins 1 and 2 on CN1 (on szmeu's schematic) together and put the  device-under-test (DUT) between these shorted pins and ground. For now, just ignore the possibility for a four-wire setup (actually three wire with the circuit from szmeu).

Yes 1+2 are shorted together amd DUT is placed between those and GND.
Quote

OK, you've done that. Now, with a 30mV pulse across your DUT, you can do the math and you should have approx. 600milliOhms +/- for the DUT. This assumes that at top of the 100 Ohm resistor, R8, (where it connects to the emitter of Q1) you see a 5V pulse.
If that's the case, then you may want to make sure that the oversampling is set up correctly for your device. You may need to change some of the register set stuff in the original code. This stuff...
 sbi(ADCSRA,ADPS2);
 cbi(ADCSRA,ADPS1);
 sbi(ADCSRA,ADPS0);
Refer to the datasheet for your device and the Atmel document that szmeu mentions.

I'm fairly sure my code is ok, but I'd be glad if you could take look at it - please see attachment.
I'm also getting about 3V pulses measured at the emitter of Q1.

Quote

Then again, it could be something simple like the discharge transistor, Q2, is always on. Or you didn't change the value of Vref in the code. You mention the internal ref on your device is 2.56V. In the code it's 1.1.

Unfortunatley the Atmega8 has only 2.56V internal reference voltage, but I think I can live with any decrease in resolution this will introduce.
My problem is that no values whatsoever are displayed when connecting the DUT as described above. (ok not entirely true, -1 is displayed since I return -1 from the calculation if millivolts are 0 - please refer to source code).
Q2 should not always be on, I get pulses on its base according to the discharge pulses.

If I get this to work, I'll gladly post my pcb layout.

-- Sreg
Title: Re: ESR meter with Arduino
Post by: Sreg on Jan 25, 2013, 05:43 pm
Finally got it to work, it seems the BC327 was defective  :smiley-red:

Thanks for all the help!
As promised, I attach my layout and source code (built with Atmel Studio 6.0).


-- Sreg
Title: Re: ESR meter with Arduino
Post by: markbee on Jan 25, 2013, 05:47 pm
wow thx for the layout. I was just starting to design one. Saved a lot of work.

markbee
Title: Re: ESR meter with Arduino
Post by: Totoro on Jan 25, 2013, 07:59 pm
Sreg,
Great to hear you got it working!
You mentioned above that you return -1 when millVolts is zero. I wondered why, so I took a look at your code. You have helped me to avoid a bad thing, the potential divide-by-zero bug. Thank you!
- Totoro
Title: Re: ESR meter with Arduino
Post by: bseishen on Apr 09, 2013, 05:53 pm
What Schottky diode is everyone using that has had success? I am currently using a B340A-E3/61T and the pulse peak at the terminal with no DUT is only around 150mv. I think this is causing my reading to drastically be off. I am trying to wrap my head around how the current voltage divider equations every one is using is working. It doesn't take in account of the clamping voltage and power dissipation of the Schottky diode. Any help would be greatly appreciated!

Title: Re: ESR meter with Arduino
Post by: Totoro on Apr 10, 2013, 10:36 pm
Hi bseishen,

If you read my original text (kept intact, below) then I am sorry. I 'double-thinked' myself into some confusion. I will try for a better take.
First, the Schottky diodes only limit the maximum voltage available to the DUT. Here's what happens. The transistor Q1 turns on and a rising wave edge goes through R8 and is pretty much unaffected by C2/C1. So, R8 is effectively in series with the DUT. This forms a simple voltage divider and the rising wave edge sort of shelves at the voltage determined by the divider formed by R8 and the DUT. For a DUT with, say, 100 milliOhms, that is a pretty small voltage, i.e., a few milliVolts. Since we're dealing with capacitors here, there is some continuing charging that will mess up the measurement if we wait too long to make it. I put together a LTSpice model to play with this. Attached is a closeup of a pulse from a sample run with a DUT of 100uF and .1 Ohm ESR. The yellow trace is the R8 side of C2 and the blue is the DUT side. (I had looked at the same thing on a 'scope and the simulation agrees really well. I don't know why it didn't sink in earlier. It is interesting to do a run with a resistor as DUT. The 'shelving' is more apparent.)
So, pretty much ignore what I said before. Part of my confusion was from using a different power source after changing the diodes. This shows that the value for Vcc in the code is quite critical for consistent and linear results. Also, it is now apparent how two ranges work by adjusting the voltage divider.
I hope this helps. My understanding is better, anyway.

---- here is the original text ----
I went back and really looked at this as well as reading the original document by Dr. Le Hung (link in szmeu's first post). I have to admit that after looking closely, I really don't understand this completely either. Clearly, the pulse can only have an amplitude determined by the schottky forward breakdown. In my circuit I used germanium diodes and that was about 300mV. I just swapped them for 1N5822 (as in the orignal schematic) and now have a pulse of 220mV and my calibration is way off. What seems apparent now, is that the voltage specified in the code as the 'supply' voltage, i.e., 5V, is just a number. I mean that it has to be adjusted to correspond to something that, well, I don't know exactly what it specifies. Dr. Le Hung calls the pulses current pulses. There must be something to that since the two ranges do work (there is a factor of ten, approximately, difference when the pulse 'comes from' the 100 vs. 1000 Ohm resistor).
Try playing with the voltage value and see if you can dial something in. I haven't tried that yet but it will be my next step to try and figure this out.
I am first a software guy and the hardware part of this is now not as clear as I thought. Maybe someone else can add to this.
Title: Re: ESR meter with Arduino
Post by: bseishen on Apr 11, 2013, 08:51 pm
Totoro:
Ended up doing some spice analysis on the schematic. The line is very linear! So with a simple slope formula should be able to get some good results. I currently have some 1% resistors in the mail, when i get them in i'll test this out.
Title: Re: ESR meter with Arduino
Post by: Totoro on Apr 11, 2013, 09:19 pm
Wow, what timing! You posted while I was composing. Please read my update.
I think your simulation is too simplified. I would be interested in your opinions if you would try mine.
Title: Re: ESR meter with Arduino
Post by: bseishen on Apr 11, 2013, 10:29 pm
Yup, it is super simplified. Just decided to do DC analysis only. I ran your schematic and I'm getting the same voltage per ohm on the ADC pin  :) Have you tried running different Schottkys? It changes the ADC voltage quite a bit! The DUT is incremented in .5 ohms on the attached graphs.
Title: Re: ESR meter with Arduino
Post by: mikanb on Apr 21, 2013, 11:49 am
I have upgraded existing code with previous modifications to expand measurement range up to 50 Ohms and to make this ESR meter autoranging in the range of 0-50 Ohms which should be more than enough range for the ESR measurement. The code is included in the attachment and on the schematic you have to add one more PNP transistor with the same configuration as Q1 but with the 1k resistor instead of 100R (1k is for upper range measurement). Pinout in my sketch version is different in order to match my board so you will have to modify it according to your board settings.
Any comments/suggestions are welcome...
Title: Re: ESR meter with Arduino
Post by: Baravantan on Apr 23, 2013, 11:12 am
Hello everyone, and thank you for sharing your work.
I built the ESR meter using an Arduino UNO and a lcd display CDL4162-HD44780.
My version can work in two ways: with Arduino UNO connected to the board face down, and in standalone mode.
In the first case, only the bottom side of the pcb is required (single side)
I also added a function that allows me, by selecting the right value of the DUT, to know immediately if it is good or not.
BUT there is a problem: If I measure a 1ohm resistor, the reading is quite correct, but if I measure 150mohm or 75mOhm, the reading is totally wrong.   :smiley-eek:
Is there anyone who can help me? Thank you. :~
Title: Re: ESR meter with Arduino
Post by: Baravantan on May 11, 2013, 11:46 am
...mah:
20 days, 10 downloads, 0 replies   :smiley-zipper:

Title: Re: ESR meter with Arduino
Post by: JoeO on May 11, 2013, 07:11 pm
You need to post the code you are using and the schematic of your hardware before someone can help you.
Title: Re: ESR meter with Arduino
Post by: Baravantan on May 11, 2013, 07:21 pm
... 10 downloads of the attached .zip file with code, images, schematics and PCB design...
Title: Re: ESR meter with Arduino
Post by: Baravantan on May 14, 2013, 07:32 pm
:smiley-sleep: ...is there anyone who has successfully measured low ohmic values??, for example 0.1 or 0.01; appropriate values ??to an ESR meter?  ;)
Title: Re: ESR meter with Arduino
Post by: Totoro on May 14, 2013, 09:06 pm
Hi Baravantan,
To answer your last question, yes, I have measured what seem to be good values in the milliOhm range. I have a 100mOhm precision resistor and have measured many capacitors with what appears to be reasonable and repeatable results.
I took a quick look at your code and all appears to be OK with the actual calcESR routine. I didn't look at your PCB layout so I can't say more than that in my proto-board build I used the schematic exactly as in the original post EXCEPT that I used a 10microFarad cap and a 110Ohm resistor in the pulse circuit (47micro and 100 Ohm in the original).
I did notice in testing that the whole thing is very sensitive to the declared supply voltage and the value of this resistor. And I noticed in your code the following...

double Vin_LO = 4700; // milliVolts
uint16_t Rs_LO = 110; // Ohms

Are you actually using a 110 Ohm resistor? And is your supply voltage really only 4,7 V? Unless these (and the Vref voltage) are well defined, the calculation can be very non-linear.
Anyway, hope this helps.
Title: Re: ESR meter with Arduino
Post by: Baravantan on May 15, 2013, 09:06 pm
Hi, Totoro, and thanks for your help!
These days I've done some tests, including the correction of the parameters that you have shown me, but without solving the problem.

double vRef = 1.079; // Volts
double Vin_LO = 4980; // milliVolts
uint16_t Rs_LO = 99.8; // Ohms

All values ??measured with a €40 multimeter (what I have)

Considered that your ESR Meter works, surely my problem isn't in the code.
I think there is a lot of work waiting for me...

Thank you again.
Title: Re: ESR meter with Arduino
Post by: cepc on May 17, 2013, 05:52 am

Sorry, I am just a breadboard/point-to-point/proto-board type. My main need for an ESR meter is to troubleshoot old audio gear and test equipment.




Hello  Totoro , I am having a hard time wrapping my head around which pins you hooked up to the 7 segment displays, can you possibly draw something quick showing pinouts?   i dont want to use a lcd display,  im going to make a smd version of the board and will post the results after i have a working prototype.

thanks so much!


Title: Re: ESR meter with Arduino
Post by: cepc on May 17, 2013, 06:50 am
ohh crap.    :smiley-red:

i need to take it easy on the drinking.. i think

let me guess:  these are the common anodes (or cathode depending on display.) going to a transistor for each.

#define PIN_DIG_0 10 // least significant digit
#define PIN_DIG_1 11
#define PIN_DIG_2 12
#define PIN_DIG_3 13

these go to their respective pins on display..

#define PIN_SEG_DP 8
#define PIN_SEG_A 3
#define PIN_SEG_B 2
#define PIN_SEG_C 9
#define PIN_SEG_D 6
#define PIN_SEG_E 7
#define PIN_SEG_F 4
#define PIN_SEG_G 5


or do i need to stop drinking???  i think i can keep drinking.  ]:D
Title: Re: ESR meter with Arduino
Post by: garballz on May 22, 2013, 05:19 pm
Here is a shield I built for my Uno. It has a resolution of 0.02 Ohms. I'm currently finishing the video for the code demo/explanation on how it works.

http://www.youtube.com/watch?v=5YumCH5cTok

Next I plan to simplify it a bit more and add a basic function generator on a shield designed for the Due.

I would like to thank Tim and his Visual Micro project. Using his add-in to program and debug the Arduino software made it easy.
www.VisualMicro.com (http://www.VisualMicro.com)
Title: Re: ESR meter with Arduino
Post by: Bakez on Jul 23, 2013, 01:54 am
Hi

Did anyone work on getting this to work with nF range capacitors, or to a resolution of mOhms or better?

What sort of time window is it taking to do the measurement for you guys?
Title: Re: ESR meter with Arduino
Post by: dunozf on Jul 30, 2013, 10:53 am
Hi,
is it  possible in this scheme to measure the capacity of the capacitor?
If so, by what formula?
Thanks.
Title: Re: ESR meter with Arduino
Post by: spyromania on Dec 06, 2013, 05:02 am
Can anyone tell me if this ESR can be used to test in circuit caps?
Title: Re: ESR meter with Arduino
Post by: stratogazer on Dec 07, 2013, 09:29 pm
Dear SZMEU,

It WORKS!

I built it as originally designed but to challenge myself I used all SMD components. The .1uF cap (0603) was a challenge as were the TO-23 cased transistors but it works just fine.

I used an Arduino MEGA 2560 and had to modify the code a bit. For those who have the MEGA and are using a standard 44780 2 line X 16 char LCD do the following:

LiquidCrystal lcd(6, 5,  10, 11, 12, 13);

comment out the setLEDpin lines - they dont work with this display
also   analogReference(INTERNAL1V1);  //setting vRef to internal reference 1.1V

INTERNAL won't work on the MEGA - you must add the specifier "1V1" to the parameter.

This was indeed a fun project. I learned alot from building it. Thanks for sharing. Look forward to your next one.
Title: Re: ESR meter with Arduino
Post by: polymorph on Dec 26, 2013, 03:03 am
1. You cannot measure capacitance in-circuit.

2. You can measure ESR, close enough for troubleshooting, in most circuits.

The key is to keep the sensing voltage  below the peak voltage that could turn a semiconductor junction on, including Shottky.

3. You cannot use the same method to measure ESR and ESL over a really wide range of capacitance.

But it doesn't really matter. Mostly it is electrolytic capacitors that fail by increasing ESR. And the values that matter are >=1uF, usually  much larger.

ESR of a few ohms doesn't really matter for audio coupling capacitors, which are normally around 1uF to 10uF. For linear power supplies, ESR of a few ohms matters, but the capacitors are generally in the range of thousands of uF. For switching power supplies, ESR needs to be tenths of an ohm, but capacitance is still >>10uF.

And all those capacitors have varying amounts of parasitic inductance. But that doesn't change, so no real need to measure it. That is why a circuit will have Vcc bypassed by (in addition to the 100s or 1000s of uF of smoothing capacitor) both a 1uF and 1nF bypass capacitor.

For capacitors in the nF range, there are not really many mechanisms for ESR to increase as a failure mode. You can measure ESR as a function of circuit Q.
Title: Re: ESR meter with Arduino
Post by: polymorph on Dec 26, 2013, 03:08 am
...is there anyone who has successfully measured low ohmic values??, for example 0.1 or 0.01; appropriate values ??to an ESR meter?


I'm working on it.
Title: Re: ESR meter with Arduino
Post by: Eierschale on Jan 29, 2014, 03:43 pm

... 10 downloads of the attached .zip file with code, images, schematics and PCB design...


Hallo Baravantan,
in your posted listings is an function named UpCap. What is it for? If I press button at input 3, I get a display with 4,7, 6,8, 10, 15, 22 ... 10000 µF. But that is not the Value of the DUT.

Title: Re: ESR meter with Arduino
Post by: polymorph on Jan 29, 2014, 05:59 pm
To measure really low values, Kelvin leads would be a good idea.

http://dx.com/p/test-clip-probes-for-lcr-meter-with-bnc-wires-pair-34214#.Uuk1BfldXSg
Title: Re: ESR meter with Arduino
Post by: jamesglanville on Apr 09, 2014, 03:12 am
Hi, just thought I'd say thanks for the design, I think I have got it to work, but have a few questions.

(http://i.imgur.com/qO7NOPTl.jpg)
(http://i.imgur.com/giAa933l.jpg)

I copied the schematic in the first post, although I used a fubarino SD board (I had one lying around). This needed a couple of tweaks to remove avr-specific code (see https://github.com/JamesGlanville/esrmeter). I also used trimpots as I had no 1% resistors.

Are trimpots ok? I seem to remember they have a higher inductance than normal resistors, and I don't know whether this matters here. I have a fairly good LCR meter I used to trim the pots, so I think they are accurate to within 1%.

The fubarino SD board does not have an internal voltage reference, so I'm using the 3.3V supply (and 3.3V for everything apart from LCD power). I think this should be fine, although with less ADC precision. However, with vRef=3.31V (measured, and very stable), I need to set current to 0.02468 to get "good" results. By calculation, it should be 0.0331, a pretty big difference. When I say "good" results, I am getting correct readings to about 2% of 1ohm, 2 ohm, and 2.5ohm resistors. I have no way of testing ESR otherwise,  but my results seem reasonable (my supply of caps is mostly very good, a few ones are terrible). Is my weird current value ok/is there a better way to calibrate the meter?

Thanks again :)
Title: Re: ESR meter with Arduino
Post by: zaero on Apr 11, 2014, 12:42 pm
First of all I would like to thank you all for such a great work.

I have been implementing the ESR meter, and checking Totoro's function I saw he is using the voltage supply as a parameter. Then I remembered about the hidden voltmeter to own supply voltage on 168 and 328 chips (http://code.google.com/p/tinkerit/wiki/SecretVoltmeter). I just added it on setup and it improves measurement quality. Actually, helps a lot regarding "well regulated quality supply" requirements ;)

Oh, regarding the coupling capacitor: as a bipolar capacitor I have 2 electros 330µF/35V in a back to back configuration. There is a lack of slope in the scope, which means that it is only measuring ESR. Actually, coupling cap ESR is not that important: 1Ohm ESR would only affect 1% over the 100 Ohm sense resistor. Capacitor value however is important, because a low capacitance value would bother the reading due to capacitor impedance.
Regarding 4wire sensing: as the ground is shared, 4w cannot be used, but 3-wire sensing can and should be used because it is extremely easy to implement.
Regarding Transistors: Transistor models are not important, they are operated as a switching device. However, they should be "fast" to switch. Currently I am using a 2SA733 and 2SC945 that I had in junkbox.

Oh, another thing, adding a decoupling capacitor between PNP transistor emitter and sense ground would be beneficial as well. Location on PCB should be as close as possible to those points.

Edit: Couple mods I think interesting:
Playing with it, I just realized that if capacitors hold (or grow) any charge, readings get (easily) bothered. In the original schematic, there is a 10k capacitor to ground, I decreased it to 470 Ohm: well far to bother reading range and low enough to not grow bald while waiting to discharge 1000µF caps... The modification of the "commercial" schematic with BS170 does that, but I think there is no need for 50mA application.
For LOW ESR Capacitors, original circuit may be a bit "short" in current terms. If increasing current to say 100mA, decoupling is probably needed for good measurement stability. According to my oscilloscope, measurement last 35µs, so I would use over 100µF...
Title: ADC settings and conversion time
Post by: zaero on Apr 12, 2014, 12:09 pm
I have been playing a bit with the Code and the ADC, and reading about it.

It is interesting that maximum 10bit speed is specified at 200kHz, FASTADC option of original code sets the ADC speed at 500kHz, which can degrade resolution. Totoro decreased that speed to 250kHz, increasing acquisition time, but it is important to understand how the ADC works (which I didn't know before  :smiley-roll: )
ADC operation is preceded by sample&hold where input is sampled. That takes around 2 ADC cycles and then conversion which may take up to 25cycles. At 250kHz ADC clock, sampling time should be around 8µs, and 4µs when a 500kHz ADC is used. Measuring voltages with oscilloscope, approximated voltage sampling occurs around 10µs and 6µs after pulse activation. Here I attach a picture of a 500kHz ADC sampling a 10µF capacitor. Measurement is pretty close with expected times of around 4µs sample&hold + 1µs delay of micros(1)+ ...

(http://s15.postimg.org/9dgb85b0r/SDS00001.png)

Note that for a 10µF capacitor there is an important charging slope of the capacitor, which sets measurements a bit off. At 50mA and 6µs delay that is ~300mV/C[µF] and 10µs delay ~500mV/C[µF]  Using: deltaV[mV]=50*DELAY[µs]/C_value[µF]
Even setting a prescaler for ADC clock at 1MHz the delay effects would be around 200mV per each µF.

This comment is important because: decoupling cap can be smaller than what I said before  :smiley-roll-blue: and because that with those mV/µF we can find wich is the low-ESR measuring limit for different cap values.

Oh! In Totoro's code, delay added is 5µs, which considering the 250kHz ADC would set the capacitor charging error to ~700mV/µF

Sidenote: The capacitor charging effect and knowing the exact point of S&H can be used to estimate capacitor value as well, even to correct the capacitor charging effects.

Cheers
Title: Re: ESR meter with Arduino
Post by: zaero on Apr 12, 2014, 06:26 pm
My third post in a row...
...finaly I have what seems to be a decent operating capacitor measurement + ESR correction.

Capacitor values found are an estimation, but seem to match with my multimeter readings within 5-10% (tested from 10µF to 1000µF). Then once capacitor value is found, I used to correct the ESR deviation due to DUT charging effects, which can be seen as a resistance at the sampling instant, which if I didn't do much wrong, would be Zequivalent=deltaV/I --> Zeq=6µs/C[µF]
I'd appreciate any comments regarding if this makes sense or I just got crazy here...

Anyways, I attach code for Capacitor measurement function (below 10µF gets high error, so I just cropped under 5µF, I won't use it with such small caps anyway :D
Code: [Select]
double measureC()
{
  double CAP;
  unsigned long esrSamples;
  unsigned int sampleA = 0;
  unsigned int sampleB = 0;
  int cnt = 0;

  //oversampling is overrided
  digitalWrite(DISCHARGE_PIN,LOW);//disable discharging
  digitalWrite(PULSE_PIN,LOW);//making a miliVolt pulse of 50mA
  delayMicroseconds(1);//Considering S&H is done after 2us, this could even be taken away.
   
  sampleA = analogRead(ESR_PIN); //First read: T=6us
  while((sampleB<sampleA+100)&&(cnt<40)){  //less than 107mV between samples or 40 times done the loop
    delayMicroseconds(10);
    sampleB = analogRead(ESR_PIN); //Second read: T+delay
    cnt++;
  }
  // If we are here, either samples have more than 107mV or comparison TimedOut
  digitalWrite(PULSE_PIN,HIGH);//stopping pulse
  digitalWrite(DISCHARGE_PIN,HIGH);//discharging the capacitors
  delayMicroseconds(600);//waiting a bit longer

  //Vsupply is found using 'Hidden Voltmeter in AT328'
  //Resistor value is 100.0 (approximated)
  //45.0 is the delay time between measurements (estimated by measured values).
  CAP=45.0*cnt*Vsupply/100.0/(sampleB-sampleA)/vRef; //50us_delay*times_of_delay * Current / (voltagedifference)
 
  if(CAP<5)  return(0.0);
  else       return(CAP);
}


Regarding ESR function, I only altered the last part of the function to correct for capacitors detected but smaller than 1000uf
Code: [Select]

  ESR=1000*100.0 / ((Vsupply / miliVolt) - 1); //100 is sense resistor  //Correct with Cvalue!!!!!
  if(Cvalue&&(Cvalue<1000))
    return ESR-6000.0/Cvalue; //Capacitor nuissance, Req=6/C[µF]
  else
    return ESR;
}
Title: Re: ESR meter with Arduino
Post by: Heffa on May 18, 2014, 09:03 pm
Thanks for this project everyone, I'm planning to build one of these as soon as I have wrapped my head around all the info in the thread and have had time to design a shield for it.
Will upload the gerber files here if someone would be interested. I'm probably going down the SMD route, since I like tinkering with 0805 components  :smiley-eek:
Title: Re: ESR meter with Arduino
Post by: AutoElecHack on Jul 27, 2014, 12:01 pm
Hi,

I'm about to build this project with parts I have and am a bit lost with caps that are being used.

I have a 2A104J greencap to use as the 100uf (C2).

But the 47uf, Bipol (C1) I do not have, only in electrolytic cap form. I am assuming that I need to find a bidirectional cap? is that what you call a cap that can be used either polarity?

I am finding it hard to find an assorted pack of caps which are not electrolytic on ebay.

Also the only transistors I have are BC328 and BC338. The schematic says 327 and 337...Is there a difference?

One more Q, how the hell are all of you guys making your own circuit boards?

Thank you.
Title: Re: ESR meter with Arduino
Post by: onapthanh on Aug 18, 2014, 01:19 pm
I think that I am worndering how to wire up the push button ZERO with my 2 wire LCD display.
Title: Re: ESR meter with Arduino
Post by: alibenpeng on Sep 15, 2014, 01:38 pm
Hi,

I also built a standalone version of this and it seems to be working ok. There is one thing I don't know what to make of, though.

In the original schematic, there's  R4 connected to Arduino digital pin 8. This doesn't seem to be used in any version of the code I found. From what I understand, this was intended to be used as a low current pulse output. Is this correct? If so, isn't the version posted by mikanb http://forum.arduino.cc/index.php?topic=80357.msg1210134#msg1210134 (http://forum.arduino.cc/index.php?topic=80357.msg1210134#msg1210134).

So let me recap (absolutely no pun what-so-ever intended!):

- The original R4/D8 connection was never used by any version of code seen here on this thread.
- The 1k-PNP-1k implementation by mikanb does what R4/D8 originally intended to do but never did.
- The ak-PNP-1k implementation by mikanb is superior to the original R4/D8 implementation, because it adds a bit more decoupling from the MCU through the PNP.
- In a revised design, I could omit the R4/D8 connection in favour of mikanb's implementation.

Right...? Is it?

Cheers,

Ali
Title: Re: ESR meter with Arduino
Post by: szmeu on Sep 16, 2014, 10:25 pm
@alibenpeng
right it is! your observations regarding R4/D8 are correct :-)

szmeu
Title: Re: ESR meter with Arduino
Post by: alibenpeng on Sep 17, 2014, 05:22 pm
Thanks for clearing this up!

Cheers,

Ali
Title: Re: ESR meter with Arduino
Post by: Heffa on Nov 23, 2014, 10:50 pm
I'm looking for SMD parts for this, but being pretty noobish I'm not sure what characteristic to look for in the 1N5822 schottky diodes - could anyone help me explain this?
The discussion have been about 300mV voltage drop, but I don't understand what characteristics of the diode this comes from. The specified forward voltage drop on the 1N5822 I've found is 525mV or 950mV.
Title: Re: ESR meter with Arduino
Post by: onaplioachinhhang on Nov 28, 2014, 07:49 am
Great ! Thanks for share !
Title: Re: ESR meter with Arduino
Post by: onaplioachinhhang on Nov 28, 2014, 07:53 am
Thanks for your share !
Title: Re: ESR meter with Arduino
Post by: DL1AKP on Dec 11, 2014, 10:32 am
Hello!

I got messed up reading this whole posts...
Not perfect in english, sorry.

Can anybody tell me - or post-  the correct code for this project?
I really would like to give it a try, but don't know what changes on the original code I have to make.
And where...

Help would be nice!

Thanks! Andy
Title: Re: ESR meter with Arduino
Post by: jtroutt19 on Feb 10, 2015, 02:29 pm
IT would be nice to have A complete circuit schematic and code pack. I know there have been alot of changes since the very first post. This is a great project just unorganized. Would someone be willing to bundle all the latest up and put it in a zip file to download.
Title: Re: ESR meter with Arduino
Post by: Maverik2210 on Mar 16, 2015, 12:03 am
yeep, it would be so cool...
Title: Re: ESR meter with Arduino
Post by: Melman on May 17, 2015, 09:50 pm
IT would be nice to have A complete circuit schematic and code pack. I know there have been alot of changes since the very first post. This is a great project just unorganized. Would someone be willing to bundle all the latest up and put it in a zip file to download.
Agree!
Title: Re: ESR meter with Arduino
Post by: WAC2504 on Oct 02, 2015, 01:52 pm
... 10 downloads of the attached .zip file with code, images, schematics and PCB design...
Great ! Thanks for your share !
Title: Re: ESR meter with Arduino
Post by: utesterosam on May 01, 2016, 05:46 pm
Help please, does anyone have arduino code for the original schematics? thanks
Title: Re: ESR meter with Arduino
Post by: daneshvar on Sep 11, 2016, 06:06 am
hi dear
please tell me,DUT connect to the wich pins of CN1?
Title: Re: ESR meter with Arduino
Post by: arduino_314 on Nov 18, 2016, 11:29 am
This is very old thread, however I have a need to build some simple, cheap and more or less reliable ESR tester fast...

I have look and read this thread and dr. Le Hung website about ESR. Few  things I have noticed:

1. The schematic is almost identical to dr. Le Hung ESR part.
2. Notification on this forum ESR is not able to do in-circuit measurement, while dr. Le Hung device is.
3. Dr. Le Hung do not expose source (hex only for ATmega88PA) as it sold the device.
4. The 47uF discharge capacitor need to be non-polarized? This is not commonly available part easily found in local stores.

Upper force me to believe many things could be improved for this  Arduino open source version.

1. If hardware is almost identical, identical features this ESR tester should have. I.e in-circuit measurements (up to ~300mV test voltage) is possible to achieve.

2. As I'm only amateur, my knowledge in electronic is limited. However, if 47uF is jut discharge capacitor, I believe it could be used two 100uF 100V in series el. capacitors (with the diodes protection) - the circuit to make non-polarized capacitor from two polarized. This kind of capacitor configuration double its own ESR, however if it serves only to discharge it before test, this is not crucial. Even better, any, especially larger capacitors should be discharged before test in order to protect MCU.

3. The most important feature for an ESR is to have measures with at least two freq. I have not found at dr. Le Hung documentation that his device can do that as well (only measurement at 100KHz).

Anyone with more experience can elaborate about for this circuit?

If not, is there some DIY circuit with commonly available parts is proven to be able for in-circuit measurements as well as can test in at least two freq.?

Thanks in advance.

Title: Re: ESR meter with Arduino
Post by: FluxP on Dec 29, 2018, 01:32 pm
Many thanks to @szmeu and @mikanb for their exellent designs of the Arduino ESR meter described in this forum topic.

I assembled a complete meter with their designs with a few minor changes, combined with a capacitor meter for measuring values between 100 pF and 2000 uF and a frequency meter for frequencies between 1 Hz and 3 MHz.
All in one ino file.

Thanks to @arduinoaleman for his great frequency meter design. See for his original data also on the the Arduino forum:

https://forum.arduino.cc/index.php?topic=324796.0#main_content_section.

You can find my three-function meter design including diagrams and assembly instructions on the instructables website at

https://www.instructables.com/id/Arduino-CAP-ESR-FREQ-Meter/

Title: Re: ESR meter with Arduino
Post by: PA3CNO on Apr 01, 2019, 12:41 pm
I improved the ESR measurement, added Capacitance measurement to the ESR measurement, and combined the code with an L-C-R meter. The meter was described in our radio club magazine: https://www.pi4raz.nl/razzies/razzies201904.pfd (Meter description is also in English).
Title: Re: ESR meter with Arduino
Post by: YU5KBM on Apr 28, 2019, 01:04 am
I improved the ESR measurement, added Capacitance measurement to the ESR measurement, and combined the code with an L-C-R meter. The meter was described in our radio club magazine: https://www.pi4raz.nl/razzies/razzies201904.pfd (Meter description is also in English).
Where I can find code and schematic for that? Tnx