LCR-T4 Upgrade

by Palingenesis in Circuits > Tools

20326 Views, 129 Favorites, 0 Comments

LCR-T4 Upgrade

LCR-T4 Upgrade 003.png
LCR-T4 Upgrade 004.png

This Instructable is about upgrading a Chines version (LCR-T4) of the Transistor Tester.

  • I will show how to upgrade the firmware.
  • I have also modified it to run on a 3.7 volts rechargeable battery.
  • All this is placed in a Case I designed.

The firmware used to upgraded the LCR-T4 is found here:

I have done some modifications to the original, my fork of the source is here:

Requirements

  • Some knowledge of programming will help (Not required, full instruction is given).
  • Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11 (pain in the A) is best, as that is what I now have now, this is so WSL (The Windows Subsystem for Linux) can be installed.
  • Some parts of the Instructable uses Linux. (It is easier than changing code to be windows compatible)
  • If you just want to do exactly as I have done there will be no need for Linux.
  • There is some soldering of tiny SMD (Surface Mount Device), A steady hand is required.
  • Arduino IDE version 1.8.19 should be installed. If the IDE is not installed in the default location some file paths may need to be altered.
  • We are not going to use the Arduino IDE to program the LCR-T4.
  • We use the Arduinos IDE copy of AVRDUDE installed to program the LCR-T4.
  • Using the Arduino IDE's copy of AVRDUDE keeps us on the same page so to speak.

I say that we need Linux, but it is not totally true.

  • I have actually created the HEX and EEP files needed to upgrade the Tester.
  • I thought I would go through the procedure on how to make them, so that should you have your own preferences, you could create your own.
  • There is quite a comprehensive list of choices when creating the firmware.

I have attached here is the manual you get with the Chinese Clone also the Manual for the Transistor Tester.

  • There are more mods that can be done to the Transistor Tester, hopefully this Instructable may help you decide if you want to go further with the project.

Supplies

LCR-T4 Upgrade 003.png
USBasp.png
Li-Po_Battery_01.png
HW-107 Li-Po Charger + Protection.png
Switch DPDT.png
MT3608.png
Cable.png
My 3D Printer.png
Screws.png

Obviously because this is about the Chinese Version of the Component Tester LCR-T4, you will need one of these.

By the way I think LCR-T4 stands for?

  • (L) Inductors
  • (C) Capacitors
  • (R) Resistors
  • (T4) Model number. Could be Transistor or Tester, version 4.

To Program it you will need a USBasp.

One 3.7 volts Li-Po battery.

  • I have designed the case to take the type and size as the one shown.

One Charger Module.

  • I have used the HW-107.
  • This one also has the Charge/Discharge protection circuit on it.

One Toggle Switch.

  • I have used what I had, I think most are a standard size, mine looks like the image.
  • I always us a switch with a Li-Po battery that has a Boost attached to it.

One Boost Module.

  • I have used an MT3608.
  • The tester runs at 5 volts.

Some Cable to connect things together.

  • The tester does not use much current so most of the cable does not need to be to thick.
  • The charger to the battery may have 5 volts 1 amp.

A 3D Printer to print the Box.

Some Screws to screw the Case together.

  • I have used M1.7 x 10mm Self Tapping Screws.

Soldering Iron and general electronics tools.

Downloads

Download Binary Files

LCR-T4 Upgrade 005.png

I will start with uploading firmware to the LCR-T4 using the Firmware I have created.

  • Later I will show you how to make your own version of the firmware. You may have another version of the tester you want to try and upgrade.
  • The process will be the same to upload your own version of firmware, only the files used will be different.
  • I do this now as you may be happy with just upgrading to what I have done and don't need to know how to make your own firmware.
  • If you are just doing what I have done you don't need to make your own firmware. No need for Linux.
  • The files needed are attached.

The GitHub Repositor for the files can be found here: kubi48/TransistorTester-source: Sources of the Transistor Tester project (github.com)

I have a fork from there which is here: Palingenesis/TransistorTester-source: Sources of the Transistor Tester project (github.com)

  • My fork has the files we will be using, but I have also attached them. Note! The ".txt" extension needs removing, leaving ".eep" extension for the EEPROM File.
  • ".eep" is not a recognized extension here.
  • My version of the firmware has been modified for the Battery modification I have done.
  • I have attached them for those that don't want to try the advanced section and make there own.
  • If you want to try the advanced section, you will need to copy my full repository.

If you don't want to do the battery modification there is pre-made firmware at The GitHub repository:

Identify the ISP Pins

LCR-T4 Upgrade 006.png
LCR-T4 Upgrade 008.png
LCR-T4 Upgrade 007.png

On the PCB are holes for a 6 pin ISP Header.

The ISP Pin Header Holes may be mirrored

I believe there are several versions of this PCB.

  • Well actually I know there are a few Chinese Manufacturer making this, some when copying get things a little different.

It is best to check which version you have.

  • It may have been made so that the header goes on the front under the LCD.
  • It may have been made so that the header goes on the back.
  • But both have the Silkscreen showing the Pin labels on the front under the LCD.

To be able to see the pin labels, you have to de-solder the Backlight LED Pins.

  • Once the Display can be lifted, use a fine permanent marker to write the labels on the back side.
  • Replace the Display once you have identified each pin connection.
  • I am not going to use a standard header in these holes, the display needs to lay flat against the PCB.

Pin Header Fly-Lead

LCR-T4 Upgrade 009.png
LCR-T4 Upgrade 010.png
LCR-T4 Upgrade 013.png
ISP Pin Heaaders.png
LCR-T4 Upgrade 014.png

Some times when I am making stuff, I may not use a dedicated PCB.

  • So I have made my self a header fly-lead.
  • It consists of a Header with cable soldered to it and some fine wire to the end of the cable.
  • I use this to connect to the PCB.
  • I will remove it when done.
  • Doing it this way also means that if the holes are mirrored, it can easily be rectified.
  • I have shown the standard Pinouts for the Headers, the 6 pin will be mirrored if your LCR-T4 was made to have the header on the front.

I use Coloured Nail-Varnish to colour code the connections also.

  • I find colour coding connections and cable reduces errors.

