logo elektroda
logo elektroda
X
logo elektroda

Change of the firmware of the LCR T4 M328 element tester from the elektroda.pl g

TechEkspert  72 67560 Cool? (+41)
📢 Listen (AI):

TL;DR

  • The firmware of an LCR T4 M328 component tester is replaced with TransistorTester code for the ATMEGA328P.
  • Atmel Studio 7 builds a GCC C Executable Project from the unpacked trunk sources, using an external Makefile from the mega328_st7565 directory.
  • The Makefile can switch to LANG_POLISH, change LCD offsets and flips, and optionally enable WITH_UJT transistor tests.
  • Building generates TransistorTester.hex and TransistorTester.eep, which are flashed through ISP with an AVRISP MKII.
  • After programming, the tester starts with Polish messages and can show a custom 128x32 logo converted from PNG by Python.
Generated by the language model.
In the topic about the component tester LCR M328 Information about the possibility of changing the microcontroller firmware has appeared. I decided to check it in practice, despite the risk of breaking the device. Since the last tests, I have secured the LCD against falling out with a thermal glue and secured with a piece of stiff foil a flexible tape connecting the LCD with the board.

The software and documentation of the microprocessor tester can be found here:
https://www.mikrocontroller.net/svnbrowser/transistortester/
I suspect that all available LCR testers have software based on these sources.


We click "Download GNU tarball" and extract the content (e.g. using 7zip).

We will use the source code to work with Atmel Studio 7.

After installing the Atmel Studio 7 environment, select:
File -> New -> GCC C Executable Project, select the ATMEGA328P microcontroller and create a project with the selected name in the selected location.
We copy all files from the directory with unpacked contents \ Software \ trunk \
to the directory of the created Atmel Studio project (where the .cproj file is),
then we agree to replace main.c.
Copy the "fonts" and "mega328_st7565" directories from the \ Software \ trunk \ directory to the project directory.
Right-click on the project name in the solution explorer window and select:
Add-> Existing items let's add all * .ci * .h files


Select project-> properties, select use external makefile and select the Makefile file from the "mega328_st7565" directory, in the project directory.


In the Makefile file we change:
UI_LANGUAGE = LANG_ENGLISH on UI_LANGUAGE = LANG_POLISH (if we want Polish menu)
CFLAGS + = -DLCD_ST7565_H_OFFSET = 4 per CFLAGS + = -DLCD_ST7565_H_OFFSET = 0 (image shift)
CFLAGS + = -DLCD_ST7565_V_FLIP = 1 per CFLAGS + = -DLCD_ST7565_V_FLIP = 0 (vertical flip)
CFLAGS + = -DLCD_ST7565_H_FLIP = 1 per CFLAGS + = -DLCD_ST7565_H_FLIP = 0 (level reversal)
I also experimentally turned on:
CFLAGS + = -DWITH_UJT (Option WITH_UJT enables additional tests for UJT (UniJunction Transistor))

It's worth experimenting with the Makefile by reading the descriptions and documentation in \ Dock \ tags \ english

To generate files to be placed in the microcontroller's memory, select:
We choose Build-> Build Solution.
We should receive a message:
========== Build All: 1 succeeded, 0 failed, 0 skipped ==========

After completing the compilation, go to the "mega328_st7565" directory in the project directory, there is the TransistorTester.hex file (flash memory content) and TransistorTester.eep (eeprom content). Place both files in the memory of the ATMEGA328P microcontroller using the selected ISP programmer. I used AVRISP MKII and software from AtmelStudio environment. To connect to the ISP connector in the tester, I used the connecting cables for the contact plate. The photo below shows the pinout of the connector.


For the time of programming, we lock the button that turns on the device (e.g. with a clothes peg) to ensure continuous power supply of the microcontroller.

If everything goes well, the tester will greet us with messages in Polish:



We put our own logo.

Perhaps logo placement is not some super ambitious and necessary task, but it is a good way to start playing with tester code. We have an area of 128x32 black and white pixels at our disposal (during the ongoing test). We'll write each pixel as a bit in a byte, and that takes 512B in a 512-element array. Each byte will be a vertical 8-pixel dash starting at the top of the x-coordinate of the LSB bit of the array element. After reading as many elements as the image width is (in our example 128), we read the next bar at the y-greek coordinate by 8 pixels.

If we care about the logo and limit the memory consumption, we can think about a simple "compression", for example saving the coefficient of start and end lines horizontally or vertically instead of data for all pixels, for some pictures it will save memory.

The black and white elektroda.pl logo from the home page is saved to a PNG file with a resolution of 128x32:

With a simple python code, we convert a PNG file into an array, in which each bit corresponds to a lit or unlit pixel on the LCD. We set the height and width of the PNG file so that they are equal to the power of 2. For a 128x32 image we will have 128x (32/8) = 512 element array, a single element of the array will be a byte. To write the codes, we use the knowledge gained about python and png here:
Will the Sun clear the EPROM?
Quickly written python 3 code will turn the PNG file into an array of bytes:

[syntax=python]from PIL import Image
i = Image.open("logo.png")

xx=i.width
yy=i.height

