Project, Reverse Eng, Repair: ATmega328-based “Transistor Tester” Kit

A common complaint and reason for the falling popularity of electronic kits is that none of them really let you build something that’s really useful that you couldn’t buy pre-built at a lower cost. I believe this complaint does have a lot of merit, as DIY-ers aren’t expected to be able to build intricate small-scale SMD-based electronics, and restricting ourselves to through-hole style devices means a bulkier device which is less attractive and probably less functional.

On the other hand, after visiting Electronex this year, I managed to see a Peak Atlas DCA, a semiconductor analyzer which you can hook up the three leads in any order, push a button, and then it will tell you exactly what you’ve hooked up, give you some basic measurements and tell you the pin-out. It’s been something that’s been missing from my “toolbox” for a long time – when it comes to transistor testing, I only have the very basic DT830-style meters with their very questionable gain measurements for bipolar transistors. The meter itself costs about AU$169 inc. GST from element14, which isn’t prohibitively expensive, but also isn’t so cheap that I would pick one up without thinking about it.

However, what is cheap is the newer “generic” ATmega328 based “transistor tester” kits on eBay which seem to do a very similar job but at a cost of just AU$12 including postage. These are sometimes listed as component tester, capacitance, ESR, inductance, resistor, M328 tester. At that price, it’s really stupidly cheap and potentially so useful that you’d be silly not to have one. It’s a kit and it could be pretty useful. After all, how much do you think an ATmega328P and a 2×16 character LCD is worth?

Unbagging

2016102618538980

All the kits from China seem to be the same – they come in bags, so logically this is an unbagging rather than an unboxing. Anyway, this one comes inside a resealable clear plastic bag with a barcode label on the outside.

2016102618558984

Inside, only the LCD is wrapped in an anti-static bubble wrap. Three small resealable plastic bags contain the rest of the components. The centre one contains all the resistors on cut tape and a trimpot. The rightmost contains the monolithic ceramic, regular ceramic, polyester and electrolytic capacitors, LEDs, transistors, voltage regulators and crystal oscillator. The leftmost bag contains the “rest” which includes the external DC jack, an IC socket, a pre-programmed ATmega328P (both in-foam), header pins and sockets, a terminal block, screws, standoffs and a 9V battery snap. The microcontroller itself is worth about AU$2.85 on its own, without the program.

The sorting of the components seem to be semi-logical, although the semiconductors which are static sensitive don’t appear to be properly ESD protected. This seems to be a fairly common “thing”, and most of the time, things survive. From a glance, the resistors used appear to be quality 1% tolerance resistors, with a 5-band colour code which is a little more hassle compared to the more regularly encountered 4-band codes.

2016102618578986

The LCD is a classic 16 character x 2 line LCD with an HD44780 style controller. The interface pads are along the top, and the LCD appears to be a blue-coloured inverse type display with LED backlighting.

2016102618568985

The display is marked on the rear as 1602A V2.0. The unit has J1 configured, and U3/C1/C2/C3 are not populated, R9 and R7 are shorted across. Two gob-top ICs are mounted on the board. The display itself is about AU$2.16 to obtain on its own. This means the remainder of the components have to cost less than AU$6.99 or so.

2016102618548982

The unit is built on a red coloured double-sided PCB with tin plated finish. The PCB has solder resist and silkscreening, and appears to have good pad design for hand-soldering. For extra convenience, some mounting holes are pre-drilled and the edges of the board are rounded as well. The values are printed directly on the silkscreen, making construction a snap.

2016102618548983

The rear of the board has some silkscreen on the duplicated SMD test pads on the front. The holes are nicely spaced, and nicely shaped as well, with only through hole parts used making this kit suitable for beginners (provided they aren’t brutally overheating the transistors/ICs). The inclusion of an IC socket for the ATmega328P is also a good idea, although a source to get the programmed ICs is not really known.

The downside of this kit is that no printed instructions or schematics are supplied, and the principle of operation is completely “opaque”. As a result, the educational value of the kit is really in the construction process and in (possibly) the knowledge gained from using the kit afterward.

Construction Experience