Solder the fly-lead to the pin holes on the PCB and connect the UBBasp for programming.

Program the LCR-T4

LCR-T4 Upgrade 011.png

I am assuming you have the Arduino IDE version 1.8.19 installed.

To program the LCR-T4, we will use the Command Prompt Terminal.

  • In the screenshot I have navigated to the folder I have the Binary Files.
  • In my case it is C:\mega328_T4_v2_st7565_Li-Po>
  • You will need to navigate to where you have saved your copy of the files.

Make sure you have connected the USBasp to the ISP of the LCR-T4.

  • Plug your USBasp into a USB Port.

This is the command to upload the firmware (All one command/one line):

"C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe" -C"C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -p m328p -c usbasp -P usb -U flash:w:"mega328_T4_v2_st7565_Li-Po.hex":i -U eeprom:w:"mega328_T4_v2_st7565_Li-Po.eep":i

What you may need to change:

  • "C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude.exe" Check that the path is correct.
  • "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" Check that the path is correct.
  • "mega328_T4_v2_st7565_Li-Po.hex" This is my version of the Firmware.
  • "mega328_T4_v2_st7565_Li-Po.eep" This is my version of the Firmware.

When you press enter you should see what is in the screenshot.

When done the LCR-T4 will need calibrating.

Note!

If you want it to continue running off a 9 volts battery you need to use the other firmware.

Please note that I used "Windows Power Shell" in the screenshot.

  • If using "Windows Power Shell" put "& " in front of the command. (there is a space after &)

Calibration

LCR-T4 Upgrade 012.png
Calibrate 001.png
Calibrate 002.png
Calibrate 003.png
Calibrate 004.png
Calibrate 005.png
Calibrate 006.png
Calibrate 007.png
Calibrate 008.png

To calibrate you will need some bent tinned wire (see image).

  • Also 2 capacitors, I assume you have some, otherwise why have a tester :)
  • One capacitor greater than 100nF.
  • One capacitor between 4nF and 30nF.

Calibration

Note!

  • Do the change quickly. otherwise it will timeout.
  1. Place the bent piece of wire into the sockets of 1,2 and 3. (Or you can wait until it asks.)
  2. Hold the "Test" button down until "Selection:" appears. Then let go of the button.
  3. Click the "Test" button until the cursor ">" is next to "Self test".
  4. Hold the "Test" button until "Short Probes !" appears.
  5. If you haven't already: Place the bent piece of wire into the sockets of 1,2 and 3.
  6. Wait while it does a few routines.
  7. When you see the message "T4 isolate Probe". Remove the bent piece of wire.
  8. Wait while it does a few routines.
  9. When you see the message "1 <capacitor symbol> 3 > 100nF" Place a Capacitor greater than 100nF in sockets 1 and 3.
  10. Wait while it does a few routines.
  11. When you see the message "1 <capacitor symbol> 3 > 4-30nF" replace the 100nF with a Capacitor between 4nF and 30nF in sockets 1 and 3.
  12. Wait for the message "Version 1.13k Test End". (This happens quick)
  13. Remove the Capacitor. The menu should appear.
  14. Click the "Test" button until the cursor ">" is next to "Contrast"
  15. Hold the "Test" button until "Contrast" appears and a number.
  16. Click the "Test" button to change the value of the "Number". The "Number" can only be changed in one direction, if you go too far, keep clicking the button until it starts from the beginning again.
  17. Once you are happy with the contrast. Hold the "Test" button down until you return to the menu again.
  18. Click the "Test" button until the cursor ">" is next to "Switch off" of "Transistor". what ever you prefer.

You Tester should now be calibrated.

Note!

  • If you are going to do the advanced part of the Instructable, make a note of the number that was set for the Contrast. This number can be set if you make your own version of the firmware.

Modification for Li-Po Battery

Circuit 001.png
Resistor Mod 001.png
Resistor Mod 002.png
Circuit 002.png

The modification for the Li-Po Battery, needs a resistor repositioning.

  • This resistor is small 2012(metric) SMD in millimetres is: 2mm x 1.2mm.
  • The value of the resistor is 10K.
  • If you unable to solder something this small, you can remove it and use a norm through hole resistor instead.

If we look at the circuit.

  • We can see that the Resistor R3 (10k) is connected to the 9 Volts Battery via Q1.
  • We can see that the Resistor R3 (10k) is connected to the to the input of U1.
  • This resistor is part of a voltage divider to give a reference voltage of 2.25 volts (when the power supply is 9 volts) to pin 28 of the microcontroller.
  • The modification requires that the Resistor R3 is not connected to U1 and Q1.
  • I will be connecting the Resistor R3 to the Li-Po battery.

What we need to do is move the Resistor R3.

  • Once we move the Resistor R3, we attach a wire to the floating end of the Resistor R3.
  • This will but the Resistor in a delicate state, be carful not to pull the wire attached with some force.

The PP3 9v Battery Press-Stud socket is not needed.

  • Replace this with new cable or cut off the Press-Studs.

Hopefully the images show clearly what I have done.

  • I have modified the circuit to show the modification.

New Parts Circuit

LCR-T4 Upgrade_bb.png
LCR-T4 Upgrade_schem.png

I have done this circuit in Fritzing.

  • Doing it in Fritzing helps visualise how it should look.
  • You should check out how it all fits into the Case, to get an idea of the length of the cables.

Note!

The output of the MT3608 should be set to 7 volts.

  • The reason or this is: The LCR-T4 Power is through a Linear-Regulator 78L05 so the input should be above the output, this is to compensate for any voltage drop in the device.

Print the Case

LCR-T4 Bottom.png
LCR-T4 Top.png
LCR-T4 Upgrade 002.png
LCR-T4 Upgrade_Text.png

Print the two parts of the case.

Once you have Printed the parts, you may want to add some decals.

I have done a PDF and SVG with the text I used.

  • You may want to change and print your own text.

Part Locations [Switch]

Fit Parts 001.png

You may want to do a test run fitting things together to work out the lengths of cable you need.

  • You will want to solder all the parts together before fitting the parts.

The switch should be first as this may be a little tricky having to screw the nut inside the recess.

  • I put the switch in a recess, so that the lever was sticking out too far.

