Skip to content

gojimmypi/ComponentTester

Repository files navigation

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

                   ReadMe for the Component Tester firmware

                                Trendy Edition

                 for ATmega328 with character or graphic display

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

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

Last edit:  2015-07-15

Content
  - About
  - Safety Advice
  - License
  - Whats different?
  - Displays
  - Building the firmware
  - Source Code
  - Test Key
    - Rotary Encoder
  - Startup
  - Probing
  - Power Off
  - Menu
    - PWM Tool
    - Square Wave Generator
    - Zener Tool
    - ESR Tool
    - Frequency Counter
    - Rotary Encoder
    - Contrast
    - Selftest
    - Self Adjustment
    - Save
    - Show Values
    - Exit
  - Resistors
  - Measuring Capacitance
  - Discharging Components
  - ADC Oversampling
  - Vf (V_BE) of BJTs
  - Displaying Results
    - Special Components
  - Unsupported Components
  - Known Issues
  - Change Log
  - References


* About

The Component Tester is based on the project of Markus Frejek [1&2] and the
successor of Karl-Heinz Kübbeler [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 ATmega328/P due to memory and flash
size constraints. The UI languages currently supported are just English and
German, but can be changed or extended easily.

Hint: Run the self adjustment for a new tester or if you've done any
modifications, like a firmware update or changing probe leads.


* 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). 


* License

The original author hasn't provided any information about the licence
under which the firmware is distributed. He only stated that it's open
source and any commercial user should contact him. Unfortunately we (
Karl-Heinz and I) haven't found any way to contact him. To remedy
this problem I will choose an open source license at 2016-01-01, if the
original author doesn't contact us to state his wishes until that date.
Since the source code of this firmware version is a major rewrite with
tons of new code and features, I think that this approach is justified.


* What's different?

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

- user interface
  No worries! ;)
- adaptive component discharge function
- resistance measurement
  + dedicated method for resistances <10 Ohms (instead of using ESR check)
- capacitance measurement
  + starts at 5pF
  + additional method for caps from 4.7µF up to 47µF
  + correction/compensation method
- diodes
  + detection logic
- BJTs
  + V_f is interpolated for a more suitable (virtual) I_b based on hFE
- TRIACs
  + detection of MT1 and MT2
- structured source code
- some more I couldn't think of right now

There are more details in the sections below.


* Displays

At the moment following LCD controllers are supported:
- HD44780 (character display)
- ST7565R (graphic display 128x64)

If you connect a rotary encoder to PD2/PD3, please connect the module's /CS
to PD5 and set LCD_CS in config.h (applies to graphic displays). Otherwise the
rotary encoder would screw up the display by interfering with the data bus.


* Building the firmware

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

In config.h please choose the display and the language for the UI. Change
any default values if required. All settings and values are explained in the
file, so I won't discuss them here. The display has to provide 2 lines with
16 characters each, at least. For graphic displays select a font which is
small enough to match the requirements.

Hardware options are also enabled in configh.h:
- rotary encoder
- 2.5V voltage reference
- relay based cap discharger
- Zener voltage measurement
- frequency counter

The external 2.5V voltage reference should be only enabled if it's at least
10 times more precise than the voltage regulator. Otherwise it would make
the results worse. If you're using a MCP1702 with a typical tolerance of
0.4% as voltage regulator you really don't need a 2.5V voltage reference.

After editing the Makefile and config.h please run 'make' or whatever
toolchain you got to compile the firmware. The Makefiles provides following
additional targets:
- clean    to remove all object and firmware files
- fuses    to set the ATmega's fuse bits
- upload   to upload the firmware to the ATmega


* 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.


* Test Key

The test key starts the tester and also controls the user interface. For that
purpose the tester differentiates between a short and a long key press (0.3s).
The short key press is typically used to proceed with something or to select
a menu item. The long key press performs a context specific action.   

If the tester expects you to press a key it will tell you that by displaying
a cursor at the last position in the second row of the LCD (bottom right).
A steady cursor signals that more information will be displayed and a
blinking cursor informs you that the tester will resume the probing loop. The
cursor is supressed for menus and some tools, because it's obvious that
a key press is neccessary.  


+ Rotary Encoder (hardware option)

With a rotary encoder you'll get some extra functionality with the user
interface, but that's context specific. The additional functionality
is described in the sections below, if applicable.

The algorithm for reading the encoder is tested only with an ALPS EC11 series
encoder, since I don't got any other rotary decoders yet. So I would
appreciate any feedback on other encoders.


* Startup

A long key press 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 will continue. Otherwise the tester chooses the continous (looping) mode by
default. After powering on, the firmware version is shown briefly.

A very long key press (2s) will reset the tester to firmware defaults. This
might be handy if you have misadjusted the LCD contrast for example and can't
read the display anymore.

