A few weeks back we ran a piece about the convergence of making and baking in an attempt to create a cake festooned with working LEDs. The moral was that not every creative idea ends in victory, but we applauded the spirit it takes to post one’s goofs for the whole internet to see and to learn from.
[Craig]’s LED matrix proved unreliable…and the underlying cake didn’t fare much better, resembling that charred lump in the toaster oven in Time Bandits. The cakes-with-lights meme might have died right there if not for a fluke of association…
At the time the story ran, some of us were working on an unrelated LED project which involved experimenting with light diffusers, trying to spread distinct points of LED light to a more soothing glow. Drafting vellum and frosted acrylic both worked well, but small pieces of upholstery foam had proven especially effective.
Between seeing the cake project and handling squares of foam, an idea was jokingly tossed out: backlight a cake from below, using angel food cake as a light diffuser much like the foam we’d been experimenting with. The density, optical properties (and taste) do seem remarkably similar!
In the creative afterglow of Maker Faire (or more likely it was just exhaustion), this idea somehow made the jump from tongue-in-cheek to demo-or-die. The concept would look something like this:
A custom pedestal would secure the LEDs in place while providing a more prominent perch for the cake. A layer of glass or clear acrylic separates the two, so the LEDs would remain clean for future projects and the cake would not be sullied with any sort of flux or lead or other electronic residue. RoHS compliant cake!
Two questions then remained:
- What sort of display would we make? Static lighting would be boring, we knew this had to be animated. As a first crack at this sort of thing, we settled on a single seven-segment display, counting down.
- What type of LEDs to use? Instead of wiring up a pile of discrete LEDs, for the sake of a quick prototype we instead opted for serial addressible LEDs. Even then, there are decisions to be made:
The choice of what type to use was based more on availability than on engineering: our Adafruit RGB pixels were tied up in another project, and we didn’t have enough BlinkMs or ShiftBrites on hand to build our prototype and didn’t want to wait around for shipping. We’d just bought a string of Cool Neon’s new “Total Control Lighting” LEDs at Maker Faire and were eager to try them in something, so they won by default. Looking back, these proved less than ideal for this particular project due to the diffuse bulbs, but we give them kudos for being among the easiest to program. Over the years we’ve messed with many different addressable LEDs, and have found that there is no One LED to Rule Them All — every one of them has unique and desirable attributes for different tasks.
We then fashioned an LED-holding template in Adobe Illustrator, sized to fit a single page:
This was printed and glued to a sheet of mat board, then the holes for the LEDs were laboriously cut out with a hobby knife. A laser cutter or even just a drill press would have made this much easier. For scale reference, each of the segments is about 1.5 inches wide, and with this just being a first prototype we didn’t bother with fancy beveled corners.
After cutting LED holes, the sidewalls and some supports were cut from foam core board and assembled using a hot glue gun. These added about two inches of height to the pedestal, to accommodate the bullet-shaped LED housings and the wires underneath. Then we punched each LED into place:
And there’s photographic proof of our first goof. Aside from the whole absurd idea, that is. These LED strings have connectors on both ends for daisy-chaining, with a distinct “in” and “out” end to each string. In our enthusiasm to attach a microcontroller, not thinking this through, we cut the “in” end and soldered our own breadboard wires. Electronically speaking this works just fine, but a better idea would be cutting the “out” connector, making that into our chip-to-LEDs adapter. Then this string would still work fine at the end of any chain, as well as with Cool Neon’s own driver circuits (which use the plug), and we’d have an adapter dongle for future applications with these strings. Lesson learned.
The string has 25 LEDs. Our display has seven segments, with three LEDs each. The last four LEDs were just wadded up under the pedestal and aren’t used here, but could have been made into ground effects lighting or something suitably corny.
After physical installation of the LEDs, we wrote and tested the code, which runs on an Arduino, natch. We’ll delve into the source later.
This pic shows the order in which the LEDs were installed and are addressed by the code. Also, the small boxes around each segment (more mat board and hot glue) restrict the diffuse outward glow from the lights and support the top acrylic for the cake:
We added contact paper to the bottom side of the acrylic, to further control stray light. This was probably overkill, but did help in positioning the cake segments later, as a sort of template. We’re not certain if acrylic is food-safe, so it’s possible that our eventual offspring may be born with tails or something. A small price to pay for SCIENCE!
Thus began the baking. And hilarity ensued…
It was already determined that the segments would be angel food cake. The non-segment parts of the cake needed to be opaque…not just to contain the light, but as a vehicle for frosting, because a cake without frosting is no cake at all! We opted for chocolate, but most anything will do…red velvet, carrot cake, you name it. Not fruitcake though, it has an intense gravitational field from which not even light can escape.
The chocolate cake proceeded without incident. After baking and cooling, we trimmed down the risen center portion of the cake to give it a more uniform cross-section…this also provided essential sustenance to carry us through the next phase.
You’ll notice there are no photographs of the angel food cake being made. Oh, sure, [Craig] may be man enough to show his failures, but not us. We usually take umbrage to those television ads that depict the “man of the house” as an imbecile when confronted with domestic tasks, as if all males are HULK SMASH! brutes who can’t so much as feed or dress themselves. We’ve seen some awesome cooking hacks around here and know it’s simply not true. Then we tried baking an angel food cake…
Angel food cake (the name being an obvious conspiracy of marketing to lure us in) is a strange and alien thing, no doubt a product of NASA research that also brought us aerogels and space shuttle thermal tiles. The box contains what looks like diatomaceous earth, to which water is added. No eggs or oil or anything resembling, y’know, food. This is frothed in the mixer and poured in a pan, baked (during which it swells to over 6,000 times its original volume) and then, removed from the oven and allowed to cool (very important that it’s on its side, for whatever alien agenda reason) it proceeds to mock you for all eternity as an impenetrable sticky mass that defies all attempts at cutting or removal, like a loaf-pan version of the Blob from X-Men. We could actually hear the garbage disposal chewing as it worked on this. For five minutes.
After that experience, we’re officially declaring a one week moratorium on manly pride. If you see a guy washing his colors and whites together, or microwaving Hot Pockets and calling it “dinner,” he is totally fair game for mockery. You have our permission.
So, another trip to the grocery store, returning with a pre-made angel food loaf cake (day old, for extra durability)…which, we’ll note, would have been cheaper than buying the mix in the first place…and we can proceed…
Both cakes were carved into suitably-sized segments and arranged on the acrylic base/template. To help keep the angel food segments spotless and clean of frosting, we pre-frosted the top of the chocolate cake before carving it up, and would touch up the seams after the fact. Had to get creative with the last few rectangles of chocolate cake, but frosting hides all sins. The angel food cake should have been trimmed a bit thinner to match the height of the chocolate cake, but we were getting hungry after the whole emasculating fiasco and just wanted to see if this thing would work or not.
A quick test with the cake atop the LED pedestal showed a problem: the white cake picked up all diffuse light in the room, entirely washing out the backlighting. But we’d seen this problem before…of all things, a SparkFun capacitance meter kit, which suffers the same issue where its red LED segments are washed out by the white diffusers in a bright room. The fix there is to add a piece of smoked acrylic atop the display. So we applied a similar principle here, but wanting to keep everything edible we used fruit roll-ups instead of acrylic. Reflecting on it now, fruit jelly would have tasted better and would slice well with the rest of the cake.
The fruity fix didn’t address the problem completely, and it was still necessary to operate the cake in near-darkness for best effect, which may or may not be a problem since programmers normally thrive in low-light conditions. The photo above shows how the number “6” looks under normal room lighting…washed out and nearly indistinguishable from the full “8”. Using brighter, more directional LEDs (but still using the fruit topping) would probably help with this…BlinkMs or ShiftBrites or their higher-lumen equivalents. Not too much though, or you’ll go all Easy Bake Oven on it.
Here’s a video of the completed countdown cake in action:
[youtube=http://www.youtube.com/watch?v=d_o7c2cz0nU&w=470]
So the idea does…kind of…work. Would we try it again? Probably not. It was a fun idea to mess around with – a hack – and any day you get to eat cake and call it your job is a good day indeed, but the effect ultimately wasn’t worth the effort. Like the original article, we hope this one can be filed under “heroic failure.” It’s progress though, and might give someone food for thought. Maybe third time’s the charm.
A closing thought is that this could be combined with a Wave Shield or the chipKIT digital audio technique from a prior article to play the Happy Birthday song, creating a cake that’s both fattening and incredibly annoying!
Finally, here’s the Arduino sketch that drives the LED display:
// 7-segment LED Cake Sketch for Arduino. // Uses Cool Neon's "Total Control Lighting" // addressible LEDs. Data issued on Arduino // digital pin 11, clock on pin 13. #include <SPI.h> // 7-segment bitmask for each digit. // Bit-to-segment mapping is as follows: // 1 // 2 0 // 6 // 3 5 // 4 // This corresponds to the order in which LEDs // are mounted in the physical template. byte segmask[] = { B0111111, B0100001, B1011011, // 0 - 2 B1110011, B1100101, B1110110, // 3 - 5 B1111110, B0100011, B1111111, // 6 - 8 B1110111, B1111010, // 9, ersatz 10 B0100001, B0110000, B0011000, // Spinny thing B0001100, B0000110, B0000011 }; #define N_PIXELS 25 #define GAMMA 2.4 byte gamma[256]; void sendPixel(byte r, byte g, byte b) { SPI.transfer(~((r >> 6) | ((g >> 4) & B00001100) | ((b >> 2) & B00110000))); SPI.transfer(b); SPI.transfer(g); SPI.transfer(r); } void sendLatch() { for(byte i = 0; i < 4; i++) SPI.transfer(0); } void setup() { int i; // Initialize SPI communication: SPI.begin(); // The following 3 lines can normally be // left out - Arduino's default SPI config // appears to be MSB, Mode 0 and runs at // 4 MHz (instead of 8 as is done here, // but still plenty quick). But for // posterity, here's the full config: SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); SPI.setClockDivider(SPI_CLOCK_DIV2); // 8 MHz sendLatch(); // Wake up! // Set all pixels to initial "off" state: for(i = 0; i < N_PIXELS; i++) sendPixel(0, 0, 0); sendLatch(); // Calculate gamma correction table. // Provides a perceptually more linear // fade between brightness levels. for(i = 0; i < 256; i++) { gamma[i] = (byte)(255.0 * pow((float)i / 255.0, GAMMA)); } } byte digit = 10, prev = 10; void loop() { byte i, bit, x; int fade; // Fade from previous to current digit: for(fade = 0;fade < 256; fade++ ) { // For each of 7 segments: for(bit = 0x01; bit < 0x80; bit <<= 1) { x = 0; // Assume segment is off by default if(segmask[digit] & bit) { // On, or fading on x = (segmask[prev] & bit) ? 255 : gamma[fade]; } else if(segmask[prev] & bit) { // Fading off x = gamma[255 - fade]; } // 3 LED "pixels" per segment for(i = 0; i < 3; i++) sendPixel(x, x, x); } // Last 4 pixels are unused and stay off for(i = 0; i < 4; i++) sendPixel(0, 0, 0); sendLatch(); // Update LEDs delay(1); // ~1000 updates/sec } // Hold last image for remainder of ~1 sec. delay(1000 - 256); if(digit > 0) { // Still counting down prev = digit; digit--; } else { // Done counting, reset... // But show spinny animation first for(int n = 0; n < 5; n++) { for(digit = 11; digit <= 16; digit++) { for(bit = 0x01; bit < 0x80; bit <<= 1) { x = (segmask[digit] & bit) ? 255 : 0; for(i = 0; i < 3; i++) sendPixel(x, x, x); } for(i = 0; i < 4; i++) sendPixel(0, 0, 0); sendLatch(); delay(100); } } digit = prev = 10; } }
A couple of notes on using the Total Control Lighting LEDs:
- Red wire = +5V. White = data (Arduino pin 11). Green = clock (Arduino pin 13). Blue = ground.
- The datasheet suggests issuing 32 consecutive zero bits to mark the start of a full frame of data, but we’d sometimes see a stray first or last pixel on the initial image. A more reliable approach has been to issue the 32 zeros at the program’s start, then after each full frame. Rock steady.
Why would you want to do this? It’s cool but it seems very pointless…
What could I change to make one of these actually useful?
I’m baking one of these at the next possible excuse!!
Hahahahaha… Nice. A tasty piece of technology.
So I guess you CAN hack your cake and eat it too.
…that was bad… That was bad, and I am sorry. I am a terrible person…
What could you possibly want this to be useful for? It’s a cake! Great for new years parties! Next step, bake a cake-in-place, with little/no post-assembly required. Maybe you could form a special cake-pan out of some thin sheet.
@derpa
I mean useful as in… can take chunks out of to eat!
I think it turned out quite well, after all.
Great, now we just need edible conductive frosting.
Need good and eatable light diffusor? Use Jell-o (shots)! :-D
I’m sure there’s a way to make a transistor out of a carrot and corn or something… brb.
I’m waiting for the OLED cake!
i would make such a cake, but with 2 didgets for every time someone claims worlds end
would be cool
i like cake, and the plate is reusable
Very nicely done (and documented)! In principle it would not be too difficult to extend this to a matrix which then allows scrolling messages or basic images. Also to make the effect sharper I imagine you could do quite well just cranking up the drive current on the LEDs; that’s always my approach when my 7 segments wash out.
I wonder if you could use a bunch of cupcakes with each one being a segment of a matrix.
It’s way cool and useful for a new years cake, 11/11/11 countdown cake, or Mayan calendar countdown cake. Any geek who said it’s pointless or didn’t know what to use it for obviously has…no friends. So try to invite your ass to a party or throw one…yeah it’s like hacking your social life, but ‘chew can dew iiiit!’
HAHHAhahahahaha Very nice Sunday evening reading! TY for the many laughs…
“frosting hides all sins.”
Don’t ever shy away from food hacks!
Food=good
hacking=good
Food Hacking=good, good
Rock on!
To shamelessly promote yet another macetech product, these would probably have been ideal for the segments: http://macetech.com/store/index.php?main_page=product_info&cPath=1&products_id=32
@Itwork4me
I know, I can’t wait for Skyrim either.
@Hirudinea Actually you may laugh but I reckon that a primitive EL display could work if you used that conductive Play-Doh recipe with food-safe ingredents.
You would still have to peel off the plastic top and use something like laminated film to contain the EL phosphors and ITO sheet but the underlying contacts would be fine.
Inspired by that EL toy which uses water based inks to draw on the glowing screen..
Nice idea but seriously…weak baking guys.
I mean come on, you bought pre-made cake mix and then moan it costs more than a cake? Try making a real cake, you know one where you hack the eggs! You break them open and mix them with flour, butter and sugar. Voila, cake!
Dissapointing
i love my LEDs with lots of chocolate sauce on top.
@leafy because everyone is both good at electronics and cake. Looks like a jealous user.
This is amazing and well done!
You could do a count down clock until midnight or a birthday or such…
C-C-C-C-Cake Boss!
You can buy digit-segment cake pans online –
http://www.suck.uk.com/product.php?rangeID=142
Hey folks…if anyone was thinking of trying these LEDs (whether for cake or for anything else), Benny of coolneon.com gave the OK to post the Maker Faire discount here: coupon code “MF11” receives 10% off all online orders, good through 7/31/2011.
Not meaning to be a plug; the usual “I don’t work for them” disclaimer applies. Just mentioning it because, hey, relevant discount!
I cant find any cake-pans on the suck UK website