Showing posts with label LED. Show all posts
Showing posts with label LED. Show all posts

28.1.10

Inside a LED lamp

Using LED lamps instead of incandescent bulbs and fluorescent lamps is argued to be power efficient thus economically favorable. Longer life span is also usually cited as an advantage. I wanted to look into the details for a long time and recently I ordered some LED lamps on ebay, so I took one of them apart to see what is inside...
The lamp is a 48 LED device, and is written to use 4.5W on a 230V power supply. My intention is to present the schematics of the lamp so that we can see the details of its operation.

LED basics:


Just to understand the main building block of the lamp: LEDs (light emitting diodes) are semiconductor heterostructure devices meaning that they have rectifying properties so that current only passes through one direction, while in the other way around it doesn't. While this is true for all diodes, the plus for LEDs is that light emission will happen only when they are conducting. Even if this is the case there is a certain threshold for the light emission to start which is around 3.5V for blue and white LEDs. Above this threshold the current through the device rises exponentially so it needs to be regulated which is usually achieved by either an external resistor in series or a current generating power supply circuit.

LED lamp:


Let's see what we have here: Regulation on the AC side is done by C1 as it acts as a finite impedance at 50Hz. The point is that the this is achieved without any unnecessary dissipation as there is no heat generated on C1. D1 is an integrated Graetz-bridge which rectifies the input voltage. The role of C2 is smoothing the output and R4 is an additional protection for the LED block. R1, R2 and R3 discharge the capacitors after switching the lamp off (most likely due to safety reasons). I also put some measurement data on the schematics: the 48 LEDs in series operate from a sum of 179V meaning that each LED has a voltage drop of 3.73V on average, in good agreement with our expectations. The 110mV voltage across the 10 Ohm resistor tells that 11mA flows through the LEDs meaning that the dissipation of the block is 11mA×179V=1.97W which is way lower than the expected 4.5W! Indeed it is not surprising that the light output of this lamp is not enough especially if compared to compact fluorescent lamps. The power factor can also be calculated: the voltage drop over C1 is 124V leading to a  power factor of 0.84. This value of course becomes important if LED lighting is to take a major role in households.
In conclusion it turns out that the electrical circuit is as simple as possible leading to a high average lifetime of the device (I expect it to be comparable to the couple of thousand hours of compact fluorescent lamps). No 50Hz wobbling of the light output is also a benefit of the device. However the efficiency of the principle described above is given by the fact that many low power LEDs was put in series leading to a voltage drop of 179V on the LED block with only 11mA current consumption. High power LEDs cannot be used this way since each single (!) chip has a light output better then this entire block while consuming several hundred mA-s at around 3.5V (a good example is Cree's XLamp series). This means that a more complicated power supply is necessary for such a LED lamp which together with the more expensive LED means more expensive device but way better light output as well (especially true for devices equipped with three or four high power LEDs), so I recommend buying such a lamp instead of these cheap ones.

29.12.09

WD MyBook Hacks - LEDs

One fascinating aspect of this storage device is the front LED panel. This can be used to visualize the status of the MyBook, or even to merely play around :)
For the "blue ring" version of the MyBook there exist a detailed tutorial on the related wiki, yet for the newer "white light" version I haven't found anything, but after some testing I managed to have a consistent picture of what is going on. Let's see:

The modul in charge for operating the LEDs is the following:

~#: lsmod | grep led
oxnas_wd810_leds            7496   0

This modul is located in  
/lib/modules/2.6.24.4/kernel/arch/arm/mach-oxnas/oxnas-wd810-leds.ko.

 If the modul is loaded (it should be on startup), we get the interface in /sys/class/leds:

/sys/class/leds#: ls -1
oxnas-wd810-leds:ac/
oxnas-wd810-leds:ca/
oxnas-wd810-leds:st/
oxnas-wd810-leds:sw/


Here we find for directories with rather identical content:

/sys/class/leds/oxnas-wd810-leds:ac#: ls -1
brightness
device@
subsystem@
trigger
uevent 

In detail:

brightness contains a single numeric value between 0 and 255
device@  symlink to /sys/devices/platform/oxnas-wd810-leds directory
subsystem@ symlink to /sys/class/leds
trigger:  by default one single line: none [sata-disk]
uevent: contains:
PHYSDEVPATH=/devices/platform/oxnas-wd810-leds
PHYSDEVBUS=platform
PHYSDEVDRIVER=oxnas-wd810-leds

Out of these brightness will be of the most importance. Using the numeric value here we can control the illumination of the LEDs. The rest, well those need some more research, I think however that it is a good idea to leave uevent alone, and trigger might be responsable of the automated operation in response to some event. It is quite confusing still that it has the same content in all four directiories...

The brightness files can simply be altered by for example:

/sys/class/leds/oxnas-wd810-leds:ac#: echo 1 > brightness

which means that we put "1" in the file. So let's see the role of each directory:
  • oxnas-wd810-leds:ac/: "ac" might stand for activity. Putting any numeric value here will cause the LED stripe sweeping up and down once and returning to the previous state. It is interesting that the actual value does not matter (even can be the same always), yet a simple "touch brightness" is not enough.
  • oxnas-wd810-leds:ca/: Here we have a fuel gauge operation of the stripe. The numeric value expresses percentage, so that values between 0 and 100 make sense here. 
  •  oxnas-wd810-leds:st/: This directory is for several visual effects (including blinking, wobbling, sweeping back and forth...) which can be altered by putting a number between 0 and 15 in the brightness file. Larger values have no effect, while 0 and 1 stand for the steady pattern determined by the fuel gauge.
  • oxnas-wd810-leds:sw/ I did not manage to alter the LED pattern by any numeric value. This can be either not implemented feature or has some different mode of operation.
Using these one can easily visualize the disk usage, temperature, or even the load average of the MyBook :) The moving patterns are also capable of some sort of alarm operation (based on e. g. SMART report of smartmontools).

I noticed that sometimes all of the LEDs turned off and didn't respond anymore. In this case a reboot is necessary since reloading the module itself not seemed to be enough.


There is even more: I also found signs of controlling the rest of the LEDs on the storage (including power, USB). This is what I found in /sbin/fschk_prompt.sh:

    #Turn on PWR LED
    /bin/echo 0 >/proc/wixgpio/gpio06
    #Turn off PWR LED
    /bin/echo 1 >/proc/wixgpio/gpio06
    #Turn on USB LED
    /bin/echo 1 >/proc/wixgpio/gpio10
    #Turn off USB LED
    /bin/echo 0 >/proc/wixgpio/gpio10
    #Turn off ID LED
    /bin/echo 0 >/proc/wixgpio/gpio00


The interesting thing is that there is neither such directory in /proc nor any GPIO-related module anywhere. So this can be some sort of residual of code from the "blue ring" device or something like that...