LED UV exposure box part 2, the timer

Introduction

Continuing the development of my UV exposure box I have designed and built a countdown timer.

There are a few others out there for the same purpose, but I wanted to add some more features to make things better.

As I have mentioned in the previous post, safety was a big concern for me so I added a switch that should prevent turning on the UV LEDs when the lid is open.  Of course, this is not enough, so the switch has to work along with the timer ensuring that everything goes smoothly.

The key features that I wanted:

–          Exact time display

–          Adjustable time, 10 second resolution

–          Start/pause function

–          Automatic pause and UV LED turn off when the lid is open

–          Some predefined available values for easy access.

Implementing the safety measures is easy, as the switch on the box could be made to connect either the RED or the UV LEDs.  The timer needs to control the UV LEDs, so I have used a MOS transistor. It also needs to know the state of the box lid. I have built a circuit that can achieve all this. The concept schematic can be seen below:

The schematic shows, symbolically, the red and UV LED arrays through the basic cell that is repeated on the panels: a series of three LEDs and a resistor. As you can see, there is no way to turn on the UV light when the lid is open, even if such a command would come from the microcontroller. The microcontroller can turn the UV light on via the MOS transistor only when the lid is closed. This is controlled through software too. In order to sense whether the lid is open or not, the microcontroller monitors the state of the cathode of the red LED array. When the lid is open, this is shorted to ground and the micro sees a low logic level. When the lid is open the red LEDs will conduct current and force the microcontroller to see a high. This current is small, limited by the 10K resistor and therefore the LEDs do not appear to be on. I could have chosen to leave the red LEDs on all the time as this does not influence the functionality of the exposure box, but it adds extra consumption and more heat needs to be dissipated by the lower panel.

Although it is not totally justified, I decided to go the full effort and make this timer with a display. There could be many more ways to do this starting from a simple 555 circuit. I wanted the circuit to be a challenge for the box itself, so small SMD parts are used wherever possible.

The build

The display is a KW4-361ASB from Luckylight. It is small, 9mm digit height and has 4 multiplexed digits. There were two basic criteria for selecting this particular part, first I wanted it to be small and efficient so that a small current is enough for a bright display and second I wanted it to be multiplexed as this simplifies board layout.

I choose an ATTiny2313 microcontroller as it has all the features needed to implement all the tasks: sufficient pin driving capability, a timer, enough pins and memory. It’s got an internal oscillator too, but as I missed it, the tolerance is within 10% which I consider too high for this project. I have later added a crystal on the board but adjusted the starting timer value on my particular circuit to compensate for the internal oscillator deviance. This was easy as I knew that the refresh frequency for the display should be 50Hz, so a frequency meter was all that I needed. I believe that this should not fluctuate and no future compensation will be needed to maintain the error at a small value, maybe less than 2-3%. I do suggest using a quartz crystal, but this is not mandatory, you may use my method or simply accept the maximum 10% tolerance.

To turn on the UV LEDs I have used a TSM2302 MOS transistor which has a capability of 3.6A, more than enough for both the boards. Other transistors may be used, such as IRLML0060TRPBF.

Other than this, there are 4 buttons on the board, a 7805 regulator and connectors. The 4 buttons have the following functions, from left to right: START/STOP the timer, UP – adds 10 more seconds, DOWN – subtracts 10 seconds, MEM – recalls some preset values from the memory.

Because software allows flexibility in connecting the display, I chose to make the connections as easy as possible for the PCB layout, and this is why the schematic is not very straightforward.

The connection of the lid switch and LED arrays is shown below:

Because the box was functional, I decided to make the PCB a challenge for it: Small display, small SMD components. The finished PCB is shown below, the board is very compact and measures less than 6×3.5cm:

You may wonder why there is no programming connector. The reasons are two: I wanted to make it as compact as possible and the fact that it is the type of circuit that requires a single programming (For the end user). As all the pins required for programming are connected to the display it is easy to connect a few wires to the programmer, as you can see I did in the picture below:

Click here to download the archive containing PCB files (eagle and PDF), bill of materials and firmware.

The finished timer(there’s no silk screen because my laser printer broke 🙁 ):

LM317 voltage regulator and heatsink also mounted on the box:

I’ve used 2 nuts on each of the mounting screws between the heatsink and the box to ensure good air circulation:

And, of course, a 3A protection diode, just in case:

The mounted timer:

The final result:

First test:

Checking the safety measures, red turns on, UV off, timer stops:

Other similar built boxes:

This one is built by a friend of mine, Alex

Another box built by kh9005, uses a different grouping for the LEDs to suit his power supply and an adapted timer pcb:

dewp has a larger box, complete with psu:

Bookmark the permalink.

