Fire2012: an open source fire simulation for Arduino and LEDs

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

Enjoy!

-Mark

 

Advertisement

If I’m confused, it must be playtime.

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.

20140320-090628.jpg


Hoop skirt — made with real hoops!

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!)

Hoop skirt -- made with real hoops!


“Firelight” Lantern

This past January (2013), I created “Firelight”, a lantern that shines with the light of a simulated fire.

The lantern contains over a hundred LEDs, a microcontroller, a battery pack, and custom software.  The software monitors the remaining power in the batteries, and as the voltage slowly runs down, the flames burn lower, finally dying into embers as the batteries die.

I presented the Firelight lantern at the Veracode winter Hackathon, where I lit it, and then gently blew on the coals to kindle a flame.  I’ve had a few requests to build more of these lanterns for other people, and I’m considering it, but haven’t made a decision yet.  More pictures are here.

-Mark

 

 


The Lightning Tree: Halloween

Over this past summer, I built “The Lightning Tree” — a 13-foot-tall steel and aluminum tree covered in hundreds of programmable LEDs.  Normally, The Lightning Tree slowly cycles through animations depicting the different seasons of the year, but for Halloween I reprogrammed it full of wild purples and oranges, and planted it in our front yard!

It attracted and delighted kids and grown-ups throughout Halloween night, but the time the sun rose, it had disappeared, like all things ephemeral and magic.  (To be clear: it disappeared in a good way, as Black Rock City does.)


Travel Tips for Venturing OUT of Black Rock City

So! You’ve decided to take a trip away from Black Rock City!  Here are some tips to keep in mind when traveling away from Home:

Clothing: Make sure to bring enough clothes so that everyone in your group can have some. Among other things, will save you all time later since you won’t have to keep switching.

Stormy Bedroom Eyes

Travel:  A note of caution here! Some vehicles that appear to have extra room for more people may not be giving rides!  We’re not sure exactly why this is, but we’ve had several reports of this.  Always ask for explicit permission before getting into someone else’s vehicle — a friendly “Hi!” and a wave as you climb in may not be enough!  Use your judgement.  Also note that some vehicles may travel faster than 5 M.P.H.

Make sure you are at Burning Man...

Money: Do you remember when you were a child, collecting bits of money here and there, slowly saving up for that one thing you really wanted? Well, money here works the same way, except that you may have to break open your piggy bank a little bit more often.  If it helps, think of every shop, store, restaurant, gas station, bar, and mall that you see as if they were “Arctica”, and what they’re all selling is basically just ice: cool, and maybe useful, but ultimately fleeting and ephemeral. ‘Nuff said.

be 100% happy or receive 100% money back.*

Fire: Make sure to establish a safe perimeter around any burn events that you create.  This goes double for large-scale burns; many people you meet may be new to this form of expression and will greatly benefit from your love and guidance as they participate in the burning of any large-scale structures.  Also, you might want to ask permission from the structure’s owner beforehand, if you can find them easily.

And finally... The Man burns... and we are done.

Bacon: BACON IS EXACTLY THE SAME EVERYWHERE, THANK $%!*&@# GOD.

Returning Home After Your Trip: After you’ve had an exciting jaunt out and about, it’s always good to come back Home, to be with your family and your loved ones.  Have a wonderful trip, and we’ll see you when you get Home again.

Mighty Trojan Warriors!

Yours in flame-
-Mark


“Five Elements” light sculpture

After months of work, “Five Elements”, my first full light sculpture debuted this weekend at a private event.  This quick video shows a short clip of each ‘element’; the actual five-element cycle is 12 minutes long, repeating each of the five elements five times each hour.  As with any “version 1.0”, I have a dozen ways I’d like to polish and keep improving it, but I’m happy with it as is, too.

It’s illuminated by 150 RGB LEDs and controlled by an Arduino Uno using the FastSPI_LED library and my own custom code.
The installation at the debut event used a very different diffuser which made the LEDs more visible.  While both were good, I think I prefer this diffuser overall.


Small Scale Solar power presentation

I gave a “learning lunch” presentation on Small Scale Solar power today.  We had a great audience, got great questions, and had fun doing it — despite the definite lack of sunshine to play with today.

The Short Version is this:

  1. Hook a solar panel to a charge controller to a battery.  (There are starter kits with everything.)
  2. Presto: 12 Volt DC power!
  3. Use your newfound power as-is, or step down to 5v USB, or up to 120VAC using an inverter.

