Quick Transistor Sorter

As you may have gathered if you have perused my projects, I recycle a lot of junk and surplus parts. Mostly if I need a transistor I pick one from a drawer or unsolder it from a junk board. I need to find one of the correct polarity, and will have to find out which way the pins are connected before I test it on my ancient homemade transistor tester. This is a hassle, so my large stock of reusable transistors is largely unsorted. This device does this by measuring the Collector to Base voltage and then the Emitter to Base voltage for a 3.3 MA current. When connected properly, both are in the correct range for their chemistry.
The different connections are performed by three multi-contact form C telephone type relays. These were cut from a surplus subscriber board with a hacksaw, together with their driver transistors.
The program tries the most common configurations in turn. It stops when a valid answer is found or if it detects a short.
A momentary-contact switch controls 24V relay power and also restarts the program for the next test.
Five LEDs show the final configuration and whether a valid result has been obtained.
There is also an unnecessary serial output.

Here is a photograph

Here are the circuit diagrams

Here is the code