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:
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:
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:




















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.
what current has the power supply have?
I am using a lab adjustable power supply.
But a stabilized 12V 2A should be enough.
Hello
is it usefull for screen printing purpose
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).
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.
I’m glad you managed to work out your problems. Please post some pictures when your box is up and running.
Send photos of the finished box, although later, but still sent. At the end are attached two photos of the finished PCB.
photos
Great results! I see your box is working fine and your first pcb seems ok. I like how you have included the supply in the box, i should have done that too. Hope you don’t mind, i’ll add your pictures from your box.
no problem
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.
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.
[...] out part 2 for a timer specially designed for this box. June 24th, 2010 | Tags: box, exposure, led, leds, [...]