ttester_eng109k.pdf

Warsztatowy tester elementów na ATmega328

http://obrazki.elektroda.pl/1786977800_1392319590_thumb.jpg Chciałem się podzielić projektem który zbudowałem - czyli warsztatowym testerem komponentów. 1. Opis a) Założenia: Projekt wyszukałem w internecie i bardzo mi się spodobał. Stwierdziłem że takiego urządzenia brakuje w moim warsztacie. Więc podjąłem się jego budowy. Zainspirowała mnie konstrukcja: http://sq7ofb.pl Jak również źródło oryginalne: mikrocontroller.net Posiłkowałem się też czytając podobne opracowania na elektrodzie :) b) Opis konstrukcji, napotkane problemy: Konstrukcja jak już wspomniałem pochodzi z powyższych linków. W załączniku dołączam schemat ideowy - bez układu zasilania. Oraz instrukcję w pdf-ie do najnowszej wersji. Płytkę PCB kupiłem. Kontakt ze sprzedawcą nawiązałem za pośrednictwem allegro. Sądzę że można dostać też namiary na niego na pierwszej stronie z linka. Skusiłem się na zakup ze względu na nie wysoką cenę 20 PLN i solder maskę. Problemy: Odwrotnie wlutowałem stabilizator 7805 którego użyłem zamiast LM293 (bo taki maiłem w szufladzie). Spowodowało to brak stabilizacji napięcia w układzie i procesor dostał 7V zamiast 5V. Co ciekawe przeżył. Warto zaznaczyć że podmiana 7805 zamiast LN293 powoduje dużo większy prąd w stanie "shut down". Co za tym idzie nie nadaje się taki układ do pracy na baterii. Zwarłem też nogi E-C tranzystora BC557 żeby wyeliminować wyłączanie układu. Ma ono na celu oszczędzanie energii ale podczas pracy z zasilacza jest dla mnie zbędne. Nie miałem też na początku opisu "fuse"-ów do AVR-a więc układ zaprogramowany "z głowy" chodził wolno, a pomiary pojemności nie przystawały do rzeczywistości. Po zaprogramowaniu właściwych bitów układ zaczął pracować poprawnie. c) Opis załączników: Poniżej wstawiam zdjęcia wykonanego urządzenia, schemat ideowy układu, ustawienia fuse-ów procesora, instrukcję w języku angielskim do najnowszej wersji oprogramowania. Wsad do procesora, jak również instrukcja składania z której korzystałem są do "zdobycia" na stronie: Pliki Oryginalny wsad można pobrać na stronie projektu: mikrocontroller.net O prasowankę płytki trzeba pytać na stronie SP7PTK do której podałem link powyżej. Jak się poprosi pana Kubę to chętnie udostępnia. Podsumowanie: Kosztorys: - płytka PCB od pana Kuby + przesyłka 20PLN; - procesor + wyświetlacz + precyzyjne źródło napięcia 2.5V(zamiennik) - 30PLN z przesyłką z lispol-u. - resztę elementów miałem z "szuflady" - zastosowałem rezystory 5% węglowe, które być może wymienię na 1% w celu poprawy dokładności. Wrażenia z eksploatacji: Jestem z urządzenia bardzo zadowolony, zaskoczyła mnie szybkość jego pracy. Z ciekawostek podaje napięcie przewodzenia LED-ów, jak również potrafi podobno mierzyć ESR. Wadą zakupionej płytki jest brak złącza do programowania ISP. Zamierzam takie dorobić. Jest to ważne bo firmware jest ciągle rozwijany. Prawdopodobnie przełączę się też na wersję EN. Źródła są otwarte więc można wprowadzać własne modyfikacje. Zaletą kompaktowy rozmiar i po zamontowaniu przetwornicy możliwość pomiaru diod Zenera. http://obrazki.elektroda.pl/3253090500_1392319592_thumb.jpg http://obrazki.elektroda.pl/4913387100_1392319594_thumb.jpg http://obrazki.elektroda.pl/7768032800_1392319595_thumb.jpg http://obrazki.elektroda.pl/9945247600_1392319597_thumb.jpg http://obrazki.elektroda.pl/9624633800_1392319750_thumb.jpg


TransistorTester with AVR microcontroller
and a little more
Version 1.08k
Karl-Heinz K¨bbeler
u
kh kuebbeler@web.de
November 17, 2013

Contents
1 Features
2 Hardware
2.1 Circuit of the TransistorTester . . . . .
2.2 Hints for building the TransistorTester
2.3 Changeover for tester versions designed
2.4 Chinese clones . . . . . . . . . . . . . .
2.5 Programming of the microcontroller . .
2.6 Troubleshooting . . . . . . . . . . . . .

4

........
........
by Markus F.
........
........
........

3 Instructions for use
3.1 The measurement operation . . . . . . . . . .
3.2 Selftest and Calibration . . . . . . . . . . . .
3.3 special using hints . . . . . . . . . . . . . . . .
3.4 Compoments with problems . . . . . . . . . .
3.5 Measurement of PNP and NPN transistors . .
3.6 Measurement of JFET and D-MOS transistors

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

7
7
9
9
11
12
13

.
.
.
.
.
.

15
15
16
16
17
17
18

4 Configuring the TransistorTester

19

5 Description of the measurement procedures
5.1 Measurement of Semiconductors . . . . . . . . . . . . . . . . . . . . . . . .
5.1.1 Measurement of PNP Transistor or P-Channel-MOSFET . . . . . .
5.1.2 Measurement of NPN Transistor or N-Channel-MOSFET . . . . . .
5.1.3 Measurement of Diodes . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.4 Results of different measurements . . . . . . . . . . . . . . . . . . .
5.2 Resistor Measurement . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.2.1 Resistor Measurement with 680 Ohm Resistors . . . . . . . . . . . .
5.2.2 Resistor Measurement with 470 kOhm resistors . . . . . . . . . . .
5.2.3 Results of the resistor measurements . . . . . . . . . . . . . . . . .
5.3 Measurement of Capacitors . . . . . . . . . . . . . . . . . . . . . . . . . .
5.3.1 Discharging of Capacitors . . . . . . . . . . . . . . . . . . . . . . .
5.3.2 Measurement of big Capacitors . . . . . . . . . . . . . . . . . . . .
5.3.3 Measurement of small Capacitors . . . . . . . . . . . . . . . . . . .
5.3.4 Measurement of the Equivalent Series Resistance ESR, first way . .
5.3.5 Measurement of the Equivalent Series Resistance ESR, second way
5.3.6 Voltage loss after a load pulse, Vloss . . . . . . . . . . . . . . . . .
5.3.7 Results of Capacitor measurement . . . . . . . . . . . . . . . . . . .
5.3.8 Automatic calibration of the capacitor measurement . . . . . . . . .
5.4 Measurement of inductance . . . . . . . . . . . . . . . . . . . . . . . . . .
5.4.1 Results of the inductance measurements . . . . . . . . . . . . . . .

25
27
27
29
31
31
35
35
37
38
43
43
43
45
47
50
55
56
61
65
66

1

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

5.5

Selftest Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.5.1 Some Results of the Selftest Function . . . . . . . . . . . . . . . . . . . . . . .

67
71

6 Known errors and unsolved problems

74

7 Special Software Parts

75

8 To Do List and new ideas

76

2

Preface
Basically Motive
Every hobbyist knows the following problem: You disassemle a Transistor out of a printed board or
you get one out of a collection box. If you find out the identification number and you already have
a data sheet or you can get the documents about this part, everything is well. But if you don't find
any documents, you have no idea, what kind of part this can be. With conventional approach of
measurement it is difficult and time-consuming to find out the type of the part and parameters. It
could be a NPN, PNP, N- or P-Channel-Mosfet etc. It was the idea of Markus F. to hand over the
work to a AVR microcontroller.

As my work has started
My work with the software of the TransistorTester of Markus F. [1] has started, because I had problems with my programmer. I had bought a printed board and components, but I could not program
the EEprom of the ATmega8 with the Windows driver without error messages. Therefore I took
the software of Markus F. and changed all the accesses from the EEprom memory to flash memory
accesses. By analysing the software in order to save memory at other places of program, I had the
idea, to change the result of the ReadADC function from ADC units to millivolt (mV) units. The
mV resolution is needed for any output of voltage values. If ReadADC returns directly the mV
resolution, I can save the conversion for each output value. This mV resolution can be get, if you
first accumulate the results of 22 ADC readings. The sum must be multiplied with two and divided
by nine. Then we have a maximum value of 10239?22?2 = 5001, which matches perfect to the wanted
mV resolution of measured voltage values. So I additionally had the hope, that the enhancement of
ADC resolution by oversampling could help to improve the voltage reading of the ADC, as described
in AVR121 [5]. The original version ReadADC has accumulated the result of 20 ADC measurements
and divides afterwards by 20, so the result is equal to original ADC resolution. By this way never a
enhancement of ADC resolution can take place. So I had to do little work to change the ReadADC,
but this forced analysing the whole program and change of all "if-statements" in the program, where
voltage values are queried. But this was only the beginning of my work!
More and more ideas to make measurement faster and more accurate has been implemented.
Additionally the range of resistor and capacity measurements are extended. The output format for
LCD-Display was changed, so symbols are taken for diodes, resistors and capacitors instead of text.
For further details take a look to the actual feature list chapter 1. Planned work and new ideas are
accumulated in the To Do List in chapter 8. By the way, now I can program the EEprom of the
ATmega with Linux operating system without errors.
At this place I would like to thank the originator and software author Markus Frejek, who has
enabled the continuation with his initial work. In addition I would like to say thanks to the authors
of numerous input to the discussion forum, which have assist me, to find new tasks, weak points
and errors. Next I would like to thank Markus Reschke, who give me the permission, to publish his
cheerful software versions at the SVN server. Furthermore some ideas and software part of Markus
R. was integrated in my own software version, again thank you very much. I have to thank also Asco
B., who has developed a new printed board, to enable the reproductions for other hobbyists. Another
thank I would like to send to Dirk W. , who has handled the omnibus order for this printed board.
Never I had time anough to handle these things concurrently with my software developement, at no
time the state of further developement of software would have the same level. Thanks for the many
suggestions to improve the tester to the members of the local chapter of the "Deutscher Amateur
Radio Club (DARC)" in Lennestadt.

3

Chapter 1
Features
1. Operates with ATmega8, ATmega168 or ATmega328 microcontrollers.
2. Displaying the results to a 2x16 character LCD-Display.
3. One key operation with automatic power shutdown.
4. Battery operation is possible since shutdown current is only about 20nA.
5. Low cost version is feasible without crystal and auto power off. With software version 1.05k
the sleep modus of the Atmega168 or ATmega328 is used to reduce current if no measurement
is required.
6. Automatic detection of NPN and PNP bipolar transistors, N- and P-Channel MOSFETs,
JFETs, diodes, double diodes, Thyristors and Triacs.
7. Automatic detection of pin layout of the detected part.
8. Measuring of current amplification factor and Base-Emitter threshold voltage of bipolar transistors.
9. Darlington transistors can be identified by the threshold voltage and high current amplification
factor.
10. Detection of the protection diode of bipolar transistors and MOSFETs.
11. Measuring of the Gate threshold voltage and Gate capacity value of MOSFETs.
12. Up to two Resistors are measured and shown with symbols
and values with up to four
decimal digits in the right dimension. All symbols are surrounded by the probe numbers of the
Tester (1-3). So Potentiometer can also be measured. If the Potentiometer is adjusted to one
of its ends, the Tester cannot differ the middle pin and the end pin.
13. Resolution of resistor measurement is now up to 0.01Ohm, values up to 50M Ohm are detected.
14. One capacitor can be detected and measured. It is shown with symbol
and value with up
to four decimal digits in the right dimension. The value can be from 25pF (8MHz clock, 50pF
@1MHz clock) to 100mF. The resolution can be up to 1 pF (@8MHz clock].
15. For capacitors with a capacity value above 0.18uF the Equivalent Serial Resistance (ESR) is
measured with a resolution of 0.01Ohm and shown with two significant decimal digits. This feature
is only avaiable for ATmega with at least 16K flash memory (ATmega168 or ATmega328).

4

16. For capacitors with a capacity value above 5000pF the voltage loss after a load pulse can be
determined. The voltage loss give a hint for the quality factor of the capacitor.
17. Up to two diodes are shown with symbol
the flux voltages are shown.

or symbol

in correct order. Additionally

18. LED is detected as diode, the flux voltage is much higher than normal. Two-in-one LEDs are
also detected as two diodes.
19. Zener-Diodes can be detected, if reverse break down Voltage is below 4.5V. These are shown as
two diodes, you can identify this part only by the voltages. The outer probe numbers, which
surround the diode symbols, are identical in this case. You can identify the real Anode of the
diode only by the one with break down (threshold) Voltage nearby 700mV!
20. If more than 3 diode type parts are detected, the number of founded diodes is shown additionally
to the fail message. This can only happen, if Diodes are attached to all three probes and at
least one is a Z-Diode. In this case you should only connect two probes and start measurement
again, one after the other.
21. Measurement of the capacity value of a single diode in reverse direction. Bipolar Transistors
can also be analysed, if you connect the Base and only one of Collector or Emitter.
22. Only one measurement is needed to find out the connections of a bridge rectifier.
23. Capacitors with value below 25pF are usually not detectet, but can be measured together with
a parallel diode or a parallel capacitor with at least 25pF. In this case you must subtract the
capacity value of the parallel connected part.
24. For resistors below 2100Ohm also the measurement of inductance will be done, if your ATmega
has at least 16K flash memory. The range will be from about 0.01mH to more than 20H ,
but the accuracy is not good. The measurement result is only shown with a single component
connected.
25. Testing time is about two seconds, only capacity or inductance measurement can cause longer
period.
26. Software can be configured to enable series of measurements before power will be shut down.
27. Build in selftest function with optional 50Hz Frequency generator to check the accuracy of
clock frequency and wait calls (ATmega168 and ATmega328 only).
28. Selectable facility to calibrate the internal port resistance of port output and the zero offset
of capacity measurement with the selftest (ATmega168 and ATmega328 only). A external
capacitor with a value between 100nF and 20uF connected to pin 1 and pin 3 is necessary to
compensate the offset voltage of the analog comparator. This can reduce measurement errors
of capacitors of up to 40uF . With the same capacitor a correction voltage to the internal
reference voltage is found to adjust the gain for ADC measuring with the internal reference.
Thyristors and Triacs can only be detected, if the test current is above the holding current. Some
Thyristors and Triacs need as higher gate trigger current, than this Tester can deliver. The available
testing current is only about 6mA! Notice that all features can only be used with microcontroller
with more program memory such as ATmega168.

5

Attention:

Allways be shure to discharge capacitors before connecting them to the
Tester! The Tester may be damaged before you have switched it on. There is only a little protection
at the ATmega ports.
Extra causion is required if you try to test components mounted in a circuit. In either case the
equipment should be disconnected from power source and you should be shure, that no residual
voltage remains in the equipment.

6

Chapter 2
Hardware
2.1

Circuit of the TransistorTester

The circuit of the TransistorTester in figure 2.1 is based on the circuit of Markus F. released in Abb. 1
of AVR-Transistortester report [1]. Changed or moved parts are marked with green color, optional
parts are marked with red color.
Some changes are made because the electronical power switch make problems in some implementations. Therefore the resistor R7 is reduced to 3.3k Ohm. The capacitor C2 is reduced to 10nF and
R8 is moved so that the PD6 output does not try to switch the C2 capacitor directly. Additional
blocking capacitors are added and should be placed near the power connection of the Atmega and
near the Voltage regulator.
Because the PD7 input and PC6 (RESET) are the only pins, where pull up resistors where needed,
one extra 27k Ohm resistor is added to the PD7 (pin 13) input. With this modification the software can
disable all internal pull up resistors of the ATmega.
The additional crystal with its 22pF capacitors are optional added. The accuracy of a crystal has
the benefit of more stable time measurement for getting the capacitor values.
New software version can use a voltage scale switch of the ADC. The speed of switching is
reduced by the external capacitor C1 at the AREF (21) pin of the ATmega. To avoid slowing down
the measurement speed more than necessary, the value of this capacitor should be reduced to 1nF.
Removing of the capacitor C1 is also possible. For adapting the software to the actual circuit take
a look to the Makefile options in the configuring chapter 4.
Some different versions of R11 / R12 resistor combinations circulates in the internet. I have
adapted my software to the original of Markus F. [1] with 10k Ohm and 3.3k Ohm.
The additional 2.5V precision voltage reference connected at pin PC4 (ADC4) can be used to
check and calibrate the VCC voltage, but is not required. You can use a LM4040-AIZ2.5 (0.1%), a
LT1004CZ-2.5 (0.8%) or a LM336-Z2.5 (0.8%) as voltage reference. A optional ISP connector has
been added to easier load new software versions to the tester.

7

VCC

Ubat

VCC

R10

22p
C12

33k

T3
BC557C

3k3

R7
LED1

IC2

PB2(OC1B)
PB3(MOSI/OC2)
PB7(XTAL2/TOSC2)

PB4(MISO)
PB5(SCK)

BC547

Test

C6

100n

8

R8
BC547

C2
10n

R9

T1

PD2(INT0)

VCC

C4
100n

VCC

IN
OUT
GND

PD0(RXD)
PD1(TXD)

VCC

27k

7

100k

10u 100n

PB1(OC1A)

R15
T2

C5

PB0(ICP)
PB6(XTAL1/TOSC1)

8MHz
10

10k

2k2
R16

PD3(INT1)
PD4(XCK/T0)
PD5(T1)

GND

PD6(AIN0)

27k

PD7(AIN1)

ISP

VCC

16
17

10k

18
19
1
2

2
3

10k

4
6

7
8

11
12

9
10
11

13

SCK

MOSI

3

Reset

4

5

33-270

6
RESET

12
13
14

R14

VCC

3
4
5
6

5

2
MISO

R6

15

VCC

1

470k

14

VCC

Button

680

2.5V

R4

R12

3k3

22p

Ubat

C9

9

AGND

LT1004

15

GND
+5V
VEE
RS
R/W
E
D0
D1
D2
D3

LCD 2x16

C11

D1

PC5(ADC5/SCL)