Part Locations [HW-107] and [MT3608]

Fit Parts 002.png

Next I fit the Charger (HW-107) and the Boost (MT3608)

  • Make sure you have set the Output Voltage of the MT3608 Boost.
  • The Battery Charge fits with the components face down.
  • The USB socket of the HW-107 should fit in the hole.
  • You may want to apply some glue to the end of the HW-107 to keep it in place.

Part Locations [Battery]

Fit Parts 003.png

Next I fit the Battery.

  • Li-Po Batteries like the one I am using here, have a Charge/Discharge Circuit Board inside them.
  • As the charger I am using here, the HW-107 has Charge/Discharge Protection Circuit Built into it. I have removed the one on the battery.
  • This is because this battery is going to be a permanent fixture in this device and I won't be using the battery for anything else.

Part Locations [LCR-T4 Module]

Fit Parts 004.png
Fit Parts 005.png

The LCR-T4 Module should fix over all the other components.

  • There is a recess that it should fit into.
  • Make sure the cables don't stop it from laying flat.
  • The PCB should be set to the bottom edge of the recess.
  • When it is in its correct position, the top of the PCB should be flush with the outer edges. You should be able to see the holes for the screws.

There may be some fettling needed where the wires for the Backlight LED bend around the PCB.

  • I just softened the plastic in that area and let the wires make there own depressions.

Fit the Top

Fit Parts 006.png

To finish off, the top is held in place with four M1.7 x 10 mm self tapping screws.

For the Advanced the Makefile

MakeFile.png

First

If you are going to make your own version of the firmware.

The Firmware for the Component Tester has been made to work with many variants of the Component Tester.

  • In the GitHub Repository are folders in the "trunk" folder.
  • In each folder there is the compiled version of the Firmware for a particular Component Tester.
  • With each set of compiled Firmware there is the Makefile used to compile the Firmware.
  • I will run through some key points of the Makefile I have created.
  • The Makefile I have made is on my fork of the Repository.
  • TransistorTester-source/trunk/mega328_T4_v2_st7565_Li-Po at master · Palingenesis/TransistorTester-source (github.com)
  • It is the Li-Po Mod.
  • I have also changed some of the main files as I did not like the fonts for some of the numbers, I also wanted to add a space after the Icon for the component.

Ok lets have a look at the Makefile for my version of the tester.

###############################################################################
# Makefile for the project TransistorTester
# Edit Tim Jackson.1960 12/12/2023 Added a space after the Icon.
###############################################################################

## General Flags
PROJECT = mega328_T4_v2_st7565_Li-Po

CC = avr-gcc

CPP = avr-g++

CFLAGS = -Wall

# ********************** Änderbare Flags zur Configuration des Transistortesters
# ********************** config options for your Semiconductor tester
# Every changing of this Makefile will result in new compiling the whole
# programs, if you call make or make upload.

# Select your Part-No. for avrdude :
# atmega8  : m8
# atmega168: m168 or m168p
# atmega328: m328 or m328p
# atmega1280: m1280 // see config.h for different port setting
# atmega2560: m2560 // see config.h for different port setting
PARTNO = m328p

# The WITH_MENU option enables a dialog to choose some additional functions.
# Currently a frequency measurement at ATmega Pin PD4, a frequency generator at TP2 ,
# the external voltage measurement and C+ESR measurement can be selected. Of course you can also return to
# the normal transistor tester function and switch off the tester.
CFLAGS += -DWITH_MENU
#
# For ATmega328 the menu function "rotary encoder check" is only enabled with the WITH_ROTARY_CHECK option.
#CFLAGS += -DWITH_ROTARY_CHECK
#
# Option NO_FREQ_COUNTER will disable the frequency counter function.
CFLAGS += -DNO_FREQ_COUNTER

# With the menu item "Show data" the used icons and the font data are displayed for
# graphical displays after the presentation of calibration data.
# You can switch off the presentation of the icons and the font data by setting
# the option NO_ICONS_DEMO to save flash memory and display time.
CFLAGS += -DNO_ICONS_DEMO

# The menu function can be easier controlled with a incremental encoder (rotary switch).
# Both switches of the rotary switch can be connected with 1 kOhm resistors to PD1 and PD3.
# The common contact of the two switches must be connected to GND.
# You must also connect both switch contacts with two 10 kOhm resistors to VCC (pull up).
# The best choise is a incremental encoder with Push Button. The button can be connected
# parallel to the start key of the Transistor Tester.
# A define of the WITH_ROTARY_SWITCH enable the support for this extension.
# If your encoder has the same count of pulses at any switch as indexed positions (detent) for every turn,
# you should set the WITH_ROTARY_SWITCH to 2 or 3.
# If your encoder has twice the count of indexed positions, you should set the WITH_ROTARY_COUNT to 1.
# For rotary encoder without indexed position or with an indexed position at every change of
# the state of any switches (four times the count of pulses) you can set the
# WITH_ROTARY_COUNT to 5 for getting the best resolution.
# You can also use two separate push-buttons for Up and Down instead ot the rotary encoder.
# You must set the WITH_ROTARY_SWITCH to 4 for the UP/DOWN push-buttons.
CFLAGS += -DWITH_ROTARY_SWITCH=2
# the option CHANGE_ROTARY_DIRECTION changes the rotary direction by swap of switches
#CFLAGS += -DCHANGE_ROTARY_DIRECTION
# The best solution for connecting the rotary switch is PD1 and PD3, because this setting can be used
# with character and ST7565 LCD. But the first draft has used PD2 instead of PD1.
# To return to the old setting, you can override the PD1 default setting with the following setting:
# CFLAGS += -DROTARY_2_PIN=PD2

# Select your language:
# Available languages are: LANG_BRASIL, LANG_CZECH, LANG_DANISH, LANG_DUTCH, LANG_ENGLISH, LANG_GERMAN, 
#                          LANG_FRANCAIS, LANG_HUNGARIAN,
#                          LANG_ITALIAN,LANG_LITHUANIAN, LANG_POLISH, LANG_RUSSIAN , LANG_SLOVAK, LANG_SLOVENE,
#                          LANG_SPANISH, LANG_UKRAINIAN
UI_LANGUAGE = LANG_ENGLISH

