PIC-based Darkroom (Enlarger) Timer

Of course you can get a decent enlarger timer for $50 or so, but that's not a do-it-yourself spirit! I've been thinking about it for a while, and the main obstacle was power: adding a power supply with a transformer and all would dramatically increase the size, while battery power wouldn't last long with a LED display. Then I had a revelation - my enlarger (a dichroic Bogen 66), like many others of this type, uses a separate box which supplies 12 V AC to the lamp. So why not tap into it? To my delight, even the connector is of a standard type available at Radio Shack.

[1/2007] A few people wrote me asking why I don't just use a relay hooked up to the parallel port of my computer. The simple answer is that I prefer to use my $1200 laptop elsewhere, for what it does best, while a $4 chip is doing it's job just fine in this application. And making up the whole box was simply fun...

The PIC 16C84 microcontroller is ideal for this application. Even running at a low clock speed it will be more than accurate at keeping time for this purpose, and it has enough inputs/outputs to provide all the functions I wanted:

If more functions were desired, some I/O lines could do double-duty, e.g. with some modifications the strobe outputs could be used to detect the button presses as well.

The 12 V AC from the enlarger's supply goes into a simple circuit which rectifies it (a small bridge rated 1 A at 50 V), smooths it with a couple of caps, and then feeds it into a 5 V regulator. I used an old one I had lying around; it's probably rated at 0.5 A or so, and even though I put a large heatsink on it, it gets too warm. It's a better idea to use a standard 1 A regulator in a TO-220 case.

The same board holds a relay and a transistor for driving it. Since the relay I had on hand was a 12 V type, I connected the coil to the rectified supply ahead of the regulator. There is a protection diode across the coil and a smallish capacitor across the contacts to reduce surges/noise.

A similar board holds the display and the controller. I used a socket for the PIC because I knew I'd have to keep reprogramming it during debugging. This makes the chip stick out above the displays, and I wish I had avoided that. The PIC drives a BCD decoder chip, which in turn feeds the common-anode 7-segment displays through a 100 ohm resistor network chip. I should have used 200 or 300 ohms, because as it is the circuit draws too much power and brightness in the darkroom is not essential; I'm hoping to adjust this using appropriate delays in software. General purpose NPN transistors controlled by three strobe signals are connecting the power to the anodes. The pushbuttons are from a broken answering machine.

In fact, if I were to rework it, I would probably go with 7 PIC outputs directly driving the individual segments of the displays one after another, without a 7-segment decoder and the transistors. The slight loss of perceived brightness wouldn't matter in the darkroom.

Wiring the displays is quite a challenge, and it's easy to make a mistake. I snipped off the unused pins (second anode, decimal point) from all three to make more room for the wires, but even so I'm very glad that you can't see the underside on the picture! The circuit is simple enough - something like this common cathode version, but please consider this to be a concept rather than a finished project.

I used a 4 MHz crystal oscillator (the picture above was taken when it wasn't mounted yet) with the capacitors attached directly to the solder points underneath. The switches use pull-up resistors, and current-limiting ones go between the PIC and the transistors' bases; since I didn't want to clutter the board, I used surface-mount ones on the bottom. It's quite easy to solder them with a fine-tipped iron, although it takes a bit of practice and they can be easily damaged by excessive heat.

I got a flat plastic enclosure on sale at Radio Shack. Two small PCBs will easily fit, leaving plenty of room for the switches etc. I'm still working on the software, but the timer is almost ready to go.

Added 11/25/2000 EJB: Several people wrote asking about the PIC code; I never got around to cleaning it up, because it just works for me and I don't feel like messing with what works. So if you want it, here it is, but beware -- it's an embarrassing lump of spaghetti. Carefully look at the code to make sure it's compatible with your hardware, the PIC outputs you use etc. Second, it was written for a rather obscure compiler, and you may have to modify it for yours. Finally, don't try to learn good PIC programming practices from me! ;-)

Eric Behr's home page