UV pcb exposure box

Today, I want to write a few words about another of my older projects.

UV exposure box - whole view

A while ago, I started building this DIY UV exposure box. The electrical part consists of a self-designed count-down timer based on an AVR Tiny2313 CPU, 4x8W PHILIPS UV tubes, ignition/driver circuits from cheap fluorescent bulbs, a multiplexed numeric LED display, a rotary encoder and some wiring. A piece of ~4mm aluminum serves as a faceplate, picture frame glass as the exposure surface. We’ll have a look inside in a moment.

When turned on, the controller presents the configuration menu first. All options are preset – or should I say ‘preprogrammed’ because the preset cannot be changed, as of yet – to the values I use most frequently. Configuration includes the time (up to 9min 59sec), a variable tube preheat time up to 59 seconds and a zone selection. The zone selection does nothing at the moment, but the pcb features a mounting spot for a second solid state relais which I have not yet installed. Which means, all four tubes are activated.

Exposure box - menu

Exposure box - menu

Exposure box - menu

Exposure box - menu

Exposure box - menu
…ready to go!

Exposure device - running

Press the selector one more time and the process starts. To stop again, either press the button again, switch off the mains or wait patiently until the time runs out.

Now, on to the inner values. After undoing 7 torx screws, the lid can be removed to access the elecronics compartment behind the front panel:

Exposure device - mains part
Mains input and ignitors

Exposure device - microcontroller
Microcontroller board

Exposure device - electronics compartment
Electronics compartment

Inside the compartment is the four-fold ballast circuit, which consists of four board found in the sockets of fluorescent energy saving lights. These are pretty cheap compared to commercial electronic or inductive ballasts and they can be used right as they come. The only crucial number is the power rating – my tubes are rated for 8W while the ballasts came from 9W bulbs, which works just fine. Care has to be taken when opening the sockets, though. The bulbs should be left lying around for some time prior to “dissection” because they contain a pretty juicy capacitor. The circuit inside is basically a simple switchmode current supply. When that’s done, an easy way is to cut them open along the circumfence about in the middle of the socket’s height with a fine saw blade. Don’t cut too deep or you will damage the pcb. Once the casing is open, mark the pairs of wires coming from each end of the tube before cutting them. These pairs need to go to the ends of the UV tube, don’t mix them up or you’ll short out the circuit. How the two wires connect to the two pins of the tube on each side is completely up to your choice, though.

As always, remember the hazards involved when dealing with mains equipment, especially such that was never designed to be opened or even run in the open. Also, don’t go breaking any fluorescent tubes as they might contain traces of mercury.

The four ballasts are wired in parallel to the mains, with just a fuse, the power switch and a solid state relais in series. Fuse-wiring got a little complicated because I forgot to place separate fuse sockets for controller and drivers onto the pcb, but nothing dangerous here. A connection between faceplate and protective earth is also present for safety reasons, seeing that there is lots of live wiring very near. You may have noticed the absence of any cooling fan or holes – these are not necessary as the device is run for a few minutes at a time and never unobserved. The ballast circuits are designed for operation in a very tight unventilated space anyways, so no trouble to that end. After ~5 minutes of exposure the glass surface becomes just noticeably warm.

To the right is the control circuit, consisting of said ATTiny2313, a small 6VA transformer-powered 5V supply, the solid state relais (SHARP S202S02) and three npn transistors as segment drivers for the LED display. I still have some pictures from back when I made the pcb (about a year ago now):

Drilling holes…

Finished pcb

…all soldered.

I have used this exposure box several times now and am pretty content with the results. There still remains some creepage of light between the layout print and the photosensitive layer, resulting in fuzzy edges of traces and larger groundplanes sprinkled with small holes. This is partly thanks to an absolutely ridiculous laser printer made by HP (Color LaserJet 2600nse). No matter what settings are used (even in the expert options), the printer will never do dense black withing planes and very often blur traces on either the leading or trailing edge. Text works fine, though.