# The LCD_CYRILLIC option is necessary, if you have a display with cyrillic characterset.
# This lcd-display don't have a character for Ohm and for µ (micro).
# Russian language requires a LCD controller with russian characterset and option LCD_CYRILLIC!
#CFLAGS += -DLCD_CYRILLIC

# The LCD_DOGM option must be set for support of the DOG-M type of LCD modules with ST7036 controller.
# For this LCD type the contrast must be set with software command.
#CFLAGS += -DLCD_DOGM

# Can be used with a 4x20 character display for better using the additional space.
# Additional parameters, which are shown only short in row 2, will be shown in row 3 and 4 with this option.
CFLAGS += -DFOUR_LINE_LCD
#CFLAGS += -DLCD_LINE_LENGTH=20

# Some character display types have a different DD_RAM start adress for line 1. 
# Usually the DD_RAM start address for line 1 is 0.
# You can specify a different start address with the option DD_RAM_OFFSET
#DD_RAM_OFFSET=128

# The PAGE_MODE activates a moving line cursor for menu function selection together with FOUR_LINE_LCD
# and WITH_ROTARY_SWITCH.
# Without the PAGE_MODE option, the line cursor is fixed to line 3 and the text moves.
#CFLAGS += -DPAGE_MODE

# The LCD_ST7565 option must be set to support a 128x64 LCD graphics display
# with ST7565 controller. It is controlled with a 1-bit interface (SPI or I2C)
# The normal ST7565 controller will be supported by setting the WITH_LCD_ST7565 to 1 or 7565.
# The special action for a simular SSD1306 controller can be activated by
# setting the WITH_LCD_ST7565 variable to 1306.
WITH_LCD_ST7565 = 1
#WITH_LCD_ST7565 = 1306

# Normally the ST7565 controller is connected with a SPI 4-wire interface, but
# you can enable a I2C interface with address 0x3c for the SSD1306 controller 
# by setting the LCD_INTERFACE_MODE to 2.
# The SCL signal is available at PD5 (LCD-E, LCD-6), the SDA signal at PD2 (LCD-D6, LCD-13).
# A pull up resistor of about 4.7k is required for both signals to 3.3V.
# Please check, if your display module can also tolerate a 5V signal level.
# For the ST7920 controller you can select the serial interface by setting the LCD_INTERFACE_MODE to 5 . 
# ST7920-RW <--> PD2 , ST7920-E <--> PD5 , ST7920-PSB <--> GND , ST7920-RS <--> VCC , ST7920-RST <--> VCC
# For the PDF8814 controller you can also select a 3 for the 3-line serial interface with RS (D/C) as first bit.
# The RS (data/command) signal at PD1 is used as chip enable SCE.
#CFLAGS += -DLCD_INTERFACE_MODE=2

# With the option LCD_SPI_OPEN_COL the data signals of the SPI interface are not switched to VCC.
# With option LCD_SPI_OPEN_COL the signals are switched to GND only, for high signals the pullup resistors
# of the ATmega are used. For the RESET signal a external pull-up resistor is required, if the
# option PULLUP_DISABLE is set. For the other signals the internal pullup resistors of the ATmega
# are temporary used, even if option PULLUP_DISABLE is set.
#CFLAGS += -DLCD_SPI_OPEN_COL

# The I2C Address can be preset to a address of 0x3d instead of 0x3c by setting the constant LCD_I2C_ADDR.
#CFLAGS += -DLCD_I2C_ADDR=0x3d

# If LCD_ST7565 option is used: Set the resitor ratio for the internal
# voltage regulator. Supported value range: 0..7.
# Good values are e.g. 4 or 7. If unsure just have a try.
LCD_ST7565_RESISTOR_RATIO = 4

# If LCD_ST7565 option is set to 1: Flip the display's horizontal direction.
#CFLAGS += -DLCD_ST7565_H_FLIP=1
# With LCD_ST7565_H_OFFSET you can specify a horizontal pixel offset to the display window.
# The controller knows 132 horizontal pixel, the window shows only 128 pixel.
# OFFSET values can vary for the connected display type to 0, 2 or 4.
CFLAGS += -DLCD_ST7565_H_OFFSET=0
# If LCD_ST7565 option is set to 1: Flip the display's vertical direction
#CFLAGS += -DLCD_ST7565_V_FLIP=1
# The contrast value can be predefined with the constant VOLUME_VALUE
# for ST7565 controller the value can be between 0 and 63, for the SSD1306 0 to 255 can be selected.
CFLAGS += -DVOLUME_VALUE=40

# You can specify a Y start line (vertical address) for the display output with the option LCD_ST7565_Y_START.
# If your output start in the middle of the display, you can specify a Y_START of 32
#CFLAGS += -DLCD_ST7565_Y_START=32

# If option WITH_LCD_ST7565 is present one of the following fonts should be
# choosen. With a font width below 8 more than 16 characters can be shown in one display line.
#CFLAGS += -DFONT_5X8
#CFLAGS += -DFONT_6X8
#CFLAGS += -DFONT_8X8
#CFLAGS += -DFONT_7X12
#CFLAGS += -DFONT_8X12thin
#CFLAGS += -DFONT_8X14
CFLAGS += -DFONT_8X15
#CFLAGS += -DFONT_8X16
#CFLAGS += -DFONT_8X16thin

# There are also different 24x32 pixel icons for presentation of the transistor symbols available.
# you can select a special type with setting the ICON_TYPE.
# Currently you can select 1 or 3 for one of two thin layouts for the icons.
# You can also select two thick layouts for the icons by setting the ICON_TYPE to 2 or 0 (0=old style).
CFLAGS += -DICON_TYPE=3

# I (Tim) found that the text of the results look a little close to the large Icon on the left.
# I (Tim) decided to add a space between the Icon and the text.
# If you dont want the space, just comment out or change the value to zero.
# The value is in pixels.
CFLAGS += -DSPACE_FROM_ICON=6

