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:

[flickr 212611715 ]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)

[flickr 212611654 ]

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.

Make a robot friend with Adafruit’s CRICKIT – A Creative Robotics & Interactive Construction Kit. It’s an add-on to our popular Circuit Playground Express, FEATHER and other platforms to make and program robots with CircuitPython, MakeCode, and Arduino. Start controlling motors, servos, solenoids. You also get signal pins, capacitive touch sensors, a NeoPixel driver and amplified speaker output. It complements & extends your boards so you can still use all the goodies on the microcontroller, now you have a robotics playground as well.

Join 7,500+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython in 2018 – Python on Microcontrollers is here!

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!

Follow Adafruit on Instagram for top secret new products, behinds the scenes and more https://www.instagram.com/adafruit/

Maker Business — Rethink Robotics closes shop. Long live collaborative robots #makerbusiness

Wearables — Cleaning is key

Electronics — Serial overkill

Biohacking — Biohacking Resources – Books, Talks and Podcasts

Python for Microcontrollers — CircuitPython @ Hackaday SuperCon #ICYMI @circuitpython @micropython @ThePSF #Python

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !


  1. 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. 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.