Monday, May 25, 2009

Infrared (IR) Activated Power On/Off for ReadyNAS NV

Important Note: Please note that the following procedure will void warranty on your ReadyNAS device. If you have never attempted electronic projects, then this can't be your first electronic project. Please make sure that you have disconnected power before you start this project.

Detailed step-by-step instructions with pictures are at the bottom of this blog.


It really beats me that we have been talking about the great convergence of Internet, rich multimedia like music, videos and computer devices for more than nine years but not much has yet been done to make these various devices and software work together without a lot of hacking. We have a plethora of software protocols like streaming multimedia and UPnP for distribution of music and videos. We have Bluetooth and 802.11b,g,n protocols for near-area networking but the good old remote control in all the music systems still uses IR. Granted that some of the remote controls have started using UHF but these are still one-way fire-and-forget type of communications. Remote controls don't receive any acknowledgements and don't receive or retain the status of devices. Music lovers trying to program their remote controls have to constantly troll the Internet for finding discrete controls. Actually, there is a deeper issue. Most of the music devices for home use process acknowledgements visually using a small LED screen. The assumption is that user is always sitting in the line of sight of the multimedia device and he or she can see the device responding to remote control commands. This situation is fast changing due to use of computers for multimedia. Well, this is a different subject; here we are just going to talk about ReadyNAS NV model RNV1.

ReadyNAS NV is one device that has quickly gained almost a cult-like status among the multimedia crowd that is giving up CDs, DVDs in favor of IPODs, streaming multimedia, UPnP devices and Internet Radio. It is a tiny but very sturdily built device that can store almost 4.5 terabytes of multimedia on four commonly used 3.5" SATA disk drives arranged in a fault-tolerant configuration. This network area storage (NAS) device was designed by Infrant Technologies, which was later acquired by Netgear, since Netgear's own efforts in this area were not bringing them much market success. ReadyNAS NV has plug-ins for UPnP, streaming multimedia and several other utilities. I understand that due to popularity of this device, TwonkyVision has also released their own UPnP plug-in for ReadyNAS. Therefore, if you have a digital multimedia player, then you could use ReadyNAS for storing all your digital multimedia content. You really don't have to keep the ReadyNAS device in your drawing or living room. First of all, the fan makes a heck a lot of noise. Secondly, though it is a nice little device, I can bet it is pretty low on SAF (spouse acceptance factor) and it won't sit well with your receiver or DVD player. Therefore, most of the people like to keep it hidden inside a shelf in another room. This is the starting of our problem. You can turn it off remotely from an Internet browser but you can't power it on. You have to have physical access to ReadyNAS device in order to turn it on.

If you search the ReadyNAS site you will find several people trying to find out how they can power this device on and off remotely. Since this device is a tiny Linux computer, it has to have soft power-off; otherwise you will risk damaging your hard disks. Therefore, use of IR controlled 110v power-strips or lamp on/off controllers is out of question.

About a year back I had bought a used a ReadyNAS NV device to store my collection of more than 300 DVDs and 400 CDs. This worked very well but the problem was having physical access to the device each time I wanted to listen to music or enjoy my favorite movie. One weekend, in my copious spare time, I decided to add an Infrared (IR) switch to ReadyNAS device.

Initially, I looked into some USB IR receivers for remote control of PCs. There are several of these that come with their own software. However, the problem is that USB protocol does not have stand-by power supply. Therefore, you cannot power-on a device with USB IR receiver. I think it would be a good idea to upgrade USB protocol to add a low consumption standby power. This will help make USB power supplies greener, since they won't have to on all the time. But this is a discussion for another day. Luckily for us, designers of ATX form factor were smart people. They designed an ATX power supply that has a stand-by power, which can be used to drive IR receiver unit when a computer is turned-off. ATX form factor computers have soft-off and soft-on feature. This means that you can use software to power-off or hibernate your computer and use a signal to hardware such as network controller to wake-up your computer. You couldn't have done this with PC-AT form factor computers. The way this is done is that ATX power supplies have a 5v stand-by power with a max current rating of 10 milliamperes (MA). This wire is purple. This is similar to stand-by power in home audio devices like receivers and DVD players, which can be powered on using IR remote controls. When power on switch is pressed, stand-by power is used to pull TTL (transistor to transistor logic) to low, which turns on the power supply. When power supply has stabilized, it sends a POWER_OK signal to the motherboard to turn the computer on. When I opened ReadyNAS I noticed that ReadyNAS had an ATX power supply, which meant that addition of a soft-on and soft-off power functions was going to be easy.