# option BIG_TP makes the 123 for the test pins (beside the icon) bigger
CFLAGS += -DBIG_TP
# option INVERSE_TP inverse the 123 for the test pins (black on white)
# the option INVERSE_TP disable the option BIG_TP because a frame is required
CFLAGS += -DINVERSE_TP

# Option STRIP_GRID_BOARD selects different board-layout, do not set for standard board!
# The connection of LCD is totally different for both versions.
#CFLAGS += -DSTRIP_GRID_BOARD

# The WITH_SELFTEST option enables selftest function (only for mega168 or mega328) including the calibration.
# Normally the mega168 uses selftest without T1 to T7 to enable both hFE measurements.
CFLAGS += -DWITH_SELFTEST
# You can enable the extended tests T1 to T7 for the atmega168 by selecting the  NO_COMMON_COLLECTOR_HFE  option.
# The T1 to T7 tests are usefull to find problems with your tester.
# You can also disable the extended tests T1 to T7 with the option NO_TEST_T1_T7 to accelerate the calibration
# for the atmega328 and atmega168.
#CFLAGS += -DNO_TEST_T1_T7

# FREQUENCY_50HZ enables a 50 Hz frequency generator for up to one minute at the end of selftests.
#CFLAGS += -DFREQUENCY_50HZ

#CFLAGS += -DNO_COMMON_COLLECTOR_HFE
#CFLAGS += -DNO_COMMON_EMITTER_HFE

# AUTO_CAL will enable the autocalibration of zero offset of capacity measurement and
# also the port output resistance values will be find out in SELFTEST section.
# With a external capacitor a additionally correction of reference voltage is figured out for 
# low capacity measurement and also for the AUTOSCALE_ADC measurement.
# The AUTO_CAL option is only selectable for mega168 and mega328.
CFLAGS += -DAUTO_CAL

# The tester reports the uncalibrated state with a message after testing a part.
# Normally a long text is shown, which explains the steps of calibration.
# You can prevent the long explanation by setting the SHORT_UNCAL_MSG option.
# With this option set, only a hint of one line is shown.
CFLAGS += -DSHORT_UNCAL_MSG

# You can extend the measurement feature by use of a sampling mode for the ADC converter
# to extend the resolution of capacity measurement to about 0.01pF.
# Setting the WITH_SamplinADC to 1 enables this feature for capacity values below 100pF.
WITH_SamplingADC = 1

# Option WITH_XTAL enables additional Xtal / Ceramic resonator tests.
# Option can be set only together with SamplingADC=1 and OP_MHZ=16
#CFLAGS += -DWITH_XTAL 
# Option WITH_UJT enables additional tests for UJT (UniJunction Transistor)
#CFLAGS += -DWITH_UJT
# Option WITH_PUT enables additional tests for PUT (Programmable Unijunction Transistor)
#CFLAGS += -DWITH_PUT
# Option FET_Idss will measure the Idss parameter for FETs, if not estimated > 40mA.
CFLAGS += -DFET_Idss

# The WITH_AUTO_REF option enables reading of internal REF-voltage to get factors for the Capacity measuring.
CFLAGS += -DWITH_AUTO_REF
# REF_C_KORR corrects the reference Voltage for capacity measurement (<40uF) and has mV units.
# Greater values gives lower capacity results.
CFLAGS += -DREF_C_KORR=12
# REF_L_KORR corrects the reference Voltage for inductance measurement and has mV units.
CFLAGS += -DREF_L_KORR=40
# C_H_KORR defines a correction of 0.1% units for big capacitor measurement.
# Positive values will reduce measurement results.
CFLAGS += -DC_H_KORR=0

# The WITH_UART option enables the software UART  (TTL level output at Pin PC3, 26).
# You can set WITH_UART to 2 to enable a special mode of serial output with line number in column 1.
# If the option is deselected, PC3 can be used as external voltage input with a
# 10:1 resistor divider.
#CFLAGS += -DWITH_UART

# With option TQFP_ADC6 or/and TQFP_ADC7 you can use the additional pins of the TQFP or
# the QFN package for external analog input. You should install a 10:1 voltage dividers
# on the selected pin(s).
# If both pins are defined, both voltages are measured with the voltage measure function.
# But for zener diode measurement the ADC6 pin is used, if both pins are defined.
#CFLAGS += -DTQFP_ADC6

# For ATmega8/168/328 processor the option WITH_VEXT can only be set, if the PC3 pin
# is not used for serial output (WITH_UART option).
# For ATmega644/1284 processor the UART has a separate pin.  Therefore the external input
# at pin ADC3 can be enabled separate by setting the WITH_UART option.
#CFLAGS += -DWITH_VEXT

#
# If you want to measure Inductors with the resistance meter, you must specify
# the RMETER_WITH_L  option. The measurement cycle time slow down with this option
# for resistors below 2.1kOhm. Resistors below 10 Ohm are measured additionally
# with the ESR measurement methode, which takes also a longer time.
CFLAGS += -DRMETER_WITH_L

# The CAP_EMPTY_LEVEL  defines the empty voltage level for capacitors in mV.
# Choose a higher value, if your Tester reports "Cell!" by unloading capacitors.
CFLAGS += -DCAP_EMPTY_LEVEL=4

# The AUTOSCALE_ADC option enables the autoscale ADC (ADC use VCC and Bandgap Ref).
CFLAGS += -DAUTOSCALE_ADC
CFLAGS += -DREF_R_KORR=3

# The ESR_ZERO value define the zero value of ESR measurement (units = 0.01 Ohm).
#CFLAGS += -DESR_ZERO=29
CFLAGS += -DESR_ZERO=20

# NO_AREF_CAP tells your Software, that you have no Capacitor installed at pin AREF (21).
# This enables a shorter wait-time for AUTOSCALE_ADC function.
# A capacitor with 1nF can be used with the option NO_AREF_CAP set.
CFLAGS += -DNO_AREF_CAP

# The OP_MHZ option tells the software the Operating Frequency of your ATmega.
OP_MHZ = 8

# Restart from sleep mode will be delayed for 16384 clock tics with crystal mode.
# Operation with the internal RC-Generator or external clock will delay the restart by only 6 clock tics.
# You must specify this with "CFLAGS += -DRESTART_DELAY_TICS=6", if you don't use the crystal mode.
#CFLAGS += -DRESTART_DELAY_TICS=6

