Back to Hardware

Fluid Simulation Pendant

13 Jan 2025
Progress: Complete

Here's my fluid simulation pendant, a handcrafted piece of jewellery running a realtime FLIP fluid simulation. The enclosure is gold plated, and the display is protected by a watch glass.

Illuminated fluid simulation pendant

Watch the following video to experience the narrated design and construction:

I produced the first pendant in March 2024, and then several more over the next few months. I now have a small handful of pendants, and if you'd really, really like to own one, then while stocks last, a few of them are for sale.

Intro

The motivation and initial design is described extensively in the youtube video, so I won't repeat myself too much here, but in short, following the volumetric display animations, I've been looking to implement a realtime fluid simulation that ultimately could create a 3D virtual snowglobe. Progress has been made on that front, but along the way, we came up with the Simsim concept, upon which this pendant is based.

While working on it, I came up with a bunch of cool new developments that led to several other projects, which I'll post in due time, but this is the project that spawned them. Not just the fluid simulation stuff, but also the unexpected benefits of a diagonal charlieplexed display.

Technical overview

The FLIP simulation is based on the work of Matthias Müller, check out his website Ten Minute Physics and particularly the "How to write a FLIP Water Simulator" tutorial. It explains FLIP better than I can here.

My fluid simulation is not a direct port, but a re-implementation following the tutorial.

The hardware consists of an STM32L432KC (ARM Cortex-M4 with FPU, overclocked to 100MHz), an ADXL362 ultra-low power accelerometer, an MCP73832 charge controller for the LiR2450 battery, a TPS7A02 regulator (crazy low power) and a TPS3839 supervisor. It all comes together on a four-layer, 0.8mm PCB.

The key takeaways from this project are as follows:

Writing the fluid simulator

Again, I followed the Ten Minute Physics tutorials for this, but in order to understand what's going on, I re-implemented it, trying as much as possible not to look directly at the source code. This was a really fun journey.

In the Eulerian fluid simulation, the movement of the fluid is enacted through a process called advection. In FLIP, we don't do this step, and instead let the particles' motion carry the fluid about.

There are some places where not enough detail was given in the videos, and in those cases I did peek at the other source code. One such example is the particle collisions. Initially I didn't bother with doing a hashgrid, as we're starting on a desktop computer and that's an optimisation that can be left until later. But even with naive collisions, what actually happens when particles collide? They are pushed apart with an impulse inversely proportional to their distance, but the stability of the simulation depends on getting that impulse right, much in the same way that the "overrelaxation" step of solving for incompressibility sort of magically corrects things. It did occur to me that if we're solving for incompressibility, and the eulerian grid velocities are transferred back to the particles, why are explicit collisions between particles even needed?

I can confirm that without the collisions step, the whole fluid collapses into an overlapping mess, so the step certainly isn't superfluous.

There's a lot of overhead (both computational, and mentally) to the hashgrid. In my final code I had a switch between naive collisions and hashgrid collisions, and the difference is remarkable – even at a tiny size of 8x8, the hashgrid algorithm provides a significant speedup.

I created a vast number of bizarre not-quite fluid simulations along the way. With the particles rendered, most of them looked like some variation of frogspawn. I have a collection of odd screenshots where I've forgotten what exactly was going on at the time, I don't remember what led to this doughnut...

Fluid particles have amassed into a doughnut

The example from Ten Minute Physics has a small error in the boundary condition for the left edge, meaning that the fluid never comes to rest. I spotted the mistake (and vaguely considered sending a pull request but forgot). With the boundaries working correctly, the whole mass of fluid and particles still doesn't quite stop moving, as there's no viscosity or friction except for the walls, but it does sort of congeal in a way that reminds me of crystal structures, often with dislocations or grain boundaries between groups of regularly spaced particles. Here's an early screenshot:

Something resembling crystal grain boundaries

Here we see a sort of triforce emerging from the fluid being pushed into a corner:

We appear to have found the triforce

The yellow plot is of density (number of particles overlapping each grid cell) which helped create some really cool visualisations. If we bunch up the fluid into one corner, then suddenly change gravity to point into the other corner, we get a shock wave as it crashes against the walls.

Fluid simulation with density showing a shockwave

It only lasts for a frame or two, blink and you'll miss it, but I find that circular wavefront of dense particles to be a really pleasing effect, especially as it emerged somewhat organically from the rules of FLIP. You can even see the shockwave directly in the particle positions if you freeze-frame at the right moment. Here I just missed the corner and two competing shockwaves are propagating:

Shockwave visible in the particle positions

Barely a fortnight after posting the Simsim concept, I produced the Simsimsim demo, as an internal testing tool to determine how low we could make the LED density and still call it a fluid.

Simsimsim screenshot

It also gives me a rough estimate of how much RAM is required when we port it to bare metal. A lot of problems can be solved by adding another lookup table, but as the diameter increases the necessary RAM for all those tables blows up very quickly. The STM32L432KC has 64KB of RAM – not a lot, but a diameter of 16 needs only 26KB. It's the kind of thing that's definitely worth checking before you commit to hardware though.

These demos, along with the source code to the pendant itself, are not yet released to the public, but I plan to do that at some point in future. I figured that at least for a short while, given that I've put some of the pendants up for sale, there should be some mystery behind their exact operation, but all will be revealed in time.

Construction of Pendant 1

