AVR Transistor Tester
This could almost perhaps be filed under my Arduino adventures section, but since it uses a raw ATmega328P microcontroller with a custom circuit built around it, we'll keep it here in the more general "Electronics" section.
I saw a Youtuber showing off one of these recently while looking for a matched pair of bipolar transistors in his series on building a discrete op amp on a breadboard.
I was intrigued and did a little research. Apparently this little "Transistor Tester" circuit has been a thing for over a decade. The name itself is a bit of a misnomer since it can test and display information about a ton of components: BJTs, FETs, MOSFETs, resistors, capacitors and inductors. That last one was particularly appealing to me since I like to tinker with radios and make coils for them by hand. Toroid coils can be tricky. Sure, you can calculate pretty close what the final inductance will be, but it would be fun to get confirmation with this little gadget after winding the coil.
Apparently, this design goes back to Markus Frejek and then further refinements by Karl-Heinz Kübbeler. Read all about it here. But the idea goes back even further with Michel Waleczek using a PIC microcontroller to construct a similar device.
You can download a nice long PDF file of the project documentation here. I essentially followed the schematic in that document, with a couple of minor changes here and there, including a blue LED with a carefully selected bias resistor to provide a rough 2.5V reference voltage, a few resistor substitutions (33K ohm for 27K ohm) in the clever 3-transistor latch/power-off subcircuit, and substituting 2n2222A and 2n2907 transistors for the two NPN and one PNP transistors in that same subcircuit.
Since I had an ATmega328P surface mount chip on hand, I also stubbornly insisted on making an iron-on transfer PCB breakout board to use it as my microcontroller, and also a homemade PCB clone of one of those "solderable breadboards" that Adafruit sells.
Underneath the ZIF socket lever in the photo above is an ICSP header for programming the microcontroller. The source code compiles pretty much without a hitch on Linux as long as you have avr-gcc installed. avrdude is used to do the actual programming of flash, eeprom and fuses. It was as simple as:
> make upload
> make fuses
And I used a USBasp programmer dongle connected via USB and breadboard hookup wires to convert from the USBasp plug to the ICSP 6 pin header arrangement.
One sneaky bit was that with the transistor power-off subcircuit in place, I had to hold down the Transistor Tester's button while programming it via ICSP.
Finally, I needed a case for the finished tester. Here's what I settled on -- a chunk of 2x4 with a lid sliced off using a bandsaw, the inside cut out with a router bit in a drill press, and the whole thing scorched with a butane torch for effect and "lacquered" using Gorilla Glue thinned with acetone.
There's a hole cut for viewing the ATmega through a glass window. I bent the blue 2.5V reference LED down to light up the microcontroller dramatically during usage.
The whole thing runs off a 9V battery that Markus points out uses a very low current with the latch power-off circuitry that should last around 5000 years, which he notes "should be sufficient".