# The USE_EEPROM option specify where you wish to locate fix text and tables.
# If USE_EEPROM is unset, program memory (flash) is taken for fix text and tables.
CFLAGS += -DUSE_EEPROM

# Setting EBC_STYPE will select the old style to present the order of Transistor connection (EBC=...).
# Omitting the option will select the 123=... style.  Every point is replaced by a character identifying 
# type of connected transistor pin (B=Base, E=Emitter, C=Collector, G=Gate, S=Source, D=Drain).
# If you select EBC_STYLE=321 , the style will be 321=... , the inverted order to the 123=... style.
#CFLAGS += -DEBC_STYLE
#CFLAGS += -DEBC_STYLE=321

# Setting of NO_NANO avoids the use of n as prefix for Farad (nF), the mikro prefix is used instead (uF).
# CFLAGS += -DNO_NANO

# With graphical displays the layout of pins is usually shown in long style " Pin  1=E 2=B 3=C"
# With the NO_LONG_PINLAYOUT option the short style "Pin 123=EBC" is used
CFLAGS += -DNO_LONG_PINLAYOUT

# The PULLUP_DISABLE option disable the pull-up Resistors of IO-Ports.
# To use this option a external pull-up Resistor (10k to 30k)
# from Pin 13 to VCC must be installed!
#CFLAGS += -DPULLUP_DISABLE

# The ANZ_MESS option specifies, how often an ADC value is read and accumulated.
# Possible values of ANZ_MESS are 5 to 200 .
CFLAGS += -DANZ_MESS=25

# The POWER_OFF option enables the power off function, otherwise loop measurements infinitely
# until power is disconnected with a ON/OFF switch (CFLAGS += -DPOWER_OFF).
# If you have the tester without the power off transistors, you can deselect POWER_OFF .
# If you have NOT selected the POWER_OFF option with the transistors installed,
# you can stop measuring by holding the key several seconds after a result is
# displayed. After releasing the key, the tester will be shut off by timeout.
# Otherwise you can also specify, after how many measurements without found part
# the tester will shut down (CFLAGS += -DPOWER_OFF=5).
# The tester will also shut down with found part,
# but successfull measurements are allowed double of the specified number.
#  You can specify up to 255 empty measurements (CFLAGS += -DPOWER_OFF=255).
#CFLAGS += -DPOWER_OFF=5
CFLAGS += -DPOWER_OFF

# Option BAT_CHECK enables the Battery Voltage Check, otherwise the SW Version is displayed instead of Bat.
# BAT_CHECK should be set for battery powered tester version.
CFLAGS += -DBAT_CHECK

# The BAT_OUT option 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 of your diode to adjust the output value.
# This threshold level is added to LCD-output and does not affect the voltage checking levels.
CFLAGS += -DBAT_OUT=150

# To adjust the warning-level and poor-level of battery check to the capability of a
# low drop voltage regulator, you can specify the Option BAT_POOR=5400 .
# The unit for this option value is 1mV , 5400 means a poor level of 5.4V.
# The warning level is 0.8V higher than the specified poor level (>5.3V).
# The warning level is 0.4V higher than the specified poor level (>2.9V, <=5.3V).
# The warning level is 0.2V higher than the specified poor level (>1.3V, <=2.9V).
# The warning level is 0.1V higher than the specified poor level (<=1.3V).
# Setting the poor level to low values is not recommended for rechargeable Batteries,
# because this increase the danger for deep discharge!!
CFLAGS += -DBAT_POOR=3200

# You can set a upper battery voltage limit in mV units for battery operation mode.
# The operation time of additional functions is limited with the battery operation mode. 
# Above the voltage limit "DC_PWR" the tester changes the operation mode to the
# "DC_Pwr_Mode", where time limits of the additional functions are switched off.
# The "DC_Pwr_Mode" is also started, if the battery voltage is detected below 0.9V
# regardless to the state of the DC_PWR option.
#CFLAGS += -DDC_PWR=4200

# Voltage divider for battery voltage measurement  10k / 3.3k = 133/33
CFLAGS += -DBAT_NUMERATOR=133
CFLAGS += -DBAT_DENOMINATOR=33
# Voltage divider for the external zener voltage measurement 180k / 20k = 10/1
#CFLAGS += -DEXT_NUMERATOR=10
#CFLAGS += -DEXT_DENOMINATOR=1

# The sleep mode of the ATmega168 or ATmega328 is normally used by the software to save current.
# You can inhibit this with the option INHIBIT_SLEEP_MODE .
INHIBIT_SLEEP_MODE = 0

# Select your programmer type, speed and port, if you wish to use avrdude.
# setting for DIAMEX ALL_AVR, Atmel AVRISP-mkII
PROGRAMMER=avrispmkII
BitClock=1.0
PORT=usb
# setting for USBasp
#PROGRAMMER=usbasp
#BitClock=20
#PORT=usb
# setting for ARDUINO MEGA, requires bootloader
#PROGRAMMER=wiring
#PORT = /dev/ttyACM0
#BitClock=5.0
#AVRDUDE_BAUD = -b 115200 -D
# ********************** end of selectable options

include ../setup.mk

########### Compile C or Assembler , Assembler saves more than 400 bytes flash
$(OBJDIR)/GetRLmultip.o: ../GetRLmultip.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/UfAusgabe.o: ../UfAusgabe.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/RvalOut.o: ../RvalOut.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/PinLayout.o: ../PinLayout.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/RefVoltage.o: ../RefVoltage.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/i2lcd.o: ../i2lcd.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/ReadADC.o: ../ReadADC.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/sleep_5ms.o: ../sleep_5ms.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/wait_for_key_ms.o: ../wait_for_key_ms.c $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

$(OBJDIR)/get_log.o: ../get_log.S $(MKFILES)
$(CC) $(INCLUDES) $(CFLAGS) -c -o $@ $<

include ../finish.mk

