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.
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, or even use Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for MakeCode, CircuitPython, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.
Python for Microcontrollers — sysfs is dead! long live libgpiod! libgpiod for linux & Python running hardware @circuitpython @micropython @ThePSF #Python @Adafruit #Adafruit
Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !
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…
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.
I’m not quite sure why, but ladyada, you are awesome. my spidey-sense goes off every time you post something neat like this.
[…] 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. […]
This section contains tactics …
They are similar because they are sketchy and morally dubious ….