Populating and soldering the components is a straightforward exercise which took me about 50 minutes at an average pace, trying to get the alignment of the parts as straight as possible.

2016102619548987

For the best success in mating the LCD with the board, I would suggest you take special care in the LCD header pins to keep them as straight as possible. I mounted the socket by first aligning by hand and tacking solder on the end pins on the rear, then soldering all the way through. This procedure was repeated for the pins on the LCD. I have soldered the battery snap leads flying out, although it may be better to thread it through the hole next to the terminal block and solder from the front to use the hole as strain relief for the cable.

2016102619548988

The rear of the board shows a pretty good soldering job – it was very easy given the design of the board, with only minor flux spatters. Some of the holes have a pretty large clearance with the component legs, so an almost embarrassing amount of solder “flow through” occurred. Maybe turning down the iron temperature, or holding it against the pads for a shorter period would have helped.

2016102619568989

The interface pins on the LCD were also extremely easy to solder thanks to their ENIG finish. I did, of course, cover the LCD with its protective film during soldering to avoid flux spatter from damaging the LCD screen.

The final steps in assembly is to straighten the legs on the ATmega328P, and insert it into the socket noting the pin 1 direction. Then, you can use a pair of screws to secure the standoffs to the main board’s bottom two LCD holes. Then the LCD can be mated with the header, and the final two screws used to secure the LCD in place securely.

2016102619588990

On the whole, the components doled out were adequate, but I have some doubts as to the quality control as I have one left over extra TL431 reference IC.

2016102619598991

I guess I shouldn’t complain. At least there were enough parts to complete the kit, so that wasn’t a disappointment in itself.

Testing … Uh oh!

As I am no novice at constructing kits and circuits, I just expected the unit to work. I connected an old 9V battery with about 8.7V open circuit voltage and pushed the button. But as soon as I powered it up, I realized something was amiss.

2016102620008995

With nothing connected, it happily idled after the test button was pushed at the “No, unknown or damaged part” screen. But if I continued to reinvoke the testing …

2016102620008997

… the battery claimed to be weak … and …

2016102620008996

… even at one stage, depleted. Something was probably wrong – maybe I got a resistor in the wrong place, or a solder bridge short where I didn’t expect it?

A quick check with the multimeter showed the unit drawing a mammoth 250mA or so when idling, and the screen backlight flickers visibly as the unit is testing. That’s way too much to be sensible.

I checked all the component values and orientation – I had made no mistake. The unit did identify components correctly, even though it seemed to be a little messed up, so I continued along with checking it out.

The first thing that came to mind was just how it would identify components – what sort of waveforms would it be putting through the pins? I hooked up my Picoscope 2205A with Channel A over A-C, and Channel B over B-C connections.

id-signal-p1-2

It’s seen that the identification procedure goes through a variety of voltages about +/- 4V over about 2.25 seconds. The voltage over A-B can be done by subtracting channels:

id-signal-a-b

As to the algorithm used to do the identification, I’m none the wiser, but at least both polarities and a variety of voltages/pseudo-AC is generated so I suppose things like decay time/phase lag and measured voltage when dealing with a component can provide the necessary information with the waveform merely needed to cycle through the necessary combinations of voltages, polarities of each of the three pads with respect to each other.

It was at this point the unit could not go on any further. I tried a new battery and even an external power supply, but that only made things worse, with the IC malfunctioning, the screen blanking out, and I even received a burn on my finger as I touched one of the resistors and found it was just way too hot to the touch. Was it curtains for the kit?

The manufacturer warned users not to connect charged capacitors to the kit as it could damage the kit and result in it continually complaining about an empty battery. That’s sort of what my kit was doing – but I haven’t even measured a capacitor yet! I believed something was probably static damaged, but to explain this to the seller and get a replacement part was very unlikely. Without a schematic, I needed to spend some time to develop one so I knew where to look.

Reverse Engineering

layers-overlaid

To reverse engineer the unit, I decided to overlay the images, with the rear “flipped” horizontally so that traces from top and bottom can be seen on the one view. It’s not so clear in monochrome as to which closely spaced traces are which, so I also used the colour images before. After three attempts, I came up with this “readable” schematic and a much better understanding of how the unit works.

