I am a lighting technician and in the live entertainment industry, we work in very loud environments. This means that we often can't hear the alarm buzzer of the UPS when we lose power which can lead to vital equipment unexpectedly powering off. We also like dark venues so we can hide better and so want to add LED strip lighting around our racks to make it easier to see what we're doing.
This Instructable will explain my solution to these issues. It is very easy if you have basic soldering skills as everything is through hole. No programming is necessary but I provide my code later on if you wish to modify it. You will however need an AVR programmer to flash the ATtiny13. Your UPS will also need a relay output card which sends a signal on loss of power.
What we want to achieve...
I want a 3 position switch to allow me to select WHITE, OFF, BLUE for my lights. If the UPS loses power, I want the lights to flash RED, even if they're turned off. When the power is restored, I want the lights to return to the switched state.
If we have no power, I want to be able to still turn on the BLUE or WHITE light with the RED flashing in the background. For this, I will switch to the OFF position and then back to the desired colour.
Lets do it...
Now that we know what we're looking for, lets get started. Watch the videos above for a demo and a walk through of the PCB build process. This Instructable will also go into further details as you read on
Step 1: Schematic & PCB
The schematic is pretty basic as is the PCB.
The first prototype I made was on a veroboard and it works perfectly well so don't feel that you need a PCB. I only designed the PCB as we wanted a more professional looking design and plan to make a number of these units.
Capacitor values don't need to be exactly the same as they're there only to smooth voltage. Resistor values need to be close but, once again, don't need to be exact. The IRL530N mosfets can be exchanged for any similar N-channel transistor - I used this as I have a stack on hand from a previous project.
Also note that this design is for 12V LED tape with a common +ve.
Step 2: Code & Flashing ATtiny13
Head over to my Github for this project here for the latest code: https://github.com/mtongnz/UPS_Warning_Light
The Arduino .ino file is available if you wish to edit the code. It's very straight forward but be aware that the ATtiny has limited space - I've used most of it already. To compile (make your bin file), in the Arduino IDE, under the Sketch menu, select "Export compiled binary".
NOTE: You need to have the ATtiny13 core installed. Follow these instructions: https://www.instructables.com/id/Updated-Guide-on-How-to-Program-an-Attiny13-or-13a/#step4
Flashing Firmware - AVRDUDESS
You will need a programmer of some sort - I use a USBASP device which is cheap and there are many available on AliExpress or similar sites.
Plug your ATtiny13 into your programmer. If your programmer doesn't have a socket, wire it up to your programmer on a breadboard using the pinout above.
Download AVEDUDESS: http://blog.zakkemble.co.uk/avrdudess-a-gui-for-avrdude/
Select your programmer. Select ATtiny13. In the "Fuses & lock bits" section, click read. If this doesn't work, ensure you have connected your programmer to the chip correctly.
Assuming that you are talking to the ATtiny, in the "Flash" section, select your bin file. Set it to write mode and click GO. You shouldn't get any errors if all goes well.
WARNING: As the ATtiny13 has a very limited number of pins, we need to disable the reset pin to give us 1 extra to use. Unfortunately, this means that once the fuse setting is changed, we can't re-flash the chip (without a special high voltage programmer anyways). If you're wanting to tinker with code, I'd recommend not doing this until you are ready!
If you didn't above, click the "Read" button to get the current fuse values. It should be (L) 0x6A (H) 0xFF
Set the (L)ow fuse bits to 0x7A and click "Write". This will turn off the clock divide by 8 which makes our timers run at the correct speed.
Now set the (H)igh bits to 0xFE and click "Write". This disable the reset pin, giving us an extra pin to use for output. Once this step is done, you cant change any settings or fuses on the chip.
You can find what these fuse settings are using this calculator: http://www.engbedded.com/fusecalc
You can now no longer communicate with your chip using the programmer. Plug it into your circuit and let's connect it to the UPS...
Step 3: Case It and Connect to UPS
To start with, I decided on how I wanted to case this project. I chose a 1U rack mount case as it allowed room for everything as well as a network switcher.
After deciding on the layout, I made a wiring harness for the switches and one for the LEDs. This will be dependent on your case size. I decided to add a second switch and outlet so I could turn off the LEDs on the rear of our rack completely. This is due to the fact that the rack is often near to audience members and the light can be off putting for them. This switch simply connects and disconnects the common 12V for the LEDs.
Now we need to drill some holes for mounting all of the switches and connectors. Once again, the method and location depends on your case. I used a variety of drill bits and then a file for the DB9 connector to get it squared off.
Put the PCB in place - I used adhesive stand-offs as they're easier than drilling holes in the case and work really well. Connect everything up, ensuring plugs go into the correct sockets and polarity of power is correct.
In my case, I added a powercon for power input and had it checked by a licensed electrician. Be very careful with mains power as it can kill you - get someone who knows what they're doing!
Connect the UPS
For this, you'll need a relay output from your UPS. It's also a bit quicker and easier if you have a manual with a pinout for the relays but you can use a multi meter to find which connections you need. As you can see from our manual, I need to connect to pin 5 to our switch common & 9 with the UPS input on the PCB.
Our relay card has a DB9 output so we purchased a DB9 for our case and a 1m serial cable to join them.
Connect the LEDs
As in my previous Instructable, I used 5 pin DIN connectors for the LEDs. They're super cheap and readily available but you can use anything that you have at hand.
Step 4: See It in Action
When we power the UPS on, we should see some coloured strobing action for about 5 seconds. This is so we can check that all 3 colours of LED are working and also because I felt like having it flash :)
Once that settles down, we get to the main event. Use the switch to select your colour of choice. After checking the white and blue both work, try turning the mains supply to the UPS off (but leave the UPS turned on obviously). The alarm on the UPS is probably beeping away and your red LEDs should be flashing also.
Flick the switch to the off position and then back to blue or white. The colour selected should now come on solid to let you fix the power issue but the red should keep flashing in the background until power is restored.
Now turn your UPS back on. Hopefully your LEDs are now in the solid colour as selected by your switch.
No more dead UPS batteries without warning :)