Bottleship

So far, a concept for an overcomplicated moodlight that's putting a few hundred tiny LEDs in a bottle as a stack of transparent flexible PCBs. It might all go horribly wrong.

Prototypes

Updates

2026, October-November

Using the same process I assembled a few more boards, until I had ten working layers; I think I soldered LEDs to 14 in the end. As if by miracle (i.e., my initial calculations matched up with reality) the ten layers with 0603 LEDs just fit through the bottle neck when curled up around the base board. I think I've broken two or three traces in the process, or perhaps I missed a bad solder bridge on one of the column pins, but I'm not opening that bottle again!

Ten layers of the orange flex PCB each with 61 white LEDs are fit into a clear glass bottle with a flip top seal standing in front of a white background only illuminted by the LEDs. The LED layers fill about the bottom half of the bottle, and at the back there is the white regular base circuit board. The flexible layers are soldered to this with four pads on a section extending from the circular shape and also holding a microcontroller. They are held in place to be almost but not quite parallel by a thin white string tied off at the top, and the base board is stuck to the bottle with white tack.
Ten layers, bottled and lit up.

On the software side I wrote a bootloader to be able to reprogram the layers over the I2C bus, much like my Matrix Hexpansion project. In the first round of programming every layer is given a unique address offset stored in the option bytes user area that does not get erased during normal programming. This means I just need three wires (VCC, GND, and SWDIO for the processor on the base) to be accessible outside of the bottle, and I cut a small hole in the rubber seal for those. When I need to reprogram the layers, I just flash the base processor with a special program that in turn sends an I2C command to put each layer into bootloader mode and then talks to the bootloader to flash the main memory and reboot. That process takes less than a minute for the ten layers.

The first pattern is inspired by signed-distance functions, and is based on three spheres that slowly move up through the layers. For each LED position we calculate the distance to the current center of each sphere, and if it is less than the radius, the LED is fully on, otherwise there is a gradual fall-off. With the right amount of randomness this gets close to a slow-moving lava lamp style effect, although it will need a bit more tuning.

As an aside, I've also compiled the pattern code to a WebAssembly module, which means the same code can run in the browser and drive a THREE.js renderer. This required a bit of restructuring to ensure the required symbols (including the LED positions) can be accessed, and to avoid importing microcontroller-specific functions into the module.