IR controlled switches are cheap and easy to design. Basically, what you are doing is that you are using a standard infrared (IR) receiver, like Vishay TSOP series to detect and demodulate a signal and then use a microcontroller to process the logic. Luckily, most of the IR detection, demodulation and comparator functions are already built into IR receivers like TSOP1703. Therefore, you can use the output of TSOP series IR receiver to feed a microcontroller chip to control activation and deactivation of a switch. If you are one of those who like to dig into technology, then I'm sure you would want to check out PIC microcontrollers made by Microchip and an equally popular family of ATtiny microcontrollers made by Atmel. You will need to get a PIC or ATtiny programming kit hardware and software. If you know a little bit of C-programming, you will be well on your way to program these microcontrollers in whatever way you want them to react to the input from IR receiver. Unfortunately for me, my copious spare time on weekends is limited to about three hours. Therefore, though I loved programming this microcontrollers long time back, I can't do the same these days. If you are in my category, then I'd recommend checking out the following websites.

Vasilis Serasidis

Vasilis Serasidis maintains a nice AVR website (http://www.serasidis.gr) with a number of electronic projects. Vasilis has designed a nice infrared remote control receiver (http://www.serasidis.gr/circuits/InReCoMe/InReCoMe.htm) for media center PCs. He even provides details of ATX power supply. He provides downloadable code for programming ATtiny13 microcontroller chip.

Circuit Exchange International

Circuit Exchange International (http://www.zen22142.zen.co.uk/index.html) has an IR switch circuit (http://www.zen22142.zen.co.uk/Circuits/Interface/ir_switch.htm) designed by Andy Collinson. However, you will have to modify it to run on stand-by power. In addition, you may want to send the TTL output of this circuit directly to the ATX power supply.

The Linux Documentation Project

Werner Heuser maintains a Linux Infrared Howto (http://tldp.org/HOWTO/Infrared-HOWTO/index.html) page as part of The Linux Documentation Project. You may want to checkout the following page: http://tldp.org/HOWTO/Infrared-HOWTO/infrared-howto-c-lirc-irda.html. It is a good discussion though less relevant for our particular project.

Xirremote

Squar0L/Xirremote provides the design of an IR controlled switch (http://xirremote.tripod.com/) for IR remote power on/off. This is a good design and it will work. However, you will need to do PIC programming and debugging.

Simerec, Austin

Finally, Simerec (http://www.simerec.com/) a small company based in Austin sells a tiny IR controlled switch (http://www.simerec.com/PCS-2.html) PCS-2 that can be used to power on/off an ATX device.

A Quick and Easy Decision

I decided to use Simerec's PCS-2 IR receiver device, since I can't be spending more time on my hobbies than is necessary to relax on certain weekends. Which meant I had to order PCS-2 IR receiver unit from Simerec and then wait. However, the benefit is that PCS-2 microcontroller chip is already programmed, which saves a ton of time in programming and debugging of code. If you pay a little attention to PCS-2, you will notice in the documentation that this switch is supposed to be connected in parallel to the existing power on/off switch on PCs. I bought it as a non-assembled kit, though I could have used the assembled kit too with some minor modifications. Since Simerec PCS-2 kit comes with documentation, I'm not going to discuss the documentation regarding PCS-2 here. I think all I need say here is that I connected Simerec PCS-2 switch in parallel with the two power on/off switches installed in ReadyNAS. Why do they have two power on/off switches in parallel. Clearly this is a good design feature. This is the only part of ReadyNAS that is manually operated and having two switches in parallel creates redundancy and improves reliability. Our Simerec PCS-2 IR controlled switch will be a third switch running in parallel to this configuration, which means that ReadyNAS device will turn on if any of these three switches are used to pull down the TTL to the power supply.

You will need to have a female and a male power connector, 22-16 AWG mid-line tap red T-splice connectors for mid-line connecting power, 22 AWG stranded wire, 21 AWG soldering wire. I'm assuming that you already know how to do fine soldering, and use midline taps for splice connecting wires. Simerec's documentation contains a nice one page instruction with pictures on how to use midline tap T-splice for connecting wires. Please review the instructions if you have not used mid-line taps.

Let's start with disassembling the ReadyNAS device. This whole project should not take more than three hours, if you are organized. Make sure that you are using a good Phillips screwdriver that fits snug in the screws, otherwise you will end up stripping the screws and that will be a bigger problem. Having the right tools is important to getting the job done quickly and efficiently.

This is a very well built device with a strong chassis. Therefore, you will be opening a lot of screws. There are only two types of screws. Make sure that you have a tray ready for storing the screws.







You can see the side panel coming out after screws are removed. In the next step, we will remove the back panel with cooling fan.











Here are the screws that you will need to remove in order to open the back panel that has cooling fan attached to it. You will need to remove same screws on both the sides.





Open the back panel after removing the screws.













In this picture you will notice that the back panel is out. Now carefully disconnect the fan power supply by gently pressing on the tab and pulling it. Don't pull it by the wires; otherwise you will have more work to do.











Here is what the fan looks like after it has been completely pulled out.







On left is the ReadyNAS device with side panels and back panel removed.







Now we need to remove the ATX power supply sitting at the bottom of the ReadyNAS device.

Power supply sits on two rails running along the bottom length of the ReadyNAS device.




Here is one of the screws. There is a similar one on the other side. Once you have removed the screws holding the power supply to the chassis, it should be easy pull it out. If it is not pulling out easily, then inspect all around and make sure that there is nothing in the way and you have removed all the screws. It is not a good idea to use force with these electronic devices.


Here is the ATX connector that you will need to disconnect. You may want to refer to an ATX power supply standard to understand more about ATX power supply. For now, you can just remember that purple wire (there is only one purple wire) is +5v standby power. You could use any of the red and black wires for powering the IR receiver.










Here is the power supply unit out of the ReadyNAS device.







The last item for removing power supply is disconnection of ATX power connector. This is a standard ATX power connector. All you have to do is to press the tab and then carefully pull it out. This should be an easy step.











OK. We got the power supply unit completely out of the ReadyNAS device. We are now ready to go to the next step, which is removal of the daughter card that has got SATA connectors for hard drives.





Now we need to get the daughter card out. This is the daughter card to which SATA drives are attached. This is precision milled. Therefore, you have to be careful, when getting it out of the device and the motherboard. You will need to open eight screws. Make sure that you are using the right screwdriver and work with it gently and carefully. Of course, you have to make sure that there are no hard drives inside the ReadyNAS device.


Now we will remove the top panel by removing these four screws.







Once top panel is removed, you will be able to pull out the daughter card from the motherboard. Make sure that you are using anti-static band and placing these devices on an anti-static surface. Static can easily cause severe damage to sensitive electronic devices.




With daughter card pulled out, you can gently slide out the motherboard. It sits on the rails at the top of the ReadyNAS device. There won't be any need to remove the motherboard from the metal backing.





Almost there, just slide out a little more and you have got the motherboard out with the metal backing.






Here is the motherboard out of the ReadyNAS device. Notice that it is still attached to a metal backing that slides on the rails at the top of the ReadyNAS.





Here is the other side of the motherboard. Notice the 250MB memory chip.






Now we find out how we are going to connect a third IR controlled switch (remember, there are already two power on/off switches on the unit labeled as SW3 and SW4 and connected in parallel in the picture below) in parallel to SW3 and SWR. I've marked two locations. You may want to check these locations with a multi-meter or a continuity tester. When power on/off switch is pressed the two points should show continuity, otherwise these two points should be disconnected. I've selected two points to reduce the chances of short-circuit due to fat-fingered soldering. You will need to make double, triple sure that you are not short-circuiting anything when you solder. You may want to test the physical power on/off switches again after soldering to make sure that the switches have not been shorted.


Using 21 gauge soldering wire and a 5 or 10 watt pencil soldering iron will help in avoiding shorts. However, you should be ready with some de-soldering wick just in case. When doing these things, the goal is to do the minimum of changes to the device. In addition, you would want to make sure that whatever changes you are making can be reversed, in case you have a problem. Carefully compare your board to this picture and mark the place, where you will need to solder two stranded wires that will get connected to the IR remote controlled switch.

Here is the picture of two stranded 22 gauge wires soldered to the two points that I had marked earlier. It is important to use 22 gauge stranded wires and then tape them on the board, otherwise there is a likelihood of damaging the copper cladding on the PCB. Please note that I have threaded the two stranded wires under the motherboard along the sides of the metal. This ensures that the wires won't be blocking the hard drives.

Here is a close-up on the two 22 gauge stranded wires connected to the power on/off switche on ReadyNAS device.





Here is PCS-2 that I assembled. There is a slight modification from the way it is used in PCs. Per instructions for PCs, one 2-pin mini connector coming out of PCS-2 is connected to the power on/off male connector on the motherboard of PC and the 2-pin female connector coming out of the power on/off switch from the PC cabinet goes into the PCS-2 2-pin male connector. However, we don't have to do it. We just need to connect the 2-pin male connector on PCS-2 to the power on/off switch on the ReadyNAS motherboard. We are not changing anything conceptually, since it is still a parallel connection.

Now I used a dremel set to make two slits in the front bottom panel of the ReadyNAS device. I guess this is one of the irreversible changes I made. However, this was unavoidable. ReadyNAS device is quite compact. This is the only location, where you can find enough room to fit the tiny PCS-2 IR remote controlled switch. I put some crazy glue at the spots that are highlighted in black and then stuck the tiny PCS-2 device to the front panel. You would want to make sure that the red pushbutton, green LED and IR receiver are sticking out of the slit. Since red pushbutton is used for IR learning, you would want to have easy access to this button after you have reassembled ReadyNAS device. If you don't glue PCS-2 properly to the front-panel, it will sink inside the device, when you try to press the red button for learning IR codes. You may want to test this physical movement before you close the device.

Here is what the slits look like from the front.







I used T-splice or mid-line tap connectors (22-16 AWG) to connect a three wire power plug to purple, red and black wires coming out of the power supply. It does not matter which red and black you use and there is only one purple wire in ATX power supplies.




Below you will notice that I have connected a female power connector to the red, black and purple wires coming out of the PCS-2 IR receiver unit. Two twisted wires (brown and black) will be connected to the loose ends of the two 22 AWG stranded wires that were soldered to the switch on the motherboard. Polarity doesn't matter. You would want to review PCS-2 IR receiver installation documentation before this step. When you thread the wire from front of the panel to the motherboard, make sure that you are not coming in the way of hard drive space in the middle of ReadyNAS. Secure all the loose wires to the chassis using tape.

Here is the ReadyNAS device fully re-assembled. Never over-tighten any of the screws when you are re-assembling this unit. A good rule of thumb is to tighten as much as you can without having to apply force and then a quarter turn more.











Here is what it looks like in the front. I did not do a pro job with my dremel set but I did complete it in about three hours, which was my goal. This is anyway going to be sitting inside a shelf; therefore I'm not worried about the looks. You will need to program PCS-2 IR receiver for a 4-second forced shutdown option. I've tested it and it works great. I used Sony IR transmitter codes to program the PCS-2 IR receiver. This part is pretty well explained in PCS-2 instructions.

All the best! If you have any questions, please feel free to send me an e-mail. This was really fun.