If the tester detects a problem with the stored adjustments values, it will
display a checksum error. That error indicates a corrupted EEPROM, and the
tester will use the firmware defaults instead.


* Probing

After the startup the testers enters the probing mode and looks for a
connected component. In continous mode it will automatically repeat the
probing after a short pause. If no component is found for several times the
tester will power itself off. In auto-hold mode (signaled by cursor) the
tester runs one round and waits for a key press or a right turn of the
rotary encoder.

In both modes you can enter a menu with additional functions or power off
the tester. For details please see below.


* Power Off

While displaying the result of the last test a long key press powers the
tester off. The tester will show a good bye message and then power off. As
long as you press the key the tester stays powered on. This is caused by the
implementaion of the power control circuit.


* Menu

By short-circuiting all three probes you'll trigger a menu which allows you
to run some special functions  You can also enter the menu by two short key
presses after the display of the last component found or function performed.
Simply press the test key twice quickly (might need some practice :-). If
the rotary encoder option is enabled, a left turn will also enter the menu. 

While in the menu, a short key press shows the next item in the menu and a
long key press runs the shown item. On a 2-line display you'll see a
navigation help at the bottom right. A '>' if another item follows, or
a '<' for the very last item (will roll over to the first item). On a
display with more than 2 lines the selected item is marked with a '*' at
the left side. 

With a rotary encoder you can move the items up or down based on the turning
direction and a short key press will run the displayed item, instead of moving
to the next item. Roll over is also enabled for the first item.

Some tools show you the probe pins used before doing anything. The output will
blink up to three times if you don't press the test button to confirm the
brief information.


+ PWM Tool

This does what you would expect :-) First you have to select the desired PWM
frequency in a simple menu. Short key press for the next frequency and a long
key press starts the PWM output for the shown frequency.

The duty ratio of the PWM starts at 50%. A short key press of the test button
increases the ratio by 5%, a long key press decreases the ratio by 5%. To exit
the PWM tool press the test key twice quickly.

If you got a rotary encoder you can use it to select the frequency in the menu
and to change the PWM ratio in 1% steps.

Configuration of the probes:
  Probe #2:         PWM output (with 680 Ohms resistor to limit current)
  Probe #1 and #3:  Ground


+ Square Wave Signal Generator

The signal generator creates a square wave signal with variable frequency up
to 1/4 of the MCU clock rate (2MHz for 8MHz MCU clock). The default frequency
is 1000Hz and you can change it by turning the rotary encoder, The turning
velocity determines the frequency change, i.e. slow turning results in small
changes und fast turning in large changes. Since the signal generation is
based on the MCU's internal PWM mode you can't select the frequency
continously, but in steps. For low frequencies the steps are quite small,
but for high frequencies they become larger and larger. To exit the signal
generator simply press the push button.

Configuration of the probes:
  Probe #2:         output (with 680 Ohms resistor to limit current)
  Probe #1 and #3:  Ground


+ Zener Tool (hardware option)

An onboard DC-DC boost converter creates a high test voltage for measuring the
breakdown voltage of a Zener diode connected to dedicated probe pins. While
the test button is pressed the boost converter runs and the tester displays
the current voltage. After releasing the test button the minimum voltage
measured is shown if the test button was pressed long enough for a stable test
voltage. You may repeat this as long as you like :-) To exit the Zener tool
press the test button twice quickly.

Connect the Zener diode:
   Probe +: cathode
   Probe -: anode


+ ESR Tool

The ESR tool measures capacitors in-circuit and displays the capacity and ESR
if the measurement detects a valid capacitor. Make sure that the capacitor is
discharged before connecting the tester! Values could differ from the standard
measurement (out-of-circuit) because any component in parallel with the
capacitor will affect the measurement.

For triggering a measurement please press the test key. Two quick short key
presses will exit the tool.

Connect the capacitor:
   Probe #1: positive
   Probe #2: negative (Gnd)


+ Frequency Counter (hardware option)

With the frequency counter hardware option installed you can measure
frequencies from about 10Hz up to 1/4 of the MCU clock with a resolution
of 1Hz for frequencies below 10kHz. The frequency is measured and displayed
continously until you end the measurement by a key press. The autoranging
algorithm selects a gate time between 1ms and 1000ms based on the frequency.


+ Rotary Encoder

This test checks rotary encoders while determining the pin-out. Your job is
to connect the probes to the A, B and Common pin and to turn the encoder
a few steps clockwise. The algorithm needs four greycode steps to determine
the proper function and pin-out. The turning direction is important to
distinguish the A nd B pins, because reversed pins cause a reversed direction.

When a rotary encoder is detected the tester will display the pin-out and
wait for a key press (or a moment for continous mode) before resuming testing.
To exit the rotary encoder test please press the test push button once while
testing.