As first impressions go, it is quite effective. Of course viewing angle matters a lot; it looks better standing up than when lying on its side, and the base board is a bit of an eyesore. The 6mm gap between layers feels about right, much closer together and it would be difficult to see the middle LEDs from most angles. However, it would be nice to have a few more layes, and the shape of the bottle I chose (IKEA's Korken) means that about half of its height is unlit as it starts to narrow towards the neck.

I'm now thinking about the next version. It may use a single wire serial link (UART) and reduce the number of wires between the layers from four to three, and I'm trying out the software changes for this on a separate development board. It would be really nice if the base board could be eliminated; perhaps the layers could be connected to each other inside the bottle so they don't have to all curl up on installation. Is there a way they could be threaded onto bare copper wires (and soldered in-place?), or mounted to each other using conductive stand-offs that can be twisted to lock with a flexible tool. Of course I'd also like to increase the LED density. I think without compromising brightness, the CH32V003 chip should be able to to drive 82 LEDs (two ports charlieplexing 7×6, up from 6×5 + 1) if I can free up one of the two I2C pins by switching to a UART connection. At lower brightness (half the duty cycle) I could treat both ports as one matrix and get to 182 (14×13), which would motivate a move to 0402 LEDs or switching to a larger diameter bottle.

There is still the question of what the brains of the operation should look like. I'd like something a bit more powerful, perhaps and RP2350 or ESP32, with wi-fi and enough processing power to run a fluid simulation, or some form of 3D mesh rendering. And of course, power remains an issue, it is currently a bit unsightly to have wires coming out of the top. There will probably be some suitable Li-Po batteries to sit in the bottle neck, but those small sizes tend to max out around 200 mAh, at a rough estimate enough to run for an hour or two. A wireless charging coil in the bottom of the bottle may seem obvious, but my gut says it may not be efficient enough as the glass forces a larger gap than with most phone chargers, but I have no experience with those calculations and it may be fun to dive in.

2026, July-August

I got my shonky pick-and place machine working enough that it could place (most of) the LEDs correctly on the flex-61 boards. I had to manually apply solder paste and spend quite a bit of time correcting the MCUs and tiny 0402 resistors though.

The mounting to the base board presented a new challenge: while I could solder the large pads on the flexible connector easily to the base, there wasn't really a good way to get the boards to stand up and remain parallel. Eventually I got close enough by threading each layer with its own string through the two mounting holes in the upper half. The boards still don't go perfectly flat but at least I can adjust each one individually once they are in the bottle.

2026, June

The PCB prototypes for a base board, to hold ten flex-61 layers and a microcontroller to coordinate them, have arrived. I've only assembled the microcontroller part so far; waiting until I can get more of the LED layers assembled.

2026, May

I manually assembled one of the flex-61 boards and put it in the bottle.

2026, April

I ordered and received two prototypes boards with a similar 61-LED layout, one on standard FR4 board including assembly (hex-61) and one unpopulated polyamide flex board (flex-61).

I spent quite a bit of time tweaking and correcting the software (and the biggest problem was that I had mistakenly used much too large I2C pullup resistors) but eventually got all ten boards working on a breadboard, being driven by a Raspberry Pi Pico sending frame and update commands over I2C.

2026, March

Decided to start by making the matrix prototype boards on FR4 using the CH32V003 processor as a matrix controller. I'm making prototypes with 61 and 91 LEDs that I imagine could be easily paired with a cheap and cheerful ESP32 board to make cute little badges, home-assistant driven mood lights, or displays. Keeping them cheap (and somewhat realistic for assembly into a larger thing) by only including the minimal components, and expecting an external board to provide power and program more complicated patterns using the I2C bus.

2026, January

It took a few weeks but I eventually got the 90-LED charlieplexed matrix on the test board to run at reasonable speed on the Ch32V003 including PWM using DMA transfers to toggle the pins set to Open Drain output mode (toggling between "off" and "high impedance" state). Thanks to tomn for the hint or I would still be trying to toggle both the pin modes and output levels to achieve the same thing!

2025, December

I made a "big-bad-bottleship-test-board", spending about £60 to get it assembled by JLCPCB, partially to learn the process of getting a PCB ready for assembly. The board has several microcontrollers, LED drivers, an accelerometer, and two styles of matrix arrangement. The process was significantly simplified by using KiKit to predictably produce the gerbers, bill of materials, and position files (as well as correcting some chip orientations where KiCad footprints differed from JLC's).

Out of the microcontrollers, the CH32V003 was the easiest to get started with, thanks to cnlohr's excellent ch32fun project.

2025, November

Playing around in KiCAD and Blender to produce some pretty renders of flexible PCBs with dense LED matrics being aligned perfectly. I used the IPC API to generate small python scripts to automatically place footprints and some tracks that were procedurally generated. Got a bit side-tracked with attempting to programmatically optimise the LED placement to reduce the number of track cross-overs. However, I also realised that most likely there won't be enough space to pack them as tightly as I'd like, the LED's would probably pop off the matrix flex PCBs when attempting to insert them (or the bottle opening would need to be sufficiently large to allow a bigger bend radius), and it's a lot of LEDs that may need more than a small battery for power.

A ray-traced preview of an open clear glass bottle lying on its side on a table. The body of the bottle is filled with a stack of twelve transparent boards each filled with a spiral pattern of warm-white small LED lights all facing towards the viewer. Connectors are visible below the bottle, as in the preview they are not correctly bent to fit to the base board. Likewise, the base board is floating below the neck of the bottle, and is a long and thin PCB that has components on the end facing the opening, including a processor, memory, and pin header connections for data and power.
An early Blender rendering of what it might look like.

2025, October

First sketches, some 3D prints, some cost calculations, and bought a few small bottles.

For a first attempt I thought of using an established I2C controlled LED driver like the IS31FL3731, because it can control two charlieplex matrices of 72 LEDs each, and has 2 configurable address bits, so one I2C bus can control 8 matrices. Each matrix uses 9 pins and could use zero-insertion-force connectors and gold fingers to connect a base board containing parts other than the LEDs.

I also considered a complicated arrangement where panels could be inserted into the bottle and then rotated and snapped onto a base board and the whole thing spun around to make a persistence-of-vision display…