
Reverse engineering the Mac ‘breathing’ LED - aitor
http://www.adafruit.com/blog/2010/08/26/reverse-engineering-the-mac-breathing-led-2
======
rbxbx
And the product that they were reverse engineered for, the iCufflinks

<http://www.adafruit.com/icufflinks>

Quite appealing if you ask me, if a bit bulky for cufflinks :)

~~~
crocowhile
Does the "made in North America" thing really adds any value to that item?

~~~
ugh
No, but it’s good marketing. Nothing wrong with that.

Funny story: At the end of the 19th century Great Britain pushed for all
products to be branded with their country of origin, not to market their
products better but for protectionism – to make it easier for customers to
recognize real or perceived knock-offs.

That works if those other countries really make inferior products but it
backfires when other countries make products of equal or better quality. “Made
in Germany” (for example) then becomes a mark of quality, not inferiority.

~~~
crocowhile
Yes, that was normal in Italy too during fascism. Protectionism has always
been a great popularistic argument and that's why I am surprised to see it on
a geeky product like that. One would think that the user of battery powered
cufflinks wouldn't care about that.

~~~
nupark2
I'm not sure why you think geeks unilaterally oppose protectionism (or that
we'd even call it protectionism). Seems like a broad, inaccurate
generalization.

Personally, I like keeping money in the local economy when it makes sense to.

~~~
crocowhile
Because hackers are usually curious people, with many interests; chances are
they study some economics and found that this kind of 'protectionism' doesn't
make much sense.

But yes, you're right, it's quite an assumption. On a parallel (OT) note, I
have no idea whether there is a political bias amongst geeks. I've read some
pool from NSF a few years ago and it was quite impressive how scientists tend
to be left wing/liberal, why engineers tend to be right wing/conservative. So
politically speaking there's probably two kinds of geeks but how about two
kind of hackers?

~~~
nupark2
_> ... this kind of 'protectionism' doesn't make much sense._

This is obviously open to some debate; your condescending declarations of
certainty are grating and rude.

------
lutorm
I suspect the waveform is so non-sinusoidal because the eye is approximately
log-sensitive. So if you want something to look sinusoidal, you should really
physically output exp(sin(w*t)+c), which looks approximately like the output
on the scope.

~~~
HeyLaughingBoy
Exactly right.

A couple years ago someone asked me to build him a product that would simulate
sunrise: basically just gradually fade up a few high-power LEDs. The _only_
thing I found that worked was a very gradual logarithmic-type fade. Even so, I
had to prolong the curve at the low end. It turns out that human vision can
detect small changes at low light levels, but at high brightness it takes a
big step change to register.

Probably old-hat to trained lighting engineers, but I learned a lot doing such
a seemingly simple project.

------
andrewgleave
The LED or SIL (Status Indicator Light), is controlled by the Mac's SMC. You
can fiddle with how it operates by setting the relevant keys using IOKit.

<http://www.parhelia.ch/blog/statics/k3_keys.html> gives details on some of
the Mac's LSx SMC keys.

------
pixelcloud
I'm pretty sure Apple has a patent on this.

Here's some code! [http://osx-launchpad.blogspot.com/2010/11/breathing-led-
effe...](http://osx-launchpad.blogspot.com/2010/11/breathing-led-effect-with-
launchpad.html)

edit: <http://www.freepatentsonline.com/6658577.html>

~~~
mseebach
IANAL, but the patent, as I read it, if for a "A sleep mode indicator
apparatus for a laptop computer, said apparatus indicating to users that said
laptop computer being in sleep mode" or "A status indicator apparatus for an
electronic device, said apparatus indicating to users of said computer a
certain status". Since the cuff links doesn't communicate any kind of state, I
don't think the patent applied. Copyright for the design sounds more
plausible, as they're clearly designed to look like something from a Mac.

~~~
rbanffy
> Since the cuff links doesn't communicate any kind of state

They could be connected to brain-wave analyzers so they could indicate _you_
are asleep.

------
chopsueyar
Must be nice to have an oscilliscope.

~~~
joezydeco
If you're doing simple digital work, you can get a hell of a lot of
functionality for a lot less.

I'm a _huge_ fan of the Saleae Logic (<http://www.saleae.com/logic>). It does
8 lines of digital scoping @ 24 Mhz PLUS protocol decoding
(I2C/SPI/CAN/Serial) for under $150. That's 5% of the cost of a Tek or Agilent
scope. And the GUI is lightyears better than those other companies.

~~~
ableal
Looks very nice, and seems made by people smart enough to make the software
multi-platform (Linux/Mac/Windows) and ship to (most of) Europe without
customs hassles.

Haven't fiddled with hardware lately, but I'm tempted to get one for old times
sake (today came across the logic probe I made with a LED, resistor, plastic
pen and sewing needle back in my student days ;-).

~~~
joezydeco
A nice touch is that you can download and play with the GUI (using faked
waveforms) to check it out.

------
Luc
Or the digital way: on the Commodore 64 disk drive (the 1541), you'd flip a
bit of a certain memory-mapped location to switch the LED on or off. Doing
this a variable amount of times per second would result in a smoothly fading
led. Not sure if anyone ever made a sinusoidal fade, but there were demo's
with the LED following the beat of the music.

~~~
PedroDiogo_
Something like PWM?

I bet Macs don't generate analog voltages to fade the LED, it would be
expensive.

~~~
wizard_2
LEDs also don't change brightness with voltage, they do with amperage and
usually have an optimal amperage for the LED's design. Brightness can be
controlled many ways, the most common way is to use Pulse Width Modulation.
It's also a common power saving technique.

<http://www.reuk.co.uk/LED-Dimmer-Circuit.htm>

------
comex
Cool; I suppose you could get the same results with a webcam and a little
image processing.

~~~
joezydeco
You would need a frame rate 2x the fastest PWM cycle. Nyquist-Shannon and
etc...

~~~
atamyrat
Hmm why can't you construct the signal amplitude from webcam image? You don't
have to capture it as digital signal...

~~~
comex
Yeah, it's not necessarily to perfectly reconstruct the LED's signal, only the
average amplitude over a relatively long period of time. Like, just sample the
color of a certain pixel on each frame.

~~~
joezydeco
If the LED being used has a perfectly linear current-to-brightness curve then
sure, it's possible. Most high-brightness LEDs, however, do not.

~~~
tesseract
But you could just map the current-to-brightness curve of your own LED and
reconstruct the necessary PWM signal using that. Actually that'd be a good way
to go anyway, since that curve may differ from the one on Apple's LED.

~~~
djahng
Generating a PWM signal based on a particular LED's characteristics is similar
to designing the gain of an amplifier circuit around a particular BJT's beta.
It's just not done. That's also the whole reason behind controlling LED
brightness through PWM. By PWMing the drive current, you can ensure that the
LED is being driven far into its conducting region, and therefore not relying
on controlling dimness by varying current around the LED's "knee" (which
literally is different for just about every LED in existence, even same part
numbers). This way you also avoid other stuff like wavelength shifts that tend
to occur near the knee.