28

470k

22

27

R5

C1 1n

26

680

PC4(ADC4/SDA)

R2

AREF

25

470k

21

TP1
TP2
TP3

24

R3

AVCC

100n

23

R1

20

PC0(ADC0)
PC1(ADC1)
PC2(ADC2)
PC3(ADC3)

PC6(RESET)

680

C3
9V

serial

ATmega8/168/328
1

R11

10u

10k

C10

R13

Reset

D4
D5
D6
D7

16

GND

Figure 2.1: New circuit of TransistorTester
The software can follow to another pin assignment of port D for a simpler connection of the LCD
display. The following table 2.1 shows the modified assignments.
Signal
circuit diagram
pushbutton input
PD7
LCD-RS
PD4
LCD-E
PD5
LCD-D4
PD0
LCD-D5
PD1
LCD-D6
PD2
LCD-D7
PD3

strip grid board version
PD0
PD7
PD5
PD4
PD3
PD2
PD1

Table 2.1: Changes for strip grid board
For better protection of the ATmega inputs the additional circuit 2.2 can be integrated. The
de-energized contacts of the relay protect the ATmega without power. The contacts will be opened
by software only for measurement.
VCC
or Ubat
depending of relay type

4k7

BC547

PC4(ADC4/SDA)

PC0(ADC0)
PC1(ADC1)

PC2(ADC2)

TP1
TP2
TP3

Figure 2.2: Additional protection of the ATmega inputs
If the serial output of text is not required, the Pin PC3 of the ATmega can be used as analog
input for measuring a external voltage. The voltage can be up to 50V with the optional 10:1 resistor
8

divider and can be used for measuring the breakdown voltage of a zener diode. A current limiting
power supply with up to 50V can be switched on with low signal at PD7 pin of the ATmega to deliver
current for testing the break down voltage of a zener diode. Figure 2.3 shows a suggestion for this
expansion. The tester shows the external voltage as long as you hold the key pressed. About 40mA
more battery current is used by this expansion during key pressing.

Vin+
DC-DC Conv.

serial / PC3

IRFU9024

C13 1uF
Vin-

TMA0515D

20k

10n

C16

Ubat

Can be placed on Tester board!

50u

Vout-15

T4

33uH
IN
OUT
GND

Com

C17

R17

L1

Vout+15

C15
100n

R19

IC3
MCP1702

Uext

10k

180k

R18

Uext

C14
100n

Button
External
Voltage

Should be placed separate!

Figure 2.3: Expansion for measuring of break down voltage of Zener diodes

2.2

Hints for building the TransistorTester

Every LCD-display with at least 2x16 character and a HD44780 compatible controller can be used
with the TransistorTester. You should respect the current needed for illumination, some LCD need
lower current than others. I had tried OLED type displays, but this type cause interference with
measurements of the ATmega and are not recommended. Also loading of special characters for
displaying the resistor symbol has caused problems with the OLED.
The resistors R1 to R6 are critical for measurements and this 680Ohm and 470k Ohm resistors should be
measurement type resistors (tolerance of 0.1%) to get the full accuracy. You should use a precision
socket for the ATmega microcontroller to enable the replacement of the microcontroller. The microcontroller ATmega8, ATmega168 and ATmega328 can be used. Recommended is a ATmega168 or
ATmega328, if you wish to use all features.
Anyway you should assemble all parts to printed board without the microcontroller. A up-to-date
low voltage drop regulator like MCP1702-5002 is recommended as IC2, because it need only 2uA of
standby current and can still deliver 5V, if your input voltage is only 5.4V. But this part is not pin
compatible to well known 78L05 with TO92 body!
After checking, that all needed parts are at the correct place, you should first connect the battery
or power supply to the printed board without LCD-display and microcontroller. You should check
the voltage at the power pins of the microcontroller and LCD-display terminal during the Test key is
pressed. The voltage should disappear, if you release the Test key. If the voltage had correct polarity
and value, you should disconnect the power and assemble the microcontroller with correct alignment.
Be careful and make shure, that all pins of the microcontroller are in the socket holes. Now you can
also connect the LCD. Check if power pins of the LCD has the right connection to GND and VCC
of your board.
If you are shure that everything is all right, reconnect the power. If you have already programmed
the ATmega, you can press the Test button. By pressing the Test key, the background light of the
LCD should switch on. If you release the Test button, the LED should illuminate weak. Notice, that
the software for the microcontroller must be compiled for the correct processor type. A program for
the ATmega8 does not run on a ATmega168!

2.3

Changeover for tester versions designed by Markus F.

Voltage control If the problem exist, the tester will shut down immediately with every switch on.
With imy suggested setting of the fuses (Makefile) the voltage control of the different ATmega
9

versions is switched to 4V (brown out level). This may be the reason why the tester makes
trouble with the power on sequence. The Pin PD6 tries to switch the 100nF capacitor C2
to VCC level causing a voltage breakdown of the VCC voltage (5V). The capacitor C2 can
be reduced to & lt; 10nF without problems. If possible, the direct connection of PD6 should be
replaced by a resistor & gt; 220Ohm.
Improvement of power on circuit Often this problem is the reason, if the tester starts with the
button hold pressed, but switch off directly by releasing. The problem is enforced by a high
current background light for the LCD. The resistor R7 to the base of the PNP transistor T3 was
optimized with the value 27k Ohm too much to save power consuming. To improve the switching
with lower battery voltage or lower current amplification factor of the PNP transistor T3, you
should reduce the resistance to 3.3k Ohm.
Additional pull-up resistor at PD7 The missing pull-up resistor results to a switch off of the
tester with the message "Timeout" after a short display time. The software is configured with
the option PULLUP DISABLE, that all internal pull-up resistors are switched off. For that
reason the voltage of pin PD7 is not definded, if the level is not switched by the push button
or transistor T2 to GND. One external pull-up resistor of 27k Ohm to VCC avoid this error.
Capacitor C1 at the AREF pin Many designs use a 100nF capacitor at the AREF pin, like the
design of Markus F. too. As long as the reference voltage of the ADC is never changed, this is a
good solution. The software of the TransistorTester for the ATmega168/328 uses a automatic
selection of the internal 1.1 V reference voltage of the ADC, if the input voltage is below 1V.
With this solution a better resolution of the ADC can be reached for little input voltages.
Unfortunately the switching from 5V to 1.1V reference is very slowly. A additional wait time
of 10ms must be respected for this reason. With changing the capacity value to 1nF this wait
time can be reduced significant. I have not noticed any degration of measurement quality with
this change. Even a removing of the capacitor has no significant change of measurement results.
If you prefer to leve the capacitor unchanged, you can remove the option NO AREF CAP in
the Makefile to activate longer wait times in the program.
Expanding of a 8MHz crystal With some skill you can expand a 8MHz crystal to the backside
of the printed board directly to the pins PB6 and PB7 (pin 9 and pin 10). My own expansion
was done without the both 22pF capacitors. This solution has operated well with all tested
ATmega. But it is not required to use a crystal. You can still use the 8MHz RC oszillator by
setting the fuses to get the better resolution of time constant measuring (capacity value).
Smoothing of the operating voltage The original circuit of Markus F. shows only one 100nF
capacitor to block the VCC voltage. This is clearly too little smoothing. You should at least
use one 100nF near the ATmega power pins and one near the voltage regulator. The input
of the voltage regulator should be blocked with a 100nF too. Additional 10uF capacitors
(electrolytic or ceramic) at the input and output of the voltage regulator can stable the voltage
level. Ceramic 10uF capacitos with SMD mounting form are easier to use for backfitting and
have usually a lower ESR value.
Selection of the ATmega processor The using of the base function of the tester is still possible
with a ATmega8. The flash memory of that device is used near 100% . Because the ATmega168 or ATmeg328 processors are pin-compatible to the ATmega8, I can recommend the
replacement. Actually the price for ATmega328 is so cheap, that there is no reason to take
a ATmega168 type. With a ATmega168/328 you get the following advantages: Self test with
automatic calibration.
Improvement of measurement quality by automatic switching of ADC scale.
10

Measurement of inductors with resistance below 2100Ohm.
Measurement of ESR value of capacitors with value of above 0.18uF .
The resolution of resistor measurement below 10Ohm is 0.01Ohm.
Using of pin PC4 as serial output.
Missing precision voltage reference Usually the software should detect the missing voltage reference with the unconnected pin PC4. In this case no VCC=x.xV message should appear in
row 2 of the LCD on power on. If this message appear without the reference, you should
connect a 2.2k Ohm resistor to the PC4 input and VCC.

2.4

Chinese clones

As I know, the tester is rebuild in China in two versions. The first model is rebuild from the first
design of Markus F. without the ISP port. The assembled ATmega8 is placed in a socket, so you
can replace it with a ATmega168 or ATmega328. For this version you should consider all the hints
of section 2.3. Additional 100nF ceramic cpacitors should be connected near by the VCC-GND
and AVCC-GND pins of the ATmega for better stabilization of the power voltage. In addition you
should notice, that if you expand the board with the additional 8 MHz crystal, your external ISP
programmer must have a external clock for programming.
The second version of rebuilded tester is build with SMD components. Also the fix installed
ATmega168 is a SMD type with 32TQFP body. Fortunately on the board is a 10-pole ISP connector
provided for the programming. I have analysed the board version "2.1 2012/11/06". One error is
the assembly of the part "D1", which should be a precision 2.5V voltage reference. Assembled is
only a zener diode. This part should be removed. You can mount a LM4040AIZ2.5 or LT1004CZ-2.5
precision voltage reference at this place. A missing voltage reference is noticed by the software, so
that you must not install the voltage reference. My exemplar was delivered with software version
1.02k. The 10-pole ISP plug was not assembled and I must install a jumper from ISP pin 6 to ISP pin
10. My programmer expect a GND connection at pin 10, but the board has GND level only on pin
4 and pin 6 of the ISP. The label of the ATmega168 was rub away and there was no documentation
delivered with the part. The lock fuses of the ATmega were set, so no readout was possible. But
I could install the software version 1.05k without any problems. Another user has problems with
the same software version 1.05k. This user has the chinese board "2.2 2012/11/26". The software
runs only without problems, if a additional 100nF keramic capacitor was placed between the pin
18-AVCC and 21-GND near by the ATmega. The software 1.05k uses the sleep state of the ATmega
for waiting time. For this reason the current alternates often and the voltage regulator is stressed
more. Further I have noticed, that the VCC voltage is blocked with a 100nF ceramic capacitor and
with a 220uF electrolytic capacitor nearby the 78L05 voltage regulator. The 9V supply voltage is
blocked with the same capacitors, but not at the input of the regulator but at the emitter of the
PNP transistor (parallel with the battery). The printed circuit board track from the ATmega168 to
the test port is very thin, so that a resistance of 100mOhm could be measured for one path. This will be
the reason for measuring a resistance of 0.3Ohm for two direct connected pins. The ESR measuring can
usually consider this by zero compensation. Beginning with version 1.07k the software does respect
this offset for measuring resistors below 10Ohm too.

11

2.5

Programming of the microcontroller

I release the software for the microcontroller with source code. The developement is done with Linux
operationg system (Ubuntu) and is controlled with a Makefile. The Makefile makes shure, that your
software will be compiled with the prior selected Makefile options. Some constellations are precompiled with the source. Please take a look to the ReadMe.txt file in the directory Software/default
and to the chapter 4. The result of compilation have the extensions .hex and .eep . Usually the
names will be TransistorTester.hex and TransistorTester.eep . The .hex file contains the data for the
program memory (flash) of the ATmega processor. The .eep file contains the data for the EEprom
memory of the ATmega. Both data files must be loaded to the correct memory.
Additionally the operating state of the ATmega processor must be programmed with the "fuses".
If you can use my Makefile and additionally the program avrdude [12], you need no exact knowledge
of the details about the fuses. You have only to type "make fuses" if you have no crystal or "make
fuses-crystal" if you have installed the 8MHz crystal to your printed board. With the ATmega168
series of the microcontroller you can also use "make fuses-crystal-lp" to use a crytal with the low
power mode. Never choose the crystal mode of clock generation, if you don't have installed the 8MHz
crystal. If you are not shure with the fuses, leave them as default set by manufactor and first bring
the the tester to operation in this mode. Maybe your program runs too slow, if you use program data
compiled for 8MHz operation, but you can correct this later! But a wrong set of fuses may inhibit
later ISP-programming. If you use the Windows operating system, the easiest way to get a correct
programmed ATmega is to use the WinAVR package [16],[17]. With my patch [18] you can also set
the fuses by using the Makefile. Of course the avrdude program must support your programmer and
the configuration in the Makefile must match to your environment.
The figures 2.4 show the File menu of the graphical user interface of WinAVR for open the file
Makefile and for saving the changed Makefile (Save).

(a) open Makefile

(b) save Makefile

Figure 2.4: Using of the WinAVR user interface Programmer's Notepad
12

The next figures 2.5 show the Tools menu of the Programmer's Notepad for compiling the program
(Make All) and for programming the ATmega (Program) with avrdude.

(a) Build programming data (.hex/.eep)

(b) Programming the ATmega

Figure 2.5: Using of the WinAVR user interface Programmer's Notepad

2.6

Troubleshooting

In most cases of problems you will miss the text output to the LCD-display. At first you should
check, if the LED was illuminated weak, if you release the Test button.
Power does not switch on. If the LED is without light and the VCC power has correct 5V voltage
during holding the Test button, the microcontroller does not switch the power correctly. The
microcontroller should hold the power by switching the PD6 output to 5V, which is usually
done as one of the first actions. If you hold the Test key pressed, the power is switched on
anyway. So you can check the value of VCC power and additionally the voltage value of the
PD6 output, if you hold the key pressed. If VCC voltage has correct value (5V), but PD6
voltage is below 4V, your microcontroller does not start the program. In this case you should
check if the microcontroller flash has been loaded with proper data for your installed type and
if ATmega is correctly configured with the fuses. If your ATmega put the PD6 output to 5V
and the power does not stay if you release the Test key, it is more difficult to find the reason.
First you can shorten the LED and try again. If your Tester now starts, your LED may be
faulty or mounted with wrong polarity. If this is not the reason, the current amplification factor
of your T3 transistor (BC557C) is insufficient. The current to the base of T3 is lower in the
microcontroller state as in the "key pressed" state.
Nothing is readable on the LCD display Check the voltage at the contrast pin at the LCD
display (pin 3). Adjust to correct value specified in the data sheet of your display and optimize
13

by viewing. If you have a high temperature display type, you must provide a negative contrast
voltage for operation. In this case you can use the ICL 7660 device for generating a negative
voltage from positive 5V.
If there is no output readable on the LCD and the background light is on, you should disconnect
the power and check all four data plus the two control signal connections. If all connection are
well, the only reason I see is a uncorrect timing of control signals. This can be caused by a
slower LCD controller than expected by the software or the ATmega software runs at wrong
clock speed. Please check for which clock speed your programming data was compiled and if
the fuses of the ATmega are correct set to that speed. You find the clock parameter in the
corresponding Makefile. If the tester is build without the switch off electronic, you can test
with a LED connected to the test pins, if the program operates normally. If the LED flickers,
the program operates well. The missing text on the LCD must be caused by wrong connection
or timing.
Something but not all is readable on the LCD display Check if the .eep data are loaded to
the EEprom memory of ATmega. If all data are loaded correctly, you should check the clock
speed of your programming data (Makefile) and ATmega processor settings (fuses).
Measurement is slow and Capacitors are measured about 8 times too small You run software compiled for 8MHz clock at real clock speed of 1MHz. Please set the fuses of the ATmega
correctly.
Measurement has strangely values Check if your programmer is still connected to the ISP-plug.
The ISP interface should be disconnected for measuring. Very often the reason of wrong
measurements is the use of software compiled with the AUTOSCALE ADC option and with
the option NO REF CAP, but the capacitor at the AREF pin has still a value of 100nF. Wrong
assembly of components or remaining soft solder flux can disturb the measurements too. Please
check with the selftest function of your TransistorTester software if possible. For the details
see Chapter 5.5.
Otherwise inspect your board visually and check the resistor values with a ohmmeter. You
can use the pins of the ATmega for this check, for example to check the R1 you can measure
between pin 23 and pin 14. Take a look at the circuit diagram 2.1 for details. There is no need
to remove the microcontroller, only battery or power supply should be removed before.
The Tester switch off the power after 2 seconds display time This condition exists, if the
external Pull-Up resistor at the PD7 input is missing or the key button is keep pressed. The
software switch off the internal Pull-Up resistors to prevent a influence to the measurement
results. Therefore a external Pull-Up resistor (27k) is required.

14

Chapter 3
Instructions for use
3.1

The measurement operation

Using of the Transistor-Tester is simple. Anyway some hints are required. In most cases are wires
with alligator clips connected to the test ports with plugs. Also sockets for transistors can be
connected. In either case you can connect parts with three pins to the three test ports in any order.
If your part has only two pins, you can connect this pins to any two of the tree test ports. Normally
the polarity of part is irrelevant, you can also connect pins of electrolytical capacitors in any order.
The measurement of capacity is normally done in a way, that the minus pole is at the test port
with the lower number. But, because the measurment voltage is only between 0.3 V and at most
1.3 V, the polarity doesn´ matter. When the part is connected, you should not touch it during
t
the measurement. You should put it down to a nonconducting pad if it is not placed in a socket.
You should also not touch to the isolation of wires connected with the test ports, the measurement
results can be affected. Then you should press the start button. After displaying a start message,
the measurement result should appear after two seconds. If capacitors are measured, the time to
result can be longer corresponding to the capacity.
How the transistor-tester continues, depends on the configuration of the software.
Single measurement mode If the tester is configured for single measurement mode, the tester
shut off automatical after displaying the result for 28 seconds for a longer lifetime of battery.
During the display time a next measurement can be started by pressing the start button. After
the shut off a next measurement can be started too of course. The next measurement can be
done with the same or another part. If you have not installed the electronic for automatic shut
down, your last measurement result will be displayed until you start the next measurement.
Endless measurement mode A special case is the configuration without automatical shut off.
This configuration is normally only used without the transistors for the shut off function. A
external off switch is necessary for this case. The tester will repeat measurements until power
is switched off.
Multi measurement mode In this mode the tester will shut down not after the first measurement
but after a configurable series of measurements. In the standard case the tester will shut down
after five measurements without found part. If any part is identified by test, the tester is shut
down after double of five (ten) measurements. A single measurement with unknown part after
a series of measurement of known parts will reset the counter of known measuerements to zero.
Also a single measurement of known part will reset the counter of unknown measurements to
zero. This behavior can result in a nearly endless series of measurements without pressing the
start button, if parts are disconnected and connected in periodical manner.