42 Comments

  1. Hi
    I am new with AVR programming so I need your help to check the correct fuses. Pls let me know from the list bellow what fuses should I check.

    Lock bits
    LB1
    LB2

    Fuse low bits
    CKSEL0
    CKSEL1
    CKSEL2
    CKSEL3
    SUT0
    SUT1
    CKOUT
    CKDIV8

    Fuse high bits
    RSTDISBL
    BODLEVEL0
    BODLEVEL1
    BODLEVEL2
    WDTON
    EESAVE
    DWEN

    Fuse Ex bits
    SELFPRGEN

    Thanks in advance for your help
    Best regards
    Antonio

  2. I need help building an exposure unit, please contact me.

  3. I need help building an exposure unit.

  4. I need help in making an LED exposure unit for screen printing, please contact me
    ASAP.
    Thanks,

  5. Hi, I would like to know whether the timer counts down or added time.
    I want to know what the display shows … 00:00 minutes: seconds? or something else? thanks

  6. Hello,

    I’m quite new to AVR programming and would appreciate your help about the exact fuse settings for this application as I don’t want the mess around too much with them. I have managed to boot up the timer but the display is flickering and it takes 3 or 4 seconds to count down one second. I think the

    Thanks for help.

    • You need to set the external oscillator to crystal since there is a 4MHz crystal on board. Now it is slow because it is running on the internal 1MHz oscillator.

  7. Hi. Built your circuit with a few mods mostly to handle higher current and a few led indicators. Works great! Thanks. The only feature I would like to have is a buzzer when the count down completes. Have you thought about this? Would I need to change the code or is there a way to drive a transistor with the current code to switch a buzzer on.

    Thanks again.

    • I actually planned on having a buzzer, but then i forgot about it in the design of the PCB. It didn’t prove to be missed, though. In the few minutes that the exposure is done I just go an prepare the etching and developing solutions. It’s all done when I come back.
      You could add a buzzer, but some software would need to be modified.

  8. Hi. Great design.
    Will a 8MHz crystal substitute OK?
    Thanks

  9. hi
    im having trouble programming the fuse bits as im unsure what low high and extended fuse bits to program .
    im using usbasp programmer with avr-dude.
    can you help by providing me with a command line please

    thanks

    btw awesome project can wait to get it finished

  10. Hello again Bogdan,
    I tried initializing with 0xB1E0 as you suggested but there was no change.After a few trials today I came up with 0xB38E as the best initialization constant for the 4mhz crystal oscillators used in this project. I have built 2 of these and results were the same for both. Thanks again for a teriffic project and your help.

    Jim

  11. Salutare.
    O intrebare si in acelasi timp o rugaminte am la tine daca se poate.
    Vreau sa-mi constuiesc si eu o cutie de expunere cu UV,insa am ales sa o fac cu tuburi black-light.
    Ca timer vreau sa constuiesc varianta propusa de tine.
    Crezi ca poti modifica softul uC-ului si pentru varianta de afisaj cu catod comun ?
    P.S. Ti-am lasat mesaj si pe elforum.ro

    Multumesc.
    Numai bine.

  12. Bogdan,
    Thanks for the great project. Once I chased the bugs away it worked like a champ. The major issue I had was using the ISP to program the T2313. What happened was that I programmed the chip using your hex file ahead of time. Then I remembered that I was using a 4 mhz xtal so I programmed the lfuse, but forgot to rempve the divide by 8 fuse, so when I powered up the timer it ran slowly – about 1/8 normal speed. Then when I tried to program it after it was soldered to the board but avrdude could not initialize the chip. What I traced it down to was that pins 17, 18, and 19 were being connected through the LED display. By temporarily removing the resistors between t2313 pins 17 and 18 and the LED display (R1 and R6) I was able to reprogram the lfuse and now it works as you designed it. A few comments though: I used an Everlight MSQC6912C display with 13mm display height. There were 2 problems – the display had 7 pins on the lower part and 5 pins on the upper side, and your display has 6 above and 6 below, so I had to relayout the board. Secondly, the Everlight display operates at different voltages and currents – I ended up with 150 ohm resistors between the T2313 and the display unit. Also, it seems like the xtal is not too accurate. I set the timer for 4.00 minutes and then timed it. It took an actual 4 minutes 5 seconds for the display to reach zero, so it is running a little slow. Is there an easy fix for that? Thanks again for sharing it.

  13. Hi, nice tutorial!
    Im working on a box of my own right now, but have one question regarding your circuit: Is it possible to use a relay instead of the MOSFET switching the UV-LEDs? or does that make it hard controlling the leds from the mcu?

    Hope you can help 🙂

  14. Salut Bogdan.
    Am realizat si eu acest timmer, dar am intampinat o problema,lumina segmentelor funtioneaza cu intermitenta si secundele dureaza de 3 ori mai mult pana se schimba,am pus si un clip ca sa vezi despre ce este vorba, de la ce sa fie?
    Multumesc anticipat.
    http://www.youtube.com/watch?v=GGOJkv1pC58

    • cred ca nu ai schimbat fuse-urile ca sa foloseasca oscilatorul extern de 4MHz. Din fabrica vine setat pe ala intern de 1MHz. Verifica fuse-urile.

      • Da asa este, cum nu am lucrat cu MC-uri, acesta fiind primul, am cautat documentatie pe net si am reusit sa il fac functional, intradevar nu am setatfuse-urile pentru oscilator extern….si apropo, acum nu stiu daca e o eroare in schema ta, dar nu imi functiona butonul de dat inapoi secundele sub nici o forma, am scazut rezistenta aceea de 10k dar degeaba, si apoi am pus butonul direct pe pinul MC-ul si merge, desi celelalte trei butoane m,erg cu rezistente de 10k, acela nu stiu de ce nu vrea, dar sper sa nu afectz ceva daca am pus direct buonul.
        Multumesc pentru proiect.
        P.S.Ti-am trimis mesaj si pe elforum.

  15. what current has the power supply have?

  16. Hello

    is it usefull for screen printing purpose

  17. Hi, and thanks for sharing your project.

    I have succeded in building a box similar to the first part of your project and am now trying to create the timer part, but I have encountered a problem. After creating the circuit I tried to program the ATTiny2313 with your firmware (using avrdude and a Bus Pirate). I set the low fuse bits to 0x6C and high to 0xDB to make use of a 4MHz 30pF external crystal (and brown-out though it’s probably not needed?) and flashed in timer.hex. When I power on the timer however, the display (a 4 digit, multiplexed, common anode) only flashes between almost random states about every 3 seconds. I assumed I needed to change the instructions as it probably doesn’t use the same as yours, so I tried flashing in a modified version. It didn’t succeeed, as now it seems the ATTiny doesn’t respond to the programmer at all, avrdude complains about invalid device signature.

    I have some ideas of what might be wrong. It is likely that I used incorrect fuse bits, as I don’t fully understand all of the options. Also, before flashing, for some reason I decided to rebuild the .hex file you provide with “make” command. It might have broken something in the firmware, though I can’t see why it would.

    Luckily I have a spare ATTiny that I will make another attempt with. Before I try it I would like to ask what fuse bits I should use this time. Which did you use?

    • Sorry, I’ve missed your comment. I have used internal 4MHz which proved imprecise so I altered the counter to get accurate timing. You just have to set the fuses to external xtal and that’s about it. You should check your fuses, maybe even use some different programing utility that does the calculation for you. (try AVR OSP II or something similar).

  18. Thank you for the involvement of the timer, I am from Slovakia and I accidentally bought 200 pieces of UV LEDs and looking for something like this. Involvement worked the first time, the board is a place where the signals are very close (pin 5 and 6), but otherwise I like the involvement. I used KW4-361ASA, recommended type is not available. Capacitor tantalum 10u I used on the top side. Capacitors also not available. 🙂

  19. Hello, Bogdan!
    This is an amazing project! I was looking for an UV Lamp from about a year, but now, I will build this box with your timer.
    I am using AVR mcs from about 7 years, but I don’t use 7 segment displays yet. So, my problem is that I can’t find this kind of display that you’re using – KW4-361ASB. So will you give me an advice in this direction – how to control a single 7 segment display with your code? (with 1 number) I build my Timer with 16×2 LCD Display, but yours look pretty simple. 🙂
    Thank you very much!
    Regards from Bulgaria!
    Borislav

    • You can’t find that particular display because there are so many kinds available. You should get any 4 digit display as long as it is multiplexed. There may be pin differences, but you can fix that by making a different board or by using wires to connect it to the one I designed.
      As for working with 7 segment displays, have a look at: http://extremeelectronics.co.in/avr-tutorials/interfacing-seven-segment-displays/
      There are many other tutorials available, google will help you uncover thousands of sites.

      • Thanks again!
        But I already found this display on TME’s web page. And I will purchase LEDs and the display soon.
        Now, I will etch the PCBs for the box and I will post here some pictures and PCB files!
        Best regards,
        Borislav

        • I bought the dispaly and UV LEDs from TME too. But i was too lasy to etch and drill boards for the leds, I did have the chance to purchase the boards used for a low price, a little over one euro.
          Have fun with your build and I’ll be waiting for your box.

  20. Nice box! I’m planning to build one myself but I have a few questions.

    I wonder how necessary the LM317 is?
    What current is the LM317 set to and does that not differ if you run one board, two boards or one with the red LEDs?

    I have ordered these high powered UV LEDs from eBay

    With 3000mcd it should fully expose a PCB in seconds 🙂

    • Hello!
      I have used the LM317 as a voltage regulator, set to output 12.0V. This is so that i can have a stable voltage for the panel, which means stable UV power, therefore a fixed exposure time.
      If the voltage applied to the leds(3 leds + 91 ohm resistor in series) varies, so does the current and the exposure time. LM317 gets a fixed output for a wide range of inputs(15 V minimum) so i can use different power supplies.
      The total current required for my panels is a little over 1A, that’s why i didn’t use a simple 7812.

      The leds you mentioned are quite a narrow angle, which means you will need a higher distance between the led and the board to get a uniform exposure. You may want to look for some with a higher angle.

  21. Pingback: LED UV exposure box part 1, the box « Electro Bob

Leave a Reply to Bogdan Cancel reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.