You will see many options, most of which are to be set depending on which components the Component Tester has been created with.

  • I will just go through a few for you to try using the LCR-T4.
  • If you decide to experiment, copy the folder "mega328_T4_v2_st7565_Li-Po" and give it a name of your choice.
  • To keep the naming convention, your new name should start "mega328_T4_v2_st7565_YourNameHere".

The "#" denotes a comment.

  • Everything after a "#" is ignored.
  • This is how choices are made.
  • Comment out what is not used by Make.
  • Un-Comment what is used by Make.
###############################################################################
# Makefile for the project TransistorTester
# Edit Tim Jackson.1960 12/12/2023 Added a space after the Icon.
###############################################################################

## General Flags
PROJECT = mega328_T4_v2_st7565_Li-Po

In the top section where it is all comments, you may want to type some notes about the changes you have made.

PROJECT should equal the same name as you made the folder name.

  • we are keeping with the naming convention, this is what the Firmware files will be called.
# Select your Part-No. for avrdude :
# atmega8 : m8
# atmega168: m168 or m168p
# atmega328: m328 or m328p
# atmega1280: m1280 // see config.h for different port setting
# atmega2560: m2560 // see config.h for different port setting
PARTNO = m328p

PARTNO is the chip that is used for the Component Tester.

  • This should not change, unless you are building your own and using a different chip
  • Maybe you want to make one with an Arduino Uno, if you do, there is already a folder made to start you off.
# Select your language:
# Available languages are: LANG_BRASIL, LANG_CZECH, LANG_DANISH, LANG_DUTCH, LANG_ENGLISH, LANG_GERMAN, 
#             LANG_FRANCAIS, LANG_HUNGARIAN,
#             LANG_ITALIAN,LANG_LITHUANIAN, LANG_POLISH, LANG_RUSSIAN , LANG_SLOVAK, LANG_SLOVENE,
#             LANG_SPANISH, LANG_UKRAINIAN
UI_LANGUAGE = LANG_ENGLISH

This will be important for those who don't want English.

Make UI_LANGUAGE equal a language from the choices given.

The Flags for tuning things on or off.

  • The CFLAGS is one big string, as the the compiler (Make) reads through the Makefile you can see that each option is added to the string "CFLAGS" with the "+=".
  • Each option is denoted by "-D" followed by the Definition. The Definition may have a value.
# The contrast value can be predefined with the constant VOLUME_VALUE
# for ST7565 controller the value can be between 0 and 63, for the SSD1306 0 to 255 can be selected.
CFLAGS += -DVOLUME_VALUE=40

If you remember when we where calibrating the Component tester, I mentioned to make a note of the value when setting the contrast.

  • Set this value to that value.
  • It will save you having to set the contrast should you make more changes.
# If option WITH_LCD_ST7565 is present one of the following fonts should be
# choosen. With a font width below 8 more than 16 characters can be shown in one display line.
#CFLAGS += -DFONT_5X8
#CFLAGS += -DFONT_6X8
#CFLAGS += -DFONT_8X8
#CFLAGS += -DFONT_7X12
#CFLAGS += -DFONT_8X12thin
#CFLAGS += -DFONT_8X14
CFLAGS += -DFONT_8X15
#CFLAGS += -DFONT_8X16
#CFLAGS += -DFONT_8X16thin

option WITH_LCD_ST7565 is present.

  • You could reduce the size of the font or make it thinner if you wish, if you have good eyesight.
  • Just have the one you want uncommented.
# There are also different 24x32 pixel icons for presentation of the transistor symbols available.
# you can select a special type with setting the ICON_TYPE.
# Currently you can select 1 or 3 for one of two thin layouts for the icons.
# You can also select two thick layouts for the icons by setting the ICON_TYPE to 2 or 0 (0=old style).
CFLAGS += -DICON_TYPE=3

There a several types of Icon you see for the component being tested.

  • You can change this to see if you prefer the other.
#	I (Tim) found that the text of the results look a little close to the large Icon on the left.
# I (Tim) decided to add a space between the Icon and the text.
# If you dont want the space, just comment out or change the value to zero.
# The value is in pixels.
CFLAGS += -DSPACE_FROM_ICON=6

I have added this.

  • I didn't like how close the text of the results where to the Icon of the component.
  • My eyes are not as good as they where.
# option BIG_TP makes the 123 for the test pins (beside the icon) bigger
CFLAGS += -DBIG_TP
# option INVERSE_TP inverse the 123 for the test pins (black on white)
# the option INVERSE_TP disable the option BIG_TP because a frame is required
CFLAGS += -DINVERSE_TP

You may want to play with this.

  • This is where I made changes to the main files of the Repository.
  • The inverted font did not look right to me, so I changed them.
# The tester reports the uncalibrated state with a message after testing a part.
# Normally a long text is shown, which explains the steps of calibration.
# You can prevent the long explanation by setting the SHORT_UNCAL_MSG option.
# With this option set, only a hint of one line is shown.
CFLAGS += -DSHORT_UNCAL_MSG

Basically as I have it set here, it just says "Not Calibrated" if you haven't calibrated the Component Tester.

  • If you comment this out, you have to wait for several screens that explain in bad translated German how to calibrate it.
# Option BAT_CHECK enables the Battery Voltage Check, otherwise the SW Version is displayed instead of Bat.
# BAT_CHECK should be set for battery powered tester version.
CFLAGS += -DBAT_CHECK

As I am using a rechargeable Li-Po Battery, I have it set to check the voltage of the battery.

  • That's why I did the modification, haha.
# The BAT_OUT option 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 of your diode to adjust the output value.
# This threshold level is added to LCD-output and does not affect the voltage checking levels.
CFLAGS += -DBAT_OUT=150

In the comments here, it is just going on that the LCR-T4 has to diodes to drop the voltage to the screen.

# To adjust the warning-level and poor-level of battery check to the capability of a
# low drop voltage regulator, you can specify the Option BAT_POOR=5400 .
# The unit for this option value is 1mV , 5400 means a poor level of 5.4V.
# The warning level is 0.8V higher than the specified poor level (>5.3V).
# The warning level is 0.4V higher than the specified poor level (>2.9V, <=5.3V).
# The warning level is 0.2V higher than the specified poor level (>1.3V, <=2.9V).
# The warning level is 0.1V higher than the specified poor level (<=1.3V).
# Setting the poor level to low values is not recommended for rechargeable Batteries,
# because this increase the danger for deep discharge!!
CFLAGS += -DBAT_POOR=3200