Before even starting on the PCB, I had to convince myself that the charlieplexed display pattern was going to work. There are a large number of charlieplexed display routing options out there. I found references to an arrangement called "twistyplexing" which optimises for hand-soldered circuits. But as the incredible benefits offered by a diagonal criss-cross started to become apparent, I began to question myself and figured I needed to produce a working prototype.

This small display took bloody ages to put together. A laser-cut piece of card is used to hold the LEDs in place, and a souvenir from MCH2022 supports the contrivance.

Arranging LEDs on protoboard for a test display

I am reminded of a paper I once read but can't find for the life of me, about the discovery of certain knots. The Ashley book of knots, which serves as a kind of knot gospel, lists a huge number of knots that have been in use for centuries. But when a mathematical notation was used to describe the topology of these knots, it was discovered that some of them are, in fact, identical, at least from a topological point of view. They were listed separately, because without a rigorous language to describe them, mentally reshuffling one knot into another form is extremely difficult.

I suppose things aren't quite as simple as all that. If you dress a knot incorrectly, that can impact its performance, so arguably a reshuffled knot could have different applications, but you'd think variations of the same knot would at least be grouped together. The point I'm making is that the capacity of a human brain to manipulate knotwork is surprisingly limited.

Wiring up of test display to dev board

We wired up our 8x9 matrix to the L432 dev board. The blue wire on the right is the BOOT0 pin of the chip, which isn't broken out, but was needed way back for debugging the flash synth.

The pain of soldering this thing together with enamel wire convinced me to quickly throw a PCB together. Just a generic, diagonally-routed, charlieplexed LED arrangement to avoid having to do this again. Consider that some not-so-subtle foreshadowing. But in the heat of the moment, nothing beats a hand-wired prototype to confirm your idea without delay.

Another view of the test display and dev board

I got our FLIP simulation running on the L432, first as a teeny 8x8 square, then as the upper left corner of an imaginary fluid pendant.

When we think about possible routings for a charlieplexed display, and how this alternative routing mode was hiding in plain sight, it makes us wonder how many other routing options are out there and yet to be discovered. The temptation is to try and use a computer algorithm to seek out new possibilities.

Autorouters are, in general, famously bad, at least outside of basic situations. That may change in the near future when people no doubt throw huge neural networks at the problem. But for autorouting to even be an option we need to accurately describe the constraints. Such as, certain components need to be in certain places. A more important constraint is that the routing needs to match the netlist (schematic). In our case, that schematic is not fixed: thanks to the lookup table, we don't care which display net ends up at what GPIO pin. But the search space is much bigger than that. We want to constrain all the LEDs to the grid of the display, but we don't care which LED goes at what position. The lookup table for a "conventional" charlieplexed matrix bares no resemblance to the diagonal criss-cross version.

Constraints reduce the search space, and with enough constraints, solving it via brute force becomes possible. The constraints for what we want to automate here are so broad, so much less constraining than in other circuit designs, that I don't think we'll be autorouting a better charlieplexed display anytime soon. There are even further "unconstraints" I haven't mentioned. In one of the follow-up projects, space was so tight that I ended up routing some of the tracks through the pads of unused GPIO on that microcontroller, thus breaking one of the implicit constraints that different nets shouldn't touch each other. It's trivial to tri-state those pins in the firmware for the chip, but knowing that's on the cards expands our search space even further.

Anyway, back to the pendant circuit.

As a reminder, the "conventional" charlieplexed matrix follows a pattern like this:

Charlieplexed schematic

Adding labels along both edges is conceptually helpful, but only one edge is strictly necessary as connections can be made along the diagonal. This arrangement needs at least one via per LED.

The diagonal arrangement, after squishing into something resembling a circle, looks like this:

Screenshot of kicad schematic for the fluid pendant

Of a possible 240 LEDs on 16 GPIO pins, we only need 216 to fill out our display, but one edge has to be pieced together from the missing corners. I did this somewhat arbitrarily, deleting unused LEDs and shifting the nearest ones into place. In the process we ended up with LEDs that don't match the pattern. This came back to bite me later, as a solder bridge on that edge is now a problem, and guess where a solder bridge occurred... With a bit more thoughtful placement, I think we could have produced the whole display with end-to-end connections making it immune to soldering mistakes.

The display is supposed to be a circle, but ended up as an octagon by coincidence. For the Simsimsim program, I just placed LEDs based on distance to the centre, a circle from first principles. It happens that at 16, depending on whether you round-down or round-to-centre, you can end up with an octagon. The option to delete some of the corner LEDs and make the display more round was considered, and rejected.

The first PCB design for the pendant, on the whole, was easier than I expected. We're not boosting the current from the GPIO so there really isn't all that much that needs to go on the back, and the reduced number of vias makes things so much easier. We also have a good amount of space to shove those vias about as needed.

Screenshot of kicad PCB

Rounding the internal layers of a PCB is both comical and, given the existence of an excellent track-rounding plugin, compulsory!

I added the panel manually, specifically because I need a way to hold the board in the pick-and-place machine. You can ask the board house to panelise it for you, but then you're at the whims of their arrangement, and the component position file will need adjustment to match. I do the mouse-bites manually, just place two drill holes on the border, a ring of stop mask to mark the edge of the pcb. I keep in mind that the normal endmill for routing these boards is 2mm diameter. It's fairly easy to round most of the internal edges, but on the mouse-bites where we're mating to another curved outline, there's no easy way in kicad to fillet those. So far, I've not had any complaints with ordering boards like this, I guess it's very clear what is desired.

