Please be aware of all shipping deadlines before placing your order - we cannot guarantee orders will arrive before Christmas!

## Reverse engineering the Mac ‘breathing’ LED

For the Duel nature sculpure, I wanted to have a ‘breathing’ pattern where all the LEDs vary in brightness in a natural/organic way. A good example is the ‘sleep indicator’ LED on recent Macs/Powerbooks. (There’s even a patent!) The problem is that, while the patent claims its a simple sinusoid (see the patent for the image), programming in a sinusoid doesn’t look nearly as good. So I decided to get the real waveform with a kludgy reverse engineering attempt:

I used a MIDIsense instead of a simple voltage divider because I want to extract the absolute LED brightness pattern and a photocell voltage divider acts ‘inversely’ (well, 1/R) instead of linearly (ie, just R). (The MIDIsense has an opamp to linearize the resistive sensor output)

There it is! There is a bit of ‘noise’ on the peaks because I’m picking up some of the PWM artifacts through the diffused white plastic.

Check out all the Circuit Playground Episodes! Our new kid’s show and subscribe!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground”Adafruit’s Apps!

## 5 Comments

1. msiegel

Having stared at that little light (but not read the patent), I’ve come to believe the waveform is made up of *pieces* of sinusoids… each quarter-cycle having its own randomly-generated frequency. Could be wrong, but the speed of brightening/dimming just keeps changing!

It’s too bad you can see the LED blinking on and off by eye — PWM cycles must be fairly long…

2. Actually, it does look like a “simple sinusoid”, with certain assumptions:
The frequency looks like it varies, probably pseudo-randomly, like a spread spectrum design.
The LED consists of two chips, back-to-back, so the light output is a full-wave rectified sine.

3. naikrovek

I’m not quite sure why, but ladyada, you are awesome. my spidey-sense goes off every time you post something neat like this.

4. […] I have been playing with pulse width modulation for running a LED lately. My goal is to reproduce a “breathing” light like that in a MAC computer or DuelNature light. Ok this ladyada has been a driving force and encouragement for me to get back into electronics. I have taken the PWM picture from her scope and placed dots on it for certain intervals. I then put those values (well close to those values) into a spreadsheet and trendlined it with the equation. I outputted the equation to actual values and exported those numbers biased on the Compare1a on an Atmel chip. I even took slope values to minimalise the code. Right now it is about 517% of the total capacity of the chip in the breakdown of the time periods i am using and do not want to add extra memory and use the smallest code…..so that is still in progress. My timing between changes must be small because great jumps are noticeable to the eye and therefore are not smooth. I think i will compile a VB app to analyze the data and equation to figure out how to streamline the code. oh if you were curious on the equation(y = 0.0009x^4 – 0.045x^3 + 1.136x^2 – 16.031x + 119.26). So why do all this? because I AM BORED and need to challenge my mind. also i find a led that uses a sinusoidish looks cool and could be used in many of applications. […]

5. This section contains tactics …

They are similar because they are sketchy and morally dubious….

Sorry, the comment form is closed at this time.