Posted: June 1, 2018 Filed under: Art, Coding, Creations, Explorations, How-to, That Totally Worked
This is a 100% recycled yak fur story.
Molly asked me a thoughtful question while I was in the middle of something else and I said “Just a second, I need to rotate my brain.” A moment later, I said OK and she asked me if my brain was all rotated now. I replied, “Well, 82° out of 90°, close enough.” Molly quipped “And since when did you ever do things square?”
But then I nerdsniped myself. I started to wonder about 82° angles. If a polygon with 90° angles is a square, what sort of polygon do you get if you turn 82° at each corner? It’s not one of your basic shapes, because:
- 120° angles make a triangle (3 sides, since 360° ÷ 120° = exactly 3)
- 90º angles make a square (4 sides; 360° ÷ 90° = exactly 4)
- 82° angles make a ??? (?? sides; 360° ÷ 82° = 4.3902439024???)
- 72° angles make a pentagon (5 sides; 360° ÷ 72° = exactly 5)
It must be some kind of … star shape, 82 doesn’t go evenly into 360, which means that you’d have to spirograph-around the circle more than once to come back to where you started.
But what kind of star? How many points would there be on a star with 82° angles at each point? I decided that I had to know, and that I wanted to see what the star looked like, not just find out the numeric answer. The numeric answer is the GCD of 82 and 360, and I could figure that out, but then where’s my picture of the star? I decided to write a quick program to draw stars with angles of ‘N’ degrees at each corner, and to print out how many points there were on the star.
So ten minutes later, I had refreshed my Logo skills. Luckily, Logo is secretly sort of a dialect of LISP, and I’m very comfortable with LISP-like languages. Here’s the code I finally came up with:
to anglestar :angle
make "count 1
while (heading > 0) [
setheading round modulo heading 360
make "count sum :count 1
And it printed “180”, meaning that this is a 180-point star. Or, as Molly pointed out, more of a bike wheel than a star really. An imaginary bike wheel.
I decided to try other angles since I now had this great program. With N=80°, you get a nine-pointed star, because 80° x 9 = 720°, which is twice around the 360° circle:
And with N=81° you get a 40-pointed star:
Although as Molly pointed out, this one isn’t really a ‘star’, either. This one is more of an imaginary bicycle gear, a lot like this real 40-toothed bicycle gear:
Oh, and after all this, Molly very patiently re-asked me her original question again, and I answered her without yak-further delay.
Posted: March 25, 2016 Filed under: Art, DIY, Explorations, Getting A Clue, Pearls of Folksy Wisdom, Reflections, That Totally Worked | Tags: art, blinky, fastled, journey, learning, LEDs, light
Five years ago today I got my very first piece of LED art gear to light up for the very first time.
It was a Color Kinetics panel that you sent data to over ethernet, not an addressable LED strip & embedded microcontroller coding situation at all. The panel itself previously belonged to an LED art pioneer, “Frostbyte”, who had taken it with him on his desert adventures before his untimely and accidental demise. His old electronic gear was auctioned for charity, and without really knowing what I was getting in to, I bought this massive (28 pound!) metal box with 144 RGB LEDs in it, and the network controller to match.
I could find no open source software to drive it, and owning the commercial sequencing/design package was out of my reach. For three years, the panel sat in my workroom idle and dark. But at some point, I found that the vendor had a simple free “test program” available, and I decided to see what I could do. Since the color data was sent from the test program to the panel over ethernet, I was able to capture the network packets, reverse engineer them, write my own code to talk directly to the LED panel, and TA-DA! First light!
But even with that one LED panel up and running, more than a year passed before I started learning how to use addressible LED strips and Arduino microcontrollers. Another year after that, I had officially become ‘part of’ FastLED with Daniel Garcia.
And now? Now I’ve created LED art myself, taken it on my adventures– desert and elsewhere, sold it and gifted it. I’ve taught LED classes, and I’ve helped build an online community for thousands of FastLED users. I’m not sure what I expected when I first bought that LED panel, but I don’t think it was all this great stuff.
So if there’s a lesson here, it might be this: If something intrigues you, step toward it. You never know exactly where you’ll wind up, but the journey will be an adventure in the right direction.
Posted: February 16, 2015 Filed under: Art, Coding, Creations, DIY, Explorations, That Totally Worked, Uncategorized | Tags: APA102, Apple, Apple //e, Apple II, AppleII, arduino, art, blinky, CALL -151, DIY, DotStar, fastled, glow, glowy, LED, LEDs, light, LPD8806, retrocomputing, WS2801
These days, I hack LEDs. I’m the co-author (with Daniel Garcia) of the FastLED library for driving tons of high speed LED pixels and strips using microcontrollers like Arduino and Teensy.
But back in the day, I hacked a lot of Apple II. I published a couple of shoot-em-up games (with Geoffrey Engelstein), all written in lovingly hand-crafted 6502 assembly language.
Finally I decided it was time to link the present to the past: to connect a hundred high-speed RGB LEDs to an Apple II, somehow, and ‘port’ our FastLED library to 6502 assembly language.
Well, I did it, and it works. My new creation, “FastLED6502”, can drive a hundred 24-bit RGB pixels at more than 30 frames per second from an Apple //e :
Here are the details of “FastLED6502”:
- “FastLED6502” is a lightweight port of FastLED’s core functions to 6502 assembly language for the Apple ][, Apple ][+, Apple //e, and Apple //gs.
- Supports APA102 / Adafruit DotStar LED strips, as well as LPD8806 and WS2801 (though those two are not fully tested yet).
- The LED strip is connected to the Apple II using the 16-pin DIP game port on the computer’s motherboard. The 9-pin DB joystick/mouse port on the back of the //c, //c+, and //gs cannot be used, as it lacks the TTL digital output signals needed to drive the LED strip.
- 24-bit FastLED Rainbow colors are included, along with FillRainbow, Random8 and a number of other useful functions from FastLED’s main library.
- Everything had to be re-written from scratch in 6502 assembly language. Luckily(?), I still remember how to do that.
- The assembly code knows the binary serial protocols for the APA102 (Adafruit DotStar), LPD8806, and WS2801 LED driver chips. Depending on which one you select, FastLED6502 transmits the LED colors in the correct protocol over the game port TTL digital output lines.
Considering that the Apple II sports a 1MHz 6502 so slow that even a “NOP” takestwo cycles, overall performance is pretty good: more than 30 frames per second for a 100-pixel strip.
Speaking of speed, or lack thereof, “three-wire” clockless LED strips such as the WS2811 NeoPixel are not supported now, nor will they ever be. The CPU is would need to be at least 20X faster to support them, and it isn’t. For that you want an Arduino or Teensy, and FastLED proper: http://fastled.io/
I gave the code its public debut at Veracode Hackathon 7. (The theme was “Cozy Cabin” — I don’t usually wear plaid.)
FastLED6502 at Veracode Hackathon 7
How’s it work?
So how does this all work? Well, you connect the CLOCK and DATA_IN pins from the LED strip to a couple of pins on your Apple II’s DIP game connector port, add power, and you’re ready to go. The Apple II’s game connector not only has inputs for joysticks, paddles, buttons, and so on, but it also has a few digital outputs — and that’s what FastLED6502 uses to deliver signals to the LED strip. On all the 16-pin DIP Apple II game ports (except for the //gs!), there’s even one pin that delivers a super-fast digital pulse; pin 5 is the C040STROBE line, which can pulse twice as fast as the other digital outputs. If you choose that for your CLOCK pin, the FastLED6502 code automatically shifts into high gear, and you get faster performance. FastLED proper does this, too, in a much fancier way; it’s amusing that ‘little’ FastLED6502 does some of this, too.
The code is in the “extras” directory here (and eventually on FastLED’s main branch, but not yet)
This is Crazy
Overall, this bit of code is completely nuts, and we don’t expect anyone to use it. At all. Ever. Accordingly, we’re not going to really support it, either. At all. Ever. It was a labor of love and a creation of pure modern retrocomputing insanity. But here it is, in all it’s insane glory, “FastLED6502”.
And now, if you cut me, I’ll bleed 16,777,216 colors at thirty frames a second.
Posted: April 4, 2014 Filed under: Art, Coding, Creations, DIY, Explorations, How-to, That Totally Worked | Tags: arduino, art, blinky, DIY, fastled, fiery, fire, glow, glowy, LED, LEDs, light
I’ve built and programmed a couple of different ‘fire’ simulations for Arduino and LEDs, and I’ve had numerous requests over the years to share the source code. I’ve always been happy to share my work; the holdup has been that before I share my code for the world to peer at, I like to clean it up a little. I like to give the code a clean shave and scrub under its fingernails before it steps out onto the wide open Internet where it might have an audience with Her Royal Majesty, The Queen of England. It could happen.
Anyway, I finally cleaned up the code for one of my simplest and most legible ‘fire’ simulations, and I give it to you, your Majesty, and everyone else, too. Here’s a video of the code in action on a 30-pixel strip of WS2812B LEDs (or maybe WS2811) and an Arduino. Source code link is below the video.
Full source code is here: http://pastebin.com/xYEpxqgq The simulation itself is only about 25 or 30 lines of code. It uses our (open source) FastLED library to drive the LEDs.
Discussion about the code and how to port it and use it are here on the FastLED discussion group on G+ https://plus.google.com/112916219338292742137/posts/BZhXE4cqEN4
Posted: March 20, 2014 Filed under: Art, Coding, Creations, Explorations, Reflections, So that didn't work, That Totally Worked | Tags: arduino, fastled, learning, LED, LEDs, play
Some things we try because we have a clear idea where we want to be and a clear idea how to get there.
Some things we try because we’re suddenly shocked to find that the heretofore completely impossible has suddenly and surprisingly come within practical reach.
And some things we try just to play, and to explore what if. We start with our heads full of simple ideas that turn out to be wrong, and we awkwardly replace them in torn out bunches with new confused half-understandings that, later, will let us reach something wholly unexpected.
I’m not sure which of these things in doing here, which means it’s probably that last one.
Posted: December 21, 2013 Filed under: Art, Reflections | Tags: art, LEDs, light, solstice
We celebrated the winter solstice last night with friends and laughter. I wore a little pin with a circle of LEDs on it, animating a cycle of light and dark.
I think that for lightbenders (LED art hackers) like me, like us, the winter solstice is actually a bit of a mixed blessing; I’m as eager as the next guy to start the slow journey back toward warmer weather, but given than our LED creations thrive in darkness, the arrival of the winter solstice means there will be fewer hours of darkness each night to illuminate with our creations.
Likewise the summer solstice marks the start of the shift away from the happy-go-lucky light-out-past-dinner-time days, but it also brings promise of a winter’s beautiful dark canvas, which we’ll light with our love and our craft.
Have a bright beautiful solstice, everyone. And if you keep your calendar that way, Happy New Year!
Posted: October 15, 2013 Filed under: Art, Creations, DIY, Explorations, How-to, That Totally Worked | Tags: costume, costuming, dress, duct tape, eak, eleanor, hoop, hoop skirt, hula hoops, skirt
Eleanor and I spent this weekend working on her Halloween costume. Part of what she planned was a ‘hoop skirt’, but as you can imagine no commercially available hoop skirt met her exacting standards of design and quality — and also my exacting budgetary requirements. Naturally, we decided to take the DIY route! And, we pondered, what goes into a hoop skirt? HOOPS, obviously!
We picked up a used dress at The Garment District (our local vintage/costume/cheapo clothing mecca), a set of three hula-hoops, and some leopard-print duct tape. The smallest hula hoop became the bottom (largest) hoop for the skirt; the other two had to be dramatically resized smaller (via pliers, dremel, duct tape). We started construction from the waist down, with a nylon web belt with a parachute snap buckle. From there, we hung each hoop with repositionable blue painters tape, and balanced each one until it was level. Then Eleanor secured each hoop in place at the right height with duct tape.
And presto! A hoop skirt made with real hoops! (and duct tape, of course!)