schematic-combined

The input 9v battery snap is wired with the 2.1mm socket so as to preference the socket power. The power passes through the 9012 PNP transistor which acts as the power switch that cuts off all the load while the tester is inactive. By using this, it ensures that quiescent current is kept extremely low, as none of the other circuits are receiving power. The test button grounds the base of the 9012 through a 9014, which sort of “kickstarts” the circuit by applying power to the 7550 5v LDO regulator which powers up the LCD and ATmega328P.

The ATmega328P “holds” the 5V regulator running by using Pin 12 to activate the 9014 transistor near the red LED which activates the LED and draws the base of the 9012 low through that 9014 instead. An R-C combination is there to allow for the power to be removed slowly after the trigger is removed.

Once the ATmega328P is running, Pin 13 provides an input for the push button to reinitiate the test when the unit is still running. I presume when the uC starts up from cold, it starts a test cycle anyway, as it can only be woken up that way. This arrangement using discrete transistors avoids using the uC’s sleep mode, which is necessary as the quiescent current of the voltage regulator is probably too high on its own even with a very efficient uC sleep mode.

The LCD is connected to the regulated 5V, and is connected in 4-bit (nibble) mode to the uC. The backlight is also connected to regulated 5v with 220 ohms to ground. Contrast is adjusted by a 10k potentiometer connected between regulated 5V and ground.

Battery sensing is performed by a voltage divider consisting of a 10k resistor and a 3.3k resistor, input to Pin 28 on the uC. The reference voltage is provided by the TL431 reference to Pin 27. Of all the pins, only Pin 26 is unused.

Pins 14 to 19 and 23 to 25 inclusive are used for the test connections. The former pins are used for driving “strong” through the 680 ohm resistor, and “weak” through the 470k ohm resistor. The resulting voltage is sensed by the latter pins. In theory, with 5v available, it seems to suggest that up to 3.7mA could be passed through the sensing pins in the worst case, at up to 5v. No real protection is provided for the sensing pins, and limited resistive protection is provided for the drive pins – so it’s necessary to be careful with the device. If testing sensitive devices, it might not be the best choice as it could stress them.

Pins 9 and 10 are used for the 8Mhz crystal reference, which are loaded by 22pF to ground, in a “traditional” set-up. Regulated 5V is applied on Pin 7 locally bypassed by both electrolytic and ceramic capacitors, with ground on Pin 8. Pin 1 is connected to regulated 5v by a 10k resistor, its purpose may be specific to the ATmega328P, as is Pin 20 which is connected to regulated 5v directly, and pin 21 and 22 which have a 1nF capacitor connected between them and pin 22 which is connected to ground.

lockbits

Further understanding of the operation is complicated by the fact that the microcontroller has its lock bits set to no further reading or programming/verifying the chip. It’s not perfect code security, however, I don’t have the technology to get around it.

Diagnosis and Repair

Now that I understand how the “analog” portion of the circuit works, it’s time to do some proper troubleshooting. The circuit had, in my attempts to play with it, changed dramatically. The load dropped dramatically to 34mA, and the unit became more consistent – it reported that the battery was 5.2V empty at all times now. At least it wasn’t getting hot anymore, but I feared this meant that something had burnt out and it might be too late for a repair.

After I saw the circuit, I realized that the majority of the unit operates off a regulated 5v rail. The high observed current is normally suggestive of overvoltage – perhaps a >5v signal input to the ATmega which is a 5v device and going through protective diodes to Vcc. The only places where that could happen would be the battery sensing voltage divider which is connected to switched/unregulated voltage, or perhaps due to a failure of the 9014 near the red LED.

A quick probe at the voltage divider showed 2.016v across the 3k3 resistor, thus implying a battery voltage of 8.125v. This should have registered as an acceptable battery. For it to register as a low battery would probably mean that the reference voltage to the ATmega328P is too high and thus making the digitized value too small. It also meant that the divider was operating correctly and wasn’t shorted.