15

In this mode there is a special feature for the display period. If the start button is pressed only
short for switching on the tester, the result of measurement ist only shown for 5 seconds. Buf if
you press and hold the start button until the first message is shown, the further measurement
results are shown for 28 seconds. The next measurement can started earlier by pressing the
start button during the displaying of result.

3.2

Selftest and Calibration

If the software is configured with the selftest function, the selftest can be prepared by connecting all
three test ports together and pushing of the start button. To begin the self test, the start butten
must be pressed again within 2 seconds, or else the tester will continue with a normal measurement.
If the self test is started, all of the documented tests in the Selftest chapter 5.5 will be done.
The repetition of the tests can be avoided, if the start button is hold pressed. So you can skip
uninteresting tests fast and you can watch interresting tests by releasing the start button. The test
4 will finish only automatically if you separate the test ports (release connection).
If the function AUTO CAL is selected in the Makefile, the zero offset for the capacity measurement
will be calibrated with the selftest. It is important for the calibration task, that the connection
between the three test ports is relased during test number 4. You should not touch to any of the
test ports or connected cables when calibration (after test 6) is done. But the equipment should be
the same used for further measurements. Otherwise the zero offset for capacity measurement is not
detected correctly. The resistance values of port outputs are determined at the beginning of every
measurement with this option.
A capacitor with any capacity between 100nF and 20uF connected to pin 1 and pin 3 is required
for the last task of calibration. To indicate that, a capacitor symbol is shown between the pin number
1 and 3, followed by the text " & gt; 100nF". You should connect the capacitor not before this text is
shown. With this capacitor the offset voltage of the analog comparator will be compensated for better
measurement of capacity values. Additionally the gain for ADC measurements using the internal
reference voltage will be adjusted too with the same capacitor for better resistor measurement results
with the AUTOSCALE ADC option.
The zero offset for the ESR measurement will be preset with the option ESR ZERO in the
Makefile. With every self test the ESR zero values for all three pin combinations are determined.
The solution for the ESR measurement is also used to get the values of resistors below 10Ohm with a
resolution of 0.01Ohm.

3.3

special using hints

Normally the Tester shows the battery voltage with every start. If the voltage fall below a limit,
a warning is shown behind the battery voltage. If you use a rechargeable 9V battery, you should
replace the battery as soon as possible or you should recharge. If you use a tester with attached 2.5V
precision reference, the measured supply voltage will be shown in display row two for 1 second with
"VCC=x.xxV".
It can not repeat often enough, that capacitors should be discharged before measuring. Otherwise
the Tester can be damaged before the start button is pressed. If you try to measure components in
assembled condition, the equipment should be allways disconnected from power source. Furthermore
you should be shure, that no residual voltage reside in the equipment. Every electronical equipment
has capacitors inside!
If you try to measure little resistor values, you should keep the resistance of plug connectors and
cables in mind. The quality and condition of plug connectors are important, also the resistance of

16

cables used for measurement. The same is in force for the ESR measurement of capacitors. With
poor connection cable a ESR value of 0.02Ohm can grow to 0.61Ohm.
You should not expect very good accuracy of measurement results, especially the ESR measurement and the results of inductance measurement are not very exact. You can find the results of my
test series in chapter 5.

3.4

Compoments with problems

You should keep in mind by interpreting the measurement results, that the circuit of the TransistorTester is designed for small signal semiconductors. In normal measurement condition the measurement current can only reach about 6 mA. Power semiconductors often make trouble by reason of
residual current with the identification an the measurement of junction capacity value. The Tester
often can not deliver enough ignition current or holding current for power Thyristors or Triacs. So a
Thyristor can be detected as NPN transistor or diode. Also it is possible, that a Thyristor or Triac
is detected as unknown.
Another problem is the identification of semiconductors with integrated resistors. So the base emitter diode of a BU508D transistor can not be detected by reason of the parallel connected internal
42Ohm resistor. Therefore the transistor function can not be tested also. Problem with detection is also
given with power Darlington transistors. We can find often internal base - emitter resistors, which
make it difficult to identify the component with the undersized measurement current.

3.5

Measurement of PNP and NPN transistors

For normal measurement the three pins of the transistor will be connectet in any order to the
measurement inputs of the TransistorTester. After pushing the start button, the Tester shows in row
1 the type (NPN or PNP), a possible integrated protecting diode of the Collector - Emitter path and
the sequence of pins. The diode symbol is shown with correct polarity. Row 2 shows the current
amplification factor (B=...) and the Base - Emitter threshold voltage. You shouls know, that the
Tester can measure the amplification factor with two different circuits, the common Emitter and the
common Collector circuit (Emitter follower).
With the common Emitter circuit the tester has only two alternative to select the base current:
1. The 680Ohm resistor results to a base current of about 6.1mA. This is too high for low level
transistors with high amplification factor, because the base is saturated. Because the collector
current is also measured with a 680Ohm resistor, the collector current can not reach the with the
amplification factor higher value. The software version of Markus F. has measured the Base Emitter threshold voltage in this ciruit (Uf=...).
2. The 470k Ohm resistor results to a base current of only 9.2uA . This is very low for a power transistor with low current amplification factor. The software version of Markus F. has identified
the current amplification factor with this circuit (hFE=...).
The software of the Tester figure out the current amplification factor additionally with the common Collector circuit. The higher value of both measurement methodes is reported. The common
collector circuit has the advantage, that the base current is reduced by negative current feedback
corresponding to the amplification factor. In most cases a better measurement current can be reached
with this methode for power transistors with the 680Ohm resistor and for Darlington Transistors with
470k Ohm resistor. The reported Base - Emitter threshold voltage Uf is now measured with the same
17

current used for determination of the current amplification factor. However, if you want to know the
Base - Emitter threshold voltage with a measurement current of about 6mA, you have to disconnect
the Collector and to start a new measurement. With this connection, the Base - Emitter threshold
voltage at 6 mA is reported. The capacity value in reverse direction of the diode is also reported. Of
course you can also analyse the base - collector diode.

3.6

Measurement of JFET and D-MOS transistors

Because the structure of JFET type is symmetrical, the Source and Drain of this transistores can
not be differed. Normally one of the parameter of this transistor is the current of the transistor
with the Gate at the same level as Source. This current is often higher than the current, which can
be reached with the measurement circuit of the TransistorTester with the 680Ohm resistor. For this
reason the 680Ohm resistor is connected to the Source. Thus the Gate get with the growing of current a
negative bias voltage. The Tester reports the Source current of this circuit and additionally the bias
voltage of the Gate. So various models can be differed. The D-MOS transistors (depletion type) are
measured with the same methode.
You should know for enhancement MOS transistors (P-E-MOS or N-E-MOS), that the measurement of the gate threshold voltage (Vth) is more difficult with little gate capacity values. You can
get a better voltage value, if you connect a capacitor with a value of some nF parallel to the gate
/source. The gate threshold voltage will be find out with a drain current of about 3.5mA for a
P-E-MOS and about 4mA for a N-E-MOS.

18

Chapter 4
Configuring the TransistorTester
The complete software for the TransistorTester is available in source code. The compilation of
modules is controlled with a Makefile. The developement was done at the Ubuntu Linux operating
system with the GNU toolchain (gcc version 4.5.3). It should be possible to use other Linux operating
systems without problems. To load the compiled data to the flash memory or the EEprom memory,
the tool avrdude (version 5.11svn) was taken by the Makefile, if you call "make upload". The program
avrdude [12] is available for Linux and Windows operating system. The gnu C-compiler gcc is also
taken by the AVR studio software and by the WinAVR [16],[17] software at the Windows operating
system. You can load the program data (.hex and .eep) also with other tools to the ATmega, but
only my Makefile version takes care to load the correct data to the choosed processor. Avrdude
loads only data to the ATmega if the Signature Bytes of the connected ATmega is identical to the
choosed one. If you alter the Makefile, all the software will be compiled new, if you call a "make"
or "make upload" command. The software compiled for a ATmega8 does not run on a ATmega168.
The software compiled for a ATmega328 does not run on the ATmega168! A exeption fron this rule is
the software compiled for ATmega168, this data can also be used for a ATmega328 without changes.
Be careful, if you don't use my Makefile.
With the correct options set, my software runs on the unchanged hardware of Markus F. (PARTNO=M8,
NO option NO AREF CAP and NO PULLUP DISABLE option). The clock rate can also be set to
8 MHz with fuses, no crystal is required!
The following options in the Makefile are avaiable to configure the software for your Tester.
PARTNO describes the target processor:
m8 = ATmega8
m168 or m168p = ATmega168
m328 or m328p = ATmega328
example: PARTNO = m168

UI LANGUAGE specifies the favored Language
LANG ENGLISH, LANG GERMAN, LANG POLISH, LANG CZECH, LANG SLOVAK, LANG SLOV
LANG DUTCH, LANG BRASIL, LANG RUSSIAN, LANG UKRAINIAN and LANG LITHUANIAN
is currently avaiable. The russian or ukrainian language requires a LCD with cyrillic character
set.
example: UI LANGUAGE = LANG ENGLISH
LCD CYRILLIC is only needed for a LCD-display with cyrillic character set. The u and Ohm character is not avaiable with the cyrillic character set. If you specify this option, both characters
are loaded to the LCD with software.
example: CFLAGS += -DLCD CYRILLIC

19

LCD DOGM must be set, if a LCD with ST7036 controller (Type DOG-M) is used for displaying.
The LCD-contrast is then set with software commands.
example: CFLAGS += -DLCD DOGM
STRIP GRID BOARD This option adapts the software to a changed port D connection for strip
grid printed boards. You can find the details in the chapter hardware 2.1.
WITH SELFTEST If you specify this Option, software will include a selftest function. Selftest
will be started, if you connect all three probes together and start measurement.
example: CFLAGS += -DWITH SELFTEST
NO COMMON COLLECTOR HFE disables the hFE measurement of transistors with the
common collector circuit. You can save memory to enable the extended selftests T1 to T7
for a ATmega168 processor. By default both measurement circuits for the hFE measurement
are enabled, but there is no place in the program memory of the ATmega168 for the extended
selftests.
example: CFLAGS += -DNO COMMON COLLECTOR HFE
NO COMMON EMITTER HFE disables the hFE measurement of transistors with the common emitter circuit. You can save memory to enable the extended selftests T1 to T7 for a
ATmega168 processor. By default both measurement circuits for the hFE measurement are
enabled, but there is no place in the program memory of the ATmega168 for the extended
selftests.
example: CFLAGS += -DNO COMMON EMITTER HFE
NO TEST T1 T7 This option disable the execution of the selftest parts T1 to T7. This tests are
usefull to find errors in the hardware like incorrect measurement resistors or isolation problems.
If your hardware is well, you can omitt this selftest parts T1 to T7 by setting this option to
get a faster calibration. The ATmega168 processor does not use the selftest parts T1 to T7, if
both measurement types for hFE determination are used.
example: CFLAGS += -DNO TEST T1 T7
AUTO CAL The zero offset for capacity measurement will be written additionally to the EEprom
with the selftest routine. Additionally the offset voltage of the analog comparator (REF C KORR)
and the voltage offset of the internal reference voltage (REF R KORR) will be measured automatically, if you connect a capacitor with a capacity value between 100nF and 20uF to pin 1
and pin 3 after measurement of capacity zero offset. All found values will be written to EEprom
and will be used for further measurements automatically. The port output resistance values
will be determined at the beginning of each measurement.
example: CFLAGS += -DAUTO CAL
FREQUENCY 50HZ At the end of selftest a 50 Hz Signal will be generated on Port 2 and Port 3
for up to one minute.
example: CFLAGS += -DFREQUENCY 50HZ
CAP EMPTY LEVEL This option defines the voltage level for discharged capacitor (mV units).
You can set the level to higher value as 3mV, if the tester does not finish discharging of
capacitors. In this case the tester ends after longer time with the message "Cell!".
example: CFLAGS += -DCAP EMPTY LEVEL=3
WITH AUTO REF specifies, that reference voltage is read to get the actual factor for capacity
measuring of low capacity values (below 40uF ).
example: CFLAGS += -DWITH AUTO REF
20

REF C KORR specifies a offset for readed reference voltage in mV units. This can be used to
adjust the capacity measurement of little capacitors. A correction value of 10 results to about
1 percent lower measurement results. If the option AUTO CAL is selected together with
the WITH SELFTEST option, the REF C KORR will be a offset to the measured voltage
difference of the test capacitor and the internal reference voltage.
example: CFLAGS += -DREF C KORR=14
REF L KORR specifies a additional offset in mV units to the reference voltage for the measurement of inductance values. The REF C KORR offset and respectively the offset value from the
calibration is additionally used with the inductance measurement. The REF L KORR value
will be subtracted for measurements without a 680Ohm resistor, for measurements with a 680Ohm
resistor the value will be added.
example: CFLAGS += -DREF L KORR=40
C H KORR specifies a correction value for the measurement of big capacitor values. A value of
10 results to 1 percent lower measurement results.
example: CFLAGS += -DC H KORR=10
WITH UART uses the pin PC3 as output for the serial text (V24). If the option is not set, the
pin PC3 can be used for reading a external voltage with a 10:1 resistor divider. With this
equipment you can check the breakdown voltage of zener diodes, which have more than 4.5V
breakdown voltage. This measurement will repeat with 3 measurements per second until you
release the Start button.
example: CFLAGS += -DWITH UART
AUTOSCALE ADC enables the automatic scale switchover of the ADC to either VCC or internal
reference. Internal reference gives a 2.56V scale for ATmega8 and a 1.1V scale for other
processors.
example: CFLAGS += -DAUTOSCALE ADC
ESR ZERO defines a zero offset for ESR measurements. The zero offsets for all three pin combinations will be determined with the selftest and replaces the preset zero offset. This zero offsets
will be subtracted from all ESR measurements. Example: CFLAGS += -DESR ZERO=29
NO AREF CAP tells your Software, that you have no capacitor (100nF ) installed at pin AREF
(pin 21). This enables a shorter wait-time for the AUTOSCALE ADC scale switching of the
ADC. A 1nF capacitor was tested in this mode without detected errors. Figure 4.1a and 4.1b
show the switching time with a 1nF capacitor. As you can see the switching from 5V to 1.1V
is much slower than switching back to 5V. If you have still installed the 100nF , switching time
will be about factor 100 longer!
example: CFLAGS += -DNO AREF CAP
REF R KORR specifies a offset for the internal ADC-reference voltage in mV units. With this
offset a difference by switching from VCC based ADC reference to internal ADC reference
for resistor measurement can be adjusted. If you select the AUTO CAL option of the selftest
section, this value is only a additionally offset to the found voltage difference in the AUTO CAL
function.
example: CFLAGS += -DREF R KORR=10
OP MHZ tells your software at which Clock Frequency in MHz your Tester will operate. The
software is tested only for 1 MHz, 8MHz and additionally 16MHz. The 8MHz operation is
recommended for better resolution of capacity and inductance measurement.
example: OP MHZ = 8
21

RESTART DELAY TICS must be set to 6, if the ATmega168 or ATmega328 is used with the
internal RC-oszillator instead of the crystal oszillator. If this value is not preset, the software
respects the 16384 clock tics delay for restart from sleep mode with the crystal operation.
example: CFLAGS += -DRESTART DELAY TICS=6
USE EEPROM specifies if you wish to locate fix text and tables in EEprom Memory. Otherwise
the flash memory is used. Recommended is to use the EEprom (option set).
example: CFLAGS += -DUSE EEPROM
EBC STYLE specifies, that the output of transistor pin layout is done with format "EBC=..." or
"GDS=...". This way of output save program memory for the ATmega. Without this option
the layout is shown with the format "123=...", where every point represent a E (Emitter),
B (Base) or C (Collector). For FET transistors every point can be a G (Gate), D (Drain) or
S (Source). If the sequence of the test pins is not 1, 2 and 3 in the reading direction, you can
invert the sequence with the option EBC STYLE=321 . The pin assignment is then shown
with style "321=...", which will better match the usual reading direction.
Example: CFLAGS += EBC STYLE
NO NANO specifies that the decimal prefix nano will not be used to display the measurement
results. So capacity values will be shown in uF instead of nF .
Example: CFLAGS += NO NANO
PULLUP DISABLE specifies, that you don't need the internal pull-up resistors. You must have
installed a external pull-up resistor at pin 13 (PD7) to VCC, if you use this option. This option
prevents a possible influence of pull-up resistors at the measuring ports (Port B and Port C).
example: CFLAGS += -DPULLUP DISABLE
ANZ MESS this option specifies, how often an ADC value is read and accumulated. You can
select any value between 5 and 200 for building mean value of one ADC measurement. Higher
values result to better accuracy, but longer measurement time. One ADC measurement with
44 values takes about 5ms.
example: CFLAGS += -DANZ MESS=25
POWER OFF This option enables the automatic power off function. If you don't specify this
option, measurements are done in a loop infinitely until power is disconnected with a ON/OFF
switch. If you have the tester without the power off transistors, you can deselect the option
POWER OFF.
If you have NOT selected the POWER OFF option with the transistors installed, you can also
shut down the tester. During displaying the measurement result you should hold the start key
pressed for several seconds until the "Timeout" message is displayed. If you then release the
key, the tester will be shut off.
You can also specify, after how many measurements without a founded part the tester will
shut down. The tester will also shut down the power after twice as much measurements are
done in sequence without a single failed part search. If you have forgotten to unconnect a test
part, total discharging of battery is avoided. Specify the option with a form like CFLAGS
+= -DPOWER OFF=5 for a shut off after 5 consecutive measurements without part found.
Also 10 measurements with any founded part one after another will shut down. Only if any
sequence is interrupted by the other type, measurement continues. The result of measurement
stay on the display for 28 seconds for the single measurement, for the multiple measurement
version display time is reduced to 5 seconds (set in config.h). If the start key is pressed a longer
time on power on time, the display time is also 28 seconds for the multiple measurement. The
22