60 Watts of solar panels

The slides don’t tell the whole story by themselves; that requires my own personal song and dance routine.  Nevertheless, here they are, with “lite” graphics for fast download: PDF.


Ice cream no longer requires adult supervision

On the sunny afternoon of Sunday, April 29, 2012, Eleanor, Abby, and a friend, all age 9, walked half a mile to The Chilly Cow for ice cream, and then back again (with a stop at the library, of course) without adult supervision or accompaniment. Total round-trip time was slightly more than an hour, well under the contractually pre-negotiated 90 minutes.

The adventurers’ parents spent the intervening time in various degrees of distraction, ranging from mindful confidence to … less meditative states.  Overall the experience was deemed a great success all around, and at least two of the parents in question got a little choked up for a moment over the “our kids are growing up” factor.

The trip itself was a little less than a half-mile each way, as the crow walks. If you’re a grownup, or driving, or both, you might think of this particular half-mile trip something sort of like this:

Chilly Cow by car

But if you’re walking, it’s more like this (please do click the image to get the full experience) :

Chill Cow on foot

But actually, I think that if you’re 9 years old, and you’re doing this by yourself for the very first time ever, it has nothing to do with time, or space, or distance, or any kind of map at all.  It’s just pure, undiluted awesome.  And that is exactly how it was reported afterwards.


Rejuvenating solar garden lights — with nail polish!

Solar LED garden lights are everywhere these days, and by ‘everywhere’ I mean ‘in our yard.’  We’ve had some for a few years now, and simply through exposure to the elements, the plastic that covers the solar cells becomes so opaque that only a small amount of light gets to them any more.  With the solar cells deprived of even that meager light that we get in Massachusetts in the winter, the solar cells don’t recharge the battery, the battery doesn’t power the LED, the LED doesn’t light up, and our yard has a serious bling deficiency.  Eleanor and I took our solar garden lights inside to see if we could make them bright again somehow.

My first thought when confronting the frosted-over plastic was to try to ‘polish’ it with a fine-grit sandpaper.  I had 400-grit handy and tried it on one cell, the bottom one in this picture.  The top shows how weathered the cells were to start.

Solar garden lights, all 'frosted' over

The sanding helped a little.  Then I rinsed the sanded plastic dust off with water in the sink, and while it was wet it looked great, but as it dried it became frosted and opaque again.  Thinking that perhaps we could use a mild plastic solvent to ‘polish’ the rough surface, I dabbed the solar cells with acetone, but again, as soon as it dried, the surface went from clear to cloudy again.  “We need some way to keep it ‘looking wet’ even when it’s dry,” I mused.  Eleanor got a wide-eyed LIGHTBULB! look in her eyes, and grabbed a bottle of clear nail polish!  She applied a few test swatches.

Nail polish on solar cells?

The nail polish made the weathered old solar cells crystal clear again!  I held the lights while Eleanor applied an even coat of nail polish to all the solar cells.  It really didn’t matter whether the cells had been sanded or not, so we didn’t bother.

Using nail polish to rejuvinate solar cells

A few minutes later, the polish was dry, and we planted the lights outside again.  You can see how completely clear the solar cells are.  Our only concern was that the nail polish might block the UV light that provides a good portion of the solar energy to the cells.

Rejuvinated solar cells soaking up sunlight

We waited for twilight to fall, and when we checked the lights: success!

Fully-recharged solar light glowing brightly!

Even though it was mid-February the solar cells were now getting enough light to make the LEDs glow brightly!  The solar cell rejuvenation project was a total success, and once we figured out how to make the cells ‘clear’ again, it was a quick and easy.

So what did we learn? We learned that ‘frosted’ plastic reflects precious light away from the solar cells; clean, clear solar cells can capture much more light.  Clear nail polish is perfect for rejuvenating plastic-covered solar cells that have become weathered and dull. Some of the solar garden lights they sell have glass covers, and we speculated that they probably (1) are much more resistant to weathering, and (2) probably should be ‘cleaned’ differently from the plastic ones.  Sometimes you need to try one thing to find out what you need to try next.  Sometimes restating the problem out loud to someone else can give them new ideas.  During the dim, dark Massachusetts winter, having bright, cheery little lights in the yard is great.