The 9014 near the red LED was also okay, I reasoned, as the unit latches on when the button is pushed, which cannot happen in the case the 9014 is faulty.

I realized that the ATmega is probably referencing its battery test voltage against the regulated 5v, as the input of 12v into the voltage divider would have resulted in 2.977v. As a result, I decided to measure the regulated 5v rail to find it was sitting at 7.7v.

The voltage regulator was not operating correctly – instead of “sinking” the unneeded voltage, it was only dropping “part” of the necessary voltage. In fact, I believe that prior to the failure that caused the load to drop, it was mostly shorted internally, and when that short burnt out, the regulated rail voltage rose even further resulting in the unit complaining the battery was empty. The cause? Most likely static damage during transit. Could have possibly been static damage from me during construction (although I’ve not killed anything before, my workbench isn’t ESD safe). Could have been a defective component from the factory. A voltage in excess of 7v is considered extremely stressful to 5v components … so now that I’ve identified the issue, I hope nothing’s been fatally damaged.

As I didn’t have any 7550 spare, or any 78L05 TO-92 style regulator, I had to make this inelegant hack with full size TO-220 LM7805CV, noting the pinout order differences.

2016102714398999

Because the rear tab is connected to ground, and the LCD may contact it, I added a single layer of electrical tape to the regulator. It’s way overspecified for current, and it probably has a higher drop-out voltage, so it won’t operate as well during low-battery periods, but … can we save the kit?

2016102714449003

The answer is yes. Yes we can!

2016102714449004

The current consumption dropped to a much more sensible 17-22mA which is very kind to the 9V batteries, things were not getting hot anymore, the voltages were reading properly and the LCD was no longer strobing oddly during tests.

If you’ve built kits long enough, you’ll probably have heard the saying that ICs are extremely reliable and the fault is more likely to be with the construction. In this case, the fault was within an IC, and taking the time to trace out the schematic gave me the necessary guidance to decide where to probe and understand the fault, and work around it.

Testing … again!

So, what kind of things can this “transistor tester” test? As it turns out, a lot of different types of components can be identified and tested. I can’t say the presented values are that accurate (maybe only 2 significant figures can be trusted), but it’s much better than not knowing anything about a mysterious three-legged component.

2016102714469009 2016102714509014 2016102714549017

The above shows the results of testing two different resistors, and a trimpot. The unit uses the custom glyph feature to good effect, rendering a clear illustration of units and connectivity. I like it. In fact, when connected to my scope probes, it was capable of reading 10Mohms, so it has an extremely large range of measurement.

2016102714559018

Don’t have an LCR meter? Well, it’s better than nothing – it’s capable of measuring capacitance and ESR, although the frequency at which the measurement is made isn’t clear.

2016102714459008

It will also measure inductors for their inductance, and show the DC resistance as well.

2016102714469010 2016102714499013

Regular power diodes and LEDs are no problem for it either.

2016102714489011 2016102714489012

It can even identify multiple-diodes in a package as well, although in this case, this was me just throwing in the defective voltage regulator with two/three legs in contact. Of course, it can’t identify those correctly, so you can expect some strange results.

2016102714519015

To give it a challenge, I grabbed a random MOSFET on the table and held it against the SMD pads. It correctly identified it as an N-channel enhancement MOSFET, providing the threshold voltage, capacitance and pin order.

2016102714529016

I did find a negative voltage regulator, which I know it can’t identify, and it took a while before giving up and claiming part unknown or damaged. The unit can really only measure devices with an operating voltage of 5v or below, as the signals are generated out of the ATmega328P running at 5v.

According to the eBay listing, it’s capable of identifying:

  • PNP/NPN bipolar transistors (Gain, Forward Voltage)
  • P/N-channel MOSFET (Threshold Voltage, Gate Capacitance, Protection Diodes)
  • JFET
  • Diodes (single, two, LEDs)
  • Thyristors
  • Resistors (and Potentiometers, 0.1 ohm resolution to 50Mohm)
  • Capacitors (30pF to 100mF at up to 1pF resolution, ESR for >2uF with 0.01ohm resolution)
  • Inductors (0.01mH-10H)

Conclusion