+ Contrast

You can adjust the contrast for graphic LCD modules. A short key press
increases the value and and a long key press decreases it. Two short key
presses will exit the tool. 


+ Selftest

If you entered the selftest by the menu you'll be asked to short circuit all
three probes and the tester will wait until you have. In case of any problem
you can abort that by a key press. That will also skip the complete 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.

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 Adjustment

The self adjustment measures the resistance and the capacitance of the probe
leads, i.e. 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
adjustment (they will be not stored in the EEPROM, see "Save" below).

The voltage offset of the analog comparator is automatically adjusted in the
capacitance measurement (in normal probing mode, outside of the self
adjustment) if the capacitor is in the range of 100nF up to 3.3µF. Also the
offset of the internal bandgap reference is determined in the same way.

Before running the self adjustment the first time, please measure a film
capacitor with a value between 100nF and 3.3µF three times at least to let the
tester self-adjust the offsets mentioned above. Typically the first
measurement will result in a slightly low value, the second in a high one
and the third will be fine. That is caused by the self adjusting offsets.
Both offsets are displayed at the end of the self adjustment.

The self adjustments is very similar to the selftest regarding the procedure
and user interface.

Expected limits:
- probe resistance   < 1.00 Ohms for two probes in series
- probe capacitance  < 100pF

Remember: Adjustment is not calibration! Calibration is the procedure to
compare measurement results with a known traceable standard and noting the
differences. The goal is to monitor the drift over time. Adjustment is the
procedure to adjust a device to meet specific specs.


+ 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 adjustment 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.

The idea of the save function is to prevent automatic saving of adjustment
values. If you need to use other probe leads for some tests, you'll simply
adjust 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-adjust because
the old values are still stored. Just powercycle the tester.


+ Show Values

This displays the current adjustments values and offsets used. 


+ Exit

If you entered the menu by mistake you can exit it by this command.


* 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 >47µF
are still measured by the charging cycle method with 10ms impulses. Mid-sized
caps between 4.7µF and 47µF 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.7µF and 47µF 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.

A measured capacitance value more than 5pF (incl. the zero offset) is
considered valid. Lower values are too uncertain and could be caused by
placing the probe leads a little bit different and things like that.


* 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. The display of the remaining voltage
will help you to choose an appropriate value.


* 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.


* 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 more
suitable 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.


* Displaying Results

Some names and abbreviations are changed. The output for several parts might
be splitted into multiple pages to support displays with just a few lines.

For a single diode the low current Vf (measured with 10µA) is shown in braces
if the voltage is below 250mV. That should give you a hint for germanium
diodes. Most datasheets of germanium diodes specify Vf at 0.1mA which the
tester doesn't support. At a higher current Vf is expected to be around 0.7V
which makes it hard to distinguish germanium from silicon diodes.

The leakage current I_R for a single diode or I_CEO for a BJT will be displayed
if it exeeds 1µA. Germanium BJTs got a leakage current of a few µA up to around
500µA. Germanium diodes are around a few µA usually.

For some components the capacitance is shown also. In case the capacitance is
below 5pF or the measurement failed for some reason the value displayed
will be 0pF.

If a depletion-mode FET with symmetrical Drain and Source is found, e.g. a
JFET, the pinout shows an 'x' instead of a 'D' or 'S' because both can't be
distinguished, they are functionally identical. Please see the FET's datasheet
if you need more details about the pinout.

The pinout for a Triac is shown with the pin IDs 'G', '1' and '2'. '1' is MT1
and '2' is MT2.


+ Special Components

For a BJT with a base emitter resistor the tester displays the base emitter
resistor and skips the hFE output. If the BJT also got a freewheeling diode the
BJT might be detected as BJT or two diodes based on the value of the base
emitter resistor (low value resistor -> 2 diodes). In the latter case the tester
shows the two diodes and the resistor while hinting at a possible NPN or PNP
BJT, The problem is that the low value base emitter resistor prevents the proper
identification of the BJT.

Another special case is a BJT with an integrated freewheeling diode on the same
subtrate as the BJT. That integrated diode junction creates a parasitic
transistor. A NPN BJT will have a parasitic PNP and vice versa. If such a BJT
is found the tester prints a '+' behind the BJT type.


* 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.

Germanium power BJTs with a very high leakage current (> 700µA) can't be
checked either because the check would collide with depletion mode FETs. 


* Known Issues

- A storage cap (like Panasonic NF series) is detected as a diode or two
  anti-parallel diodes. The capacitance measurement isn't able to determine  
  an acceptable value either.
- When using a SMPS or DC-DC converter as power supply the tester will
  sometimes detect a capacitor around 50µF even if no component is connected. 


* Change Log

Please see the CHANGES file!


* 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 Kübbeler,
    Online Article, 2012



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

About

initial fork

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published