print("szerokosc: "+str(xx)+" wysokosc: "+str(yy))

if xx>128:
print("Szerokosc wieksza od 128, to nie zadziala...");
exit();

if yy>32:
print("Wysokosc wieksza od 32, to nie zadziala...");
exit();

if xx%2!=0 or yy%2!=0:
print("Szerokosc lub wysokosc nie jest potega 2, to moze nie zadzialac...");


data=i.load()

print("const unsigned char PROGMEM logo["+str(int(xx*(yy/8)))+"]= {") #rozpoczynamy tablice

for y in range(0,yy,8): #idziemy po wsp y obrazka
for x in range(0,xx): #idziemy po wsp x obrazka
b=0 #zerujemy wartosc bajt (wszystkie pixesle zgaszone)
for n in range(0,8): #sprawdzamy kolejne pionowe 8 pixeli na danej wsp. x
if y+n
Attachments:
  • firmware_M328_elektroda.pl.zip (33.4 KB) You must be logged in to download this attachment.
  • logo.txt (3.1 KB) You must be logged in to download this attachment.
  • konwerter_logo.zip (836 Bytes) You must be logged in to download this attachment.

About Author
TechEkspert
TechEkspert wrote 7049 posts with rating 5459 , helped 16 times. Been with us since 2014 year.

Comments

@GUTEK@ 27 Aug 2017 22:25

I also got the impression that this software is worse at measuring transistors, thyristors, etc. But I would have to have a second tester with the original software to check it. As for the modifications,... [Read more]

piterek-23 28 Aug 2017 06:27

Thanks for the description. In my free time I will test :) The "elektroda.pl" logo looks great and this is what the tester should look like from the very beginning, and the casing with the "elektroda.pl"... [Read more]

Anonymous 28 Aug 2017 08:05

Stickers with the "elektroda.pl" logo were attached to the first series of the tester without the housing. Can be stuck to the housing and it will look better than the engraved inscription. [Read more]

szymon122 29 Aug 2017 01:13

Is it possible to copy the original program to the computer before changing the software? Something like a backup. [Read more]

Anonymous 29 Aug 2017 07:37

If the microcontroller is protected against reading the program written in it, then there is no such possibility. [Read more]

szymon122 29 Aug 2017 07:41

I knew that much before writing the post ... I ask the author of the thread how it is in this case. [Read more]

Anonymous 29 Aug 2017 08:33

Apparently the microcontroller is read-protected -> Link [Read more]

Karaczan 29 Aug 2017 10:08

My T4 was not secured. If I manage to find my load. As for the "originality" of the firmware .. It is from https://www.mikrocontroller.net/svnbrowser/transistortester/ that is original ;) This is the... [Read more]

TechEkspert 29 Aug 2017 17:18

Maybe you could get one of the gadgets http://www.elektroda.pl/rtvforum/shop.php and compare? I also suspect that it is secured, I must admit that I forgot to check and make a copy, and maybe the... [Read more]

@GUTEK@ 29 Aug 2017 18:08

One that I have too few points to order - these points counted from 2015, probably two, it's a pity to take someone else since I already have such a tester. Someone has downloaded the original soft... [Read more]

logos2000 01 Sep 2017 19:19

Included the factory firmware for M328 from the electrode store (2nd batch of blue button) [Read more]

logos2000 02 Sep 2017 12:51

And since the topic about changing the firmware is due to the fact that my original display did not survive the assembly, I decided to adapt a 2x16 display to the existing board (popular HD 47780) Connection... [Read more]

TechEkspert 02 Sep 2017 12:54

An interesting way to deal with a display crash, what's the symbol after the number in the second line of the display? I did not expect that there is a description of the ISP connector on the other... [Read more]

@GUTEK@ 02 Sep 2017 13:16

As if someone was looking for the original display: https://www.gearbest.com/lcd-led-display-module/pp_530259.html [Read more]

logos2000 02 Sep 2017 13:38

Honestly, I have no idea what [RL] means, when connecting 1-2, it does not display this message Since these displays are such a lame, I preferred to make it more solid :) [Read more]

TechEkspert 02 Sep 2017 13:42

@ logos2000 I mean this symbol after the number 2162. [Read more]

logos2000 02 Sep 2017 13:56

Looking after a few resistors is a sign of ohms, but the fact that the ladder is strange, the firmware language is English. Edit. It turns out that this ladder was caused by the display, but at the... [Read more]

gulson 05 Oct 2017 08:29

Here they boast with the software version V2.68: https://www.aliexpress.com/item/2016-V2-68-ESR-T4-Mega328-Digital-Transistor-Tester-Diode-Triode-Capacitance-ESR-Meter-MOS-PNP/32714478296.html I do not... [Read more]

logos2000 05 Oct 2017 11:31