The quarter-arcs between each mouse-bite are a real pain to make in kicad. In retrospect I probably should have drawn it in something else and imported a DXF. Within kicad, I first placed the circular outline of the board, then intersected it with the support arms of the panel. I zoomed way in, adjusted the end of the intersecting lines to meet the circle exactly, then used those as start and end points for the arc. Quite tedious really.

For the amulet I used a bent bit of wire to press against the battery. Functional but a bit lame. The correct search term, if you want to find PCB-mounted gold-plated spring terminals, is "RFI shield finger".

Render of rear of PCB showing components on the back and the case

I later upgraded the spring tab to a larger one with more travel but didn't bother to update the 3D model.

We have plenty of room around the LiR2450 coin cell. The original design was a bit smaller, but I embiggened it while struggling to source the magnetic charging connector. Back in 2023, a bunch of very cheap "smart rings" appeared on aliexpress, some of which used a 4mm magnetic charging connector. I originally ordered them because I wanted to steal the curved battery, which until now was not possible to buy in small quantities. But the appeal of a magnetic charging connector for this pendant was undeniable, if I could source it.

Searching for 4mm magnetic charging connector, or variations upon that theme, returned a bunch of connectors that protruded far further into the case than I was happy with. They were clearly intended as through-mount components, whereas the ring had a total thickness of maybe 3mm.

4mm magnetic charging connector from RTLECS

At the time of writing, the range of connectors available has increased dramatically, and the 4mm connector I spent so long searching for does now appear in the first page of results, so perhaps it was simply a newly launched product that hadn't been indexed yet. The part number, for future reference, is cx-4mm-jz from WNRE.

4mm magnetic charging connector from WNRE

Incidentally, the charging cables for the different 4mm connectors are not compatible. Even though they have the same polarity, even the same magnetic polarity, the cable from one doesn't stick properly to the other. I think the larger connector has a stronger magnetic field, and a correspondingly weaker field on the cable, possibly to reduce the chance of it shorting out on everything metal in the vicinity.

Metalworking

Huge thanks to Martin for giving me free use of his metalworking equipment.

The video shows the process in full, essentially just boring out some brass and making a few grooves. Producing a snap-back was definitely quicker than machining a fine thread. I didn't have any clear dimensions for how a snap-back should be built, and made some educated guesses. The resulting snap-back test piece did snap together, but was a little loose, it didn't hold itself under tension. However, the addition of an O-ring completely took up the slack, and gave us a watertight seal in the process. The O-ring means the required tolerances are way more relaxed.

Filming the process was interesting as Martin's lathe is smaller than the big Colchester I'm used to. It's a Hardinge lathe, and my magnetic tripod is too large to be useful. Also, the headstock has no flat surfaces.

A couple of magic arms to the rescue.

Camera mounted over lathe using two magic arms

Positioning the camera this way is very impractical, and makes the process take so much longer. Ideally, we could have one big arm holding it, but the vibrations of the lathe motor mean that if it isn't supported from multiple positions, the footage ends up all wobbly. If, as I hope, I get to do some more projects on this lathe, I'll have to come up with something better.

<Rant>

In an earlier edit of the video, I went on a bit of a tangent about being between workshops and eventually cut that whole bit, replacing it with some (hopefully less aggravating) piano music. There's nothing exaggerated in the rant, but it's not really the feeling I wanted to convey with a nice metalworking montage.

But for completeness, let me clarify here that the hackspace is where most of my metalworking has previously taken place, and in 2022 the hackspace closed as it was (not for the first time) evicted from the premises. At the time of writing, after much delay the hackspace has now moved into a new location, but at the time of this project I was stumped. I eventually befriended Martin who, as part of his business, has a well-equipped metalworking shop.

My first reaction upon using this lathe is that all of the tools and equipment I've used in the past have been rubbish. The hackspace machines aren't bad quality, but they were pretty well worn even before they were donated to the space. Much of the value in a metal workshop is in the tooling, which is another area where the hackspace falls short.

Unlike the hackspace, Martin's workshop is used in a commercial setting, which puts the equipment on a completely different level. At the same time, my usage of the workshop, in addition to being limited to business hours and only when the machines aren't otherwise in use, is a favour, and one that, if we're honest, I suspect was granted at least in part due to my youtube subscriber count. Which is fantastic in a way, finally we have some genuine credentials, but really life would be so much easier if I had a decent workshop of my own.

Unfortunately, I live in London and in London our houses are tiny and the rent is extortionate. Even if I could afford the equipment, I simply haven't got the space for it. My Chinese mini-lathe is, quite frankly, a piece of crap. The hackspace machines are a step up, but they're still the bottom rung.

We lie to ourselves about weighted training shoes, that learning on bad equipment makes us better overall... but it's nonsense! Anyone can see that if you have access to good tools and equipment you can do better things, more easily.

I believe that access to a lathe is a fundamental human right, and the entire notion of the hackspace limping along on a trickle of donations is abhorrent to me. This is somewhere where the government should just step in. I mean, forget socialised healthcare, I want socialised workshops! The vast majority of people can't justify owning big milling machines and lathes, even if they can afford it, but at those times when they are needed, they should be there, for all.

