# Tall Floor Lamps as Lava Lamps

**URL:** <https://forum.electromage.com/t/tall-floor-lamps-as-lava-lamps/1609>\
**Category:** Show and Tell\
**Created:** [September 28, 2021, 7:38pm UTC](https://forum.electromage.com/t/tall-floor-lamps-as-lava-lamps/1609 "2021-09-28T19:38:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [September 28, 2021, 7:38pm UTC](https://forum.electromage.com/t/tall-floor-lamps-as-lava-lamps/1609/1 "2021-09-28T19:38:31Z")

</div>

As discussed [here](https://forum.electromage.com/t/what-cool-things-are-people-planning-on-making/1595/2), I’ve got a pile of lamps in progress. Lamp #1 is now built. I’ll post some photos shortly.

Cost:

- ~$30 for the lamp. Varies by design, deal, etc, between $25 and $40
- ~$17 for the LEDs - 300 ws2812 in 5m strip, non waterproof, with adhesive backing
- $1 for a pool noodle (runs up the center of the lamp, leds wrap around it)
- $12 for 5v 8a power supply
- Pixelblaze v3 + Sensor Board (Might be replaced by a v2, or a esp32 running WLED)

Doing it as a 3D map has proven interesting, and as I load up fun patterns in 2D, I’m reminded both how easy it is to convert, and how different 3D is

Often, I just can add a few lines like:

```auto
export function render3D(index, x, y, z) {
  render2D(index, x, y)
}

```

and it’ll at least try to do something. Not always what I expect.

I’ll do some examples/videos too, as I port patterns, and figure out new and fun ways to make this high tech lava lamp do all the things.

---

<div class="post-metadata">

**Author:** ![Scruffynerf](https://forum.electromage.com/letter_avatar_proxy/v4/letter/s/34f0e0/32.png) [@Scruffynerf](https://forum.electromage.com/u/Scruffynerf)\
**Post date:** [October 3, 2021, 8:53pm UTC](https://forum.electromage.com/t/tall-floor-lamps-as-lava-lamps/1609/2 "2021-10-03T20:53:17Z")

</div>

So I’ve got some code I found, built in JS that works in a browser (it uses webgl for display, but that’s removable, and it uses some JS features we don’t have that I’ll have to work around (like array push)), but the results? That looks right. And of course, I’ve done the research into what the physics of a lava lamp is, and how it works. And also of course, the code that “looks right” isn’t actually “right” and doesn’t really do a lava lamp ‘right’, but then it _looks_ right… except now that I look closely, all I can see is the wrong. Sigh.

I also found some code that _should_ be able to do it the right way, but of course, will it look right, and run fast enough?

The ‘looks right, does it wrong’ code: [https://scruffynerf.github.io/lava-lamp/](https://scruffynerf.github.io/lava-lamp/)  
Code that should do it, but who knows: [Fluid Dynamics Demo](https://physics.weber.edu/schroeder/software/demos/FluidDynamics.html)

Yes, I could do metaballs, and fake it all. But what’s the fun in that?  
I learned, among other things, that Cloudflare uses Lavalamps _in_ it’s network.

> **[LavaRand in Production: The Nitty-Gritty Technical Details](https://blog.cloudflare.com/lavarand-in-production-the-nitty-gritty-technical-details/)**
>
> As some of you may know, there's a wall of lava lamps in the lobby of our San Francisco office that we use for cryptography. In this post, we’re going to explore how that works in technical detail.

The right way: you need to track the temperature of the ‘wax’ particles, so that their density rises and falls above and below 1 (the density of water). The cheating code looks at the temperature of where the particle is, and ‘bumps it faster’, but then there is no heat exchange between particles (which is what happens in real life). Yes, motion is energy, as is temperature (also energy), but the end result look incorrect, despite how much it looks right in so many other ways. You could even ‘cheat’, and just alter density directly from the temperature, so long as in some way, you do things like having particles equalize density (if you push two together, they should do that, not bounce off each other.). Density is what makes it rise/fall, relative to the water. Never mind surface tension, and more factors unthought of so far.

And if all of the ‘lava lamp’ code for LEDs out there cheats, then doing it the right way seems like a worthy challenge.