The “transistor tester” kit is unusual amongst kits in that it provides a fairly useful piece of test equipment for your workbench in a simple easy-to-build kit that even beginners can construct, and at a much lower price than commercially available equivalents, costing just AU$12 and about an hour of time.

Unfortunately, its educational value was rather limited due to a lack of documentation provided. Further to that, my kit suffered from a component failure which I suspect was due to their packaging and transit, which cost further time in tracking down and working around.

In the end, because of the need to troubleshoot, I managed to understand and draw the schematic for the “analog” portion of the device, and hack a suitable repair to find that my unit now functions correctly. It may have cost me much more time than its initial cost, but it taught me something about its design, and it taught me the patience and persistence necessary to draw out a readable circuit diagram.

Too bad the actual techniques used in component identification remain unknown, due to the code protection lock on the microcontroller and my general lack of knowledge in regards to AVR code even if I could obtain access to it.

Regardless, it is a AU$12 kit that will come in handy especially if you don’t have an LCR meter, especially if you get it without any failed components. Just remember that it isn’t designed to the same standards as proper test equipment and won’t tolerate the same level of abuse, so treat it with care in transit and especially when measuring capacitance.

About lui_gough

I’m a bit of a nut for electronics, computing, photography, radio, satellite and other technical hobbies. Click for more about me!

This entry was posted in Electronics and tagged , , , , , , , , , , , . Bookmark the permalink.

