TransistorTester Eng 094k
TransistorTester Eng 094k
TransistorTester Eng 094k
K.-H. Kübbeler
is only valid for the test version 0.94k
Introduction:
Based to the Software of Markus Frejek I had started to modify the software.
At the beginning the reason for this was a problem, which I had with the programming of EEprom.
Because writing to the flash memory was without problems, I believed that it is the quickest and
best way to get a run capable tester, if I put the texts and parameters away from the EEprom and put
them in the flash memory instead. Beginning from version 0.92k you can select with option
USE_EEPROM, if EEprom should be used or not. By analysing the software I had an additional
idea, which I have implemented as a test:
In order to display the voltage, values are needed in mV and not in steps of the ADC. This was done
by original software for every value which is displayed. On the other side the original function
ReadADC reads the ADC Value twenty times, adds every value and divide the sum by twenty. The
resolution of the result is again 5000mV/1023 (same as ADC). If I read the ADC value instead of
20 times now 22 times, build the sum and double the sum and divide by nine, then my maximum
value is 22*2*1023/9=5001, what matches nearly perfect to the wanted mV resolution. But with
this idea real work started.
Now all “if statements” in the program must be adapted to the new resolution. So I learned more
and more about the software of Markus Frejek. My actual version of the function ReadADC reads
the ADC value 45 times, but adds only the last 44 values and divides the result by 9. Because I had
the initial ambition to put the software of the reduced version (without resistor and capacitor
measurement) in 4K flash, I did modifications which were not really necessary. So I replaced the
wait loops by calls to a new written assembler routine, which uses only 66 bytes of flash, every call
need only one instruction, but serves a total range from 10µs to 5s in steps of 1 2 3 4 5 10. The
routine includes the Watch Dog Reset for all calls above 100ms.
Wait calls with interim value such as 8ms need two calls (5ms and 3ms). I don't know any
implementation, which is more economical if you use many wait calls in your program. The wait
calls matched the exactly delay time if the lowest time wait call does. Only the 100ms wait time
calls are 1µs longer if your clock is 1MHz because of the additional Watch Dog Reset. The calls
uses no registers, only the Stack Pointers for the return addresses in the RAM (at most 28 Byte
stack space in current release) is used. The software version for 8MHz clock needs less memory
than the 1MHz version, because the LCD-functions can then use this calls too. In this case the
additional calls 1µs,2µs,3µs,4µs and 5µs are possible.
1
New features and modifications
1. Measuring of resistors are upgraded, so that potentiometers can be connected. The display
format for this measurement is x-□-y-□-z in the first row, where x, y and z can be any of
the pin numbers 1-3. The second row shows the value of the resistor which is connected to
pin x and pin y followed by the value of the resistor connected to pin y and pin z. If you
don't want to compute the total value yourself, disconnect pin y and start measurement
again. If the potentiometer is adjusted to one of its ends, the Transistor tester cannot differ
the middle pin and the end pin!
3. The measurements of capacitor values are done by measurement of load time. The original
software did this with a program loop, which reads the corresponding digital input pin until
switch occurred and count the loop cycles. This has the handicap that the resolution is
limited by the total time consumption of one loop cycle. I have replaced this loop for little
capacitor values (about <50µF) by a technical feature of the AVR that the counter can save
its counter value by a external event. The counter can operate at full clock rate (1MHz or
8MHz). The external event can be build by the output of the comparator. The comparator
can operate with any ADC input pin and Band cap reference. So I discharge the capacitor,
prepare the comparator to the proper pin input, start the counter at 0 and start charging of the
capacitor with the 470kΩ resistor. Now I check in 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 I
subtract a experimental find out constant to eliminate the measurement offset. I don't know,
if this constant must be adapted to other boards or processors. Capacitors with bigger values
as about 50µF are measured in an previous test. This is done by up to 500 load pulses with a
length of 10ms, which is done with the 680Ω resistor. Load pulses are repeated until the load
voltage reached more than 300mV, measured without any load current. The value of the
capacity is then computed from 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.
As a result of the lower load voltage the measurement time is much faster, because this
advantage works also on discharging.
Furthermore a diode, which is parallel connected to the capacitor don’t disturb the
measurement in most cases, because the flux voltage of most diodes is not reached.
4. Capacitors are measured only in three combinations: Pin 1 (-) and Pin 3 (+), Pin 1 and Pin 2,
plus Pin 2 and Pin 3. The measurement with the other polarity are omitted.
5. Unfortunately the measurement of capacities had not the expected accuracy with respect to
different AVR's, what I know from a single user's response. As a reason I assumed the
difference of the internal 1,3V reference voltage, which was used with the comparator.
Therefore the actual release 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
2
interpolated according to the actual reference voltage. This function uses some of the limited
flash memory. I hope that the reason for the different measurement values is found. Now
the reference voltage is read by every power on if this function is selected with the option
WITH_AUTO_REF. I noticed that the reference voltage is permanently somewhat to low, so
that you can choose an offset with the Makefile option REF_KORR. The measured
reference voltage will then be corrected (added) by your value (mV units).
7. The format of displaying diodes is replaced by an diode symbol surrounded with the pin
numbers. This should be known by every user with any first language. Unfortunately I see
no way to show different symbols for special diodes like breakdown diode. Please notice the
pin numbers instead. If the outside pin numbers of two diodes are identical, it can be a two-
in-one LED, a breakdown diode or something else. Notice the flux voltages!
9. To save program place, the format of displaying pin numbers of bipolar transistors is
changed to the form EBC=xyz . Where EBC means Emitter, Base and Collector and xyz
means the sequence of the corresponding pin numbers.
10. The measurement for bipolar transistors is also done with common collector (emitter
follower). The hFE value of High Power transistors a more acceptable if measured by this
way. In this kind of connection there is no risk to overload the base, even if the base is
supplied with the 680Ω resistor. In case of Darlington transistor the voltage over the base
resistor is too little, so this measurement is done also with the 470kΩ base resistor (release
0.92k). The normal measurement with common emitter is also done as before and the
higher value of hFE is displayed. Because Darlington transistors can have very high hFE
values (>20000), the display layout is changed from hFE= to B= to save space.
11. The differences of reference voltage of ATmega8, ATmega88, ATmega168 and ATmega328
are applied as noted in the data sheet. You can also use the feature WITH_AUTO_REF with
a Makefile option, in this case the reference Voltage is read out with ADC. The factor to
transform the measured load time to capacity is dependent of the reference voltage. If the
curves in the data sheet are not only for one example, reading of actual reference voltage
should not be required, but I'm in doubt about it.
3
12. The measurement of big capacitor values is expanded to values up to 100mF. Because I
don't have such big capacitors, I could not yet test this. Capacity of Gold capacitors could
not measured correctly by this method (too quickly).
13. Use of the AVR with 8MHz crystal is added to the Makefile. The correct fuses for the
different ATmega's is selected with the „make fuses-crystal“ call. If you prefer the operation
with 1MHz, the clock divide by 8 fuse is selected automatically for the ATmega88 line. The
ATmega8 must be connected with a 1MHz crystal, if you wish to use the 1MHz crystal
mode (no clock divide).
14. Beginning from version 0.92k the program can be configured with Makefile options. You
can select a supported language, if you wish to use measurement of resistors or capacities, if
you want a serial output, if the battery voltage is displayed at the beginning, if you wish to
use the self test function and if the program should use the EEprom. Additionally you can
select your clock frequency (1MHz or 8MHz). You can also select which processor you have
installed (m8, m48, m88, m168 and m328) and which programmers (avrisp2) you have
connected if you use avrdude as programmer interface (call: make upload). The avrdude
program checks signature before any load of program data is done. If the correct processor is
not found, program terminates with a error message. You can select a clock generation with
internal RC generator (make fuses) and a clock generation with a external crystal (make
fuses-crystal). You can use the crystal version only if you have installed a 8MHz crystal
between pin 9 and pin 10 of your ATmega. If you wish to use an 1MHz clock operation with
crystal, you can do this. If you have a ATmega88 ATmega168 or ATmega328, the clock
divide fuse is selected automatically by Makefile. Only for the ATmega8 you must install
the 1MHz crystal if you wish to use a 1MHz clock operation with a crystal. Linux-user
should be able to get an ready transistor tester with 4 steps:
• Edit the Makefile, select your processor type, your programmer and options
• call „make“
• connect the ISP-plug and call „make upload“
• if necessary, call „make fuses“ or call „ make fuses-crystal“ and disconnect the ISP-
plug
15. Beginning from version 0.92k the ReadADC function adds 4 to the sum before dividing by
9 (round up to next integer).
16. Beginning from version 0.93k you can select the special option AUTOSCALE_ADC for
the ReadADC function, so that not only the 5V reference is used for measurements,
additionally the internal reference (1.1V for ATmega168) will be used if the input voltage
enables that (Input voltage must be lower than 1V). Especially if the software switch the
reference from 5V to 1.1V, the software must wait more than 5ms until the selected
reference is stable. The reason for this is the external installed 100nF capacitor at the AREF
pin (21) of the ATmega. Switch back to 5V is much quicker (300µs).
The necessary additional wait time results in a significant greater measurement period for
capacitors with big values, because very often must be switched between 5V and 1.1V
reference. The resolution of ReadADC function is always mV!
4
17. Version 0.94k has a new option in the Makefile „NO_AREF_CAP“, which will reduce the
wait time between switching the ADC reference between 1.1V and 5V. You can use this
option only if the 100nF capacitor connected to the AREF pin (21) is removed or
replaced with a 1nF capacitor. I have not noticed any degradation of measurements if this
capacitor is removed. This option does have effect only, if the AUTOSCALE_ADC option is
selected too. I have installed a 1nF capacitor after all.
18. Version 0.93k changes the measurement of resistors. The measurement of voltage of the
directly switched pin (ADC port) is removed, only the Pin which is connected across a
resistor to the power (VCC or GND) is measured. The potential drop of the direct
connected pin is computed with respect to the known internal resistance of the switched
port.
Four different measurements are made:
Low-Pin connected to GND and High-Pin connected across 680Ω to VCC
Low-Pin connected to GND and High-Pin connected across 470kΩ to VCC
Low-Pin connected across 680Ω to GND and High-Pin connected to VCC
Low-Pin connected across 470kΩ to GND and High-Pin connected to VCC
Corresponding to the measurement results, two of the measurements are selected (680Ω or
470kΩ pair) and the results are averaged. If the AUTOSCALE_ADC option is selected and
the voltage of one result is below 0,99V, an weighted average is build with factor 4 for this
value, the other value is weighted with factor 1.
In table B2 you can see the benefit (measurements around 22kΩ).
19. In version 0.93k have I added fill characters to the different texts to get the same length for
every implemented language. In version 0.94k I have removed this fill characters again,
because I had noticed, that there is no space left in EEprom for the additional data required
to implement the option LCD_CYRILLIC. To make this option selectable again, the overrun
area of the table RLtab was additionally removed.
20. By optimizing the program in version 0.94k it is possible to select the self test function
together with all other options without AUTOSCALE_ADC for a ATmega8. Therefore the
output of capacity value and the output of resistor value now uses a common function.
21. The computation of the current amplification factor for bipolar transistors is in version 0.94k
done with „long int“ (32 bit) , but result is limited to 65535 (match 16 bit). The overrun
problem was reason for the implausible results of previous versions (BC516 measurements).
I think, that optimising of measurement results is nearly finished. Some more response from users
would be helpful.
I hope, that I have not forgotten any important item and will introduce a last item, for which I will
spend a separate chapter.
5
Self test 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. 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“. The unhappy side of the self
test function is that the 8K flash is used near the limit. The length of the ATmega8 version 0.9k is
about 8000 bytes. The length of the ATmega88 version is with 8122 byte very near at the limit. Use
of EEprom (with option USE_EEPROM) is one of the only possibility to save memory. Some
functions like ReadADC are already implemented in assembler syntax.
The separate steps of the self test function is generally displayed on row 1 of the LCD display with
the letter T followed by the step number. Every step is repeated 8 times, before the program
continues with the next step. In every step only measurement results are displayed, 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.
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. The second row shows the
resulting factors for capacity measurement.
6
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).
5. This step tests the capability of GND (-) connected 470kΩ 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Ω resistors (H) to pull the test pins
to VCC (+). Row 1 shows the text „RH+“.
The best value for this three measurements is 5001.
Great differences from the best value for test 5 and 6 are errors such as isolation problem,
flux material or damaged port.
9. 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 680Ω resistors. This test is
repeated 8 times with 5 seconds period each.
You can check the time of the wait calls, if you have an oscilloscope or frequency counter.
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.
At the end of test function the text „Auto Test End“ is shown in row 1 and the version number of
software is shown in row 2. Then the program continues with the normal measurement task.
Beginning from version 0.93k, a test step is not further repeated, if the start key is pressed. If
you leave the key pressed, every test is executed only once. You can configure self test only
together with all other options for a ATmega168 (ATmega328 untested) . For the ATmega8 you
must at least omit the option AUTOSCALE_ADC because of the limited flash memory.
7
Appendix A
Result of self test
Software Version 0.94k
8
Appendix B1
Results of resistor measurements
Software Version 0.92k (old)
9
Appendix B2
Results of resistor measurements
Software Version 0.94k
680Ω 0.1% 678Ω 0.3% 678Ω 0.3% 681Ω 0.1% 679Ω 0.1%
1360Ω 0.1% 1359Ω 0.1% 1358Ω 0.1% 1359Ω 0.1% 1359Ω 0.1%
3.90kΩ 0.1% 3894Ω 0.2% 3895Ω 0.1% 3909Ω 0.2% 3903Ω 0.1%
7.80kΩ 0.1% 7813Ω 0.2% 7782Ω 0.2% 7828Ω 0.4% 7808Ω 0.1%
11.0kΩ 0.1% 11.04kΩ 0.4% 10.96kΩ 0.4% 11.08kΩ 0.7% 11.02kΩ 0.2%
22.0kΩ 0.1% 21.30kΩ 3.2% 21.60kΩ 1.8% 21.30kΩ 3.2% 21.7kΩ 1.4%
44.0kΩ 0.1% 43.10kΩ 2.0% 43.40kΩ 1.4% 43.30kΩ 1.6% 43.6kΩ 0.9%
50kΩ 0.1% 49.20kΩ 1.6% 49.30kΩ 1.4% 49.30kΩ 1.4% 49.60kΩ 0.8%
100kΩ 0.1% 98.90kΩ 1.0% 99.10kΩ 0.9% 99.10kΩ 0.9% 99.50kΩ 0.5%
200kΩ 0.1% 198.1kΩ 1.0% 198.1kΩ 1.0% 198.4kΩ 0.8% 198.4kΩ 0.8%
270kΩ 0.1% 267.7kΩ 0.8% 267.9kΩ 0.8% 267.9kΩ 0.8% 267.9kΩ 0.8%
470kΩ 0.1% 468.0kΩ 0.4% 468.0kΩ 0.4% 468.4kΩ 0.3% 468.6kΩ 0.3%
940kΩ 0.1% 938.6kΩ 0.2% 938.7kΩ 0.2% 940.8kΩ 0.1% 940.8kΩ 0.1%
1.00MΩ 0.1% 995.8kΩ 0.4% 995.3kΩ 0.5% 997.1kΩ 0.3% 998.0kΩ 0.2%
2.00MΩ 0.1% 1989kΩ 0.6% 1990kΩ 0.5% 1998kΩ 0.1% 1990kΩ 0.5%
10
Appendix C1
results of capacity measurements
Software Version 0.92k (old)
11
Appendix C2
Results of capacity measurements
Software Version 0.94k
12
Appendix D
Results of semiconductor tests
Software Version 094k
1N4150 Diode, 678mV, 0pF Diode, 681mV, 0pF Diode, 682mV, 0pF
BY398 Diode, 541mV, 0pF Diode, 553mV, 0pF Diode, 542mV, 0pF
1N4007 Diode, 654mV, 13pF Diode, 665mV, 9pF Diode, 658mV, 11pF
LED green Diode, 1954mV, 6pF Diode, 1970mV, 6pF Diode, 1951mV, 4pF
ZPD2,7 2xDi, 729mV, 2659mV 2xDi, 738mV, 2674mV 2xDi, 730mV, 2656mV
BU508A NPN, B=9, 613mV NPN, B=9, 621mV NPN, B=9, 615mV
BU508A B+E Diode, 613mV, 5201pF Diode, 621mV, 5285pF Diode, 611mV, 5344pF
BU508A B+C Diode, 595mV, 261pF Diode, 597mV, 267pF Diode, 591mV, 272pF
2N3055 NPN, B=21, 617mV NPN, B=21, 626mV NPN, B=21, 625mV
BC556B PNP, B=266, 790mV PNP, B=429, 787mV PNP, B=266, 790mV
BC639 NPN, B=180, 722mV NPN, B=180, 733mV NPN, B=188, 724mV
BC640 PNP, B=185, 716mV PNP, B=227, 725mV PNP, B=187, 719mV
AC128 (Ge.) PNP, B=68, 270mV PNP, B=64, 269mV PNP, B=66, 271mV
BC517 NPN, B=26996, 1419mV NPN, B=28220, 1413mV NPN, B=28250, 1404mV
BC516 PNP, B=65535, 1430mV PNP, B=65535, 1420mV PNP, B=65535, 1417mV
13
Appendix E
Pictures
14
Appendix F
Known errors
Software Version 0.94k
• The measurement results of little capacity values vary with the Pin combinations.
Combination 1:2 values are about 3pF less than the values of the other pin combinations
(1:3 and 2:3). This effect is equal on any tested AVR processor.
• Germanium Diodes (AC128) are not detected in all cases.
• Does program work correctly without the automatic shut off?
15
Appendix T
to do list (not sorted)
Software Version 0.93k
16
Additional:
As you can see, the list of ideas and “to do” tasks is still rather long. My purpose is to make the
transistor tester more precise, faster and multifunctional. Probably I purchase a second board for
easier checking of different processors (mega8 and mega168).
I can not promise you, that the task list will ever be empty. Also I can not promise you, that my
software is free of errors. I don't give you any warrenty! Using my software is your own risk.
During my tests never a ATmega or other part was damaged. But I give you the promise that I never
will publish a release without source code!.
By now I develop my software with the GNU toolchain under a Linux (Ubuntu) operating system.
I had got a useful hint from another thread on www.mikrocontroller.net to use my programmer
(Diamex ALL-AVR ) without any problems. The same programmer was not able to program the
EEprom of my ATmega8's with the Windows driver. Now I can also use the original software of
Markus Frejek for my tester. I still hope, that my software become a official version. But I still wait
on answer to my email to 5volt and to linuxgeek from February 2012.
17