Documentation of my modifications to the AVR Transistortester.
A transistor tester is a device where you can insert different kinds of electronic components and have them analyzed. It not only reads transistors and tells you whether it's NPN or PNP, but it tells you the resistance of resistors or capacitance of capacitors, and more. There are many different types, and they are usually very cheap.
I have the GM328 kit from Banggood (no longer available there), sometimes identified as AY-AT.
Notable hardware:
To improve the accuracy of the tester there are some simple modifications you can do.
(Image from https://github.com/Upcycle-Electronics/AVR-Transistor-Tester)
See also this post on eevblog.
From the readme of the k-firmware:
"The resistors R1 to R6 are critical for measurements and this 680Ω and 470kΩ resistors should be measurement type resistors (tolerance of 0.1%) to get the full accuracy."
"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. If you don’t install the precision voltage reference and you don’t add the relay extension, you should install a pull up resistor R16 to PC4 with a higher resistance value (47kΩ). This helps the software to detect the missing voltage reference."
From the readme of the m-firmware:
"The external 2.5V voltage reference should be only enabled if it's at least 10 times more precise than the voltage regulator. Otherwise it would make the results worse. If you're using a MCP1702 with a typical tolerance of 0.4% as voltage regulator you really don't need a 2.5V voltage reference."
The part about R16 in the readme of the k-firmware is confusing since it's not mentioned in the readme of the m-firmware. This post confirms that it's only necessary for the k-firmware:
"_For running the m-firmware you can skip step #3 or remove R16 (no need to replace it). When HWREF25 is disabled (default setting) the firmware will ignore any external voltage reference. The k-firmware handles external references a little different and always checks for a 2.5V reference (no setting to disable that). Therefore the k-firmware needs the resistor mod (step #3) to make it believe that there isn't any reference."
I chose to order 0.1% resistors and just the MCP1702 voltage regulator, skipping the voltage reference. Also added a 16MHz crystal for increased speed:
The concrete changes, referenced to the schematics:
This is how it looks with these changes in place:
The 0.1% resistors (black) are a bit thicker than the default (blue), so they overlap a little bit.
There are 2 different firmware choices for the transistor tester. The original is the k-firmware. The tester comes with version 1.12k (quite old), and the newest is 1.13k. Development of the k-firmware is currently on hold. It's been forked into the m-firmware, which is rewritten and with additional features, and still under active development.
The k-firmware source is available here, with precompiled firmware for the AY-AT in the mega328_color_kit directory. There is also a Makefile there with the correct parameters. The source of the m-firmware is available here, but only as tarballs. There are no precompiled versions. Both firmwares can also be found here.
I chose to use the m-firmware, due to it still being actively developed. The newest version at the time of writing is 1.42m.
There are 3 configuration files in the firmware that needs to be adjusted. See the file "Clones" (from the firmware tgz) for the basic changes required to build a compatible firmware for the AY-AT. The additional changes I made are documented here. The files are also available in the firmware directory.
HW_REF25
because I don't use the TL431A voltage reference or the recommended LM4040 replacement.SW_IR_RECEIVER
because the firmware was too large (105%) and wouldn't fit on the ATmega328P. The support for IR is not important to me so it was ok to disable.UI_AUTOHOLD
because continuous test mode was annoying. I'd rather take the time I need to read the result.POWER_OFF_TIMEOUT
so it turns off when idle.SW_POWER_OFF
so I can turn it off from the menu.LCD_LATE_ON
because the screen is very garbled when initialized and this setting makes it look fine.FREQ
to 16 because of my change from 8 to 16MHz crystal.If you just want to build a new firmware, and don't care for any of the hardware modifications described here you can follow the configuration examples with these exceptions:
HW_REF25
FREQ
set to 8This will give you a firmware that runs on a "stock" GM328 AY-AT from Banggood.
In addition to the build tools that was already installed, I had to add the following packages (in openSUSE):
avr-libc
cross-avr-gcc9
Then make
to build.
When build is finished you should have these files, which make up the firmware:
ComponentTester.eep
ComponentTester.hex
And the compiler output should end with something like this:
AVR Memory Usage
----------------
Device: atmega328
Program: 32234 bytes (98.4% Full)
(.text + .data + .bootloader)
Data: 248 bytes (12.1% Full)
(.data + .bss + .noinit)
EEPROM: 738 bytes (72.1% Full)
(.eeprom)
If any of these are more than 100% full you have too much enabled in the firmware and it will not work.
To flash the firmware we need 3 files. The 2 firmware-files from above, and ComponentTester.cfg. The last file contains the configuration of the fuses of the ATmega328P. The fuse configuration is extracted from the Makefile. To see what the fuses mean you can use this online calculator.
The AY-AT does not support firmware flashing out of the box. There are 2 ways around that.
The first option requires no more modfications to the transistor tester, but you have to remove the chip from the socket and insert it into the programmer every time you want to update the firmware.
I use a TL866II Plus universal programmer together with the minipro open source software for Linux. See https://github.com/blurpy/minipro for more about how to use.
With the chip in the programmer, just run these commands:
minipro -p "ATMEGA328P@DIP28" -E
minipro -p "ATMEGA328P@DIP28" -c data -w ComponentTester.eep -e
minipro -p "ATMEGA328P@DIP28" -c code -w ComponentTester.hex -e
minipro -p "ATMEGA328P@DIP28" -c config -w ComponentTester.cfg -e
That should be it.
The other option is to solder pins on the back of the circuit board to add the missing ICSP header that lets you flash the firmware in circuit. More work up front, but very useful if you update the firmware often.
I added right angle header pins like this:
This is the pinout (mirrored compared to above):
There are many different devices that can be used to flash with an ICSP header, like this example using an Arduino Uno as the programmer, but I'll be using the TL866II Plus mentioned above, as it also supports ICSP mode, with the following pinout:
With wires hooked up between the transistor tester (with power removed) and the programmer, just run these commands:
minipro -p "ATMEGA328P@DIP28" -E -i
minipro -p "ATMEGA328P@DIP28" -c data -w ComponentTester.eep -e -i
minipro -p "ATMEGA328P@DIP28" -c code -w ComponentTester.hex -e -i
minipro -p "ATMEGA328P@DIP28" -c config -w ComponentTester.cfg -e -i
That should be it.
This is the finished result after flashing the new firmware:
You can find the original firmware here if you want to restore to a known working firmware.
I initially didn't pay any attention to the output after the compile step:
AVR Memory Usage
----------------
Device: atmega328
Program: 34784 bytes (106.2% Full)
It worked fine to flash the firmware, however when trying to start the tester it would quickly flash white on the screen and then turn off. I thought it was a hardware issue at first, but when testing the original firmware it worked. After disabling enough features in this firmware to get below 100% memory it worked fine as well.
When I forgot to configure the screen in config_328.h
before compiling and flashing, the tester would turn on and display a white screen until power was removed. Easily fixed by adding the correct configuration and trying again.
After flashing a new firmware it's recommended to follow the steps described in the readme to run a self adjustment.
Short summary of the steps:
Adjustment
Save
in the menu and choose slot #1When asked to short the probes I used short breadboard wire between test point 1 and test point 2, and between test point 2 and test point 3 in the ZIF socket.