This is the warning level of the battery.

  • As I have changed to a 3.7 volts Li-Po battery, I have changed the value to 3200, which equals 3.2 volts.

This makes sense # The unit for this option value is 1mV , 5400 means a poor level of 5.4V.

  • But the rest read like Yoda to me.
  • What it is saying is:
  • If the BAT_POOR is set grater than 5.3 volts, a warning will be given within 0.8 volts of the setting.
  • If the BAT_POOR is set grater than 2.9 volts and less than or equal to 5.3 volts, a warning will be given within 0.4 volts of the setting.
  • If the BAT_POOR is set grater than 1.3 volts and less than or equal to 2.9 volts, a warning will be given within 0.2 volts of the setting.
  • If the BAT_POOR is set less than or equal to 1.3 volts, a warning will be given within 0.1 volts of the setting.

As I have it set at 3.2 volts, there will be warnings if the battery gets as low as 3.6 volts.

  • When it get as low as 3.2 volts, the component tester will not turn on.
# Voltage divider for battery voltage measurement 10k / 3.3k = 133/33
CFLAGS += -DBAT_NUMERATOR=133
CFLAGS += -DBAT_DENOMINATOR=33
# Voltage divider for the external zener voltage measurement 180k / 20k = 10/1
#CFLAGS += -DEXT_NUMERATOR=10
#CFLAGS += -DEXT_DENOMINATOR=1

Don't change this, the voltage divider in the LCR-T4 uses a 10k and 3.3k resistor.

To use this file, we need Make run by Linux.

  • The next step is how to install Linux in windows 11.
  • Trying to run a Makefile in windows, is a bit of a pain.

Note!

  • I have attached the Makefile with the ".txt" extension.
  • Remove the ".txt" extension.
  • A Make files could have a ".mk" extension, but those files are not supported here.
  • In this case the file attached should have no extension.

Downloads

Install WSL (Windows Subsystem for Linux)

WSL.png

Check your Windows version:

  • You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.

Open PowerShell or Command Prompt in administrator mode:

  • You can do this by right-clicking and selecting "Run as administrator".

Enter the WSL install command: Type `wsl --install` and press Enter.

  • This command will enable the features necessary to run WSL and install the Ubuntu distribution of Linux.

After the installation is complete, restart your machine.

That's it.

  • Now you can run Linux Applications on Windows.
  • Well if you need special ports or in/outputs, there may be a little more involved.

Note!

During the installation it will install Ubuntu Distribution of Linux by default.

  • It will ask for a "User Name". I recommend keeping it simple.
  • It will ask for a "Password". Use something you can remember easily. Every time you install/Uninstall something it will ask for your password.

Install Make

WSL Ubuntu.png
WSL Ubuntu 001.png
WSL Ubuntu 002.png

To install Make, we will be installing it or your copy of Linux.

  • We will run it from the Linux terminal.

After the installation of WSL (Windows Subsystem For Linux)

  • Windows will have created a shortcut in your start menu.
  • Called "WSL" It has an Icon like? Well it looks like a blue owl to me 😊
  • Called "Ubuntu" has an orange Icon.
  • One of these will start a new type of terminal (WSL) and start Ubuntu running inside the terminal.
  • The first time it may ask you to log in. (Into Ubuntu)

Update the package lists for upgrades and new package installations:

  • Type sudo apt-get update and press Enter.
  • This is to bring your version of Linux up to date.

To install Make:

  • Type sudo apt-get install make and press Enter.

When you make changes to your installation of Linux, In a new session of Linux it will ask for you Password.

  • It will only ask for your password again if you logout (close the terminal).

For Those That Haven't Used Linux

WSL Ubuntu 003.png

Some things to note!

  • Windows uses "\" for separating folder paths.
C:\\Users\\jsmith\\Documents\\file.txt
  • However, modern Windows systems can generally use both “\” and “/” interchangeably for file paths.
  • In windows if you have spaces on a path to a file you can put the path inside "Parenthesis".
  • I actual found in a WSL terminal you can use "Parenthesis" for Linux paths.
  • Linux uses a forward slash “/” as the path separator
/home/jsmith/Documents/file.txt
  • Linux uses "\" to identify spaces.
/home/joe\ smith/Documents/file.txt
  • But as I say I have found we can use "Parenthesis".
"/home/joe smith/Documents/file.txt"


Changing drive

First check drives letters you have (make sure we are on the same page) we get a list of the windows mounted drives.

  • It is the Windows mounted drives we are going to be working on.
  • Type the following and press enter.
ls /mnt/
  • You should see a line with letters, the letters are the mounts (drives). These may have a green background.
c j k t wsl wslg
  • To change to a mount (drive) type the following and press enter. The letter at the end of the command is the drive.
cd /mnt/c
  • You will notice that the command prompt has changed, it now includes the mount (drive) we are on.
tim@TIMS-PC:/mnt/c$


Changing Directory

Changing directory is similar to windows commands. (Just be aware of the "/" and "\" and spaces)

  • To change to a directory use a command similar the following and press enter.
 cd "Users/user/Documents/Visual Studio Projects/_Repositorys/TransistorTester-source/trunk/mega328_T4_v2_st7
565_Li-Po"
  • Notice I have put the path in "Parenthesis" as I have spaces in the path.


Pasting

If you have trouble pasting things into the terminal, the right mouse button may do it.

Make Your Personal Firmware

Make 001.png
Make 002.png

First we open the WSL Ubuntu terminal.

  • We then have to navigate to the cloned repository of the Transistor Tester and the directory where the version of Makefile is that we are going to use.
  • Once in the right directory type the following and press enter.
make
  • The result should look like the screenshot.

Two new files of the Project name should be in this folder.

  • ProjectName.hex
  • ProjectName.eep

Use these files to program your LCR-T4, just as we did in Step 4.

Note!

This directory has to be in the cloned repository, it is linked to all the other file in the repository which it uses to build the firmware.

  • The Makefile is just part of a larger script to build the firmware.