


------------------------------------------------------------------------------

                          ReadMe for the Component Tester

           (c) 2012 by Markus Reschke (madires@theca-tabellaria.de)

------------------------------------------------------------------------------

Last edit:  2012-11-9


* About

The Component Tester is based on the project of Markus Frejek [1&2] and the
successor of Karl-Heinz Kbbeler [3&4]. It's an alternative software for the
current circuit by Karl-Heinz and offers some changes in the user interface
and the methods used for probing and measuring. While Karl-Heinz provides an
official release supporting most ATmega MCUs this is a playground version
with all features enabled and limited to ATmega168/P and ATmega328/P due to
memory and flash size contraints. The UI languages currently supported are
just English and German, but can be changed or extended easily.


* Safety Advice

The Component Tester is no DMM! It's a simple tester for components capable
of measuring several things. The probes aren't protected in any way and
won't survive higher voltages than 5V. Don't use the tester for live circuits!
Just use it for unsoldered electronic components! If you test a capacitor make
sure it's discharged before connecting the probes. This isn't just the Safety
Sally, your life may be at risk if you connect the probes to a live circuit
or a power supply (or even mains). 


* Whats different?

Karl-Heinz has done a realy great documentation of the tester. I recommend
to read it. Therefore I'll tell you just about the differences to the
official release.


* Building the firmware

First edit the Makefile to specify your MCU model, frequency, oscilator
type and programmer settings. All other settings moved to config.h.

In config.h please choose the language for the UI and change any defaults
if required. All defaults are explained in the file, so I won't discuss
them here.


* Source Code

A lot of cleaning up was done, like more remarks, renamed variables,
re-structured functions, large functions splitted up into several smaller
ones and what have you. I hope the code is easy to read and maintain now.


* Startup

A long key press (0.3s) while starting the tester selects the auto-hold mode.
In that mode the tester waits for a short key press after displaying a result
before it continues. Otherwise the tester chooses the continous (looping) mode
by default. After powering on the tester displays the mode selected.

After that the tester may display a checksum error, when it loads the saved
calibration values from the EEPROM and detects an error. That error indicates
a corrupted EEPROM, i.e. caused by too much write operations. In that case
the default calibration values from config.h will be used.


* Probing Loop 

While displaying the result of the last test a long key press (0.3s) powers
the tester off. The tester will display a short goodbye message. As long as
you press the key the tester stays powered on and displays the message. That
is caused by the implementaion of the power control circuit.


* Selftest / Self Calibration

By short-circuiting all three probes you'll trigger a menu which allows you
to select some special functions. A short key press selects the next item in
the menu and a long key press (0.3s) runs the selected item. The selected
item is marked by an asterisk.


+ Selftest

The selftest function runs each test just 5 times. You can skip a test by a
short key press or skip the entire selfttest by a long key press (0.3s).

In test #4 you have to remove the short circuit of the probes which triggered
the selftest mode. The tester will wait until you really removed the short
circuit.


+ Self Calibration

The self calibration measures the resistance and the capacitance of the
probe leads, e.g. the PCB, internal wiring and probe leads as a sum, for
creating a zero offset. It also measures the internal resistance of the MCU
port pins in pull-down and pull-up mode. If the tests are skipped or strange
values are measured the default values defined in config.h are used. If
everything went fine the tester will display and use the new values gained
by the self calibration.

The voltage offset of the analog comparator is automatically calibrated in
the capacitance measurement if the capacitor is in the range of 100nF up
to 20F. Also the offset of the internal bandgap reference is determined
in the same way. Both offsets are displayed at the end of the self
calibration.


+ Save

By flashing the firmware the pre-defined values given in config.h are stored
in the EEPROM of the MCU. After running the self calibration you may update
those default values using the the "Save" function. The next time you power
on the tester the updated values will be loaded and used.

If you run the tester the first time or changed the hardware setup, i.e. using
other probe leads, I recommend to measure a capacitor (100nF - 20F) to
trigger the voltage offset calibrations, then run the selftest and save the
new values.

The idea of the save function is to prevent automatic saving of calibration
values. If you need to use other probe leads for some tests, you'll simply
calibrate the tester for the temporary probe leads and perform the tests.
If you switch back to the standard probe leads you don't need to re-calibrate
because the old values are still stored. Just powercycle the tester.


+ Values

This displays the current calibrations values and offsets used. 


* Resistors

Resistors are measured twice (both directions) and the values are compared.
If the values differ too much the tester assumes that there are two resistors
instead of just a single one. In that case the tester displays the result as
two resistors with the same pins, like "1 -- 2 -- 1", and the two different
resistance values. For resistors lower than 10 Ohms an extra measurement with
a higher resolution is performed.

