In this post I’m going to describe my attempts to date to build a novel computer hard-disk activity indicator, which I named the “spindicator”.
The usual hard-disk activity indicator is an LED connected to a header on the motherboard which illuminates when data is being read from or written to the hard drive. These reads and writes often happen many times in quick succession, resulting in the characteristic rapidly flashing LED during periods of high disk activity. A while back I built a nixie clock from old Russian nixie tubes. A related type of old-school discharge tube is the dekatron, which is a decade counting tube. I love the look of the spinning warm glowing dots of a dekatron counter, and wondered how I could possibly use one in a project. Then I had the idea of using one as a spinning computer disk activity indicator, or “spindicator”, with the activity pulses from the motherboard advancing the dot around the dekatron. There were a couple of problems with this idea, firstly I didn’t have a dekatron on hand, and secondly I didn’t (and still don’t) know how to design the high voltage circuitry for driving one. So I decided to begin by building a simulated dekatron from a ring of ten LEDs, and trying to drive this with the disk activity signal from the motherboard.
Selecting a Counter
A quick look at my old Digital Circuits & Microprocessors textbook from university (I’m not an electronics engineer, I just took the course out of interest) and I could see that simplest type of counter that would produce the required output, a sequentially advancing logic high output, would be a mod 10 ring counter. One could be easily built from flip-flops, but ring counters do not use flip-flops efficiently. A mod 10 (decade) ring counter requires 10 flip-flops. A modification of the ring counter is the switchtail counter, also known as the Johnson counter. This only requires 5 flip-flops to produce 10 unique output states. The disadvantage is that to get a single advancing high output from this counter requires decode logic to be added to the flip-flop outputs. Luckily, however, a mod 10 Johnson counter complete with decode logic is conveniently and commonly available in integrated circuit form as the 4017 decade counter. The counter has 10 outputs, Q0-Q9, which respond to the positive edge of a clocking waveform as illustrated below.
Figure 1. Response of the 4017 outputs to the clock input
This is exactly the output required to drive the spindicator LEDs. With the counter sorted, the next task was to figure out how to connect it to the motherboard HDD activity header.
Connecting to the Motherboard HDD Activity Header Pins
I did a bit of digging on the internet to try and determine the nature of the HDD activity signal at the motherboard header. I found a description of the SATA disk activity signal, with example host side implementations (figure 2) in the Serial ATA specifications.
Figure 2. Example host LED drivers (source: Serial ATA Specification Revision 2.5, figure 60 )
The specifications state that the device (the SATA hard drive) will provide an open collector (or drain) active low activity signal. Exactly how the host (the motherboard) uses this signal to drive an LED is largely up to the board designer. The two circuits given in figure 2 are examples of possible host implementations. In a circuit of type B, it would be easy to directly obtain an active low clock waveform from the header by shorting the two header pins, provided the open circuit voltage on the positive pin was the same as the supply voltage used to power the 4017 counter. I later determined that my board (a Gigabyte EP45-UD3R) had a B type circuit, and that the open pin voltage was +5V. However, initially I considered that the easiest way to obtain a signal was to use an optocoupler. That way I didn’t need to know the nature of the motherboard circuit or voltage. An optocoupler, such as the 4N25 that I used, is a nifty device consisting of an infrared LED and photosensitive transistor all contained in a small 6-pin IC. A signal is passed through it by way of light alone, allowing physical separation of parts of a circuit. For this project, the optocoupler’s LED can be connected to the motherboard HDD activity header pins in place of the regular HDD activity LED. When there is disk activity, the LED will light and switch on the opto’s transistor. The switching of this transistor provides the logic pulse to drive the counter clock.
Putting it all Together
Version 1: The Positive Edge Triggered Spindicator
It can get a bit confusing when you try and follow the waveform from device through to counter, but let’s try. The device (hard disk) provides an active low signal to the motherboard. The m/b uses this in such a way that an LED connected to the header will light when the device signal is low, as can be seen from figure 2. So when there is activity, the opto LED will light and switch on the transistor. If the opto’s NPN transistor collector is connected to V+, and emitter connected to ground, then a logic signal taken from the collector will be low when the transistor is on, i.e. when there is activity. The 4017’s count is triggered by the positive edge of a clock waveform applied to the Clock input. From our deduction above, if this input is connected to the collector of the optocoupler’s transistor, the count will advance at the end of each activity period (as the HDD activity LED goes from on to off). Such a device I call a negative edge triggered spindicator, named because it is the high to low transition of the optocoupler LED pulse that advances the count. Now of course there’s absolutely nothing wrong with this, it makes no difference to the operation of the spindicator, but for some reason I felt that the count should be advanced when the LED turns on, not off, which in my nomenclature would be a positive edge triggered spindicator. One way to do this would be to add another transistor as a logic inverter. However it turns out there’s an easier way (apart from not bothering with it at all). If you have a look at the 4017’s datasheet you will see that as well as a Clock input, there’s a Not Clock Enable input (this is usually written as Clock Enable with a bar over it, but I can’t do that here). This input is active low, so if you tie it to logic low, the counter will respond to the positive edge of the clock waveform at the Clock input. If Not Clock Enable is high, the counter will not respond to the Clock input at all (it will not enable the clock as its name says). The thing that caught my attention was another manufacturer’s datasheet for the 4017. In this one, Not Clock Enable was called Not Clock (written as Clock with a bar over it), indicating that it was the logical inverse of the Clock input — just what I needed to change the triggering edge. Looking at the (simplified) internal logic of the IC, figure 3, you can see how it works.
Figure 3. How the 4017 clock inputs are logically combined
If Not Clock is held low, then the output from the AND gate will exactly mirror the Clock input. If the Clock input is held high, then the output from the AND gate will be the inverse of the Not Clock input, and the counter will effectively become negative edge triggered with respect to a waveform at the Not Clock input. Anyway, the upshot is, that by holding Clock high and connecting the signal from optocoupler to Not Clock I could get my positive edge triggered counter as defined above. In hindsight I shouldn’t have bothered as I later ended up changing it back to negative edge triggered version anyway, as you’ll read below.
For the spindicator output, I chose ten 3mm clear-lens green LEDs. I found that connecting these directly between the outputs of the 4017 counter and ground gave adequate brightness without the need for additional switching transistors. So here then is the circuit as built and tested for the positive edge triggered spindicator.
Figure 4. The positive edge triggered spindicator – the count is advanced at the beginning of a disk activity period.
I built and tested the circuit on a breadboard using a 5V power supply, as I planned to tap into the computer’s 5V supply in the final version. To test the circuit I used either switch pulses, or the output from astable 555 timer to simulate disk activity. After verifying that everything worked, I built up the circuit on a piece of prototyping circuit board and mounted the LEDs on a circle through a 3.5” drive bay cover plate, as can be seen in the photo at the beginning of this post, and the photos below. I should mention that my computer case is a mess after years of mods, and now sports no front cover, so these cover plates are exposed. It’s quite good, as I’m not worried about drilling a few holes. I’ve also taken to using foil tape as a type of grungy exterior case finish, so unused holes just get taped over.
The spindicator circuit board. I used IC sockets so that I could reuse the ICs if the thing turned out to be a failure. A terminal block is used to tie together the LED cathodes (brown wires).
The back of the circular LED array. Some of the LEDs were a bit loose, hence the messy hot melt glue job.
An early modification I made to this particular computer case was to rip out some top-mounted unused firewire/USB/audio ports and install a top window and fan. Handily, the cables for the firewire and audio ports were terminated in lots of individual header pin connectors. These have kept supplied with pin connectors for projects ever since, including those I used here to connect the HDD activity header to my spindicator circuit. The local electronics store provided the 4-pin molex connector needed to connect to the computer’s 5V power supply.
I made the above video clip with my webcam to better show how the first spindicator (the positive edge triggered circuit of figure 4) worked when installed in the computer. In the first part of this clip the hard drive is actively storing a file which is being downloaded. In the second part it is mostly idle (apart from saving the webcam video). As can be seen, the active drive activity consisted of multiple very rapid pulses (some don’t even show in the 30fps video) with longer pulses in between where the light appears to briefly pause. This gives the spindicator an interesting but slightly chaotic looking behaviour. When idling, there are very rapid bursts of usually 8 pulses, resulting in the light appearing to jump backwards by two places every couple of seconds. I couldn’t capture this exactly in the video as the computer was also recording the video. Overall I wasn’t very satisfied with this behaviour, and started to consider how I might be able to filter out the high frequency pulses to give a more consistent rotating look to the spindicator.
Version 2: The Negative Edge Triggered Spindicator with Frequency Cut-Off
It struck me that to remove the very rapid pulse sequences I could use the charging or discharging of a capacitor via a resistor to introduce a time delay in the triggering edge of the counter clock. I’ve since discovered that this arrangement is known as a low pass filter (you can tell I’m an electronics amateur). When I sat down to work out the circuit I realised that the easiest modification to make was to introduce a delay in the rising (positive) clock edge by charging a suitable capacitor through the existing 10K resistor. I did work out and successfully test a circuit for a discharging capacitor delay on the falling clock edge, but it was not as straightforward as the charging capacitor. Of course this meant that the counter needed to be triggered by the positive clock edge, so I also has to switch the wires around and apply the clock signal to the Clock input, and tie the Not Clock input to ground. I built up a test circuit on the breadboard and tested the circuits using a 555 timer generated clock signal of variable frequency. I determined that I probably needed a 0.47µF capacitor to do the job. In the test circuit this seemed to cut off frequencies greater than about 100Hz, although when I tested it in the modified hard wired circuit it cut off frequencies greater than 160Hz. Because I wanted the ability to try different caps in the final version, I wired up some unused pins of the optocoupler’s IC socket and just plugged the capacitor into that. The modified circuit is shown in figure 5 below.
Figure 5. The negative edge triggered spindicator with low pass filter – the count is advanced at the end of a disk activity period, provided the time between pulses exceeds a threshold value determined by the capacitor and resistor.
I should note here that it is of course possible to use a different value for the charging resistor if you want to use a different resistor/capacitor combination. I have used a 10K only because it was already soldered onto my board from the first version of the circuit.
I reinstalled the modified spindicator with a 0.47µF capacitor and found that it worked really well. The jumpy behaviour was now gone and the device had fluid spinning motion. The result can be seen in the video below.
I was so pleased with this version that it has remain installed in my computer. I also disconnected my power LED, as the spindicator has the advantage of acting as both a drive activity indicator and power LED because one of its LEDs is always on.
The modified circuit. Note the white capacitor plugged into the IC socket.
Postscript: Direct Connection Without An Optocoupler
Early on I had though about the possibility of obtaining a clocking signal directly from the motherboard header. Although I decided to use an optocoupler, I wanted to go back and see if I could drive the counter without one. The first requirement was that the positive header pin be at the same open circuit voltage as that used to power the counter. A check with the meter (connected between the open positive pin and the computer case) revealed that the pin was at +5V, so that was ok. The second requirement was that the motherboard driver circuit was of the B type (figure 2). In this case, the two header pins could simply be joined together to provide a driving signal. This turned out to be the case with my motherboard. The problem was, I still wanted to include my low pass filter, and I couldn’t do this if I directly connected the motherboard signal to the counter. I would need to use the signal to switch a transistor, essentially making it the same circuit as above but with a direct connection rather than an optical connection.
I built up the circuit shown in figure 6 on a breadboard (although with just 3 LEDs) and put it beside the open computer case so that I could connect it to the header pins. Sure enough, it worked like a charm, showing that it was possible to connect a transistor directly. However it’s really no more difficult or expensive to use an optocoupler, and it removes any uncertainty regarding the motherboard circuit design. If any reader of this blog should want to build a spindicator, I would recommend the optocoupler route.
Figure 6. An alternative to using an optocoupler – using the motherboard header signal to switch a transistor directly. This may not work in all cases, and use of an optocoupler is recommended.
Testing the direct connection circuit of figure 6 using 3 white LEDs. The green lights in the background are the interior illumination of my computer case.
Well that about concludes this long-winded post. I hope it’s been of interest to someone. I certainly had fun building the circuits. A guess at some stage I should try and figure out how I might build a spindicator from a dekatron tube. If anyone has any ideas about how to do it I love to hear them.
UPDATE: Using Transistors to Drive the LEDs
From the comments it seems that some folks are having trouble driving their LEDs directly from the 4017 counter. The other option is to use some general purpose NPN transistors such as BC 547s to drive the LEDs, although this does add several components to the circuit. The circuit below should do the trick (only the modified counter output shown, the rest is as before). Note that you should change the value of the LED current limiting resistor (160 ohm below) depending on the characteristics of the LEDs you’re using, and the current you want to run them at.