Anyway, that all seemed a bit too whiny and political versus the type of content I want to produce, so to the written word it was delegated, and let's quickly move on with the fun stuff.

</Rant>

Partway through the metalworking I decided to produce a second pendant with a watch glass ("crystal") covering the display. Watch glasses are available in almost all diameters, with plenty of options for thickness, whether it's flat or curved, etc. Something I struggled to find any info about is the dimensional tolerances, or in fact any dimensions at all, for the metal part it's pressed into.

A small test piece was cut. I chose a glass diameter of 27.5mm. I imagine that somewhere out there are some instructions on how to build watches to accommodate such glasses, but here all I could find was about replacing the glass during a watch repair. Between the glass and the metal sits a gasket. With a gasket thickness of 0.45mm, our total diameter would be 28.4mm.

Brass test piece for watch glass, along with the gasket and a broken glass flat

The glass did in fact press in beautifully, with just the right amount of force. The test diameter seemed perfect. The cracked glass didn't happen until later, when I became overconfident in how easy it was to press the glass in without the special tool. Sometimes it's good to test these limits to calibrate our judgement.

Anyway, those glass flats are very cheap, so nothing lost really, and I pursued the second pendant case with abandon. When it came to bore the 28.4mm recess on the front, ordinarily it would be an ordeal to re-chuck the part after parting off. But Martin's extensive collection of soft collets turned it into a non-issue. The idea with soft collets is that you machine them to custom fit the part you're working on, but apparently by coincidence, several of the soft collets on the shelf matched my 28mm internal diameter already.

Case held by soft collet, ready to bore the recess for the glass

I really love these tiny carbide boring bars.

The milling process was uneventful and I think I was overly cautious. For subsequent pendants, I raced through this part in no time. The plastic arbour in a square collet-holder worked very well (and was reusable for later pendants).

Closeup of milled slot for jump ring

It's a pretty pleasing little slot. The O-ring adds some definition to the snap-back, I like the look of it, turning it into a feature. The alternative would be trying to hide it, but that would need much tighter tolerances, and also make opening it more difficult as there'd be no room to insert a case knife.

The jump rings were soldered using "hard" brass solder. Jewellers use multiple different grades of solder, although even "soft" jewellers' solder is harder than normal electronics solder. The idea is that you can solder the first joints with the hardest (highest melting point) solder, and subsequent joints with softer solder, without the risk of the earlier joints melting.

My gut feeling is that I probably could have done both joints with the hardest solder, but for all of the pendants so far I used soft solder for the second joint. This is electronics solder, and following some disparaging comments on a previous project, I used lead-free solder. This was meant to be a subtle joke, as the brass alloy has a significant quantity of lead in it anyway.

First soldered jump ring

I would later realise that this lead-free solder is completely incompatible with gold plating, it just bounces off the surface. I don't think it's a bad look as such, but in the past, the silver-lead solder was able to accept electroplating without any trouble. For the first pendants I made the fillet as tiny as possible, but later became concerned that there might be gaps that would compromise the overall seal, and made the fillets more prominent.

First soldered jump ring, inside view

I brush plated these parts with gold. For the first two pendants I really did a poor job of preparing the surface, and the toolmarks were embossed by the plating process. I was somewhat in a hurry to finish as the PCBs were due to arrive very shortly.

Sometimes you get these brown splodges during plating. I'm not entirely sure what causes it.

Plating process with dark mark