You may download the schematics in Eagle 6 format at your leisure. I do not guarantee correctness of the layout, though. There was a small problem in an earlier version (Pin 1 of ribbon cable connector was not connected to ground) which I have fixed now.

I do not take any responsibility for whatever happens to you. It’s up to you to decide if you want to and are able to build something like this.

>> EAGLE 6.0.0 Schematic and Layout

>> Script files for older versions of EAGLE – untested!

>> Sourcecode and .hex for ATTiny2313

* NOTE: Make sure that pin 1 of the front panel connector is really connected to ground, the traces were etched away in my case. The result is erratic behaviour of the rotary encoder.

11 thoughts on “UV pcb exposure box

  1. Hi and congratulations for your great job.
    I would like to ask you a question.
    Can you tell me please what is the exposure time use for to achieve this the results shown in the picture “Finished pcb” ;

    Thank you very much.


    1. Hi John,
      that depends on the pcb material you use, the lamps and the quality of the mask. I usually go for 95-105 seconds for somewhat aged pre-coated pcbs, on a lamp setup as shown. My masks are made of standard paper, printed with a HP Laserjet 2600n. Not the best for good coverage of large black areas, but it works. The paper is then made transparent by KONTAKT Pausklar, which is a spray-on oil. Alternatively I use Zweckform laser-printable transparency sheets. Those are not truely transparent but rather a milky white and work pretty nicely.

      I also let the lamps pre-run for 30-60 seconds without a pcb on the glass, to guarantee full emission during the real run.

      Best regards

  2. hi, I like your project and I will like to build the
    same but I only have atmega8 .can I use this chip ?
    if I don’t can I change I the code to work with atmega8.

    can you help me please?
    sorry for my english

  3. I did not find the second part of the circuit with the display and encoder.
    Can you post it? Or tell me how to connect the encoder…
    Thanks and best regards!

    1. Thanks for your feedback! Strange, I made a layout for the display part back then, even though I did not use it myself…thought I’d left it in the files. I’ll look that up, must be somewhere.

      Anyways, until then: The encoder I used is an ALPS STEC12E07, but any other rotary impulse encoder should work fine if it uses two shifted impulse outputs.

      Referring to the pin numbers of the connector as in the PCB layout:

      (1) Ground
      (2) LED cathode 3
      (3) LED cathode 2
      (4) LED cathode 1
      (5) LED anode bottom
      (6) LED anode right-bottom
      (7) LED anode left-bottom
      (8) LED anode middle
      (9) LED anode left-top
      (10) LED anode top
      (11) LED anode right-top
      (12) Encoder pulse 1
      (13) Encoder pulse 2
      (14) Encoder switch

      The center pin of the encoder switch and the other end of the encoder push-button go to ground.

      The corresponding anodes of all three LED displays are connected together and to the anode connections of the PCB and the cathode of each 7-segment block is connected to the corresponding cathode connection of the PCB.

      Hope I didn’t get anything wrong! Cheers!

    2. Hi!
      Thank you very much for the quick response!
      I have one more question – in circuit you specified chip AT90S2313, but in C-file was specified ATTiny2313. I have an AT90S2313.
      Can I use this chip?

      1. Yes. The Tiny2313 is a remake of the AT90S2313. They are pin compatible and the functions were mostly identical, too. The code only calls basic functions, so it should compile just fine. I used the 90S2313 for breadboarding and only swapped it for the Tiny in the final circuit because I had a bunch left over.

        Unfortunately, I can’t test the compile myself right now as my main PC is down for a rebuild. I just skipped through the source code and didn’t see anything that might throw up, so just change the define to the other chip type and see if it compiles. If it does, the chip should work in circuit.

        Some further info to the relation between 90S and Tiny:

        Oh, and you will need to set the crystal speed (4 MHz) in the project parameters or “#define F_CPU 4000000UL” at the beginning of the C file. Finally, the fuse programming should enable the external crystal oscillator and disable (!) the clock divider CKDIV8.

        If you hit any problems, just drop me a line here and I’ll try the compile as soon as I get set back up.

      2. Hi Mario!
        Maybe I’ll repeat this project, but have a few questions.

        I’ll not use the UV lamp, but I’ll use the UV LEDs.
        Ignitor is not needed, and not needed one pin (PD1) for solid relay. Function “Zona” also not needed.
        – Is it possible to increase the number of digits up to 4, and the maximum time up to 59 min 59 sec? Maybe use PD1 pin for 4 digit?

        – Is it possible to add a separate button START-STOP? This will improve safety (random START excluded!) and usability device!

        – Is it possible use encoder button with one of PB0-PB6 for release PB7 port? Free port can be used to signalization about end of time (active buzzer).

        Also I think that needed two round leds (vertical points) between the minutes and seconds. But I dont know how it doing… May be use 4-digits 7-segment clock display?

        I see next algorithm of the control :

        The first press of the encoder button will be set SECONDS. Turn encoder for set the desired number and press encoder button again. Set MINUTES also. Press encoder button again and device go to READY mode. These mode may be indicated with flashes all digits.

        Press START-STOP button will start process. Press it again – PAUSE mode, press another – WORK again.

        Can you help me?
        Sorry for my english… :(


        1. I just noticed, there is one thing the AT90S2313 can’t do properly. I falsely remembered that the buttons were read out using interrupts for the encoder and polling for the push-switch. This is wrong, the program uses pinchange interrupts for all of them, which only the Tiny supports.

          The encoder is already connected to real interrupts and the pushbutton can be polled instead, so there is a workaround. I’ll see if I can rewrite the program accordingly this weekend.

          For your questions:

          * Yes, the LED logic is pretty flexible. You’d need another free I/O and transistor for cathode switching, though.

          * Yes, the program flow is a simple state machine where a flag is set when the interrupt detects a button press and the main loop will execute a certain if block depending on the button flag and a “current mode” flag. Just insert another condition and another button flag. Again, another I/O is needed.

          * The encoder button needs to be handled by polling anyways on the AT90, so you can (in theory) use any pin you want. Still, I would not use PB0-PB6 because you would have to rewrite the whole LED mapping table. Also, I tried to keep all LED anode lines on a single port to keep things with the table simple.

          A slightly more complex solution would be to use one of PB0-6 for two functions. The LED anode does not disturb the pin function as long as the cathodes are all switched off, which means that the internal pull-up resistor could be enabled in the dark phase in between number displays. A button that shorts the pin to ground through a suitable resistor could be detected this way. If the resistor is large enough (but not too large, maybe 2-3 kOhms) the impact on the display would be small. This could be done for multiple buttons.

          * Yes, decimal points would make sense. I had no unused I/Os, so I went without ;-) Maybe it would be sufficient to keep the dots on all the time, to save one I/O. A clock display module can be used if it has common cathodes.

  4. Hello, I like your project and I will like to build the same. But I only have Eagle 5.11 and can’t read the schematic or board on my version. Could you send me the file on 5.11 and if possible the firmware ?

    Thank you and complimenti,


    1. No problem, the firmware should have been available since a long time ago anyways. I originally needed to sort out some of the commenting and stuff, but it seems I kinda forgot about that. I’ll see that the firmware/source are available some time tomorrow.
      For the schematics and board, I don’t know. I will try to get EAGLE to output something that EAGLE 5.11 can read, but it seems that there is no backwards compatibility included anymore.
      You’d be able to open the files using the free version of EAGLE 6 though, the board is within the size limits. If you don’t want to use EAGLE 6…well, I can understand that ;-)
      I’ll drop you a line when the files are up.


Leave a Reply

Your email address will not be published. Required fields are marked *