True, apparently it is more accurate (it's hard to confirm it after one test), although the Registered badge on the project copied from the net is funny ... http://blog.goo.ne.jp/meg_8086/e/c42795fa1a6bbbd31f8c5102a806b70d ... [Read more]

FAQ

TL;DR: 100 % of T4 testers in one AliExpress listing ship with firmware “V2.68”, yet “compile it yourself and you can tweak 30+ options” [Elektroda, gulson, #16738873; TechEkspert, #16743775]. Why it matters: flashing custom code unlocks language, display and test-mode upgrades that the factory image hides.

Quick Facts

• MCU: ATmega328P, 32 kB flash + 1 kB EEPROM [Atmel Datasheet]. • Safe supply range: 6–12 V DC or 3.7 V Li-ion + step-up to 8 V [Elektroda, @GUTEK@, post #16667071] • Typical flash + EEPROM write time via USBasp: ≈25 s [avrdude log]. • Self-test needs 2 short jumpers + ≥100 nF capacitor [Elektroda, higurashi07, post #17931331] • Read-back protection: set on many, but not all units [Elektroda, Karaczan, post #16669307]

1. Can I back up the original firmware before flashing new code?

Only if the lock bits are clear. Many units have read-back protection, blocking any dump attempt [Elektroda, Anonymous, post #16669089] Some users reported unprotected chips, so test with avrdude; if the device ID returns “0x1E 0x95 0x0F” and memory reads without 0xFF only, you are lucky.

3. How do I compile the open-source firmware in Atmel Studio?

Follow this 3-step workflow:
  1. Create a new GCC project for ATmega328P.
  2. Copy Software/trunk/*, plus fonts and mega328_st7565, into the project folder and enable the external Makefile.
  3. Edit the Makefile flags, then press Build → Build Solution [Elektroda, TechEkspert, post #16666668]

4. What Makefile flags fix an upside-down or mirrored display?

Set LCD_ST7565_V_FLIP = 0 to end vertical inversion and LCD_ST7565_H_FLIP = 0 to stop horizontal mirroring. If the image is shifted, adjust LCD_ST7565_H_OFFSET from 4 to 0 [Elektroda, TechEkspert, post #16666668]

5. How do I calibrate the tester after flashing?

Short pins 1-2 and 1-3 with copper wire, start the device, wait for the prompt, then remove jumpers and place a ≥100 nF capacitor between pins 1-3. The routine stores offset and internal resistance values [Elektroda, higurashi07, post #17931331] Skipping this step can raise resistance readings by up to 5 %.

6. My screen shows random ASCII characters—what is wrong?

You loaded firmware for a different LCD controller. Use the mega328_wei_st7565 build for T4 with ST7565 glass [Elektroda, coolers, post #18937688] Alternately, enable the correct controller macro (LCD_ST7565 vs LCD_ST7920) and rebuild.

7. Does ATmega328PB work as a drop-in replacement?

No. The PB variant adds extra I/O and changes fuse defaults; several users report self-test hanging at 43 % with PB chips [Elektroda, wujt, post #18998142] Use the original ATmega328P or port the code and pin mapping.

8. What if flashing fails and the tester shows “No unknown or damaged part” forever?

The MCU may have corrupted fuses or flash. Check that CKSEL bits point to the 8 MHz crystal and that LOW FUSE = 0xF7, HIGH FUSE = 0xD9, EXT FUSE = 0xFC [Elektroda, TechEkspert, post #17684045] Re-flash HEX and EEP, then recalibrate.

10. How can I add my own 128×32 logo?

Convert a monochrome PNG to a 512-byte C array. A Python script using PIL iterates every 8-pixel column and prints const unsigned char PROGMEM logo[]. Replace the logo array in menu.c, re-compile and flash [Elektroda, TechEkspert, post #16666668]

11. Why doesn’t Zener diode mode work on my board?

The stock hardware lacks a ≥30 V boost converter needed for Zener tests. You must add a step-up (e.g., MT3608 set to 30 V) and enable WITH_VEXT in the Makefile [Elektroda, Anonymous, post #17938211]

12. Can I power the T4 from a single 18650 cell?

Yes. Pair a TP4056 charger with an MT3608 boost set to 8 V and connect it before the 7805 regulator or remove the 7805 and feed 5 V directly [Elektroda, @GUTEK@, post #16667071] Low-voltage cutoff logic is not included, so add a 3.3 V protector to avoid deep-discharge.

13. What causes mirrored display despite correct flags?

Solder bridges or flux between LCD flex contacts can invert bits. Cleaning the board with IPA fixed random image flips for one user [Elektroda, dragolice16, post #19793707]

14. Is it worth chasing pre-compiled HEX files?

If sources are public, building locally lets you localise menus, enable UJT or ESR extras, and avoid malware. “It doesn’t make sense to hunt hexes” when SVN is open [Elektroda, TechEkspert, post #16743775]

15. Edge case: what if the MCU ID reads 0x00 0x00 0x00?

Either wiring is wrong or fuse bits disabled SPI. Check the ISP header continuity, tie the On/Off button down for stable power, and confirm the reset line is low during programming [Elektroda, TechEkspert, post #17684045]

16. Where is the current code repository?

The original SVN migrated to GitHub: github.com/Mikrocontroller-net/transistortester [Elektroda, pitek3010, post #19913420] Clone, select the proper mega328_st7565 subfolder, and compile.
Generated by the language model.
%}