An expected part of the plating process is to polish the parts afterward with a very fine abrasive (jeweller's rouge). This removes such marks, and gives us a perfect finish, or at least it would be if not for the tool marks.

Case back after plating and polishing

We definitely rushed this part, but who cares, the circuit boards had arrived. First off the pick-and-place machine:

Assembled PCB

More solder bridges than I'd anticipated. I was using a different grade of solder paste than usual (just to experiment) and I think it would have benefited from smaller apertures in the stencil. The 0402 LEDs are quite small, and touching up bridges between them is quite tricky. As mentioned, the majority of them have no impact on the performance as end-to-end LEDs are mostly the same net, all bar the few on the edge where I repositioned them. However, it detracts from the look, so I felt compelled to remove such mistakes from being on show.

One oversight is that I didn't break out the reset pin of the microcontroller. The display uses all of port A, and the SWDIO/SWCLK debug lines also exist on port A. For general use, that's not going to matter as we can disable them in software. But for development, this makes it impossible to flash new software onto the board. The trick is to reset the chip right before you program it, but here that means adding a bodge wire.

Programming wires soldered to the rear of the PCB

The first circuit board became my dev board. At this stage I still hadn't sourced the desired magnet connector, but the older magnet connector proved the charging circuit worked. With a 3D printed coin-cell holder, I was able to power the dev board from the battery too.

Illuminated dev board

The bus keeper on the accelerometer's interrupt line caused a few (of several) display glitches. A resistor was bodged onto the track which helped a bit.

Resistor bodged onto the wakeup line from the accelerometer

Ultimately I added a diode there, which completely fixed the issue. At one point I replaced that resistor with an LED, which had the added bonus of letting me see the signal as I nudged the board.

I gave a quick montage of some of the other bodges I applied to the circuit in the video, mostly trying to ensure that the circuit couldn't be tricked into a soft-lock. The battery undervoltage detection being in software made our circuit simpler, but made me sufficiently uneasy that the next revision of the PCB did it in hardware. The beauty of the simple case design, with no buttons and no easy way to open it, comes with a certain amount of paranoia. I really wanted a way to reset the chip if needed, so the circuit listening for the charging connector was constructed.

Reset circuit bodged onto PCB

Some datasheets/devboards suggest always having a 100n cap on the reset line of an STM32 chip. I'm not sure whether it's needed, but I think I'd rather have a predictable, reasonable capacitance on the pin than a small amount of unknown capacitance. The pulse of connecting the charger passes through a small capacitor on the base of an NPN transistor, which amplifies the current to pull down the reset pin. Not shown in the picture above, I added a 100n cap to the reset line as recommended, and a pulldown resistor on the transistor side of the signal cap, to try and maximise the pulse voltage when the charger connects.

It's very easy to short the charging connector as it approaches, and in that case the polyfuse heats up and drops the output voltage. Even though it starts charging as the voltage returns, the slowly rising power is not enough to trigger the reset circuit. I decided that this is fine, because if you really need to reset it, just connect the magnet end of the cable first, then plug in the USB. And, in the redesign of the PCB, the hardware undervoltage detection means that resetting the chip should never be a requirement, this circuit is just there to placate my paranoia.

Jumping ahead somewhat, we epoxied the magnet connector in place, and also filled the little hole for the charging LED with epoxy too. Under the microscope, there's a tiny meniscus of resin there.

Circuit married to case

The circuit board is soldered to the case in a few strategic locations, for mechanical stability, and to make electrical contact with the battery ground.

Coin cell fitted

After a few assemblies and disassemblies, the foam pads were corrected, the spring pin was replaced with a taller one, the overall display brightness was reduced, and the various other display glitches were corrected.

First pendant assembled

It is somewhat scary to close up the back and have no access to anything except that charge connector. The only input to the device is the accelerometer data. I had planned to activate the "deep sleep" mode by spinning the pendant on the end of a chain, which would be very easy to detect compared to most gestures, just the Y coordinate beyond a threshold for some amount of time. It would be swish if that was how to wake it up as well. Unfortunately, that would mean more complex wakeup logic. We'd need to wake up, then check the condition and go back to sleep if it wasn't met.

But I was quite pleased to think of simply increasing the threshold of the accelerometer's movement detection interrupt. By setting it to 6g, it will be unlikely to wake up accidentally, but it's easy enough to shake it back to life. Shake-to-wake. This is a great solution because it uses no more power than the regular sleep.

First pendant assembled and illuminated

Not a terrible result.

But we can do better!

Construction of Pendant 2

Before assembling the second pendant with the promised watch glass, I wanted to revise the PCB, incorporating our reset circuit, the wakeup line diode, and the hardware supervisor chip.

In the same series as the incredible TPS7A02, the TPS3839 supply voltage monitor chip comes with some similarly impressive specifications, and in the same tiny package. Its supply current of 150nA may sound a lot compared to the 25nA of the regulator, but then you take a step back and realise both of these numbers are basically zero. The coin cell has a capacity of 120mAh, so even a 1000nA would take over 13 years to drain it. And on such timescales extrapolating doesn't really make any sense, due to self-discharge, nonlinear effects and so on.

That regulator is essentially an ideal component, both the dropout and the quiescent current are infinitesimally small. But it is quite a bit more expensive than a normal regulator, by which I mean it costs maybe $1.

I chose the supervisor to cut off at 3.08V, which is conservative enough that if the battery gets this low, we still have enough capacity to sit on a shelf for a few years without hurting the chemistry. A lot of lithium protection circuits cut out at 2.5V, in fact you might be wondering why I'm not using an off-the-shelf Li-ion protection circuit, of which there are many. It's generally accepted that you shouldn't let the open-circuit voltage of a lithium battery drop below 3.0V, but in use, if there's a load on the battery, the voltage at the terminals is lower than the open-circuit voltage. For this reason, most batteries set their undervoltage protection at 2.5V, to stop it kicking in too soon when the battery has a heavy load.

In the case of our ~10mA load, and my reasoning above about not wanting to run it totally flat, a 3.08V threshold makes perfect sense. Protection circuits usually add a couple of low-voltage mosfets in the path to the battery, which themselves will eat some of the power. My plan was to connect the supervisor chip to the enable pin of the regulator. I had tried earlier to pulse the enable pin of the regulator when the charging cable is connected with no success. I later figured out that there are two versions of the TPS7A02: the TPS7A0233DQNR, and the TPS7A0233PDQNR. The P version has an "active discharge" circuit for when the regulator is disabled. The non-P version simply lets the microchip, and its power supply capacitors, sit there until they run down. If the microcontroller is in deep sleep, that could take a significant time.

I might have been creating an artificially fast rundown as I varied the voltage to the circuit, but I found that the non-P version of the regulator I was originally using caused a number of problems when the supervisor kicked in. There may or may not be some brownout monitoring circuitry on the STM32, but it was definitely possible to latch the circuit into another softlock by waving the voltage around the threshold. I ordered the P-version of the regulator, swapped it over with the heat gun, and the problems went away.

The updated PCB, bottom layer:

Second revision of the PCB

The two X2SON parts were placed probably too close together, that made rework more difficult than it needed to be.

It's not like I was trying to mass produce these things, but assembling several at once is more efficient on the odd chance that a third or fourth pendant might happen.

Batch assembly of PCBs

I did four boards at once on the hot plate. I mentioned the mini hotplate, which is great for a single tiny board, but after seeing the benefits I invested in a bigger hotplate too.

Interestingly, this time the production house added blobs of copper pour to the panel rails. No complaints about that, but it does answer my question about whether they care for such things. The concern is about uneven etching, and also wasting time and etchant, if there are huge areas of copper to be removed. I try to avoid large copper-free areas out of habbit, but for panel edges I've seen a mix of styles. These boards are also small enough that it's not something we'd usually think about.

Batch assembly of PCBs

For the rear components I used the heatgun on each board individually. For the original circuit, I placed the board flat down on a heatproof tile and blasted the parts with hot air as normal. This worked, but possibly more by luck than anything else. The second circuit got nudged during the process, dislodging some of the LEDs and leading to some tedious rework. For these four boards, I clamped the PCBs by the panel and heatgunned them with the LEDs underneath held up only by surface tension, which worked fine.

The spring pins were given a little pry, to make sure they really stick up. When the battery is fitted, it'll crush it down to the right size, and hopefully we'll have the best possible contact.

While waiting for the P version of the regulators to arrive, I attempted to implement my own active discharge circuit with a mosfet. I don't even remember if it worked, but I have some pictures of the process. The X2SON chips are 1mm square, so this is all a tight squeeze.

Mosfet soldered with bodge wire to the pins of the X2SON chip

I think if the second X2SON chip was rotated 90 degrees we would have had a much easier time reworking these parts.

Assembly of the second pendant followed the same path as the first one. Freeze frame of a test fitting of the watch glass during the metalwork, with a nice big fingerprint smear so you can actually see it:

Partially completed pendant case with watch glass fitted

After fitting the jump rings and gold plating the metal, I pressed in the glass fully and then fitted the PCB onto the inside. This was probably the wrong order to do it, as soldering the PCB heated the gasket around the glass and melted it slightly in one spot. The tiny blemish is only really visible under the microscope.

Second pendant completed

The glass makes this second pendant 1mm thicker than the first. Nice meniscus of epoxy on that charging indicator though.

Second pendant completed, view of underside

Construction of Pendant 3

The subpar finish of the gold plating, the laminated toolmarks, probably bothered no one else except me, but it bothered me enough that a third pendant attempt was made. Knowing now that fitting a watch glass is less daunting than I imagined, we also took this opportunity to redesign the case and eliminate the snap-back entirely.

The watch glass is "removable" in that we can potentially pull it out, either with a special suction cup which I don't have, potentially hotgluing a handle to it, or in the worst case, smashing the glass. The replacement glasses are about 50p each so that's less mad than it sounds. With the charge controller and undervoltage protection, there shouldn't be any need to change the coin cell, it should be good for many hundreds of charge cycles, and each full charge should be about ten hours of use. So a sealed enclosure, where the only access is by removing the glass face, is quite appealing.

The metalwork is now much simpler, just a single bored cup-shape instead of the snap-back assembly. The overall thickness is reduced by about a millimetre.

Parting off the cup-shaped pendant body

Had I planned to assemble it this way from the beginning, I'd have adjusted the PCB to accommodate. I didn't really want to do yet another revision though, especially since there were no further electrical changes to make. (And I'd "efficiently" assembled another three boards at this point...)

We're faced with the magnetic connector needing to be fitted first, which means flexible wires. I used some of my special supply of 36AWG stranded wire. The ground connection to the battery is via the case, so we also need an electrical connection there. Previously this was by direct soldering of the PCB to the case. It occurred to me that the magnetic connector is pressed into the hole, so there should be decent electrical connectivity between the connector and the case, even after epoxying it in place. Which means it should be fine to use the ground connection of the magnetic connector as the return path for the battery current. I later tested this with a multimeter, and the resistance between the case and the ground of the PCB measured (suspiciously perfect) 0.00Ω.

PCB soldered to magnet connector in third pendant case, via tiny stranded wires

I left no tolerance when calculating the depth, and as I went for a test assembly it was clear that pressing in the glass would probably crush the circuit. The back surface of the pendant is 1mm thick, so there's plenty of room to make it a bit deeper, but now the only way to do that is by tediously scraping it away by hand. You can see the scratch marks in the picture above. I cover the whole surface in sharpie, and then scrape away until all the sharpie is gone. Each pass removes about 50μm. I ended up removing maybe 0.3mm.

I didn't add a shoulder for the PCB to sit on, I probably should have. There's also no indexing to stop the PCB rotating in its place. My hope (which turned out to be mostly correct) is that the PCB is very slightly oversized, and the friction is enough to stop it rotating.

The shoulder for the glass and gasket is now very small. I made a mistake when ordering more gaskets and went for 0.35mm. I noticed this just in time while doing the metalwork, but it means our recess has a diameter of just 28.2, over a 28.0mm bore. This makes it very easy to accidentally push the glass in with the gasket skewiff, and it pushes past the shoulder.

One solution would be to make the PCB diameter smaller, and so the shoulder would be bigger. Another solution I considered was producing a kind of piston ring/snap ring that would sit between the PCB and the glass, circling the LEDs, and giving a flat surface to press the glass and gasket against.

In the end, just pushing the glass in carefully was sufficient, but it's fiddlier than it needed to be.

Completed third pendant

The lack of a snap-back means the magnetic connector is now significantly off-centre, but I think it's aesthetically acceptable. I reduced the size of the charge indicator LED hole to 0.7mm. The surface was sanded and polished properly, looking much better than before, but the end result is still impaired by various blemishes. Some of these may be due to my ineffective post-polishing after plating, others could be nicks and scratches from showing the pendant off to people (above photo taken several months after assembly).

The biggest issue with the result was the back surface, which was polished but somehow looked like I'd tried to go for a mirror finish and missed. The next pendant needed to be lapped.

Pendant 4 and beyond

For the fourth and subsequent pendants, I bored out a fraction of a millimetre deeper so the circuit can fit comfortably. The only other difference is that the rear surface was lapped, which involves sticking sandpaper to a flat surface and rubbing the brass against it, working our way up through the grades of abrasive. I re-used the plastic arbour to hold the piece.

Before lapping, the back of the parted-off case needs to be faced anyway. Rather than soft collets, I made good use out of 5C collet holder in the spindle of the Hardinge lathe. You take the chuck off and slide the collet directly into the spindle. This grips the part evenly, very accurately centred, and doesn't mar the outside surface.

Facing the part in a 5C collet mounted directly in the spindle

It's worth remembering that the surface of this hollowed-out part is now less than a millimetre thick. After building several this way and becoming overconfident, I finally faced one with a heavy enough cut that it ripped right through. On the plus side, it's good to once again push the boundaries – for calibration purposes.

I spent a long time trying to improve the process for attaching the jump ring. Instead of balancing things precariously, the correct approach is to bind them together with soft wire.

Jump ring soldered, held in place by thin copper wire

Instead of a blowtorch, this time I used the heat gun, which gives full control over flowrate and temperature, at the cost of a much lower maximum temperature. Not a problem for our soft solder. The flux tarnishes the polished brass, which isn't too much of an issue as we'll be plating it afterwards, but I made an effort to direct the excess flux to the inside of the pendant – you can see the dark red dribble above.

This is one of my better efforts, with just the tiniest ring of tarnished metal around the solder fillet.

Closeup of tarnished brass around jump ring

Whereas less cautious attempts ended up with a nasty dribble. The flux will clean up, but the brass is permanently reddened.

Flux residue dribble

Nothing we can't plate over, though.

Apparently "soft iron binding wire" is the correct material to use. I ordered some, and found it much springier (and more annoying to use) than the copper.

Soft iron binding wire holding the jump ring in place

The dark bubbles are flux that's yet to be cleaned off. I didn't pickle these parts, just scrubbed them with flux cleaner and a plastic brush. Some of the joints cleaned up very nicely.

Closeup of jump ring solder joint

This is very much an area where practice makes perfect. I kept trying until I was happy, and in the process produced a whole bunch of pendants.

As mentioned, the gold plating won't stick to the tin solder. I decided to just embrace the contrast as a bit of visual interest.

Closeup of solder fillet on jump ring after plating

Epoxying the connector is more tedious than before, as we need to get a good seal all the way around, but not cover the solder contacts. For the third pendant, I'd soldered wires to the connector before applying epoxy, but this came back to bite me during the scraping stage. Here, soldering wires only when we're ready to fit the PCB makes more sense, but we need to be careful not to overheat the epoxy in the process.

Soldering magnet connector to PCB

The joints look worse than they really are in that picture.

Soon, the kinks in this assembly tactic were worked out and I had something of a routine going.

Coin cell fitted and circuit board soldered to connector, ready to fold into place

I have to say, the macro lens really does bring out the blemishes.

Illuminated fluid simulation pendant

The possibility of constructing the pendant entirely from gold did not go unnoticed. When working with precious metals, we obviously need to be a lot more careful about wasted material, and machining it from a solid lump of gold is probably unreasonable. I considered silver, which is a bit more economically forgiving, but (at the construction time of the first pendant) decided the snap back would be too complex. This new cup shape would probably be doable, however. A strip of silver bent into a ring, soldered to a sheet, could additively construct the main body with little loss, perhaps just a skim cut on the lathe. We could even make it gold-plated silver.

Illuminated fluid simulation pendant

I got a little better at pressing in the glass with the gasket evenly. This was pendant six.

Non-illuminated fluid simulation pendant

After constructing the seventh pendant, it occurred to me (a little too late) that I should have added some protection around the charging connector. Carelessly snapping the magnets together often causes sparks, even at a measly 5V, as captured in this freeze frame from when I tried to demonstrate the reset circuit:

Sparks fly as the magnetic charging cable is tapped against the pendant

Doing this repeatedly would quickly erode both parts. It's like a terrible version of EDM (electrical discharge machining).

We can avoid these sparks by connecting the magnetic end of the cable first, and plugging in the USB after, but that puts the onus on the user. I also realised that it's occasionally possible to reverse the polarity if you push the connectors together at an awkward angle. The addition of a diode would have trivially protected against this, had I thought of it earlier.

Pendant with charger connected

The little red charge indicator, here somewhat drowned out by my studio light, works fantastically well. The epoxy projects a little circle of red light onto the cable, which is quite clear, outside of the perfectly white environment that is my purgatory workbench.

Pendant with charger connected

Here I compare a pendant to a £1 coin.

Pendant next to a £1 coin

And again, to a 50p coin. I don't remember the last time I used coins in a transaction, must have been years ago, but I kept this little handful specifically for size comparison purposes.

Pendant next to a 50p coin

When I first started showing the pendants off to people, I really wanted a small case to carry it in. Right before EMF I grabbed one of the plastic containers which the Nikon F3 focusing screens come in. The little acrylic box was an almost perfect fit for the pendant, the sponge insert held it securely, and the clear lid meant I could demonstrate the pendant without getting it out. It was particularly good for chucking the pendant in my bag without worrying about it getting too beat up.

I tried to find an equivalent source of plastic containers, and had rotten luck, but I eventually found a similarly sized plastic box that would do. Into this I added a liner made from antistatic foam, which cuts beautifully by laser.

Pendant in box

It's sufficient. There are plenty of jewellery boxes and cases available to buy, but none of them seemed appropriate. I thought about making a fancier box, perhaps some nice hardword with a glass inset, but got thoroughly distracted.

I kept churning out pendants though.

View of all the pendants so far

That's ten completed pendants, although a few of them have blemishes. It seems like a good place to stop, as it's also used up all of the populated circuit boards.

I think if I wanted to build more pendants, the design should be updated to seat the glass and gasket properly. One way would be to shrink the PCB a little. At the same time, we could add a notch or cutout to align it correctly. The bore is now quite a bit bigger than the battery, so we could add another shoulder for the PCB to sit on, with a cutout at the bottom for the connector wires.

Something I noticed embarrassingly late in the process is that both the glass and the gasket have a polarity. The size of the bezel on the glass is different top and bottom. Aesthetically, I'm not sure whether I prefer the prominent bezel or if it's better to face it downwards. More importantly, the gasket, under the microscope, is not symmetrical. I did have a varying amount of difficulty pressing in the glass on different pendants, and wonder if that had an impact. On the other hand, for a couple of the pendants, I think I slightly oversized the bore as the glass pressed in far too easily. We can fix this by moving to a thicker gasket.

For the last few pendants I made them as a kind of production run, and to do that I fiddled with the DRO until I got it into the mode where you can assign different tools and remember where they are. The Multifix toolpost is great, and theoretically lets us switch tools without worrying about losing position. Each time I mounted the tiny boring bar, I tell the DRO that tool is mounted and then start cutting without needing to measure anything. It's very fast.

The risk is that while changing tools, some tiny bit of metal swarf jams in between the surfaces and just slightly offsets it. The design of the Multifix toolpost is supposed to make this less likely, but who's to say really. I definitely noticed the different amounts of force needed to press in the glasses.

The glass we used is "mineral glass" and also the cheapest. I ordered one Sapphire glass just to see what spending ten times as much gives us. I've yet to fit it to a pendant. Another option is "acrylic crystal" which is a little different. Instead of using a gasket, it's pliable enough to deform slightly as it's pressed in. Plenty to experiment with.

Conclusion

I'm very glad to finally post this, it's one of those projects that hangs over me, where I really need to publish it but at the same time it's led to loads of other projects which wouldn't make sense to post before it, so I end up in a kind of deadlock. I'm free! (except for those two other projects hanging over me...)

One thing I did not do, is engrave the back with any info. I think the date and a serial number would have been a nice touch. I've no idea if it's possible to laser-etch gold, but perhaps with some marking fluid it might work.

The goal was not to sell it, but there's no reason not to at least offer some of the pendants I've already built for sale. However, the price has to reflect the time involved, which puts them out of reach for anyone with only a casual interest in the pendant. Is it possible to mass produce a cut-down version that could be sold for a more sensible price?

The smart ring, where I first saw the low-profile magnetic charging connector, was astonishingly cheap. It's an nRF52 chip, curved lipo, heartbeat/blood oxy sensor, and the ring enclosure along with the charging connector. The one I ordered also came with a charging case (with its own battery inside) and had the most luxurious Apple-esque packaging. The price for all of it was £18. Even factoring in that it's probably a clone of another device, even knowing how cheap labour in China is, it blows my mind that it's possible to sell it at that price. There is no way I could sell a fluid pendant for anything near that cheap.

The circuit boards are easy to get mass produced. For the case, if we dispensed with the gold plating, perhaps made it out of stainless, which can be polished to be shiny but is still easy to get CNC machined, and run with the cup-shape design which simplifies things greatly, perhaps we could get a bunch of the cases produced in the far east. The jump ring would still need to be attached, maybe TIG welded. I don't know, I still think there are a lot of hurdles to leap.

We could go as cheap as possible, just the PCB and a crappy 3D-printed case.

Overall, the main reason I'm unlikely to attempt mass production is that I'm too busy with other projects.

To conclude, I would consider this a success, and there's definitely an improvement in the production quality versus the amulet, but I'm still not entirely happy with it, even after ten pendants. I think I need to invest in yet more equipment, learn more about jewellery making, and ideally, what I really want is to have a decent metal shop at home. That either means moving out of London or trying to come up with something that fits the space. If we want to practice and improve our skills, nothing beats having our own shop that can be accessed whenever and treated however and messy forever.

Finally, I did attempt to get some pictures of the pendant being worn.

Pendant being worn

Unfortunately, I've built something that is very difficult to photograph. We need to use a slow shutter speed to avoid tearing, but the display is only interesting if you're moving it about.

Pendant being worn

One solution is to have the wearer lift up the pendant and tilt it on its back.

Pendant being worn