maximum value is 255 (CFLAGS += -DPOWER OFF=255).
example 1: CFLAGS += -DPOWER OFF=5
example 2: CFLAGS += -DPOWER OFF
BAT CHECK enables the Battery Voltage Check. If you don't select this option, the version
number of software is output to the LCD instead. This option is usefull for battery powered
tester version to remember for the battery change.
example: CFLAGS += -DBAT CHECK
BAT OUT enables Battery Voltage Output on LCD (if BAT CHECK is selected). If your 9V
supply has a diode installed, use the BAT OUT=600 form to specify the threshold voltage (mV)
of your diode to adjust the output value. Also the voltage loss of transistor T3 can be respected
with this option. threshold level does not affect the voltage checking levels (BAT POOR).
example 1: CFLAGS += -DBAT OUT=300
example 2: CFLAGS += -DBAT OUT
BAT POOR sets the poor level of battery voltage to the specified 1mV value. The warning level
of battery voltage is 0.8V higher than the specified poor level, if the poor level is more than
5.3V. If the poor level is 5.3V or less, the warning level is 0.4V higher. If the poor level is
below 3.25V, the warning level is only 0.2V higher than the selected poor level and if the poor
level is below 1.3V, the warning level is only 0.1V higher than the specified poor level. Setting
the poor level to low values such as 5.4V is not recommended for rechargeable 9V batteries,
because this increase the risk of battery damage by the reason of the deep discharge! If you
use a rechargeable 9V Battery, it is recommended to use a Ready To Use type, because of the
lower self-discharge.
example for low drop regulator (5.4V): CFLAGS += -DBAT POOR=5400
example for 7805 type regulator (6.4V): CFLAGS += -DBAT POOR=6400
INHIBIT SLEEP MODE disable the use of the sleep mode of the processor. Normaly the software uses for longer work breaks the sleep mode to avoid unneeded current consumption. The
usage of this sleep mode indeed spare battery capacity, but produce additional stress for the
voltage regulator.
example: CFLAGS += -DINHIBIT SLEEP MODE
PROGRAMMER select your programmer type for avrdude interface program. The correct selection of this option is needed, if you use the "make upload" or "make fuses" call of this
Makefile. For further information please look to the manual pages of avrdude and online documentation [12].
example: PROGRAMMER=avrisp2
BitClock selects the Bit clock period for the Programmer. See the description of the -B parameter
of avrdude.
example: BitClock=5.0
PORT select the port where avrdude can reach your microcontroller (atmega). For further information please look to the manual pages of avrdude.
example: PORT=usb

23

(a) from 5V to 1.1V

(b) from 1.1V to 5V

Figure 4.1: AREF switching with a 1nF Capacitor
Additional parameters can be set in the files transistortester.h and config.h . The file transistortester.h contains global variables and defines the port / pin constellation and the resistor values
used for measurement. The file config.h specifies parameter for different processor types, wait times
and the clock frequency of the ADC. Normally there is no reason to change these values.

24

Chapter 5
Description of the measurement
procedures
The simplified schematic of a Input/Output-Port pin of the ATmega is shown in figure 5.1. The PUD
switch isolates all "pull up" resistors of the ATmega. The output of a pin can be switched off with
the DD switch. The Input can operate regardless to the state of the switch DD. The PORT switch
usually defined the output level, but also switches the pull up resistor. Because the Switches PORT
and DD can not be changed at the same time but only one after another, the pull up resistors can
disturb the measurement. Therefore I prefere to disable the pull up resistors with the PUD switch.
Of course all the switches are electronic type and the resistors 19Ohm and 22Ohm are approximated values.
VCC
PUD
Pull up
to ADC Mux, Port C only

22

Port Pin
DD

19

PIN

PORT

Figure 5.1: simplified diagram of each ATmega port pin
Every of the three terminal probes of your Transistor Tester is build with three ATmega port
pins, which is shown as simplified diagram for the terminal probe TP2 (middle of three pins) in
figure 5.2.

22

19

22

19

22

19

VCC

GND

ADCMUX

R4

PB3
470k

R3

PB2
680

PC1

TP2

Figure 5.2: simplified circuit of each measurement terminal probe TP
25

Every test pin (measurement port) can be used as digital or analog input. This measurement
capability is independent of using the port as output. Every test pin can be switched to output and
in this mode it can be directly connected to GND (0V) or VCC (5V), or it can be connected via a
680Ohm resistor or a 470k Ohm resistor to either GND or VCC. Table 5.1 shows all possible combination
of measurements. Notice, that the positive state can be switched directly to VCC (Port C) or it can
be connected with the 680Ohm resistor to VCC (Port B). The same possibility has the negative state of
terminal probe to the GND side. The test state means, that probe can be open (Input), connected
with the 470k Ohm resistor to VCC or GND, or that the probe can be connected with the 680Ohm resistor
to VCC or GND.
1.
2.
3.
4.
5.
6.

state pin 1 state pin 2 state pin 3
positive
negative
test
positive
test
negative
test
negative
positive
test
positive
negative
negative
test
positive
negative
positive
test

Table 5.1: all combinations of measurement
If the capacitor measuring is configured for the tester, the tester will try to discharge the capacitors
connected at all test pins. If discharge will fail, that means the remaining voltage is to high, the
discharging will be aborted after about 12 seconds with the meassage "Cell!". This can also be
happen, if no capacitor is connected to any test pin. The cause for this can be, that the cut-off
voltage is choosed to low for this ATmega. You can choose a higher voltage with the Makefile option
CAP EMPTY LEVEL.

26

5.1

Measurement of Semiconductors

One probe pin is assumed to be the negative side of the component. Another pin is assumed to be
the positive side of the component. For a first test, the components positive side is directly connected
to VCC. The negative side is connected with the 680Ohm resistor to GND. The test probe (third pin,
also called TriStatePin) is first connected with the 680Ohm resistor for 10 ms to GND. The voltage of
the negative probe pin is read, during the TriStatePin is switched to Input (High Impedance). It is
assumed that the tested part can be a N-Channel MOSFET and the gate should be discharged. If the
readed voltage is above 976mV, the next test assume, that the tested part can also be a P-Channel
MOSFET and for this a 10ms switch of the TriStatePin with the 680Ohm resistor to the VCC side is
done. Also for this case the voltage at the negative Probe pin is read with a currentless TriStatePin.
If the voltage of the negative pin is greater than 455mV, additional tests are made to differ N-Channel
JFET or D-MOSFET (depletion) and P-Channel JFET or P-MOSFET. The MOSFET versions can
be differed by the missing of gate current in any state of the TriStatePin.
To get parameters of the depletion types, they will be measured with a 680Ohm resistor at the source
pin, as shown in figure 5.3 . This measurement will be done instead of the usually measurement of
current with the gate hold at source level, because the IDSS current of the FET transistor can often
not be reached with the relative high resistance of the 680Ohm resistor.

22

19

ADCMUX

TP3

R6

S

PB5
470k

TP1 D

PB4

R5

PC2

680

R1

R2

PB1
470k

PB0
680

PC0

G

22

19

22

19

VCC

22

22

19

GND

ADCMUX

19

22

19

22

19

22

19

22

19

VCC

GND

ADCMUX

470k

R3

R4

PB3

PB2
680

PC1

TP2

Figure 5.3: Measurement of the Gate-Source voltage and Source current of a N-JFET transistor
If the component has no current between positive probe and negative probe without signal at the
TristatePin, the next tests are specified in the next section 5.1.1. If current was detected, the next
test is described in the diode section 5.1.3.

5.1.1

Measurement of PNP Transistor or P-Channel-MOSFET

First the current amplification factor is measured with common collector for the assumed PNP
transistor. The measuring situation is shown in figure 5.4. If the measured voltage at the Base (U B )
27

is above 9mV with the 680Ohm resistor, the hFE is build as hF E = U E -U B . The voltage U E is the
UB
difference of the Emitter-voltage to VCC. The difference between the 22Ohm and 19Ohm resistors are not
respected. If the U B voltage is below 10mV, the measurement is done with the 470k Ohm resistor at
?470000
the base. In this case the current amplification factor is build as hF E = UU E(680+22) .
B?

GND

ADCMUX

22

19

22

19

22

19

22

19

22

19

ADCMUX

TP3

PB5

R6

TP1

PB4
470k

PC2

680

R1

R2

PB1
470k

PB0
680

PC0

R5

22

19

VCC

22

19

22

19

22

19

VCC

GND

The green switch state is used
if Voltage at PC1 is & lt; 10mV !
ADCMUX

R4

PB3
470k

680

R3

PB2

PC1

TP2