7 Responses to Project, Reverse Eng, Repair: ATmega328-based “Transistor Tester” Kit

  1. Mark says:

    These component testers are actually based on an open-source design and are quite well documented. There are several open source firmwares available. EEVBLOG has quite a discussion on them and the original design was at mikrocontroller.net Here’s a pdf:

    http://www.mikrocontroller.net/attachment/164956/ttester_eng104k.pdf

    I would recommend getting one with the graphical LCD display. They draw pretty pictures of the detected device. Also get one with a socketed ‘328 chip… makes it easier to upgrade the firmware. And don’t waste your time on a kit. Assembled and tested units are less than $20.

    My first ones were by “fish####” (can’t remember the number). They had a design defect where the battery voltage divider was on the input side of the power switch transistor and would drain the battery in a couple of months. I moved the voltage divider connection to the output of the power switch circuit. It also had a flakey power up state traced to the voltage regulator. I replaced it with an LM2936 ultra low standby power regulator.

    One common mod is to replace the voltage reference with a higher performance one… I don’t think it is all that useful to do.

    Overall these testers are amazing little devices and every body should have at least one.

  2. Mark says:

    That flakey power up state mentioned above was the unit did not like to power up with a fresh battery. It worked fine with a slightly used one. The LM2936 fixed the problem.

    • lui_gough says:

      Interesting. I didn’t know that, since my own quick searches usually turn up nothing that I’d immediately recognize as relevant. Many thanks for the link because it’s got a pretty good description and confirms the schematic, save for a few minor changes in component values and removal of ISP headers as can be expected from said Chinese manufacturers. While I used to enjoy quite a bit of eevblog Dave’s videos, time has been really short in the past few years, so I haven’t had the time to soak them up.

      I did notice the matrix LCD type but the ones I saw had the soldered 328. I suppose it really is no big deal as most people aren’t likely to upgrade the firmware themselves by burning a new chip (since the one they supplied had lock bits set) or have an appropriate high-voltage programmer to reset it. The graphical ones are indeed available from about AU$20, pre-built but I thought I’d skimp out. After all, having a second opinion of the component type and the values are most important to me.

      The other reason I didn’t choose the graphical one is because I don’t get to build something. I suppose as a tool, it’s probably better having it pre-built … some would say :).

      I don’t think replacing the voltage reference is a great deal either especially given the increased cost, and because the ATmega328P’s ADCs are really 10-bit at the best (assuming a very stable voltage), so it’s not really going to be able to give the precision a proper meter is likely able to. That being said, mine came with a TL431 reference rather than the LT1004, which has a standard 2% tolerance which is probably worse than the latter. Also, the output drive network is comprised of 1% resistors, while the PDF link explains how critical these resistors are to accurate measurements and suggests 0.1% or better to obtain full accuracy. If that hasn’t also been addressed, I see very little reason to upgrade the reference, but it also explains why I feel it’s really only good to two-ish significant figures on the primary measurement.

      Now that I know about the self-test/calibration feature, I’ll probably have a go later and see if my particular unit has the features enabled or not.

      – Gough

  3. Mark says:

    I think the open source firmware is up to at least version 1.15 There are versions out there with pulse generator and frequency counter modes. Also versions that have a boost converter that supports reading zener diode voltages. Also versions that control relays for draining charged electrolytic caps. And versions that use a rotary encoder for menu selection. Lots of fun stuff. Also lots of people griping about the Chinese knockoffs not giving credit to the designers or honoring the open source firmware license…

    My units have 0.1% resistors and seem to be quite accurate… at least as good as most cheap DMMs. But for $20, what can one expect? These are really pretty amazing devices and have a REALLY clever design. Everybody should have one in their tool kit.

    Don’t expect too much from the inductance measurements… but most LCR meters also have issues… inductance measurement can be dependent upon test frequency (as can be capacitor ESR). Even my $25,000 (when new) ESI Video Bridge has issues measuring inductance.

    The AVR ADCs (and most micro-controller ADCs) are pretty sucky. You do good to get 8 honest bits, but can do better with lots of averaging. The AVR ADCs also have issues with measuring voltages near GND and VCC. They can be particularly bad below around 0.4 V.

    • lui_gough says:

      I did do some looking and did find some of the variations you mentioned. That being said, cheap DMM accuracy was something I was “fine with” until I got into more serious scientific ventures, so I’m moving away from those. At least I do have a proper Agilent U1733C LCR meter, although only with discrete frequency settings up to 100khz. Good enough I suppose, but a lot more expensive than the kit, but has never let me down (yet).

      I’m really surprised they managed to make an 8-bit micro do so much … it’s really clever how they pulse pins and look for voltage changes to determine capacitance between pins as a way of identifying device characteristics. Maybe I’ll consider buying a more “advanced” version if I ever feel the need, but at this stage, this one will probably suit me just fine. I did find some pre-assembled versions with an SMD ATmega328 and mono LCD for even as low as AU$10 (cheaper than the kit) but there seems to be even more advanced colour LCD (or maybe OLED) displays for about AU$17 (kit form) or AU$25 (pre-assembled). It’s a shame that the sellers aren’t clear as to what the firmware version/capabilities are, and have just copied the text wholesale. Even amongst the graphical display units, the quality and arrangement of the displayed images and text does seem to vary. The fact you get so many peripherals for your dollar is amazing … most people can’t even buy the LCD individually from a local retailer for the price of the whole kit! I suppose it wouldn’t hurt me to buy another and build it … but I think I’m busy enough as it is.

      Microcontroller integrated ADCs are always quite tricky to effectively use. They’re so close to the digital domain that they can easily be affected by “hash noise” such that shutting down most of the MCU and going with oversampling/averaging is preferable for more reliable values. Even then, yes, there are non-linearity issues especially near the rails, and conversion “speed” requirements – it seems that this particular applications needs very rapid measurements (and in some cases, preferably simultaneous but because it isn’t possible, it is done sequentially), so I don’t think the full potential of the ADCs are necessarily available because of the speed requirement.

      – Gough

  4. Mark says:

    When I need precision, I fire up my 3 HP3458A DMMS… 8.5 digit. I have a bank for Fluke 732A/B voltage references and SR104 standard resistors and Valhalla current references to keep things honest… plus some late night access to a Josephson Junction Array. For time/frequency I have a cesium beam oscillator, several rubidiums, and GPS disciplined oscillators. Most came from Ebay at 1-10% of what a new one would cost (and less than a week (or even a day) of rental costs). I can measure / calibrate pretty much anything to levels approaching national standards labs accuracy.

    But day to day I use Tektronix DMM 914A hand held meters (4.5 digits). One seldom needs more than that outside of a lab. Even those are overkill for 99% of measurements.

Error: Comment is Missing!