In some rare cases the tester might not be able to detect a very low
resistance, since the primary measurements indicate a problem with the
validity of the results. In that case simply re-run the test.


* Measuring Capacitance

The measurement of capacitance is split into three methods. Large caps >47F
are still measured by the charging cycle method with 10ms impulses. Mid-sized
caps between 4.7F and 47F are processed the same way but with 1ms charging
impulses. And small caps are still done by the analog comparator method. That
way the accuracy of the measurement of caps between 4.7F and 47F is
increased.

Also I found a simple correction solution for large caps. Without correction
the measured values are too large. IMHO that is caused by the measurement
method, since the ADC conversion after the charging impuls needs some time
during which the cap looses some charge due to internal resistive losses. So
it takes longer to charge the cap and the cap seems to have a larger
capacitance. A discharge measurement later on tries to compensate that, but
the capacitance is still too large. 

A logic for preventing large caps to be detected as resistors was added.
Resistors < 10 Ohms are checked for being large caps.


* Discharging Components

The discharge function isn't based on a fixed timeout, it adapts itself
to the discharging rate. That way a battery will be identified faster (about
2s) and large caps got more time to discharge. If a large cap is identified
as a battery please repeat the check. In a noisy environment you might need
to adjust CAP_DISCHARGED to about 3mV.


* ADC Oversampling

The ADC function is modified to support a variable oversampling (1-255 times).
The default value is 25 samples. You can try to improve the accuracy of the
measurements by increasing the number of samples. Note that more samples will
take more time resulting in slower measurements.


* Displaying Results

Several names and abbreviations are changed. The output for an enhancement
mode MOSFET and for diodes is splitted into two pages to have sufficient space
to fully display all data. Antiparallel diodes got only a single page (the
capacitance will not be shown). The display of BJTs may be splitted based on
the size of hfe.


* Vf (V_BE) of BJTs

When checking for diodes Vf is measured with Rl (high test current) and Rh (
low test current), and both voltages are stored. The output function for BJTs
looks up the matching diode for V_BE and interpolates the two Vf measurements
based on the transistors hfe for a virtual test current. That way we get some
nice results for different kinds of transistors, since Vf of a small signal
BJT isn't measured with the same test current as for a power BJT.


* Unsupported Components

Any semiconductor which requires a high current to trigger conduction can't
be supported, since the tester only provides about 7mA at maximum. Also the
tester provides just a voltage of 5V, which isn't sufficient for DIACs with
a V_BO of 20-200V.

In theory the tester could measure inductance by monitoring how the current
increases over time. Tests showed that this works only in a quite limited way,
so we won't support inductors. A better way is to add a signal source (sinus
AC), meassuring frequency, current and voltage, and calculating the inductance
by the frequency and the complex resistance. But that's something for a new
hardware version of the tester. 


* Change Log

v1.04m 2012-11
- Added a simple logic to the output function for diodes to prevent the
  measurement of capacitance for antiparallel diodes. 

v1.03m 2012-11
- Fixed detection problem of power diodes with high leakage current (mistaken
  for resistors).
- Fixed compiler warnings about possible uninitialized variables. That
  increased the firmware size by about 44 bytes :-(

v1.02m 2012-11
- Added upper limit for resistance of probe leads in the self calibration
  function (1.00 Ohms).
- Selftest and calibration functions perform a short circuit test before
  running the main part and return feedback now.
- The mainmenu gives feedback about success/failure of the selected action.

v1.01m 2012-10
- Added a checksum for calibration values stored in the EEPROM and wrote a
  function to validate the checksum.
- Added a measurement function for small resistors (resolution: 0.01 Ohms).
- Extended self calibration to support an auto-zero for the resistance of the
  probe leads.
- CheckResistor() runs an extra measurement for small resistors (<10 Ohms).
- Added a function to compare two scaled values. 
- Adapted several functions to support variable scaling of values.

v1.00m 2012-09
- Added a simple menu for selection of self test, self calibration, update of
  the calibration values in the EEPROM and display of values.
- Changed hfe from 16 bit to 32 bit value (no 65k limit anymore).

v0.99m 2012-09
- Initial public release based on Karl-Heinz' version 0.99k.



* References

[1] AVR-Transistortester, Markus Frejek,
    Embedded Projects Journal, 2011-11

[2] http://www.mikrocontroller.net/topic/131804
    thread of Markus Frejek, Forum, 2009

[3] http://www.mikrocontroller.net/articles/AVR-Transistortester
    Online documentation of the Transistortester, Online Article, 2009-2011

[4] http://www.mikrocontroller.net/articles/AVR_Transistortester
    Short description of the TransistorTester, Karl-Heinz Kbbeler,
    Online Article, 2012



------------------------------------ EOF -------------------------------------