Figure 5.4: hFE measurement of PNP transistor with common collector circuit
Next the tests with common emitter are done for the assumed PNP transistor. The positive side
of component is now direct connected to VCC, the negative side 680Ohm resistor is connected to GND
as shown in Figure 5.5. If the negative side of component has a voltage of above 3.4V, when the base
side 680Ohm resistor was connected to GND, it must be a PNP transistor or a P-Channel FET. This can
be easy find out by analysing the base voltage. If the base voltage is greater 0.97V, it must be a PNP.
For measuring the current amplification factor, the 470k Ohm resistor is taken as Base resistor instead
C 0)?470000
of the 680Ohm. The current amplification factor is build by hF E = (U C -U(680+19) . The voltage UC0
U B?
is the voltage at the colletor resistor without base current. The higher current amplification factor
is assumed to be the right one, this one or the one found with the common collector circuit.
The values found for the PNP are only valid, if a second set of measurements is done. In order to
prevent detecting the PNP in the inverse mode (collector and emitter are swapped), the measurement
with the higher current amplification is taken as the right one. If base voltage is lower than 0.97V,
it must be a P-E-MOS. In this case the gate threshold voltage is measured by switching the gate
slowly with the 470k Ohm resistor up and down, waiting for a digital input signal change of the Drain
side and then read the voltage of the gate pin.

28

GND

22

19

22

19
ADCMUX

TP3

PB5

R6

TP1

PB4
470k

R2

470k

R1

680

PC2

PB1

680

PB0

PC0

R5

ADCMUX

22

19

22

19

22

19

22

19

VCC

22

19

22

19

22

19

VCC

GND

The black state of switches is used for test!
The green state is used for current
amplification factor hFE.

ADCMUX

R4

PB3

470k

680

R3

PB2

PC1

TP2

Figure 5.5: test and hFE measurement of PNP transistor with common emitter circuit

5.1.2

Measurement of NPN Transistor or N-Channel-MOSFET

The measuring of NPN-Transistors begin in the same way as PNP-Transistors with measuring the
current amplification factor in the common collector circuit. First measurement is done with a 680Ohm
base resistor switched to VCC. If the voltage at the base resistor ist too low, the 470k Ohm resistor is
taken instead. Measurement then continues with the common emitter circuit as shown in figure 5.6.

29

22

22

GND

19

22

19

19

22

19

22

19

22

19

VCC

ADCMUX

ADCMUX

R6

PB5
470k

TP3

R5

TP1

680

470k

PB4

PC2

PB1

R1

680

PB0

R2

PC0

22

19

22

19

22

19

VCC

GND

The black state of switches is used for test!
The green state is used for current
amplification factor hFE.

ADCMUX

R4

PB3

470k

680

R3

PB2

PC1

TP2

Figure 5.6: test and hFE measurement of NPN transistor with common emitter circuit
If the voltage of collector sinks below 1.6V, when the 680Ohm base resistor is connected to VCC,
ist must be a NPN, N-Channel MOSFET or Thyristor/Triac. With two simple tests a Thyristor
or Triac can be identified. If the gate pin resistor is connected for 10ms to GND and than made
currentless, the current at the anode should stay. If then the anode resistor is short connected to
GND and reconnected to VCC, the Thyristor should not trigger again (no current). Please keep
in mind, that only low power Thyristors can be tested, because the holding current of the tester
can reach only 6mA. If both tests attest a Thyristor, further tests with reverse polarity are done to
exclude or confirm a Triac.
If neither Thyristor nor Triac could be confirmed, it can be a NPN or N-Channel E-MOSFET.
The Base voltage of a NPN Transistor will be near the Emitter voltage, so this type can be
identified definitely. The current amplification factor in the common emitter circuit is build by
hF E = (V(CC -U C -U?C 0)?470000 . If the voltage of the Base or better Gate shows, that there is no or
V CC -U B ) (680+22)
little current, part will be a N-Channel E-MOS (Enhancement MOSFET). In this case the threshold
voltage is measured by switching the Gate slowly with the 470k Ohm resistor to VCC and GND, waiting
for a digital input signal change of the Drain side and then read the voltage of the Gate pin. This
measurement is done eleven times with ADC results accumulated as shown in Figure 5.7. The result
is multiplied by four and divided by 9 to get the voltage in mV resolution.

30

Figure 5.7: measuring of threshold voltage of N-Channel-MOSFET

5.1.3

Measurement of Diodes

If current is detected with the pre-tests, the behavior of the part will be checked to be a diode. The
flow voltage with the 680Ohm resistor must be between 0.15V and 4.64V. The flux voltage with the 680Ohm
must be greater than 1.125 times the flux voltage with the 470k Ohm resistor and sixteen times the flux
voltage with the 470k Ohm must be greater than the flux voltage with the 680Ohm resistor. Additionally
the afterward renewed measurement with the 470k Ohm resistor should not have a higher voltage than
the previous measurement with the 680Ohm resistor. I hope, that this behavior identifies always a
diode. The identification of a diode by no current flow in the opposite direction is not possible with
a inverse parallel diode. If only a single diode is detected, the residual current in reverse direction
is measured with the 470k Ohm resistor at 5V. The resolution is about 2nA. If the residual current is
greater as 5.3uA (voltage at the 470k Ohm is more than 2.5V), the measurement is done with the 680Ohm
instead. Then the resolution is only about 1uA. Furthermore the capacity in reverse direction is also
measured for single diodes.

5.1.4

Results of different measurements

The following three tables shows results of different test probes with one ATmega8, a ATmega168
and a ATmega328 processor. The measurement of the inverse capacity value for the double diode
MBR4045PT is only possible with cooling. This will be caused by high residual current of this 40A
diode. Also the capacity value of the inverse base emitter diode of the germanium transistor AC128
can only be measured with cooling.

31

Mega8@8MHz
Diode Type
1N4148

Mega168 @8MHz

Diode, 715mV,
1pF
Diode, 665mV,
1pF
Diode, 619mV,
19pF
Diode, 538mV,
16pF
Diode, 650mV,
13pF
Diode, 1.96V, 5pF
2xDi, 743mV, 2.53V
Diode, 609mV,
5.15nF
Diode, 582mV,
256pF
Diode, 272mV,
0pF

Mega328 @8MHz

Diode, 718mV,
0pF, 2nA
Diode, 672mV,
1pF, 4nA
Diode, 621V,
17pF, 12nA
Diode, 541mV,
14pF, 63nA
Diode, 655mV,
10pF, 6nA
Diode, 1.95V, 4pF
2xDi, 737mV, 2.52V
Diode, 611mV,
5.20nF, 0.39uA
Diode, 586mV,
255pF, 21nA
Diode, 277mV,
0pF, 2.2uA

Diode, 715mV,
1pF, 4nA
1N4150
Diode, 666V,
2pF, 6nA
BA157
Diode, 615mV,
18pF, 12nA
BY398
Diode, 537mV,
15pF, 63nA
1N4007
Diode, 650mV,
13pF, 6nA
LED green
Diode, 1.95V, 4pF
ZPD2,7
2xDi, 733mV, 2.51V
BU508A B+E
Diode, 606mV,
5.25nF, 0.4uA
BU508A B+C
Diode, 587mV,
259pF, 19nA
AC128 B+E
Diode, 273mV,
0pF, 2.3uA
AC128 B+E
Diode, 349mV,
cooled
140pF, 0.57uA
MBR20100CT 2xDi, 337mV, 337mV 2xDi, 338mV, 338mV 2xDi, 336mV, 335mV
MBR20100CT
Diode, 337mV,
Diode, 339mV,
Diode, 337mV,
345pF
351pF, 29nA
350pF, 25nA
MBR4045PT
Diode, 243mV,
Diode, 233mV,
Diode, 235mV,
cooled
1.80nF
1.94nF, 1.7uA
1.95nF, 1.8uA
SF38G
Diode, 519mV,
Diode, 521mV,
Diode, 516mV,
107pF
105pF, 2nA
106pF, 2nA
Table 5.2: measurement results of diode testing

32

Transistor
Type

Typ

Mega8

Mega328

BU508A
2N3055
BC639
BC640
BC517
BC516
BC546B
BC556B
AC128 (Ge.)
BRY55/200
MAC97A6

NPN
NPN
NPN
PNP
NPN
PNP
NPN
PNP
PNP

B=9, 602mV
B=20, 553mV
B=180, 628mV
B=216, 635mV
B=26.1k, 1.20V
B=77.6k, 1.20V
B=381, 659mV
B=285, 689mV
B=63, 190mV
Thyristor
Triac

B=9, 597mV
B=21, 550mV
B=172, 629mV
B=176, 609mV
B=24.8k, 1.22V
B=76.1k, 1.20V
B=427, 687mV
B=254, 668mV
B=59, 191mV
Thyristor
Triac

Mega328
commoncollector
B=9, 594mV
B=21, 546mV
B=172, 622mV
B=179, 640mV
B=26.3k, 1.20V
B=81.6k, 1.17V
B=428, 678mV
B=251, 684mV
B=59, 184mV
Thyristor
Triac

Mega328
commonemitter
B=5, 470mV
B=6, 427mV
B=171, 580mV
B=184, 594mV
B=765, 1.21V
B=754, 1.21V
B=380, 654mV
B=262, 653mV
B=48, 114mV
Thyristor
Triac

Table 5.3: measurement results of bipolar transistor testing
Some results are different to the earlier results of the software of Markus Frejek. For example
a darlington transistor BC517 has been measured by the older software with a hFE of 797 instead
of 76100 and a base emitter voltage of 1438mV. This will be caused by the additional measurement
of current amplification with common collector circuit. Also the new version shows the same low
hFE result with the common emitter circiut as you can see in the last column of table 5.3. The base
emitter voltage is measured by the older Version as separate diode test with 1438mV. Now the base
emitter voltage is measured with the state of current amplification testing (1.20V).
The following table 5.4 shows the measurement results for germanium transistors, which are extra
problematic to measure because of the temperatur dependent and high residual collector current. The
results of the original version of Markus F. and the results of the actual 1.08k version are compared
together. The 1.09k version for a ATmega328 measures the current amplification factor with common
collector and common emitter circuit with respect to the collector residual current, the higher result
will be shown. The collector residual current is not respected by earlier versions.
Transistor
Type

Mega8@1MHz
Mega168 @8MHz
Mega328 @8MHz
Original Version
Version 1.09k
Version 1.09k
Markus F.
AC128
PNP, B=52, 279mV PNP, B=59, 190mV PNP, B=59, 191mV
AC116-65 PNP, B=505, 378mV PNP, B=71, 150mV PNP, B=72, 149mV
AC116-145 PNP, B=485, 294mV PNP, B=145, 161mV PNP, B=146, 163mV
AC176-65
NPN, B=98, 235mV
NPN, B=55, 95mV
NPN, B=56, 96mV
GC122
PNP, B=84, 368mV PNP, B=55, 194mV PNP, B=56, 117mV
GC301
PNP, B=48, 289mV PNP, B=38, 191mV PNP, B=39, 188mV
Table 5.4: Measurement results of bipolar junction germanium transistors

33

Mega8@8MHz
FET Type
ZVNL120A

N-E-MOS,D, 1.6V
147pF
IRF530N
N-E-MOS,D, 3.6V
1.55nF
BS170
N-E-MOS,D, 2.6V
78pF
IRL3803
N-E-MOS,D, 2.3V
9.81nF
IRFU120N
N-E-MOS,D, 4.2V
909pF
BUZ71A
N-E-MOS,D, 3.2V
714pF
ZVP2106A
P-E-MOS,D, 3.2V
122pF
IRF5305
P-E-MOS,D, 3.6V
2.22nF
BS250
P-E-MOS,D, 2.6V
53pF
IRFU9024
P-E-MOS,D, 3.5V
937pF
J310
N-JFET
Idss=24-60mA I=3.1mA Vgs=2.2V
2N5459
N-JFET
Idss=4-16mA
I=2.1mA Vgs=1.5V
BF256C
N-JFET
Idss=11-18mA I=3.4mA Vgs=2.4V
BF245A
N-JFET
Idss=2-6mA
I=1.1mA Vgs=.75V
BF245B
N-JFET
Idss=6-15mA
I=2.5mA Vgs=1.7V
BF245C
N-JFET
Idss=12-25mA I=3.9mA Vgs=2.7V
J175
P-JFET
Idss=7-60mA
I=3.2mA Vgs=2.2V
2N5460
P-JFET
Idss=1-5mA
I=0.78mA Vgs=0.54V

Mega168 @8MHz

Mega328 @8MHz

N-E-MOS,D, 1.5V
139pF
N-E-MOS,D, 3.6V
1.54nF
N-E-MOS,D, 2.6V
68pF
N-E-MOS,D, 2.3V
9.71nF
N-E-MOS,D, 4.2V
913pF
N-E-MOS,D, 3.2V
708pF
P-E-MOS,D, 3.2V
115pF
P-E-MOS,D, 3.6V
2.22nF
P-E-MOS,D, 2.6V
43pF
P-E-MOS,D, 3.6V
945pF
N-JFET
I=3.1mA Vgs=2.2V
N-JFET
I=2.1mA Vgs=1.5V
N-JFET
I=3.4mA Vgs=2.4V
N-JFET
I=1.1mA Vgs=0.75V
N-JFET
I=2.5mA Vgs=1.7V
N-JFET
I=3.9mA Vgs=2.7V
P-JFET
I=3.2mA Vgs=2.2V
P-JFET
I=0.77mA Vgs=0.54V

N-E-MOS,D, 1.5V
140pF
N-E-MOS,D, 3.6V
1.56nF
N-E-MOS,D, 2.6V
70pF
N-E-MOS,D, 2.3V
9.80nF
N-E-MOS,D, 4.2V
920pF
N-E-MOS,D, 3.2V
714pF
P-E-MOS,D, 3.2V
117pF
P-E-MOS,D, 3.6V
2.24nF
P-E-MOS,D, 2.6V
44pF
P-E-MOS,D, 3.5V
952pF
N-JFET
I=3.1mA Vgs=2.2V
N-JFET
I=2.1mA Vgs=1.5V
N-JFET
I=3.4mA Vgs=2.4V
N-JFET
I=1.1mA Vgs=0.75V
N-JFET
I=2.5mA Vgs=1.7V
N-JFET
I=3.9mA Vgs=2.7V
P-JFET
I=3.2mA Vgs=2.2V
P-JFET
I=0.78mA Vgs=0.54V

Table 5.5: measurement results of MOS transistor testing

34

5.2

Resistor Measurement

Each resistor is measured with four different types of measurement in one current direction. The
same resistor ist also tested with the same four measurement types in the other current direction.
The measurement in the opposite direction is only used to identify a resistor. If mismatch between
both measurements is too big, it's not a resistor.

5.2.1

Resistor Measurement with 680 Ohm Resistors

The measurement of a unknown resistor Rx is done in two ways with the build in precision 680Ohm
resistors. The diagram of this measurements for test pin 1 (TP1) and test pin 3 (TP3) are simplified
shown in figure 5.8 and figure 5.9 as a example of the six choises of probe combinations.

GND

22

19

22

19

22

19

22

19

22

19

ADCMUX

TP1

Rx

PB4

TP3

PB5

R6

PC2

680

R1

R2

PB1
470k

PB0
680

PC0

470k

ADCMUX

R5

22

19

VCC

Figure 5.8: Measurement type 1 with 680Ohm

22

19

22

19

22

19

22

19

22

19

GND

ADCMUX

TP1

Rx

TP3

PB4

PB5

R6

PC2

470k

R2

PB1
470k

R1

PB0

680

PC0

R5

ADCMUX

680

22

19

VCC

Figure 5.9: Measurement type 2 with 680Ohm
On the left side test pin 1 is shown and on the right side you can see test pin 3. In both diagrams
you see, that the terminal 3 (right side) is connected to VCC, the left side is connected to GND. The
direction of current flow through the resistor Rx is allways the same. The values of ports switched
to output are shown with red color, the values of ports used as Input are shown in blue color, the
inactive ports are black. In both shown measurement types the current should have the same value,
because the sum of resistor values between VCC and GND is identical (if the build in resistors
are identical). Usually the measured voltage is not the same, because the sequence of resistors has
changed.

35

The V symbol within the circle marks the ports used for voltage measurement. In both configurations the value of resistor Rx can be computed with the known resistor values and the measured
voltages, if the relation of resistor Rx and the 680Ohm is not too high. The theoretical voltage gradient
is shown in figure 5.10, where resistor values are shown in logarithmic scale.
5000

voltage / mV

4000

3000

PC2, type 1
PC0, type 2

2000

1000

0
100m

1

10
100
1k
resistor Rx / Ohm

10k

100k

Figure 5.10: Voltages of type 1 and type 2 measurements with 680Ohm
The graph of measurement type 1 is shown in figure 5.11a with zoomed scale for the lower resistor
range. You can see, that you need a better ADC resolution than the standard 4.9mV resolution at
the 5V ADC reference, to get the right resistor value from measured voltage below 2Ohm. There are only
three ADC steps from 0Ohm to 2Ohm. The range switching with the AUTOSCALE ADC option can help
in this case. The same zoomed range of measurement type 2 shows the figure 5.11b. Unfortunately
we can not use the higher ADC resolution for measurement type 2 in this range, because the voltage
is too high and our ATmega have no differential ADC input. Measurements with the 680Ohm resistors
are taken for building the result of measurements up to 20k Ohm (Voltage of measurement type 2 will
be below 169mV).
For higher resistor values the measurements with the 470k Ohm resistors are used. The mean value
of both measurements is taken as displayed resistor value, if all tests attests, that it is no other
type of part. If the AUTOSCALE ADC function is selected and one of the voltages of the both
measurement types is below 0.98V, a weighted average is build with factor four for this value. The
other value is weighted with factor one. This is done to respect the factor four better resolution
of this measurement. Factor four is only taken for ATmega168 and ATmega328 processors, for the
ATmega8 two is taken as weighting factor if voltage is below 0.98V, because the reference voltage
for the ADC is here 2.54V instead of 1.1V . If the ATmega has more than 8KByte flash memory, the
voltage measurement at the resistors will be delayed until no more changes are detected or the time
limit is reached. With this method big capacitors are no more detected as resistors by mistake and
the DC resistance of big inductors will be measured correctly.

36

PC2, type 1

voltage / mV

voltage / mV

200
195
190
185
180
175
170
165
160
155
150
145
140
135
130
0

1

2

3

4
5
6
7
resistor Rx / Ohm

8

9

4850
4845
4840
4835
4830
4825
4820
4815
4810
4805
4800
4795
4790
4785
4780

10

PC0, type 2

0

1

(a) Type 1 measurement

2

3

4
5
6
7
resistor Rx / Ohm

8

9

10

(b) Type 2 measurement

Figure 5.11: Cut-out of theoretical Voltage from 0Ohm to 10Ohm

5.2.2

Resistor Measurement with 470 kOhm resistors

The next figures 5.12 and 5.13 shows the same measurement procedure for the measurement with
the precision 470k Ohm resistors. Because the 470k Ohm is very big in relation to the port resistor values
22Ohm and 19Ohm, the port resistor values are ignored for the computing of the resistor value Rx.
For both measurement types with the 470k Ohm resistors only one Voltage is measured, because the
current is so low, that no voltage difference at the internal port resistors of the ATmega can be
measured (as expected). The theoretical voltage gradient is shown in figure 5.14 where the resistor
values are again shown in logarithmic scale. The theoretical gradient in this diagram ends at 100M Ohm,
but the resulting value of the Tester is limited to 60M Ohm, otherwise the Tester assumes that no resistor
is connected. The weighted average of both measurement types is taken as result with the same rules
described for the measurements with the 680Ohm resistors. For all ATmega processors I had found,
that the measured results with the 470k Ohm resistors are more exactly, if a constant offset of 350Ohm will
be added. This offset can be adjusted with the RH OFFSET define in the config.h file.

22

19

22

19

22

19

22

19

22

19

22

GND

ADCMUX

ADCMUX

TP3

Figure 5.12: Measurement type 3 with 470k Ohm

37

R6

Rx

PB5

470k

TP1

PB4

R5

PC2
680

R2

PB1
470k

PB0

R1

PC0
680

19

VCC

22

19

22

19

22

19

22

19

22

19

22

19

VCC

GND

ADCMUX

Rx

TP3

PB5

R6

TP1

PB4
470k

PC2
680

R2

R1

PB1

470k

PB0
680

PC0

R5

ADCMUX

Figure 5.13: Measurement type 4 with 470k Ohm

5000

voltage / mV

4000

3000
PC2 type 3
PC0, type 4
2000

1000

0
10k

100k

1M
10M
resistor Rx / Ohm

100M

Figure 5.14: Voltages of type 3 and type 4 measurements with 470k Ohm

5.2.3

Results of the resistor measurements

Figure 5.15 shows the relative errors of the resistor measurements with three ATmega8 microcontrollers. Additionally some results with the original software of Markus F. with one ATmega8 are
shown as "Mega8orig" in this figure. More measurements results with ATmega8A and ATmega8L
are shown in figure 5.16a and 5.16b. Figure 5.17 shows the same measurements with a ATmega168
microcontroller. Mega168 are the results without the AUTOSCALE ADC option, Mega168as are
the same measurements with the AUTOSCALE ADC option. With the ATmega168 microcontroller
it seems to be possible, that measurements of resistors in the range from 20Ohm to 20M Ohm can be measured with a tolerance of ?1%. For Measurements below 100Ohm you should keep in mind, that any
measurement probe with wire have a resistance too. It is better to connect the resistor directly to
the terminal pins. If this is not possible, subtract the resistance value of the shortened probe. For
example, if your Resistor have a printed value of 30Ohm, your tester shows a value of 30.6Ohm and the
two probes shortened have a value of 0.5Ohm, then your resistor has been measured with 30.1Ohm. Below
a resistance value of 10Ohm one resolution step results to a error of more than 1%!
38

5

Mega8-1
Mega8-2
Mega8-3
Mega8orig

4

Error / Percent

3
2
1
0
-1
-2
-3
-4
-5
1

10

100

1k
10k 100k 1M
Resistor value / Ohm

10M

100M

Figure 5.15: Relative error for resistor measurements with ATmega8

5
4
3

Mega8L-7
Mega8L-8
Mega8L-9

4
3

2

Error / Percent

Error / Percent

5

Mega8A-4
Mega8A-5
Mega8A-6

1
0
-1
-2

2
1
0
-1
-2

-3

-3

-4

-4

-5

-5
1

10

100

1k
10k 100k 1M
Resistor value / Ohm

10M

100M

(a) with three ATmega8A

1

10

100

1k
10k 100k 1M
Resistor value / Ohm

(b) with three ATmega8L

Figure 5.16: Relative error for resistor measurements

39

10M

100M

5

Mega168
Mega168as

4

Error / Percent

3
2
1
0
-1
-2
-3
-4
-5
1

10

100

1k
10k 100k 1M
Resistor value / Ohm

10M

100M

Figure 5.17: Relative error for resistor measurements with ATmega168
The figure 5.18a shows the measurement errors of three ATmega168 processors before calibration
as points, after the calibration as line. The equivalent measurement errors of three ATmega168A
prozessors are shown in figure 5.18b and the measurement errors of three ATmega168P prozessors
are shown in figure 5.19 . The measurement errors of three ATmega328 prozessors are shown in
figure 5.20a and 5.20b. After the automatic calibration the relative measurement errors of resistors
between 10 Ohm - 20M Ohm usually are in the limit ?1 %. Only one measurement of a 22k Ohm resistor with
the ATmega328P-13 shows a higher error. Before the calibration errors of some processors are found
with ? 3%. This will be caused by the AUTOSCALE ADC switching of the ADC reference. The
direct compare of a capacitor voltage below 1 V, once measured with the VCC reference and another
once measured with the internal reference, can adjust this error. With this measurement condition
the voltage is measured with the same multiplexor channel and the internal bandgap reference is
connected to the AREF pin of the ATmega. Unfortunately the direct measurement of the bandgap
reference with the special multiplexor channel results to this offset, which can be manually adjusted
with the REF R KORR option or automatically with the AUTO CAL option of the selftest. With
the AUTO CAL option the REF R KORR value is a additional offset to the automatic find out
value!

40

5

3
2

m168a-4
m168a-5
m168a-6
m168a-4
m168a-5
m168a-6

4
3
Error / Percent

4

1
0
-1
-2

2
1
0
-1
-2

-3

-3

-4

-4

-5

-5
1

10

100

1k
10k 100k 1M
Resistor value / Ohm

10M

100M

(a) with three ATmega168

1

10

100

1k
10k 100k 1M
Resistor value / Ohm

(b) with three ATmega168A

Figure 5.18: Relativ error for resistor measurements

5

m168p-7
m168p-8
m168p-9
m168p-7
m168p-8
m168p-9

4
3
Error / Percent

Error / Percent

5

m168-1
m168-2
m168-3
m168-1
m168-2
m168-3

2
1
0
-1
-2
-3
-4
-5
1

10

100

1k
10k 100k 1M
Resistor value / Ohm

10M

100M

Figure 5.19: Relativ error for resistor measurements with three ATmega168P

41

10M

100M

5

3
2

m328p-13
m328p-14
m328p-15
m328p-13
m328p-14
m328p-15

4
3
Error / Percent

4

Error / Percent

5

m328-10
m328-11
m328-12
m328-10
m328-11
m328-12

1
0
-1
-2

2
1
0
-1
-2

-3

-3

-4

-4

-5

-5
1

10

100

1k
10k 100k 1M
Resistor value / Ohm

10M

100M

(a) with three ATmega328

1

10

100

1k
10k 100k 1M
Resistor value / Ohm

(b) with three ATmega328P

Figure 5.20: Relativ error for resistor measurements

42

10M

100M

5.3

Measurement of Capacitors

The measurement of capacitor values are done as separate task by measurement of load time after all
other measurements. The original software of Markus F. did this with a program loop, which reads
the corresponding digital input pin until a switch occured and count the loop cycles. This has the
handicap, that the resolution of time measurement is limited by the time consumption of one loop
cycle. This usually was done in all six combinations for all three probe pins. The actual software
uses two different ways to get the load time in only three combinations for the three probe pins. The
positive side is now always the higher probe number. Only if capacity is measured parallel with a
diode, the polarity can be in the other order.

5.3.1

Discharging of Capacitors

You should always discharge the capacitor before connecting it to the tester. The tester additionally
discharge the capacitor before any measurement. If the voltage is below 1300mV, the capacitor is
shortened by the output pins of the connected ADC port (Port C). I believe that this is legal because
every output port has a built in resistance of about 20Ohm. The data sheet Figure 149 (page 258)
[2] shows voltage drop of output pins up to 2V. Of course I can not guaranty, that no damage can
occur. I have tested the function with big capacitors of more than 15mF many times and I have
never noticed any problem. The current should be below the specified limit of 40mA and is reduced
fast by discharging. Off course damage can occur if you do not discharge a (high voltage) capacitor
before connecting it to your tester.

5.3.2

Measurement of big Capacitors

One side of the capacitor is connected to GND. The other side of the capacitor is connected with
the 680Ohm resistor to VCC for a period of 10ms. Afterwards this probe pin is switched to Input (High
Impedance). After this 10 ms current pulse the voltage of the capacitor is measured without any
current. If the voltage has not reached a minimal value of 300mV, the load pulse is repeated up to
499 times. If after 127 pulses a minimum voltage of 75mV is not reached (about 2s), further load
is stopped, because never the 300mV can be reached with the remaining load pulses. Figure 5.21
shows the three phases of measuring the capacity value of a capacitor. The value of the capacity is
then computed with the count of load pulses and the reached load voltage from a table. The table
contains the factors to get the capacity in nF units from load time and the reached voltage with a
spacing of 25mV. Interim value of voltage will be interpolated.

43

22

19

22

19

GND

22

19

22

19

22

19

22

19

VCC

& lt; 1.3V
ADCMUX

Cx

TP3

PB5

R6

R2

470k

R1

TP1

PB4
470k

PC2

PB1

680

PB0
680

PC0

R5

ADCMUX

Quick Discharge of capacitor

GND

22

ADCMUX

PB4

Cx

TP3

R6

TP1

PB5
470k

PC2

680

470k

PB1

R1

680

PB0

R2

PC0

R5

ADCMUX

19

22

19

22

19

22

19

22

19

22

19

VCC

10ms Charge Phase of capacitor

22

19

22

19

22

19

22

19

22

19

22

GND

ADCMUX

ADCMUX

TP3

PB5
470k

Cx

R5

TP1

PB4

R6

PC2

PB1
470k

R1

680

PB0

R2

PC0

680

19

VCC

Voltage Measurement Phase of capacitor

Figure 5.21: discharge a capacitor and load with 10ms load pulses until voltage reach a value of
300mV
As a result of the low load voltage, the measurement is much faster than the initial software
version, because this advantage works also on discharging. So bigger capacitors can be measured.
Furthermore a diode, which is parallel connected to the capacitor dont disturb the measurement in
most cases, because the flux voltage of most diodes is not reached. Figure 5.22a shows the charge and
discharge for a 229uF capacitor. The flat top of diagram from load end to discharge begin is caused
by the measuring and computing time of the ATmega. Figure 5.22b shows the same measurement
for a 5mF capacitor, notice how the time for measurement is grown to about 1.5 seconds inclusive
the discharge. The last example shows the capacity measuring of a 15mF capacitor in Figure 5.23

44

(a) 229uF Capacitor

(b) 5mF Capacitor

Figure 5.22: Charge and discharge of big Capacitors for measuring

Figure 5.23: Charge and discharge of a 15mF Capacitor for measuring
After this capacity measurement the self-discharge of the capacitor will be checked by waiting a
proportional period the loading has taken and reading the load voltage again. The measured capacity
value is corrected due to this voltage drop. A test with a parallel connection of a 68uF capacitor
and a 2.2k Ohm resistor shows the effectivity of this method. The measured capacity value without
the resistor is 66.5uF , with the parallel 2.2k Ohm resistor results to a capacity value of 66.3uF . For
comparison here are the results measured with a Peaktech 3315 multimeter: Without the resistor a
capacity value of 68.2uF is measured, with the parallel 2.2k Ohm resistor a value of 192uF is measured
with the multimeter.

5.3.3

Measurement of small Capacitors

If the first 10 ms load pulse has overloaded the capacitor, another technique of measurement is used.
The ATmega processor has a build in 16-Bit counter, which can operate at the full clock rate (1MHz
45

or 8MHz). This counter has also the feature to save his counter value by a external event. This event
can be built by the output of the comparator. The comparator can operate with any ADC input pin
and the band gap reference. Figure 5.24 shows a simplified diagram of the measurement situation.
So I discharge the capacitor, prepare the comparator to the proper pin input, start the counter at 0
and start immediately the charging of the capacitor with one side connected to GND and the other
side connected with the 470k Ohm resistor to VCC. Now I check within a program loop, if the counter
flags signals a overflow event or a input capture (external) event. I count the overflow events until I
detect the input capture event. In this case I stop the counter and check if I must count a additional
overflow, because the counter can't be stopped by the input capture event.
The input capture counter and the overflow counter built together the total time, from which
we can get the capacity with a factor. The actual software can use a table with the theoretical
dependency of the load time in respect to the comparator voltage. The table is spaced in 50mV
steps and will be interpolated according to the actual reference voltage. This table will only be
acticated with the Makefile option WITH AUTO REF. From the build capacity value I subtract a
predefined experimental find out constant or a value found by the last selftest with AUTO CAL
option to eliminate the zero offset. The zero offset may vary with printed board type, the used
test equipment or processor. The selftest with AUTO CAL option will find out your zero offset
automatically.
I noticed that the reference voltage is permanently somewhat to low, so that you can choose an
offset with the Makefile option REF C KORR. After calibration with the AUTO CAL option , the
REF C KORR will only be a offset to the measured difference voltage between loaded capacitor and
internal reference. The measured reference voltage will then be corrected (added) by your value (mV
units). If option WITH AUTO REF is not used, the reference voltages of ATmega8, ATmega168
and ATmega328 are applied as noted in the data sheets [2] [3]. A sample measurement of this type
is shown in figure 5.25. The measurement time for the 22uF capacitor is above 2.6s because the
470k Ohm is used for charging. But discharging is in this case much faster than charging.

Bandgap
Reference

Clock

Control
Logic

ACBG

AIN0

Clear
Direction

TOV1
Timer Counter
TCNT1
DATA BUS

Count

Noise
Canceler

AIN1
From ADC Multiplexor

ACME

Edge
Detector

ICR1

VCC

TP3

Cx

ICFn

470k

R6
TP1

Figure 5.24: measurement little capacity values with comparator

46

Figure 5.25: Charge and discharge of a 22uF Capacitor for measuring
In principle this technique of measurement can also be done with the 680Ohm resistor, but because
the ADC can't be used if the comparator is working, I have no chance to monitor the load voltage
until the comparator is stopped. If a undetected diode is parallel connected with the capacitor, the
load current of the capacitor can be absorbed by the diode (threshold voltage) and the band-gap
voltage will never be reached. The method taken in actual software for big capacitors in section 5.3.2
avoids this conceptual bug.

5.3.4

Measurement of the Equivalent Series Resistance ESR, first way

The series resistance ESR [8] is a good indicator for the aging of electrolytical capacitors for example.
The figure 5.26 shows a equivalent circuit of a capacitor. The resistor Rp represents the leakage
resistance of the capacitor, ESL the equivalent series inductivity and the resistance ESR represents
the equivalent series resistance. If the measured capacitor has a capacity of more than 0.45uF , the
tester will try to measure the series resistance too. For a capacity of more than 3.6uF the normal
clock rate of 125kHz for the Analog-Digital converter is used. For lower capacities the higher clock
rate of 500kHz is used to accelerate the measurement. The accuracy of the ADC results will be more
worth by the higher clock rate, but this could be accepted by the higher ESR values of capacitors
with lower capacity. Otherwise the measurement of ESR with this method is not possible for a
capacity of less than 1.8uF at the normal clock rate of 125kHz .
Rp

C

ESR

ESL

Figure 5.26: Equivalent circuit of a capacitor
Strictly speaking the ESR of a capacitor depends on the operating frequency and temperature.
Usually the value measured with sine wave-form signal of 100kHz is denoted in the data sheets. This
measurement can not be done with the ATmega without external equipment. With the subsequent
written method the measurement frequency with the standard ADC clock rate will be below 640 Hz
with nearly rectangular signal. With 500kHz ADC clock rate the measurement frequency will be
47

2400 Hz. To get the value of the equivalent series resistance, the voltage of both connections will
be measured during loading in one direction with the ADC internal reference voltage (1.1 V). After
the measurement the load current will be switched off and the voltage of the capacitor is measured
again without the current. If this voltage is below 3 mV, the sequence of measurement is repeated.
The figure 5.27 shows the corresponding circuits.

GND

22

ADCMUX

PB4

Cx ESR TP3

R6

TP1

PB5
470k

PC2

680

470k

PB1

R1

680

PB0

R2

PC0

R5

ADCMUX

19

22

19

22

19

22

19

22

19

22

19

VCC

Voltage measurement with charge current

22

19

22

19

22

19

22

19

22

19

22

GND

ADCMUX

Cx ESR TP3

PB5

R6

TP1

PB4
470k

R2

470k

R1

680

PC2

PB1

PB0

R5

ADCMUX

PC0

680

19

VCC

Voltage measurement without current

Figure 5.27: Circuit of the ESR measurements of a capacitor
The difference of capacitor voltages with and without current is proportional to the internal
resistance of the capacitor. The expected voltage of this difference is so low, that one measurement
can not result to a feasible result. Therefore after this the current will be switched to the opposite
direction and the same measurement will be repeated. The whole measurement sequence will be
done 128 times and the results of the voltage measurements will be added. So we have three sums of
voltages, the voltage U lp at the low side of the capacitor with current, the voltage U hp at the high
side of the capacitor with current and the voltage U c of the high side of the capacitor without current.
The sum of voltages at the low side of the capacitor represents the potential drop with the mean
load current at the port output resistance Rport. The voltage difference of the high side and the low
side of the capacitor represents the voltage of the capacitor with load current U dif f = U hp - U lp.
The difference U esr = U dif f - U c should represent the voltage drop at the internal resistance of the
capacitor with mean load current. We will get the resistance value with the relation of this voltage
U esr to the voltage U lp, scaled with the known resistance value of the port output Rport. The
10?
scale factor is selected to get a resistance resolution of 0.01Ohm: Resr = U esr?U lpRport The figure 5.28
shows a part of the voltage curve of a 4.2uF capacitor during the ESR measurement. To explain
the influence of the ESR, a series 6.8Ohm resistor is added to the capacitor. The little voltage break
after loading the capacitor is interpreted by software to get the ESR. The greater voltage drop of
48

the measurement to GND potential is caused by the port output resistance of about 20Ohm. For this
measurement a total ESR of 7.5Ohm is reported by the tester, without the series 6.8Ohm resistor a ESR
of 0.56Ohm is found. The figure 5.29 shows the same measurement with higher measurement frequency
of a 2.2uF electrolytical capacitor with a ESR of 6.5Ohm.

(a) measured one pin to GND

(b) measured pin to pin

Figure 5.28: Voltage curve of a 4.2uF capacitor during the ESR measurement

(a) measured one pin to GND

(b) measured pin to pin

Figure 5.29: Voltage curve of a 2.2uF capacitor during the ESR measurement
The accuracy of the ESR measurement is not very high by different reasons:
1. The voltage measurement at both pins of the capacitor can not be done at the same time, the
only way is to do it in sequence. In the interim time between both measurements the load
current has changed due to the charge of capacitor. The program tries to compensate this fact
with a capacity dependent correction of the low side voltage.
2. The ADC takes the measurement voltage after 1.5 clock ticks after the start of conversion. The
conversion beginns with the rising edge of the ADC-clock, if the start bit is set. If the charge
current will be switched off to early, the ADC takes the wrong voltage for the measurement
with current. If the charge current will be switched off to late, the capacitor will take more
49

electric charge, than that of the corresponding measurement with load current. This will cause
a too high voltage of the measurement without current. But it is difficult to switch off the
current at the right time by software.
3. The port output resistance is used as a reference value by this measurement method, but this
resistance value is not exacly known too.
4. The resolution of the ADC is not sufficient to get a resolution of resistance of 0.01Ohm. To get the
best avaiable resolution of ADC, the internal reference (1.1 V) is used for all measurements.
The resolution deficit will be attenuated by accumulating a big number of single measurements
too.
5. The switching of ports can not be exactly synchronized to the ADC clock with polling of
conversion done.
Anyway the results seems to be practical, as shown with the following figure 5.30. The ESR
values of the same part measured with the Transistortester vary more than the values measured with
the LCR meter. The ESR values from the LCR meter are measured with a frequency of 1 kHz or
are interpolated for little capacities to 2.4 kHz. You must respect the quality of all connection parts.
The used cable connections can cause a higher measured resistance value. The plug connectors can
also result a higher resistance value. The LCR meter has the advantage of the used Kelvin terminals.
Only one capacitor with a capacity below 1uF was a 500nF ceramic type, all others were plastic film
capacitors. The only electrolytical capacitor of the test series below 9uF was a 2.2uF capacitor.
7

328p
328
168p
168a
168
LCR

6

ESR / Ohm

5
4
3
2
1
0
100n

1u

10u
Capacity value / F

100u

1m

Figure 5.30: ESR measurement results of 15 different ATmega

5.3.5

Measurement of the Equivalent Series Resistance ESR, second way

From beginning with software version 1.07k the ESR measurement way is changed to a new measurement method. The different measurement steps are shown in figure 5.32. The difference to
the previous way is that the period of current flow through the capacitor is essential shorter. The
capacitor is preloaded with a half pulse to the negative direction and is than loaded in a cyclic way
in both direction. The timing of the load pulse is so selected, that the middle of the load puls at
50

ADC busy

sample 4 and 8 is pointed to the sample and hold time of the ADC (2.5 clock tics after start of
ADC). A complete measurement cycle is shown in figure 5.31. The sums of 255 measurement cycle
results is used for getting a result with adequate resolution. A continuing charge of the capacitor
in any direction is avoided by the same charge and discharge pulse length and the same circuit. By
measuring the reference voltage the capacitoe remains currentless. By that this measurement are
not time critital. It is only assumed, that the capacitor hold the voltage until the next charge or
discharge pulse begins.

Sample1

Sample2

Sample3

Sample4

Sample5

Sample6

Sample7

Sample8

Current

t

t

Figure 5.31: Timing of a measurement cycle for the new ESR-measurement way

51

22

19

22

19

22

19

22

19

22

19

GND

ADCMUX
PC2

TP1

PB4

Cx ESR TP3

PB5

R6

R2

R1

470k

PB1

680

PB0
680

PC0

470k

ADCMUX

R5

22

19

VCC

Forward reference measurement

GND

22

ADCMUX

PB4

Cx ESR TP3

R6

TP1

PB5
470k

PC2

680

470k

PB1

R1

680

PB0

R2

PC0

R5

ADCMUX

19

22

19

22

19

22

19

22

19

22

19

VCC

Forward voltage measurement with probe current

22

19

19

22

ADCMUX

R6

Cx ESR TP3

PB5
470k

R2

R1

TP1

PB4
680

PC2

PB1
470k

PB0
680

PC0

R5

ADCMUX

22

GND

19

22

19

22

19

22

19

VCC

Reverse reference measurement

GND

22

19

22

19
ADCMUX

Reverse voltage measurement with probe current

Figure 5.32: More simple ESR measurement of a capacitor

52

PB5
470k

Cx ESR TP3

680

R2

TP1

PB4

R6

PC2

PB1
470k

R1

PB0
680

PC0

R5

ADCMUX

22

19

22

19

22

19

22

19

VCC

Due to the shorter load puls not only the ESR of capacitors with lower capacity can be measured,
but this way of measurement can also be used for the measurement of resistors with little resistance,
if they don't have a detectable inductance. By doing that, a resolution of 0.01Ohm for this resistors
can be achieved. Also the zero resistance can be detected by the calibration part of the selftest
for all three test pin combination. You should keep in mind, that stable plug sockets or clamping
connectors are essential for stable results. The measurement periode is about 900us, which results
to a frequency of about 1.1kHz . Because the load pulse is very short, the measurement result is
comparable to measurements with 10kHz . A measurement example with a 10uF foil capacitor, once
measured alone and once measures with a 2.7Ohm series resistor is shown in figure 5.33. You can see
the effect of the additional resistance by comparing both diagrams. You can see also, why the ADC
measurement (SH) should point to the middle of the load pulse. With big capacity values the load
current is nearly stable during the total pulse length, so you will get the middle voltage at the middle
time of the load pulse. With lower capacity values you will get a significant difference, which can be
compensated by the known capacity value.

(a) without series resistance

(b) with 2.7Ohm series resistance

Figure 5.33: Voltage curve of a 10uF capacitor during new ESR measurement
The measurement results of the new ESR measurement method is shown in figure 5.34. The
ESR values are different from the results shown for the previous mesurement procedure in figure 5.30
because the ESR is frequency dependence of the ESR. The reference values are determined with a
LCR meter at a measurement frequency of 10kHz .

53

6

328p
328
168p
168a
168
LCR

ESR / Ohm

5
4
3
2
1
0
100n

1u

10u
Capacity value / F

100u

1m

Figure 5.34: ESR results with 15 different ATmega, method 2
A measurement series with different sized electrolytic capacitors are shown in figure 5.35. The
results of a PeakTech 3315 LCR meter of measurements with different frequencies and the results
of the TransistorTester are shown together. The resistance is illustrated with logarithmic scale in
this diagram. In all cases the results of the TransistorTester is near by the results of the 10kHz
measurements of the LCR meter. Only the 500uF/3V capacitor is a older exemplar, all others
capacitors are as good as new.
100

LCR-100Hz
LCR-1kHz
LCR-10kHz
LCR-100kHz
TTester

ESR / Ohm

10
1
0.1

0.47u/100V
1u/100V
1u/50V
2.2u/100V
2.2u/50V
3.3u/100V
4.7u/63V
4.7u/50V
10u/50V
22u/10V
22u/63V
33u/63V
47u/63V
100u/63V
220u/63V
470u/35V
500u/3V

0.01

Figure 5.35: Results of the ESR measurements of different electrolytic capacitors
Because the new measurement method can be taken for measuring of resistors with low values,
the measurement errors of some resistors below 10Ohm with three example of each ATmega type will
be shown in figure 5.36.
54

0.2

m168
m168a
m168p
m328
m328p

0.15
difference / Ohm

0.1
0.05
0
-0.05
-0.1
-0.15
-0.2
0

2

4

6
8
10
Resistor value / Ohm

12

14

Figure 5.36: Measurement errors of resistors with the ESR method

5.3.6

Voltage loss after a load pulse, Vloss

With the measurement of capacitors with big capacity values the voltage loss after the loading is
analysed. The reached load voltage is lost with electrolytic capacitors after a short periode. This
voltage loss can be caused by a parallel connected resistor. But I assume, that this voltage loss
of electrolytic capacitors is caused by a internal load dispersion directly after the load pulse. By
loading the capacitors with the 470k Ohm resistor, as it is done for little capacity values, this dispersion
is already done after switching off the current. No voltage loss is detectable for this case. But if you
load the same capacitor with a short current pulse, you can also detect the voltage loss for capacitors
with lower capacity. The same effect with lower loss can also be noticed for ceramic type capacitors.
I have noticed, that capacitors with more than some % voltage loss are suspect. Especially noticable
with respect to the voltage loss are older paper type capacitors, which are for other measurement a
problem too. Some measurement examples will be shown in the following table.

55

capacitor
type
paper
paper
unknown
foil
paper
foil
paper
ceramic
foil

Nenncapacity
4700pF

PeakTech
Voltcraft PeakTech TransistorLCR 2170
M2650-B
3315
Tester
6.75-10.36nF 8.00nF
25.40nF
10.71nF
Q=2.5-32
Vloss=11%
6800pF 9.40-11.40nF 10.41nF
23.30nF
11.65nF
Q=5-25
Vloss=5.0%
4700pF 5.85-6.33nF
6.12nF
6.90nF
6225pF
Q=16-87
Vloss=1.7%
7870pF 7.86-7.87nF
7.95nF
7.95nF
7872pF
Q= ?1540
Vloss=0%
22000pF 37.4-57.5nF
52.8nF
112nF
118.5nF
Q=2.5-32
Vloss=12%
22600pF 22.4-22.5nF 22.57nF
22.69nF
22.54nF
Q= ?1540
Vloss=0%
100nF
144-256nF
177nF
318nF
529.7nF
Q=2.6-28
Vloss=12%
100nF
97.7-102nF
103.7nF
103.3nF
103.1nF
Q=90-134
Vloss=0.1%
100nF
98.0-101nF
101.4nF
102.2nF
101.6nF
Q=58-700
Vloss=0%

In this table you will find, that the capacity of all foil type capacitors can be measured by all
intruments with good precision. The capacity values and the quality factor Q of the PeakTech LCR
meter are minimum and maximum values of the measurements in the frequency range 100Hz to
100kHz . At all examples in the table the voltage loss Vloss of the TransistorTester is big, if the
capacitors have a low quality factor. Only in this case the differences of the capacity measurement
results are also big. The TransistorTester can only determine the voltage loss, if the measured
capacity is more than 5000pF .

5.3.7

Results of Capacitor measurement

The results of my capacity measurements are shown in figure 5.37 for three ATmega8 processors.
Additionally some values of original software are shown with a correction factor of 0.88 (-12%). Other
measurement results of different ATmega8 versions are shown in figure 5.38a and 5.38b. The results
of the measurement of the same capacitors for a ATmega168 is shown in figure 5.39. The base for
the error computing are the measurement results of a PeakTech 2170 RCL-meter, not the printed
value of the parts. A part of the relative high measurement difference is caused by the too high
measurement frequency of the RCL-meter for big electrolytical capacitors. On the other side the bad
quality factor of the electrolytical capacitors may cause another percentage.

56

10

Error / Percent

8

Mega8-1
Mega8-2
Mega8-3
orig

6
4
2
0
-2
10p 100p 1n

10n 100n 1u 10u 100u 1m 10m 100m
Capacity value / F

Figure 5.37: Error in % for capacitor measurements with ATmega8

Error / Percent

8

10

Mega8A-4
Mega8A-5
Mega8A-6

8
Error / Percent

10

6
4
2
0

Mega8L-7
Mega8L-8
Mega8L-9

6
4
2
0

-2
10p 100p 1n

10n 100n 1u 10u 100u 1m 10m 100m
Capacity value / F

(a) with three ATmega8A

-2
10p 100p 1n

10n 100n 1u 10u 100u 1m 10m 100m
Capacity value / F

(b) with three ATmega8L

Figure 5.38: Relative error of capacitor measurement

57

10

Mega168
Mega168as8

Error / Percent

8
6
4
2
0
-2
10p 100p 1n

10n 100n 1u 10u 100u 1m 10m 100m
Capacity value / F

Figure 5.39: Error in % for capacitor measurements with ATmega168
Figure 5.40 illustrates, how difficult is it to choose the right base for the capacity measurement.
All measurement results are compared with the best estimated value of the capacitors. The gradient
,,Multimeter" shows the differences of the Peaktech 3315 Multimeter results. The next gradient
,,LCR" shows the differences of the Peaktech 2170 LCR-Meter results, which is taken from best
frequency approach. To compare this results to the results of a ATmega168 equipped TransistorTester the gradient ,,ATmega168as" is also shown. I beleave, that this errors are not real measurement
errors of the particular equipment, because my best estimated value are also not the real capacity
value of the capacitors.
7
6
5

Multimeter
LCR
Mega168as

Error / Percent

4
3
2
1
0
-1
-2
-3
-4
10p 100p 1n

10n 100n 1u 10u 100u 1m 10m 100m
Capacity value / F

Figure 5.40: Comparison of capacity measurement results of Multimeter, LCR-meter and ATmega168
The differences of measurements of three different ATmega168 processors are shown in figure 5.41a
58

. In this case the results of the LCR meter is taken as base of comparison. The same results of
three different ATmega168A processors are shown in figure 5.41b and three different ATmega168PA
processors are shown in figure 5.42. The results of three ATmega328 are additianally shown in
figure 5.43a and the results from three ATmega328P are shown in figure 5.43b. At this only the zero
value of the capacity measurement of 39pF is respected, all other facility to correct the results are
not used. This zero value includes the 2-3pF, which are caused by the 12 cm long cable with the
clips. The board layout can cause a different zero value, I have fixed this zero value with the board
"DG2BRS V 5.2.1".
25

6

168-1
168-2
168-3

20

5

168A-4
168A-5
168A-6

Error / Percent

10
5

3
2
1
0

0

-1

-5
10p 100p

1n

10n 100n 1u 10u 100u
Capacity value / F

1m

-2
10p

10m

(a) three ATmega168

100p

1n

10n 100n 1u
10u
Capacity value / F

100u

(b) three ATmega168A

Figure 5.41: capacity measurement error, not calibrated

12
10
Error / Percent

Error / Percent

4
15

168PA-7
168PA-8
168PA-9

8
6
4
2
0
-2
10p 100p

1n

10n 100n 1u 10u 100u
Capacity value / F

1m

10m

Figure 5.42: capacity measurement error of three ATmega168PA, not calibrated

59

1m

10m

12

10

328-10
328-11
168-12

10

8
6
328P-13
328P-14
328P-15

4
Error / Percent

Error / Percent

8
6
4
2

2
0
-2
-4
-6

0

-8
-2
-4
10p 100p

-10
1n

10n 100n 1u 10u 100u
Capacity value / F

1m

-12
10p 100p

10m

(a) three ATmega328

1n

10n 100n 1u 10u 100u
Capacity value / F

1m

10m

(b) three ATmega328P

Figure 5.43: capacity measurement error, not calibrated
To get the best accuracy you must adapt the software to the individual characteristic of your
ATmega exemplar. For this you can set a correction voltage REF C KORR for the comparator,
which will be used for measurement of little capacity values. A correction of 1 mV will reduce the
measurement results to 0.11 % . For big capacity values you can specify with the per mill value
C H KORR, how much your capacity values are measured too big. Because the capacitors with big
values are most electrolytic capacitors with worse quality factor, the measurement of the capacity
value is difficult. So it is also extra difficult to get the difference to the real value of a capacitor.
Especially with the ATmega168 processors I have noticed a anomaly of measurement results of
little capacity values, which depend on the slew rate of the voltage during loading of the capacitor.
Figure 5.44 shows the error of the capacity measurement when only the zero value is respected (1683-A), with correction factor for little capacitors REF C KORR=66 as well as the correction factor for
big capacitors C H KORR=5 (168-3-B), plus additional as gradient 168-3-C with a model of the slew
rate dependency of little capacitor measurements (COMP SLEW1=4000 und COMP SLEW2=220).
Also the self-discharge of big capacitors is respected with gradient 168-3-C. The component with
COM P
the slew rate dependent value is computed with cval+COM SLEW 1 2 - COM P SLEW 1 , where cval is the
P SLEW
COM P SLEW 2
measured capacity value with pF units.

60

25

168-3-A
168-3-B
168-3-C

Error / Percent

20
15
10
5
0
-5
10p 100p

1n

10n 100n 1u 10u 100u
Capacity value / F

1m

10m

Figure 5.44: Improvement of the capacitor measurement of one ATmega168

5.3.8

Automatic calibration of the capacitor measurement

The automatic calibration is build in two parts. The first part find out the zero offset of the capacity
measurement. For that the mean value of the capacity measured without connected capacitor is
build. A mean value for all 6 measurement combinations is build with 8 repetitions. After successfull
determination the zero offsets are written to the EEprom and will be used for further measurements.
More difficult was the clearance of the variance of the different ATmega processors for little capacitors
( & lt; 40uF ), which is shown in Figure 5.41a, 5.41b and 5.42. As a significant reason for this is found
the different characteristic (Offset voltage) of the analog comparator.
The date of measurement of nine different processors is shown in figure 5.45 . The "diff2ref" points
show the difference of the voltage of a loaded capacitor of 660nF to the individual internal reference
voltages (band gap). Ideally this difference Voltage should be zero, if the analog comparator has
stopped the loading by the signal to the processor. The short handling time of the processor should
not result to a measurably rising of the capacitor voltage of this relative big capacitor. The "CapErr"
points show the estimated measurement errors of each processor out of figure 5.41a, 5.41b and 5.42
with per mill units. It is noticeable, how the "CapErr" points will follow the "diff2ref" points.
Therefore the "diff" points show the difference between the particular "CapErr" and "diff2ref"
points. With a mean value of the "diff" points we can get a good estimation for the correction
of the capacitor measurements together with the difference voltage of the loaded capacitor and the
internal reference.
For the second part of adjustment you must connect a capacitor to pin 1 and pin 3. This capacitor
should have a good quality factor and should have a capacity between 100nF and 20uF . It should
be a film capacitor, as far as possible not a ceramic capacitor und in no case a electrolytic capacitor.
You don't need to know the exact value of this capacitor.

61

70
60

Difference to reference / mV

diff2ref
CapErr
diff

Error / per mill

50
40
30
20
10
0
-10
-20
0

2

4
6
Number of ATmega168

8

10

Figure 5.45: Date of nine ATmega168 processors
The figures 5.46a, 5.46b, 5.47, 5.48a and 5.48b shows the measurement results of the different
processors with a standard software after the auto calibration. The flash of the processors was loaded
with the same software, only the Makefile option "PARTNO = " must be adapted to the different
processor type ("m168", "m168p", "m328" or "m328p") for the avrdude program. After loading the
data the selftest was started for each ATmega and a capacitor with 330nF was connected during
test No. 10 to pin 1 and pin 3.
7
6
5

6

168-1
168-2
168-3

5
4
Error / Percent

Error / Percent

4
3
2
1
0

168A-4
168A-5
168A-6

3
2
1
0

-1

-1

-2

-2

-3

-3

-4
10p

100p

1n

10n 100n 1u
10u
Capacity value / F

100u

1m

-4
10p

10m

(a) three ATmega168

100p

1n

10n 100n 1u
10u
Capacity value / F

(b) three ATmega168A

Figure 5.46: capacity measurement error, calibrated

62

100u

1m

10m

8

168PA-7
168PA-8
168PA-9

Error / Percent

6
4
2
0
-2
-4
10p

100p

1n

10n 100n 1u
10u
Capacity value / F

100u

1m

10m

Figure 5.47: capacity measurement error of three ATmega168PA, calibrated

10

8

6

Error / Percent

Error / Percent

8

10

328-10
328-11
328-12

4
2
0
-2
-4
10p 100p

328P-13
328P-14
328P-15

6
4
2
0
-2

1n

10n 100n 1u 10u 100u
Capacity value / F

1m

-4
10p 100p

10m

(a) three ATmega328

1n

10n 100n 1u 10u 100u
Capacity value / F

1m

10m

(b) three ATmega328P

Figure 5.48: capacity measurement error, calibrated
At last I will make more clear the effect of the AUTO CAL option in the selftest program. The
following figure 5.49 shows the results from the three ATmega processors with the biggest error of
measurement, one measurement before the calibration and another measurement after the calibration.
The points marked with the ending "unc" shows the the errors without calibration. The lines with
the ending "cal" shows the error results of the same processors with the same software after the
calibration in the selftest section. The reason for the measurement errors for big capacitors & gt; (40uF )
is not yet known. All used capacitors for this series of measurements are film capacitors or ceramic
capacitors (56pF , 100pF and 3.3nF ), no electrolytical capacitors are used.

63

20

168-3unc
168-3cal
168PA-7unc
168PA-7cal
328P-14unc
328P-14cal

Error / Percent

15
10
5
0
-5
-10
-15
10p 100p 1n 10n 100n 1u 10u 100u 1m
Capacity value / F

Figure 5.49: Error of capacitor measurement of three ATmega, before and after the calibration

64

5.4

Measurement of inductance

The measurement of inductance values will be done as separate part with all found resistors with
less than 2100 Ohm. The methode of measurement is based on the growing of current by formula
L
Il = Imax ? (1 - exp -t ) after switching on the current. The time constant ? = R is proportional
?
to the inductance L, but reverse proportional to the resistor R. The current can only measured
indirectly with the potential drop of a resistor.
Unfortunately the time constant will be reduced additionally by the relative high resistance 680 Ohm,
for that the measurement of little inductance values is additionally made difficult with the 8 MHz
clock. To get the time constant, the voltage at the 680 Ohm resistor will be monitored by the analog
comparator. If the voltage drop at the 680 Ohm resistor is higher than the voltage of the internal
reference, this event will be notified to the 16-bit counter, which is started at the same time of
switching current on. The counter will save the state of this event. If the counter will overrun, this
will be counted by the program. After the event, the counter will be stopped by the program and
the total time will be build with the saved counter stage and the overflow counter. The positive side
of the coil will be switched from VCC to GND and hold in this stage until monitoring of the voltages
of both pins shows, that no current is detected. The figure 5.50 shown a simplified diagram of the
measurement situation.
Bandgap
Reference

Clock

Control
Logic

ACBG

AIN0

Timer Counter
TCNT1

Noise
Canceler

AIN1
From ADC Multiplexor

ACME

Edge
Detector

22

TP3

Rx
Lx

Clear
Direction

TOV1

DATA BUS

Count

ICR1

VCC

ICFn

19

TP1

680

19

R1

Figure 5.50: Measurement of inductances with the comparator
With the supply voltage VCC and the sum of all resistors in the electric circuit the maximum
current Imax and from that the percentage of the reference voltage to the maximum voltage at the
t Rges
680 Ohm resistor can be calculated U max = Imax ? (680 + 19) . With the formula L = - log (1 ?- U ref )
U max

the inductance can be calculated. The natural logarithm will be taken out of a build in table. A
inductance resolution of 0.1mH is taken for this type of measurement.
In order to also measure lower inductance values, the 680Ohm resistor will be omitted in the current
loop, if the resistance value of the inductor is measured with less than 24Ohm. Only the output resistance
of the port (19Ohm) will be used for measurement of the current. In this special case the peak current
will be greater than the value, that the specification of the ATmega allows. Because this will be true
only for a very short time, I expect no damage of the ATmega ports. For this type of measurement
a resolution of inductance of 0.01mH is selected. To avoid a longer time with excessive current, the
additional measurement with delayed start of the counter will always be done with the 680Ohm resistor.
To get better fitting measurement results, a zero offset of 6 is subtract from the counter reading, if
65

the measurement is done without the 680Ohm resistor. Otherwise a zero offset of 7 or 8 is subtracted.
With great inductance values the parasitic capacity can cause a quick rise of current, so that the
comparator will responce inmmediately. To get the value of the inductance anyway, the measurement
will be repeated with a delayed start of the counter. With this methode the voltage grow caused by
the current increase of the inductor will be detected by the analog comparator instead of the current
peak of the parasitic capacity. The measurements are always done in both current directions. The
program will select the higher result of measurement in the same current direction, but the lower
result of the different current direction as the displayed result.

5.4.1

Results of the inductance measurements

The figure 5.51 shows the results of the measurement of different inductors. The Inductors above
1H are relays or primary sides of power transformers, for which measurements are difficult because
the iron core has residual remanence.
20

328p
328
168p
168a
168

15

Error / Percent

10
5
0
-5
-10
-15
-20
10u

100u

1m

10m 100m
1
Inductance value / H

10

100

Figure 5.51: Error of inductance measurement of 15 different ATmega

66

5.5

Selftest Function

Beginning with release 0.9k I have implemented a self test function. Usage is very simple. If you
have installed test terminal with clamps, put all clamps together to a piece of uninsulated wire and
press the start button. The program notice the shorten probes and start the self test function, if you
confirm within two seconds with pressing the start key. This confirmation is implemented to prevent
the tester going automatically to the self test by connecting a defect transistor. After finishing the
self test the transistor tester will continue with normal measurement. If no equipment is connected,
the program will end with "part unknown or damaged". You can configure self test only for a
ATmega168 or ATmega328. Before the test steps begin, the zero resistance of the connected probes
is determined for all three combinations (T1:T3, T2:T3 and T1:T2). This zero resistances will be
subtracted for the future ESR and resistance measurements below 10Ohm. The separate steps of the
self test function 1 to 7 is displayed on row 1 of the LCD display with the letter T followed by the
step number. Every step is repeated 4 times, before the program continues with the next step. But
if you hold the start key pressed, when the test cycle is finished, this test is not repeated any more.
If you leave the key pressed the total time, every test is executed only once.
Without the AUTO CAL option only measurement results are displayed in every step, no error
analysis are done, you must interpret the results yourself. At this place I will give you an additional
important hint. Never do a measurement with connected ISP plug! The ISP interface influences the
measurement. Here is the list of currently implemented tests:

1. Measurement of the 1.3V (or 1.1V) reference Voltage (band gap Reference). In row
1 the text "Ref=" and the measured Voltage in mV is displayed. For the ATmega8 the voltage
should be near to 1.3V. For the other processors the voltage should be near to 1.1V. The second
row shows the resulting factor for the capacity measurement with the 470k Ohm resistor.
2. Comparing of the 680Ohm resistors. In row 1 the cryptic text "+RL- 12 13 23" is shown.
Meaning of this is as follows: The RL is the short form of Resistor Low meaning the 680Ohm
resistors. The 12 stand for: resistor at pin 1 is connected to VCC (+) and resistor at pin 2
is connected to GND (-). The result of this measurement is displayed in row 2 at the first
place as difference to the theoretical value. In row 1 follows now a "13" which means, that the
first connection of measurement 1 is still connected with 680Ohm to VCC but that the resistor of
pin 3 is connected to GND. The result is displayed in the middle place of row 2 as difference
to the theoretical value. The last measurement of this test "23." means that now the resistor
at pin 2 is connected to VCC (+) and the resistor of pin 3 is connected to GND. The result of
measurement is displayed at the last place of LCR row 2 as difference to the theoretical value.
Please remember, that the resolution of the ADC is about 4.88mV! The measurement situation
is also shown in figure 5.52. The theoretical value with respect to the internal resistance of the
5001?(19+680)
pins should be: (19+680+680+22) = 2493 .

67

first measurement

22

19

22

19

22

19
GND

ADCMUX

second measurement

TP2

TP3

PB4

R5

PC2

R3

PB2 TP1

680

TP3

PC1

680

TP1

PB4

R5

PC2

680

PB0 TP2

R1

PC0

680

TP2

R3

TP1

PB2

680

PC1

R1

680

PB0 TP3

19

22

ADCMUX

PC0

22

GND

19

22

VCC

19

19

22

19

22

ADCMUX

22

GND

19

22

VCC

19

22

19

22

19

VCC

third measurement

Figure 5.52: Comparison of 680Ohm resistors
3. Comparing of the 470k Ohm resistors. Now the display shows in row 1 "+RH- 12 13 23".
The same procedure as done in step 2 is repeated with the 470k Ohm resistors (symbols RH).
All results are shown as difference to the theoretical value. The theoretical value is this time
5001?(19+470000]
= 2500 for all combinations.
(19+470000+470000+22)
4. In this step nothing is measured, but the order is displayed isolate Probe!, which means
that it is time to separate the probes (release from wire). This step will finish only if you
release the connections between the probes.
5. This step tests the capability of GND (-) connected 470k Ohm resistors (H) to pull the
test pins to GND. Row 1 shows the text "RH-". Row 2 should display zero for all three pins.
6. This step tests the capability of VCC (+) connected 470k Ohm resistors (H) to pull the
test pins to VCC (+). Row 1 shows the text "RH+". The results are shown als difference
to VCC and should be near zero. Great differences from the best value for test 5 and 6 are
errors such as isolation problem, flux material or damaged port.
7. This Step tests the voltages of the 470k Ohm/680Ohm resistor divider. The voltage difference
to the expected voltage of the 470k Ohm / 680Ohm resistor dividers is shown in row 2 of the LCD
for all three terminals. Differences of more than some mV can be caused by the assembly of
wrong resistor values.
8. Measuring of internal resistance of pin output switched to the GND signal. This
test and the follwing tests will only be done, if the option AUTO CAL is selected. The internal
resistance of the port C outputs switched to GND (-) are measured with the current of to
VCC (+) switched 680Ohm resistors, see Figure 5.53. Only the three pins of the ADC port are
measured, the resistor port B (PB0,PB2 and PB4) can not be measured without hardware
modification. Is is assumed that the port resistance of the different ports are nearly identical.
The resistor value will be shown in the next test.

68

22

19

PB4

TP2

second measurement

R5

PC2

680

680

first measurement

GND

ADCMUX

PB2

TP1

22

19

19

PC1

R1

680

GND

ADCMUX

PB0

PC0

VCC

R3

ADCMUX

22

GND

22

VCC

19

22

19

22

19

VCC

TP3

third measurement

Figure 5.53: Measurement of internal resistance of Port C switched to GND
9. Measuring of internal resistance of port outputs switched to the VCC (+)signal.
The needed current is generated with to GND connected 680Ohm resistors . It are the same
measurements as those in test 8 to the other side as you can see in Figure 5.54. With the
following steps the resistance is computed: To get the current, the following is computed:
(V CC - (resultof test8) - (resultof test9))/680. To get both resistor values, the voltage (result
of test 8 or 9) is divided by this current. The result for this test will then be notified in row 1
with the text "RI Hi=", the resistance value (Ohm) to the GND side is displayed in row 2 with
the text "RI Lo=". Beginning with version 1.06k of the software, the port output resistance
values are determined at the beginning of every measurement. The values are only shown by
this step.

TP1

first measurement

22

19

ADCMUX

PB2

TP2

second measurement

PC2

PB4

R5

PC1

R3

R1

680

PB0

GND

680

ADCMUX

PC0

22

19

22

VCC

GND

680

ADCMUX

19

GND

22

19

VCC

22

19

22

19

VCC

TP3

third measurement

Figure 5.54: Measurement of internal resistance of Port C switched to VCC
10. Measurement of the zero offset of the capacitor measurement. The zero offset for the
capacity measurement with pin combinations 1:3, 2:3 and 1:2 is shown in that order in display
row 1 following the "C0 ". Alls three values are shown in pF units. For this measurements no
predefined zero offset is respected. The zero offsets of pin combinations in opposite order is also
measured. The results will be written to the EEprom, if all values are less than 70pF . This
will be notified by the output of "OK" in row 2. The found zero offsets are used for further
capacity measurements with respect to the pin combination. Please notice, that changes of the
test equipment can cause a new adjustment of the zero offset. If you use wire with clips, the
zero offset may be 3 pF greater compared to a empty socket.

69

11. Wait for the connection of a capacitor to pin 1 and pin 3. The message "1-C-3 & gt; 100nF"
is shown in row 1 of LCD. To prepare the measurement of the comparator offset voltage, you
must connect a sufficient big capacitor to pin 1 and pin 3. It should be a capacitor with a high
quality factor and a capacity between 100nF and 20uF . You should never use electrolytical
capacitors, use film capacitors instead.
12. Measurement of the comparator offset for capacitor measurement adjustment. To
get the offset of the analog comparator, a capacitor must already be connected to pin 1 and
pin 3. The capacitor is needed for buffering the load voltage of a capacitor, in order to get the
voltage difference of load voltage to the internal reference voltage (band gap). If measurement
is successfull, the correction value is short shown with the text "REF C=" in row 1 of the LCD
and written to the EEprom. You can give a additional offset to the automatic measured value
with the REF C KORR option.
If you have selected the AUTOSCALE ADC option, the gain of the ADC readings with the
internal reference will be adjusted by comparing a capacitor voltage below 1 V once readed
with VCC reference and once readed with the internal reference. The measurement result is
shown in row 2 with the text "REF R=". Your REF R KORR value is a additional offset to
this automatic find out difference value.
At the end of test function the text "Test End" is shown in row 1 and the version number of
software is shown in row 2. If the Makefile option FREQUENCY 50HZ is set, a 50Hz rectangle
signal is generated on pin 2 and the same signal in opposite direction on pin 3. Pin 1 is switched to
GND . The current is limited with 680Ohm resistors. This will be notified by the Output of "50Hz" at
the end of row 1 of the LCD display. The 50Hz signal will be generated 30 times for 2 seconds each.
You can check the time of the wait calls, if you have an oscilloscope or frequency counter. Figure
5.55 shows the oscillograph curves of both 50 Hz output pins with crystal operation.

Figure 5.55: Oscillograph curve with the 50Hz outputs of Port 2 and 3
If you don't use the crystal clock version, the result may be inexactly. A exactly clock frequency
and wait time are important for measurement of capacity values. You can abort the generation of
the 50Hz signal by long time pressing of the start button. Then the program continues with the
normal measurement task.
70

5.5.1

Some Results of the Selftest Function

The results of the selftests of nine different ATmega168 processors and of six ATmega328 processors
will be shown in the following figures.
Test
Test
Test
Test
Test
Test
Test
Test
Test
Test

No.
measurement typ
1
band gap Ref
2
RL-Mean
3
RH-Mean
5
RH-Low
6
RH-High
8
R out Lo
9
R out Hi
10
Cap zero offset
11
Reference correction

theoretical figure
1100
5.56
0
5.57a
0
5.57b
0
5.58a
0
5.58b
131
5.59a
151
5.59b
30
5.60
0
5.61

Table 5.6: Table of the selftest figures

1110

Reference

reference voltage / mV

1100
1090
1080
1070
1060
1050
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Processor number
Figure 5.56: Selftest: Reference-Voltages

71

5

RHmiddle12
RHmiddle13
RHmiddle23

0
voltage / mV

0
voltage / mV

5

RLmiddle12
RLmiddle13
RLmiddle23

-5

-10

-15

-5

-10

-15

-20

-20
0

1

2

3

4

5

6 7 8 9 10 11 12 13 14 15 16
Processor number

0

1

2

3

4

(a) with 680Ohm

5

6 7 8 9 10 11 12 13 14 15 16
Processor number

(b) with 470k Ohm

Figure 5.57: Selftest: difference to ideal mean voltage

5

(voltage - VCC) / mV

4
voltage / mV

0

RHbottom1
RHbottom2
RHbottom3

3

2

1

0

RHtop1
RHtop2
RHtop3

-1

-2

-3

-4

-5
0

1

2

3

4

5

6 7 8 9 10 11 12 13 14 15 16
Processor number

0

(a) with 470k Ohm to 0V

1

2

3

4

5

6 7 8 9 10 11 12 13 14 15 16
Processor number

(b) with 470k Ohm to 5V

Figure 5.58: Selftest: Input voltage

21.2

23.5

RiLo1
RiLo2
RiLo3

21

23
resistance / Ohm

20.8
resistance / Ohm

RiHi1
RiHi2
RiHi3

20.6
20.4
20.2
20

22.5

22

21.5

19.8
19.6

21
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Processor number

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Processor number

(a) with 680Ohm to 5V

(b) with 680Ohm to 0V

Figure 5.59: Selftest: Output resistance
72

44

CNULL1
CNULL2
CNULL3

Capacity / pF

42
40
38
36
34
32
0

1

2

3

4

5

6 7 8 9 10 11 12 13 14 15 16
Processor number

Figure 5.60: Selftest: zero offset of the capacity measurement

80

REF C KORR
REF R KORR

Voltage correction / mV

60
40
20
0
-20
-40
-60
0

1

2

3

4

5

6 7 8 9 10 11 12 13 14 15 16
Processor number

Figure 5.61: Selftest: correction values after automatic calibration
At last I would like to show you the difference voltages of the external at the AREF pin with
a multimeter measured voltages and the internal with the ADC measured voltages of the reference
voltages of 15 different ATmega precessors and the found correction voltages (REF R KORR) after
the automatic calibration in figure 5.62. You can see, that the automatic calibration values nearly
follow the external measured values.
40

AREF - REF
REF R KORR

Voltage difference / mV

30
20
10
0
-10
-20
-30
-40
0

1

2

3

4

5

6 7 8 9 10 11 12 13 14 15 16
Processor number

Figure 5.62: Selftest: Voltage difference of the internal reference
73

Chapter 6
Known errors and unsolved problems
Software Version 1.08k
1. Germanium Diodes (AC128) are not detected in all cases. Cooling of the diode can help to
reduce the residual current.
2. The current amplification factor of germanium transistors can be measured too high because
of the high residual current. In this case the basis emitter voltage will be very low. Cooling of
the transistor can help to get a more correct current amplification factor.
3. Capacity value in reverse direction for Power Schottky Diodes such as MBR3045PT can not
be measured, if only one diode is connected. The reason is a too big residual current of this
diode. Sometimes the measurement is possible by cooling down the device (with cooling spray
for example).
4. Here and there a wrong detection of the 2.5V precision reference is reported, when the PC4 pin
(27) is unconnected. You can avoid this behaviour with a additional pull up resistor connected
to VCC.
5. The diode function of a triac gate can not be examined.
6. Sometimes a problem with the Brown Out level of 4.3V is reported for ATmega168 or ATmega328 processors. This will cause a reset during capacity measurement. A reason is not
known. The Resets will disappear, if the Brown Out level is set to 2.7V.
7. With the using of the sleep state of the processor, current of VCC power is changing more than
using previous software versions. You should check the blocking capacitors, if you notice any
problems. Ceramic capacitors with 100nF should be placed near the power pins of the ATmega.
The using of sleep state can be deselected by the Makefile option INHIBIT SLEEP MODE.

74

Chapter 7
Special Software Parts
Several modifications are done to save flash memory. The LCD-Output of probe-pin numbers
was done in the form "lcd data('1'+pin)". To save the add operation for every call, the entry
"lcd testpin(uint8 t pin)" was added to the lcd routines.c.
The pseudo calls in the form " delay ms(200)" are not implemented as library calls, but wait
loops are implemented for every call. This will consume much memory, if you have many calls at
different location in your program. All of this pseudo calls are replaced with calls to my special
assembly written library, which uses only 74 bytes of flash memory (@8MHz), but enables calls from
wait1us() to wait5s() in steps of 1,2,3,4,5,10,20. . . . The routines include the Watch Dog Reset for
all calls above 50ms. Every wait call usually only need one instruction (2 Byte). Wait calls with
interim value such as 8ms need two calls (5ms and 3ms or two times a 4ms call). I don't know any
implementation, which is more economical if you use many wait calls in your program. The calls
uses no registers, only the Stack Pointers for the return adresses in the RAM (at most 28 Byte stack
space in current release) is used. The total list of functions is:
wait1us(), wait2us(), wait3us(), wait4us(), wait5us(), wait10us(),
wait20us(), wait30us(), wait30us(), wait40us(), wait50us(), wait100us(),
wait200us(), wait300us(), wait400us(), wait500us(), wait1ms(),
wait2ms(), wait3ms(), wait4ms(), wait5ms(), wait10ms(),
wait20ms(), wait30ms(), wait40ms(), wait50ms(), wait100ms(),
wait200ms(),wait300ms(), wait400ms, wait500ms(), wait1s(),
wait2s(), wait3s(), wait4s() and wait5s();
That are 36 functions with only 37 instructions inclusive Watch Dog Reset! There is really no way to
shorten this library. Last not least matches the wait calls the exactly delay time, if the lowest wait
call does. Only the wait calls above 50ms are one cycle per 100ms to long because of the additionally
integrated watch dog reset.
Additionally the often used calling sequence "wait5ms(); ReadADC. . . ();" is replaced by the call
"W5msReadADC(. . . );". The same is done for the sequence "wait20ms(); ReadADC(. . . );" which
is replaced by one "W20msReadADC(. . . );" call. The function ReadADC is additionally written in
assembly language, so that this add-on could be implemented very effective. The functional identical
C-version of the ReadADC function is also avaiable as source.

75

Chapter 8
To Do List and new ideas
1. Add more and better documentation.
2. Think about how we can get the real internal resistance of port B output (resistor switching
port) instead of assuming, that ports are equal.
3. Can discharging of capacitors be made more quickly, if the minus pin is additionally raised
with the 680Ohm resistor to VCC (+)?
4. Check if the tester can use floating-point representation of values. The risk of overflow is lower.
There is no need to use multiplication and division together to build a multiplication with a
non integer factor. But I don't know how much flash memory must be spend for the library.
5. Write User's guide for configuring the tester with the Makefile options and description of the
build chain.
6. If the holding current of a thyristor can not be reached with the 680Ohm resistor, is it harmless to
switch the cathode directly to GND and the anode directly to VCC for a very short time? The
current could reach more than 100mA. Will the port be damaged? What is with the power
supply (voltage regulator)?
7. Check the Port afterwards with self test function!
8. Can voltage regulators be checked? (Input, Output, GND)
9. Warning message, if the found reference voltage is not plausible in relation to ATmega model
and VCC.
10. What is about a second generation tester with a bigger ATmega which includes differential
ADC-port, more flash memory . ? There is no ATxmega which have supply voltage of 5V,
only the ATmega line is possible.
11. Idea for a New Projekt: USB version without LCD-Display, Power from USB, Communication
to PC over a USB-Serial bridge.

76

Bibliography
[1] Markus Frejek AVR-Transistortester,. Embedded Projects Journal, 11. Ausgabe, 2011
[2] Atmel Corporation 8-bit AVR with 8KBytes In-System Programmable Flash - ATmega8(L),.
Manual, 2486Z-AVR-02/11, 2011
[3] Atmel Corporation 8-bit AVR with 4/8/16/32KBytes In-System Programmable Flash - ATmega48 - ATmega328,. Manual, 8271D-AVR-05/11, 2011
[4] Atmel Corporation Atmel AVR126: ADC of megaAVR in Single Ended Mode,. Application
Note, 8444A-AVR-10/11, 2011
[5] Atmel Corporation Atmel AVR121: Enhancing ADC resolution by oversampling,. Application
Note, 8003A-AVR-09/05, 2005
[6] http://en.wikibooks.org/wiki/LaTeX LaTeX documentation,. Guide to the LaTeX markup
language, 2012
[7] http://en.wikibooks.org/wiki/Gnuplot Gnuplot documentation,. Documentation for the
plotting tool gnuplot, 2012
[8] Wikipedia http://de.wikipedia.org/wiki/Equivalent_Series_Resistance Explanation
for ESR in german language. Standardization and equivalent circuit of a capacitor, 2012
[9] http://www.xfig.org/userman Xfig documentation,. Documentation of the interactive drawing
tool xfig, 2009
[10] http://docs.gimp.org/2.6/de gimp documentation. Documentation of the GNU Image Manipolation Program, 2010
[11] http://www.mikrocontroller.net/articles/AVR-Transistortester Online documentation
of the Transistortester, Online Article, 2009-2011
[12] http://www.mikrocontroller.net/articles/AVRDUDE Online documentation of avrdude programmer interface, Online Article, 2004-2011
[13] http://www.mikrocontroller.net/topic/131804 Thread from Markus, Forum thread, 2009
[14] http://www.mikrocontroller.net/articles/AVR_Transistortester Short description of
new features of the TransistorTester von Karl-Heinz K., Online Article, 2012
[15] http://www.mikrocontroller.net/topic/248078 Thread from Karl-Heinz, Thread and new
software versions, 2012
[16] http://www.mikrocontroller.net/articles/WinAVR Information about WinAVR in german
language, Online Article, 2012

77

[17] http://winavr.sorceforge.net Source for WinAVR package, Download source, 2012
[18] http://www.mikrocontroller.net/topic/248078?page=5#2922341 Patch for WinAVR, Setting of Fuses with avrdude, Download Quelle, 2012

78


Download file - link to post